View Single Post
  #10  
Old 11-10-2008, 02:08 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

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)
RULE_INT ( World, ExemptAccountLimitStatus, -1 )  //Min status required to be exempt from multi-session per account limiting (-1 is disabled)
\world\clientlist.h
Code:
void	GetCLEAccount(int32 iAccID);
\world\client.cpp
Code:
if (RuleI(World, AccountSessionLimit) >= 0) {
client_list.GetCLEAccount(this->GetAccountID());  //Check current CLE Accounts against incoming connection
}
\world\clientlist.cpp
Code:
void ClientList::GetCLEAccount(int32 iAccID) {
	ClientListEntry* count_Chars_On = 0;
	LinkedListIterator<ClientListEntry*> iterator(clientlist);

	int Chars_On = 0;
	iterator.Reset();
	while(iterator.MoreElements()) {
		count_Chars_On = iterator.GetData();
		if ((count_Chars_On->AccountID() == iAccID) && ((count_Chars_On->Admin() <= (RuleI(World, ExemptAccountLimitStatus))) || (RuleI(World, ExemptAccountLimitStatus) < 0))) {
			Chars_On++;
			if (Chars_On > (RuleI(World, AccountSessionLimit))){
				count_Chars_On->SetOnline(CLE_Status_Offline);
				iterator.RemoveCurrent();
			}
		}
		iterator.Advance();
	}
}
Required SQL:
Code:
Insert into rule_values values (0, 'World:AccountSessionLimit', -1);
Insert into rule_values values (0, 'World:ExemptAccountLimitStatus', -1);
The only other thing I am unsure of is that by switching this from a Bool that only allows 1 max character on at a time per account into an Int that lets you set the max number allowed per account, I am not sure how it would decide which online character to kick off. I imagine it would just go through the while and kick the first one online that it got to once it exceeded the limit. But, I figured it was worth mentioning. Personally, I think this would have been fine as a Bool instead of an Int, so you just enable or disable it. I do think the exempt status check could possibly be useful though. No reason to limit admins from logging in more than 1 per account.

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
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote