View Single Post
  #8  
Old 08-02-2008, 05:50 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

To start, you would need the following from what you posted above to create the rule entries:
Quote:
Originally Posted by trevius View Post
\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)
Required SQL:
Code:
Insert into rule_values values (0, 'World:AccountSessionLimit', false);
Insert into rule_values values (0, 'World:ExemptAccountLimitStatus', -1);
However, I think something similar to TheLieka's IP limiting code would be good, where you can specify how many characters on the same account can be logged on at once. For example, -1 means the rule is disabled, 1 would allow just 1 character on, etc.

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
  447 		{
  448 			if (GetAccountID() == 0) {
  449 				clog(WORLD__CLIENT_ERR,"Enter world with no logged in account");
  450 				eqs->Close();
  451 				break;
  452 			}
  453 			if(GetAdmin() < 0)
  454 			{
  455 				clog(WORLD__CLIENT,"Account banned or suspended.");
  456 				eqs->Close();
  457 				break;
  458 			}
  459 
  460 			if (RuleI(World, MaxClientsPerIP) >= 0) {
  461             client_list.GetCLEIP(this->GetIP());  //Lieka Edit Begin:  Check current CLE Entry IPs against incoming connection
  462             }
  463
We would first need to find out if any characters associated with the account are logged on, and if so proceed to kick the online one(s). I haven't found the Kick function in the source yet, but once we find that, then we can find out if we need the character name or if we can just use the account ID. From what I was able to find, it looks like it may be manually defined in several different places, several different ways, so we may need to make one.

If I can, I'll look a little deeper into this, but hopefully this gives us a place to start.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote