Merge pull request #593 from EQEmu/2002_fixes

MaxClientsSimplifiedLogic rule. See commit for description
This commit is contained in:
E Spause 2017-03-13 14:59:30 -04:00 committed by GitHub
commit 81cadf3bb2
8 changed files with 54 additions and 3 deletions

View File

@ -163,6 +163,7 @@ RULE_INT(Mercs, AggroRadius, 100) // Determines the distance from which a merc
RULE_INT(Mercs, AggroRadiusPuller, 25) // Determines the distance from which a merc will aggro group member's target, if they have the group role of puller (also used to determine the distance at which a healer merc will begin healing a group member, if they have the group role of puller)
RULE_INT(Mercs, ResurrectRadius, 50) // Determines the distance from which a healer merc will attempt to resurrect a group member's corpse
RULE_INT(Mercs, ScaleRate, 100)
RULE_BOOL(Mercs, AllowMercSuspendInCombat, true)
RULE_CATEGORY_END()
RULE_CATEGORY(Guild)
@ -225,6 +226,7 @@ RULE_INT(World, PVPSettings, 0) // Sets the PVP settings for the server, 1 = Ral
RULE_BOOL (World, IsGMPetitionWindowEnabled, false)
RULE_INT (World, FVNoDropFlag, 0) // Sets the Firiona Vie settings on the client. If set to 2, the flag will be set for GMs only, allowing trading of no-drop items.
RULE_BOOL (World, IPLimitDisconnectAll, false)
RULE_BOOL(World, MaxClientsSimplifiedLogic, false) // New logic that only uses ExemptMaxClientsStatus and MaxClientsPerIP. Done on the loginserver. This mimics the P99-style special IP rules.
RULE_INT (World, TellQueueSize, 20)
RULE_BOOL(World, StartZoneSameAsBindOnCreation, true) //Should the start zone ALWAYS be the same location as your bind?
RULE_CATEGORY_END()

View File

@ -663,6 +663,7 @@ struct UsertoWorldRequest_Struct {
uint32 worldid;
uint32 FromID;
uint32 ToID;
char IPAddr[64];
};
struct UsertoWorldResponse_Struct {

View File

@ -940,7 +940,7 @@ bool IsRegularSingleTargetHealSpell(uint16 spell_id)
{
if(spells[spell_id].effectid[0] == 0 && spells[spell_id].base[0] > 0 &&
spells[spell_id].targettype == ST_Target && spells[spell_id].buffduration == 0 &&
!IsFastHealSpell(spell_id) && !IsCompleteHealSpell(spell_id) &&
!IsCompleteHealSpell(spell_id) &&
!IsHealOverTimeSpell(spell_id) && !IsGroupSpell(spell_id))
return true;

View File

@ -1022,6 +1022,12 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
eqs->Close();
return true;
}
case OP_WorldLogout:
{
eqs->Close();
cle->SetOnline(CLE_Status_Offline); //allows this player to log in again without an ip restriction.
return false;
}
case OP_ZoneChange:
{
// HoT sends this to world while zoning and wants it echoed back.

View File

@ -214,6 +214,24 @@ void ClientList::GetCLEIP(uint32 iIP) {
}
}
uint32 ClientList::GetCLEIPCount(uint32 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)) && countCLEIPs->Online() >= CLE_Status_Online) { // If the IP matches, and the connection admin status is below the exempt status, or exempt status is less than 0 (no-one is exempt)
IPInstances++; // Increment the occurences of this IP address
}
iterator.Advance();
}
return IPInstances;
}
void ClientList::DisconnectByIP(uint32 iIP) {
ClientListEntry* countCLEIPs = 0;
LinkedListIterator<ClientListEntry*> iterator(clientlist);
@ -252,7 +270,6 @@ ClientListEntry* ClientList::FindCharacter(const char* name) {
return 0;
}
ClientListEntry* ClientList::FindCLEByAccountID(uint32 iAccID) {
LinkedListIterator<ClientListEntry*> iterator(clientlist);

View File

@ -56,6 +56,7 @@ public:
ClientListEntry* FindCLEByCharacterID(uint32 iCharID);
ClientListEntry* GetCLE(uint32 iID);
void GetCLEIP(uint32 iIP);
uint32 GetCLEIPCount(uint32 iLSAccountID);
void DisconnectByIP(uint32 iIP);
void EnforceSessionLimit(uint32 iLSAccountID);
void CLCheckStale();

View File

@ -134,11 +134,26 @@ bool LoginServer::Process() {
if( (int32)numplayers >= x && x != -1 && x != 255 && status < 80)
utwrs->response = -3;
if (pack->size == sizeof(UsertoWorldRequest_Struct))
{
uint32 decimalIP = inet_addr(utwr->IPAddr);
if (RuleB(World, MaxClientsSimplifiedLogic)) {
if (client_list.GetCLEIPCount(decimalIP) >= (RuleI(World, MaxClientsPerIP))) {
if ((status < (RuleI(World, ExemptMaxClientsStatus))) || (RuleI(World, ExemptMaxClientsStatus) < 0)) {
utwrs->response = -4;
}
}
}
}
if(status == -1)
utwrs->response = -1;
if(status == -2)
utwrs->response = -2;
utwrs->worldid = utwr->worldid;
SendPacket(outpack);
delete outpack;

View File

@ -5468,7 +5468,7 @@ void Client::SuspendMercCommand() {
Merc* merc = Merc::LoadMerc(this, &zone->merc_templates[GetMercInfo().MercTemplateID], 0, true);
if(merc)
{
SpawnMerc(merc, true);
SpawnMerc(merc, false);
Log.Out(Logs::General, Logs::Mercenaries, "SuspendMercCommand Successful Unsuspend for %s.", GetName());
}
else
@ -5482,6 +5482,15 @@ void Client::SuspendMercCommand() {
{
Merc* CurrentMerc = GetMerc();
if (!RuleB(Mercs, AllowMercSuspendInCombat))
{
if (!CheckCanSpawnMerc(GetMercInfo().MercTemplateID))
{
return;
}
}
if(CurrentMerc && GetMercID())
{
CurrentMerc->Suspend();