mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 13:41:31 +00:00
Make the reconnect code only trigger when there's actually a client IN ZONE and try to clean up otherwise
This commit is contained in:
parent
780f8f8515
commit
cd32a5a47a
@ -80,6 +80,7 @@
|
||||
#define ServerOP_GroupJoin 0x003e //for joining ooz folks
|
||||
#define ServerOP_UpdateSpawn 0x003f
|
||||
#define ServerOP_SpawnStatusChange 0x0040
|
||||
#define ServerOP_DropClient 0x0041 // DropClient
|
||||
#define ServerOP_ReloadTasks 0x0060
|
||||
#define ServerOP_DepopAllPlayersCorpses 0x0061
|
||||
#define ServerOP_ReloadTitles 0x0062
|
||||
@ -317,11 +318,17 @@ struct ServerZoneIncomingClient_Struct {
|
||||
uint32 accid;
|
||||
int16 admin;
|
||||
uint32 charid;
|
||||
uint32 lsid;
|
||||
bool tellsoff;
|
||||
char charname[64];
|
||||
char lskey[30];
|
||||
};
|
||||
|
||||
struct ServerZoneDropClient_Struct
|
||||
{
|
||||
uint32 lsid;
|
||||
};
|
||||
|
||||
struct ServerChangeWID_Struct {
|
||||
uint32 charid;
|
||||
uint32 newwid;
|
||||
|
||||
@ -121,6 +121,8 @@ void ClientListEntry::SetOnline(ZoneServer* iZS, int8 iOnline) {
|
||||
}
|
||||
|
||||
void ClientListEntry::SetOnline(int8 iOnline) {
|
||||
Log(Logs::Detail, Logs::World_Server, "ClientListEntry::SetOnline for %s(%i) = %i", AccountName(), AccountID(), iOnline);
|
||||
|
||||
if (iOnline >= CLE_Status_Online && pOnline < CLE_Status_Online)
|
||||
numplayers++;
|
||||
else if (iOnline < CLE_Status_Online && pOnline >= CLE_Status_Online) {
|
||||
|
||||
@ -64,8 +64,6 @@ void ClientList::Process() {
|
||||
struct in_addr in;
|
||||
in.s_addr = iterator.GetData()->GetIP();
|
||||
Log(Logs::Detail, Logs::World_Server,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort());
|
||||
//the client destructor should take care of this.
|
||||
// iterator.GetData()->Free();
|
||||
iterator.RemoveCurrent();
|
||||
}
|
||||
else
|
||||
|
||||
@ -109,14 +109,14 @@ void LoginServer::ProcessUsertoWorldReq(uint16_t opcode, EQ::Net::Packet &p) {
|
||||
auto cle = client_list.FindCLEByLSID(utwr->lsaccountid);
|
||||
if (cle != nullptr) {
|
||||
auto status = cle->GetOnline();
|
||||
if (CLE_Status_Zoning == status || CLE_Status_InZone == status) {
|
||||
if (CLE_Status_InZone == status) {
|
||||
utwrs->response = UserToWorldStatusAlreadyOnline;
|
||||
SendPacket(&outpack);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//our existing cle is in a state we can login to, mark the old as stale and remove it.
|
||||
client_list.RemoveCLEByLSID(utwr->lsaccountid);
|
||||
zoneserver_list.DropClient(utwrs->lsaccountid);
|
||||
client_list.RemoveCLEByLSID(utwrs->lsaccountid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -708,6 +708,13 @@ void ZSList::WorldShutDown(uint32 time, uint32 interval)
|
||||
}
|
||||
}
|
||||
|
||||
void ZSList::DropClient(uint32 lsid) {
|
||||
ServerPacket packet(ServerOP_DropClient, sizeof(ServerZoneDropClient_Struct));
|
||||
auto drop = (ServerZoneDropClient_Struct*)packet.pBuffer;
|
||||
drop->lsid = lsid;
|
||||
SendPacket(&packet);
|
||||
}
|
||||
|
||||
void ZSList::OnTick(EQ::Timer *t)
|
||||
{
|
||||
if (!EventSubscriptionWatcher::Get()->IsSubscribed("EQW::ZoneUpdate")) {
|
||||
|
||||
@ -57,6 +57,7 @@ public:
|
||||
void SOPZoneBootup(const char *adminname, uint32 ZoneServerID, const char *zonename, bool iMakeStatic = false);
|
||||
void UpdateUCSServerAvailable(bool ucss_available = true);
|
||||
void WorldShutDown(uint32 time, uint32 interval);
|
||||
void DropClient(uint32 lsid);
|
||||
|
||||
ZoneServer* FindByPort(uint16 port);
|
||||
ZoneServer* FindByID(uint32 ZoneID);
|
||||
|
||||
@ -1457,6 +1457,7 @@ void ZoneServer::IncomingClient(Client* client) {
|
||||
s->accid = client->GetAccountID();
|
||||
s->admin = client->GetAdmin();
|
||||
s->charid = client->GetCharID();
|
||||
s->lsid = client->GetLSID();
|
||||
if (client->GetCLE())
|
||||
s->tellsoff = client->GetCLE()->TellsOff();
|
||||
strn0cpy(s->charname, client->GetCharName(), sizeof(s->charname));
|
||||
|
||||
@ -1713,6 +1713,18 @@ Client *EntityList::GetClientByWID(uint32 iWID)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Client *EntityList::GetClientByLSID(uint32 iLSID)
|
||||
{
|
||||
auto it = client_list.begin();
|
||||
while (it != client_list.end()) {
|
||||
if (it->second->LSAccountID() == iLSID) {
|
||||
return it->second;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Client *EntityList::GetRandomClient(const glm::vec3& location, float Distance, Client *ExcludeClient)
|
||||
{
|
||||
std::vector<Client *> ClientsInRange;
|
||||
|
||||
@ -176,6 +176,7 @@ public:
|
||||
}
|
||||
Client *GetClientByCharID(uint32 iCharID);
|
||||
Client *GetClientByWID(uint32 iWID);
|
||||
Client *GetClientByLSID(uint32 iLSID);
|
||||
Client *GetClient(uint32 ip, uint16 port);
|
||||
Client *GetRandomClient(const glm::vec3& location, float Distance, Client *ExcludeClient = nullptr);
|
||||
Group *GetGroupByMob(Mob* mob);
|
||||
|
||||
@ -547,6 +547,23 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_DropClient: {
|
||||
if (pack->size != sizeof(ServerZoneDropClient_Struct)) {
|
||||
break;
|
||||
}
|
||||
|
||||
ServerZoneDropClient_Struct* drop = (ServerZoneDropClient_Struct*)pack->pBuffer;
|
||||
if (zone) {
|
||||
zone->RemoveAuth(drop->lsid);
|
||||
|
||||
auto client = entity_list.GetClientByLSID(drop->lsid);
|
||||
if (client) {
|
||||
client->Kick();
|
||||
client->Save();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_ZonePlayer: {
|
||||
ServerZonePlayer_Struct* szp = (ServerZonePlayer_Struct*)pack->pBuffer;
|
||||
Client* client = entity_list.GetClientByName(szp->name);
|
||||
|
||||
@ -1106,6 +1106,7 @@ void Zone::AddAuth(ServerZoneIncomingClient_Struct* szic) {
|
||||
zca->accid = szic->accid;
|
||||
zca->admin = szic->admin;
|
||||
zca->charid = szic->charid;
|
||||
zca->lsid = szic->lsid;
|
||||
zca->tellsoff = szic->tellsoff;
|
||||
strn0cpy(zca->charname, szic->charname, sizeof(zca->charname));
|
||||
strn0cpy(zca->lskey, szic->lskey, sizeof(zca->lskey));
|
||||
@ -1128,6 +1129,21 @@ void Zone::RemoveAuth(const char* iCharName)
|
||||
}
|
||||
}
|
||||
|
||||
void Zone::RemoveAuth(uint32 lsid)
|
||||
{
|
||||
LinkedListIterator<ZoneClientAuth_Struct*> iterator(client_auth_list);
|
||||
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
ZoneClientAuth_Struct* zca = iterator.GetData();
|
||||
if (zca->lsid == lsid) {
|
||||
iterator.RemoveCurrent();
|
||||
return;
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
}
|
||||
|
||||
void Zone::ResetAuth()
|
||||
{
|
||||
LinkedListIterator<ZoneClientAuth_Struct*> iterator(client_auth_list);
|
||||
|
||||
@ -52,6 +52,7 @@ struct ZoneClientAuth_Struct {
|
||||
uint32 accid;
|
||||
int16 admin;
|
||||
uint32 charid;
|
||||
uint32 lsid;
|
||||
bool tellsoff;
|
||||
char charname[64];
|
||||
char lskey[30];
|
||||
@ -244,6 +245,7 @@ public:
|
||||
void ReloadStaticData();
|
||||
void ReloadWorld(uint32 Option);
|
||||
void RemoveAuth(const char *iCharName);
|
||||
void RemoveAuth(uint32 lsid);
|
||||
void Repop(uint32 delay = 0);
|
||||
void RepopClose(const glm::vec4 &client_position, uint32 repop_distance);
|
||||
void RequestUCSServerStatus();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user