mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 12:41:30 +00:00
[Code Cleanup] More login <-> world code cleanup (#4724)
* More cleanup * More cleanup
This commit is contained in:
parent
cb634cf57d
commit
eb6ac25540
@ -245,7 +245,7 @@ uint32 Database::CreateAccount(
|
||||
e.password = password;
|
||||
}
|
||||
|
||||
LogInfo("Account Attempting to be created: [{}:{}] status: {}", loginserver, name, status);
|
||||
LogInfo("Account attempting to be created loginserver [{}] name [{}] status [{}]", loginserver, name, status);
|
||||
|
||||
e = AccountRepository::InsertOne(*this, e);
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ static const uint32 ADVANCED_LORE_LENGTH = 8192;
|
||||
*/
|
||||
#pragma pack(1)
|
||||
|
||||
struct LoginInfo_Struct {
|
||||
struct LoginInfo {
|
||||
/*000*/ char login_info[64];
|
||||
/*064*/ uint8 unknown064[124];
|
||||
/*188*/ uint8 zoning; // 01 if zoning, 00 if not
|
||||
|
||||
@ -25,7 +25,7 @@ void EQ::Net::ServertalkServerConnection::Send(uint16_t opcode, EQ::Net::Packet
|
||||
return;
|
||||
|
||||
if (opcode == ServerOP_UsertoWorldReq) {
|
||||
auto req_in = (UsertoWorldRequest_Struct*)p.Data();
|
||||
auto req_in = (UsertoWorldRequest*)p.Data();
|
||||
|
||||
EQ::Net::DynamicPacket req;
|
||||
size_t i = 0;
|
||||
@ -45,7 +45,7 @@ void EQ::Net::ServertalkServerConnection::Send(uint16_t opcode, EQ::Net::Packet
|
||||
}
|
||||
|
||||
if (opcode == ServerOP_LSClientAuth) {
|
||||
auto req_in = (ClientAuth_Struct*)p.Data();
|
||||
auto req_in = (ClientAuth*)p.Data();
|
||||
|
||||
EQ::Net::DynamicPacket req;
|
||||
size_t i = 0;
|
||||
@ -54,7 +54,7 @@ void EQ::Net::ServertalkServerConnection::Send(uint16_t opcode, EQ::Net::Packet
|
||||
req.PutData(i, req_in->key, 30); i += 30;
|
||||
req.PutUInt8(i, req_in->lsadmin); i += 1;
|
||||
req.PutUInt16(i, req_in->is_world_admin); i += 2;
|
||||
req.PutUInt32(i, req_in->ip); i += 4;
|
||||
req.PutUInt32(i, req_in->ip_address); i += 4;
|
||||
req.PutUInt8(i, req_in->is_client_from_local_network); i += 1;
|
||||
|
||||
EQ::Net::DynamicPacket out;
|
||||
|
||||
@ -677,36 +677,53 @@ struct ServerLSPlayerZoneChange_Struct {
|
||||
uint32 to; // 0 = world
|
||||
};
|
||||
|
||||
struct ClientAuth_Struct {
|
||||
struct ClientAuth {
|
||||
uint32 loginserver_account_id; // ID# in login server's db
|
||||
char loginserver_name[64];
|
||||
char account_name[30]; // username in login server's db
|
||||
char key[30]; // the Key the client will present
|
||||
uint8 lsadmin; // login server admin level
|
||||
int16 is_world_admin; // login's suggested worldadmin level setting for this user, up to the world if they want to obey it
|
||||
uint32 ip;
|
||||
uint8 is_client_from_local_network; // 1 if the client is from the local network
|
||||
char loginserver_name[64];
|
||||
char account_name[30]; // username in login server's db
|
||||
char key[30]; // the key the client will present
|
||||
uint8 lsadmin; // login server admin level
|
||||
int16 is_world_admin; // login's suggested worldadmin level setting for this user, up to the world if they want to obey it
|
||||
uint32 ip_address;
|
||||
uint8 is_client_from_local_network; // 1 if the client is from the local network
|
||||
|
||||
template <class Archive>
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
{
|
||||
ar(loginserver_account_id, loginserver_name, account_name, key, lsadmin, is_world_admin, ip, is_client_from_local_network);
|
||||
ar(
|
||||
loginserver_account_id,
|
||||
loginserver_name,
|
||||
account_name,
|
||||
key,
|
||||
lsadmin,
|
||||
is_world_admin,
|
||||
ip_address,
|
||||
is_client_from_local_network
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
struct ClientAuthLegacy_Struct {
|
||||
struct ClientAuthLegacy {
|
||||
uint32 loginserver_account_id; // ID# in login server's db
|
||||
char loginserver_account_name[30]; // username in login server's db
|
||||
char key[30]; // the Key the client will present
|
||||
uint8 loginserver_admin_level; // login server admin level
|
||||
int16 is_world_admin; // login's suggested worldadmin level setting for this user, up to the world if they want to obey it
|
||||
uint32 ip;
|
||||
uint8 is_client_from_local_network; // 1 if the client is from the local network
|
||||
char loginserver_account_name[30]; // username in login server's db
|
||||
char key[30]; // the key the client will present
|
||||
uint8 loginserver_admin_level; // login server admin level
|
||||
int16 is_world_admin; // login's suggested worldadmin level setting for this user, up to the world if they want to obey it
|
||||
uint32 ip_address;
|
||||
uint8 is_client_from_local_network; // 1 if the client is from the local network
|
||||
|
||||
template <class Archive>
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
{
|
||||
ar(loginserver_account_id, loginserver_account_name, key, loginserver_admin_level, is_world_admin, ip, is_client_from_local_network);
|
||||
ar(
|
||||
loginserver_account_id,
|
||||
loginserver_account_name,
|
||||
key,
|
||||
loginserver_admin_level,
|
||||
is_world_admin,
|
||||
ip_address,
|
||||
is_client_from_local_network
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -834,38 +851,38 @@ struct ServerSyncWorldList_Struct {
|
||||
bool placeholder;
|
||||
};
|
||||
|
||||
struct UsertoWorldRequestLegacy_Struct {
|
||||
uint32 lsaccountid;
|
||||
uint32 worldid;
|
||||
uint32 FromID;
|
||||
uint32 ToID;
|
||||
char IPAddr[64];
|
||||
};
|
||||
|
||||
struct UsertoWorldRequest_Struct {
|
||||
uint32 lsaccountid;
|
||||
uint32 worldid;
|
||||
uint32 FromID;
|
||||
uint32 ToID;
|
||||
char IPAddr[64];
|
||||
char login[64];
|
||||
};
|
||||
|
||||
struct UsertoWorldResponseLegacy_Struct {
|
||||
struct UsertoWorldRequestLegacy {
|
||||
uint32 lsaccountid;
|
||||
uint32 worldid;
|
||||
int8 response; // -3) World Full, -2) Banned, -1) Suspended, 0) Denied, 1) Allowed
|
||||
uint32 FromID;
|
||||
uint32 ToID;
|
||||
char IPAddr[64];
|
||||
};
|
||||
|
||||
struct UsertoWorldRequest {
|
||||
uint32 lsaccountid;
|
||||
uint32 worldid;
|
||||
uint32 FromID; // appears to be unused today
|
||||
uint32 ToID; // appears to be unused today
|
||||
char IPAddr[64];
|
||||
char login[64];
|
||||
};
|
||||
|
||||
struct UsertoWorldResponseLegacy {
|
||||
uint32 lsaccountid;
|
||||
uint32 worldid;
|
||||
int8 response; // -3) World Full, -2) Banned, -1) Suspended, 0) Denied, 1) Allowed
|
||||
uint32 FromID;
|
||||
uint32 ToID;
|
||||
};
|
||||
|
||||
struct UsertoWorldResponse_Struct {
|
||||
struct UsertoWorldResponse {
|
||||
uint32 lsaccountid;
|
||||
uint32 worldid;
|
||||
int8 response; // -3) World Full, -2) Banned, -1) Suspended, 0) Denied, 1) Allowed
|
||||
uint32 FromID;
|
||||
uint32 ToID;
|
||||
char login[64];
|
||||
int8 response; // -3) World Full, -2) Banned, -1) Suspended, 0) Denied, 1) Allowed
|
||||
uint32 FromID; // appears to be unused today
|
||||
uint32 ToID; // appears to be unused today
|
||||
char login[64];
|
||||
};
|
||||
|
||||
// generic struct to be used for alot of simple zone->world questions
|
||||
|
||||
@ -143,7 +143,7 @@ void WorldServer::ProcessUserToWorldResponseLegacy(uint16_t opcode, const EQ::Ne
|
||||
packet.ToString()
|
||||
);
|
||||
|
||||
if (packet.Length() < sizeof(UsertoWorldResponseLegacy_Struct)) {
|
||||
if (packet.Length() < sizeof(UsertoWorldResponseLegacy)) {
|
||||
LogError(
|
||||
"Received application packet from server that had opcode ServerOP_UsertoWorldResp, "
|
||||
"but was too small. Discarded to avoid buffer overrun"
|
||||
@ -152,7 +152,7 @@ void WorldServer::ProcessUserToWorldResponseLegacy(uint16_t opcode, const EQ::Ne
|
||||
return;
|
||||
}
|
||||
|
||||
auto *res = (UsertoWorldResponseLegacy_Struct *) packet.Data();
|
||||
auto *res = (UsertoWorldResponseLegacy *) packet.Data();
|
||||
|
||||
LogDebug("Trying to find client with user id of [{}]", res->lsaccountid);
|
||||
Client *c = server.client_manager->GetClient(res->lsaccountid, "eqemu");
|
||||
@ -229,7 +229,7 @@ void WorldServer::ProcessUserToWorldResponse(uint16_t opcode, const EQ::Net::Pac
|
||||
packet.ToString()
|
||||
);
|
||||
|
||||
if (packet.Length() < sizeof(UsertoWorldResponse_Struct)) {
|
||||
if (packet.Length() < sizeof(UsertoWorldResponse)) {
|
||||
LogError(
|
||||
"Received application packet from server that had opcode ServerOP_UsertoWorldResp, "
|
||||
"but was too small. Discarded to avoid buffer overrun"
|
||||
@ -238,7 +238,7 @@ void WorldServer::ProcessUserToWorldResponse(uint16_t opcode, const EQ::Net::Pac
|
||||
return;
|
||||
}
|
||||
|
||||
auto res = (UsertoWorldResponse_Struct *) packet.Data();
|
||||
auto res = (UsertoWorldResponse *) packet.Data();
|
||||
LogDebug("Trying to find client with user id of [{}]", res->lsaccountid);
|
||||
|
||||
Client *c = server.client_manager->GetClient(
|
||||
@ -494,7 +494,7 @@ void WorldServer::HandleWorldserverStatusUpdate(LoginserverWorldStatusUpdate *u)
|
||||
void WorldServer::SendClientAuthToWorld(Client *c)
|
||||
{
|
||||
EQ::Net::DynamicPacket outapp;
|
||||
ClientAuth_Struct a{};
|
||||
ClientAuth a{};
|
||||
|
||||
a.loginserver_account_id = c->GetAccountID();
|
||||
|
||||
@ -503,7 +503,7 @@ void WorldServer::SendClientAuthToWorld(Client *c)
|
||||
|
||||
a.lsadmin = 0;
|
||||
a.is_world_admin = 0;
|
||||
a.ip = inet_addr(c->GetConnection()->GetRemoteAddr().c_str());
|
||||
a.ip_address = inet_addr(c->GetConnection()->GetRemoteAddr().c_str());
|
||||
strncpy(a.loginserver_name, &c->GetLoginServerName()[0], 64);
|
||||
|
||||
const std::string &client_address(c->GetConnection()->GetRemoteAddr());
|
||||
@ -521,7 +521,7 @@ void WorldServer::SendClientAuthToWorld(Client *c)
|
||||
}
|
||||
|
||||
struct in_addr ip_addr{};
|
||||
ip_addr.s_addr = a.ip;
|
||||
ip_addr.s_addr = a.ip_address;
|
||||
|
||||
LogInfo(
|
||||
"Client authentication response: world_address [{}] client_address [{}]",
|
||||
|
||||
@ -154,9 +154,9 @@ void WorldServerManager::SendUserLoginToWorldRequest(
|
||||
|
||||
if (iter != m_world_servers.end()) {
|
||||
EQ::Net::DynamicPacket outapp;
|
||||
outapp.Resize(sizeof(UsertoWorldRequest_Struct));
|
||||
outapp.Resize(sizeof(UsertoWorldRequest));
|
||||
|
||||
auto *r = reinterpret_cast<UsertoWorldRequest_Struct *>(outapp.Data());
|
||||
auto *r = reinterpret_cast<UsertoWorldRequest *>(outapp.Data());
|
||||
r->worldid = server_id;
|
||||
r->lsaccountid = client_account_id;
|
||||
strncpy(r->login, client_loginserver.c_str(), 64);
|
||||
|
||||
@ -447,30 +447,30 @@ void Client::SendPostEnterWorld() {
|
||||
|
||||
bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
||||
{
|
||||
if (app->size != sizeof(LoginInfo_Struct)) {
|
||||
if (app->size != sizeof(LoginInfo)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto *login_info = (LoginInfo_Struct *) app->pBuffer;
|
||||
auto *r = (LoginInfo *) app->pBuffer;
|
||||
|
||||
// Quagmire - max len for name is 18, pass 15
|
||||
char name[19] = {0};
|
||||
char password[16] = {0};
|
||||
strn0cpy(name, (char *) login_info->login_info, 18);
|
||||
strn0cpy(password, (char *) &(login_info->login_info[strlen(name) + 1]), 15);
|
||||
strn0cpy(name, (char *) r->login_info, 18);
|
||||
strn0cpy(password, (char *) &(r->login_info[strlen(name) + 1]), 15);
|
||||
|
||||
LogDebug("Receiving Login Info Packet from Client | name [{0}] password [{1}]", name, password);
|
||||
LogDebug("Receiving login info packet from client | name [{}] password [{}]", name, password);
|
||||
|
||||
if (strlen(password) <= 1) {
|
||||
LogInfo("Login without a password");
|
||||
return false;
|
||||
}
|
||||
|
||||
is_player_zoning = (login_info->zoning == 1);
|
||||
is_player_zoning = (r->zoning == 1);
|
||||
|
||||
uint32 id = Strings::ToInt(name);
|
||||
if (id == 0) {
|
||||
LogWarning("Receiving Login Info Packet from Client | account_id is 0 - disconnecting");
|
||||
LogWarning("Receiving login info packet from client | account_id is 0 - disconnecting");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -480,15 +480,15 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
||||
LogClientLogin("Checking authentication id [{}] passed", id);
|
||||
if (!is_player_zoning) {
|
||||
// Track who is in and who is out of the game
|
||||
char *inout= (char *) "";
|
||||
std::string in_out;
|
||||
|
||||
if (cle->GetOnline() == CLE_Status::Never){
|
||||
if (cle->GetOnline() == CLE_Status::Never) {
|
||||
// Desktop -> Char Select
|
||||
inout = (char *) "In";
|
||||
in_out = "in";
|
||||
}
|
||||
else {
|
||||
// Game -> Char Select
|
||||
inout=(char *) "Out";
|
||||
in_out = "out";
|
||||
}
|
||||
|
||||
// Always at Char select at this point.
|
||||
@ -497,7 +497,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
||||
// Could use a Logging Out Completely message somewhere.
|
||||
cle->SetOnline(CLE_Status::CharSelect);
|
||||
|
||||
LogInfo("Account ({}) Logging({}) to character select :: LSID [{}] ", cle->AccountName(), inout, cle->LSID());
|
||||
LogInfo("Account ({}) Logging ({}) to character select :: LSID [{}] ", cle->AccountName(), in_out, cle->LSID());
|
||||
}
|
||||
else {
|
||||
cle->SetOnline();
|
||||
@ -545,7 +545,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
||||
if (!skip_char_info && !custom_files_key.empty() && cle->Admin() < RuleI(World, CustomFilesAdminLevel)) {
|
||||
// Modified clients can utilize this unused block in login_info to send custom payloads on login
|
||||
// which indicates they are using custom client files with the correct version, based on key payload.
|
||||
const auto client_key = std::string(reinterpret_cast<char*>(login_info->unknown064));
|
||||
const auto client_key = std::string(reinterpret_cast<char*>(r->unknown064));
|
||||
if (custom_files_key != client_key) {
|
||||
std::string message = fmt::format("Missing Files [{}]", RuleS(World, CustomFilesUrl) );
|
||||
SendUnsupportedClientPacket(message);
|
||||
@ -1434,7 +1434,7 @@ void Client::EnterWorld(bool TryBootup) {
|
||||
}
|
||||
else {
|
||||
if (TryBootup) {
|
||||
LogInfo("Attempting autobootup of [{}] ([{}]:[{}])", zone_name, zone_id, instance_id);
|
||||
LogInfo("Attempting autobootup of [{}] [{}] [{}]", zone_name, zone_id, instance_id);
|
||||
autobootup_timeout.Start();
|
||||
zone_waiting_for_bootup = zoneserver_list.TriggerBootup(zone_id, instance_id);
|
||||
if (zone_waiting_for_bootup == 0) {
|
||||
|
||||
@ -1,20 +1,3 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "../common/global_define.h"
|
||||
#include "cliententry.h"
|
||||
#include "clientlist.h"
|
||||
@ -24,93 +7,86 @@
|
||||
#include "worlddb.h"
|
||||
#include "zoneserver.h"
|
||||
#include "world_config.h"
|
||||
#include "../common/guilds.h"
|
||||
#include "../common/strings.h"
|
||||
|
||||
extern uint32 numplayers;
|
||||
extern LoginServerList loginserverlist;
|
||||
extern ClientList client_list;
|
||||
extern volatile bool RunLoops;
|
||||
extern uint32 numplayers;
|
||||
extern LoginServerList loginserverlist;
|
||||
extern ClientList client_list;
|
||||
extern volatile bool RunLoops;
|
||||
extern SharedTaskManager shared_task_manager;
|
||||
|
||||
/**
|
||||
* @param in_id
|
||||
* @param in_loginserver_id
|
||||
* @param in_loginserver_name
|
||||
* @param in_login_name
|
||||
* @param in_login_key
|
||||
* @param in_is_world_admin
|
||||
* @param ip
|
||||
* @param local
|
||||
*/
|
||||
ClientListEntry::ClientListEntry(
|
||||
uint32 in_id,
|
||||
uint32 in_loginserver_id,
|
||||
const char *in_loginserver_name,
|
||||
const char *in_login_name,
|
||||
const char *in_login_key,
|
||||
int16 in_is_world_admin,
|
||||
uint32 ip,
|
||||
uint32 id,
|
||||
uint32 login_server_id,
|
||||
const char *login_server_name,
|
||||
const char *account_name,
|
||||
const char *login_key,
|
||||
int16 is_world_admin,
|
||||
uint32 ip_address,
|
||||
uint8 local
|
||||
)
|
||||
: id(in_id)
|
||||
: m_id(id)
|
||||
{
|
||||
ClearVars(true);
|
||||
|
||||
LogDebug(
|
||||
"in_id [{0}] in_loginserver_id [{1}] in_loginserver_name [{2}] in_login_name [{3}] in_login_key [{4}] "
|
||||
" in_is_world_admin [{5}] ip [{6}] local [{7}]",
|
||||
in_id,
|
||||
in_loginserver_id,
|
||||
in_loginserver_name,
|
||||
in_login_name,
|
||||
in_login_key,
|
||||
in_is_world_admin,
|
||||
ip,
|
||||
"id [{}] loginserver_id [{}] loginserver_name [{}] login_name [{}] login_key [{}] is_world_admin [{}] ip [{}] local [{}]",
|
||||
id,
|
||||
login_server_id,
|
||||
login_server_name,
|
||||
account_name,
|
||||
login_key,
|
||||
is_world_admin,
|
||||
ip_address,
|
||||
local
|
||||
);
|
||||
|
||||
pIP = ip;
|
||||
pLSID = in_loginserver_id;
|
||||
if (in_loginserver_id > 0) {
|
||||
paccountid = database.GetAccountIDFromLSID(in_loginserver_name, in_loginserver_id, paccountname, &padmin);
|
||||
m_ip_address = ip_address;
|
||||
m_login_server_id = login_server_id;
|
||||
if (login_server_id > 0) {
|
||||
m_account_id = database.GetAccountIDFromLSID(
|
||||
login_server_name,
|
||||
login_server_id,
|
||||
m_account_name,
|
||||
&m_admin
|
||||
);
|
||||
}
|
||||
|
||||
strn0cpy(loginserver_account_name, in_login_name, sizeof(loginserver_account_name));
|
||||
strn0cpy(plskey, in_login_key, sizeof(plskey));
|
||||
strn0cpy(source_loginserver, in_loginserver_name, sizeof(source_loginserver));
|
||||
pworldadmin = in_is_world_admin;
|
||||
plocal = (local == 1);
|
||||
strn0cpy(m_login_account_name, account_name, sizeof(m_login_account_name));
|
||||
strn0cpy(m_key, login_key, sizeof(m_key));
|
||||
strn0cpy(m_source_loginserver, login_server_name, sizeof(m_source_loginserver));
|
||||
|
||||
memset(pLFGComments, 0, 64);
|
||||
m_world_admin = is_world_admin;
|
||||
m_is_local = (local == 1);
|
||||
|
||||
memset(m_lfg_comments, 0, 64);
|
||||
}
|
||||
|
||||
ClientListEntry::ClientListEntry(uint32 in_id, ZoneServer *iZS, ServerClientList_Struct *scl, CLE_Status iOnline)
|
||||
: id(in_id)
|
||||
ClientListEntry::ClientListEntry(uint32 in_id, ZoneServer *z, ServerClientList_Struct *scl, CLE_Status online)
|
||||
: m_id(in_id)
|
||||
{
|
||||
ClearVars(true);
|
||||
|
||||
pIP = 0;
|
||||
pLSID = scl->LSAccountID;
|
||||
strn0cpy(loginserver_account_name, scl->name, sizeof(loginserver_account_name));
|
||||
strn0cpy(plskey, scl->lskey, sizeof(plskey));
|
||||
pworldadmin = 0;
|
||||
m_ip_address = 0;
|
||||
m_login_server_id = scl->LSAccountID;
|
||||
strn0cpy(m_login_account_name, scl->name, sizeof(m_login_account_name));
|
||||
strn0cpy(m_key, scl->lskey, sizeof(m_key));
|
||||
m_world_admin = 0;
|
||||
|
||||
paccountid = scl->AccountID;
|
||||
strn0cpy(paccountname, scl->AccountName, sizeof(paccountname));
|
||||
padmin = scl->Admin;
|
||||
m_account_id = scl->AccountID;
|
||||
strn0cpy(m_account_name, scl->AccountName, sizeof(m_account_name));
|
||||
m_admin = scl->Admin;
|
||||
|
||||
pinstance = 0;
|
||||
pLFGFromLevel = 0;
|
||||
pLFGToLevel = 0;
|
||||
pLFGMatchFilter = false;
|
||||
memset(pLFGComments, 0, 64);
|
||||
m_instance = 0;
|
||||
m_lfg_from_level = 0;
|
||||
m_lfg_to_level = 0;
|
||||
m_lfg_match_filter = false;
|
||||
memset(m_lfg_comments, 0, 64);
|
||||
|
||||
if (iOnline >= CLE_Status::Zoning) {
|
||||
Update(iZS, scl, iOnline);
|
||||
if (online >= CLE_Status::Zoning) {
|
||||
Update(z, scl, online);
|
||||
}
|
||||
else {
|
||||
SetOnline(iOnline);
|
||||
SetOnline(online);
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,16 +96,16 @@ ClientListEntry::~ClientListEntry()
|
||||
Camp(); // updates zoneserver's numplayers
|
||||
client_list.RemoveCLEReferances(this);
|
||||
}
|
||||
for (auto& elem : tell_queue) {
|
||||
for (auto &elem: m_tell_queue) {
|
||||
safe_delete_array(elem);
|
||||
}
|
||||
tell_queue.clear();
|
||||
m_tell_queue.clear();
|
||||
}
|
||||
|
||||
void ClientListEntry::SetChar(uint32 iCharID, const char *iCharName)
|
||||
{
|
||||
pcharid = iCharID;
|
||||
strn0cpy(pname, iCharName, sizeof(pname));
|
||||
m_char_id = iCharID;
|
||||
strn0cpy(m_char_name, iCharName, sizeof(m_char_name));
|
||||
}
|
||||
|
||||
void ClientListEntry::SetOnline(CLE_Status iOnline)
|
||||
@ -142,20 +118,20 @@ void ClientListEntry::SetOnline(CLE_Status iOnline)
|
||||
static_cast<int>(iOnline)
|
||||
);
|
||||
|
||||
if (iOnline >= CLE_Status::Online && pOnline < CLE_Status::Online) {
|
||||
if (iOnline >= CLE_Status::Online && m_online < CLE_Status::Online) {
|
||||
numplayers++;
|
||||
}
|
||||
else if (iOnline < CLE_Status::Online && pOnline >= CLE_Status::Online) {
|
||||
else if (iOnline < CLE_Status::Online && m_online >= CLE_Status::Online) {
|
||||
numplayers--;
|
||||
}
|
||||
if (iOnline != CLE_Status::Online || pOnline < CLE_Status::Online) {
|
||||
pOnline = iOnline;
|
||||
if (iOnline != CLE_Status::Online || m_online < CLE_Status::Online) {
|
||||
m_online = iOnline;
|
||||
}
|
||||
if (iOnline < CLE_Status::Zoning) {
|
||||
Camp();
|
||||
}
|
||||
if (pOnline >= CLE_Status::Online) {
|
||||
stale = 0;
|
||||
if (m_online >= CLE_Status::Online) {
|
||||
m_stale = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,49 +169,49 @@ void ClientListEntry::LSZoneChange(ZoneToZone_Struct *ztz)
|
||||
|
||||
void ClientListEntry::Update(ZoneServer *iZS, ServerClientList_Struct *scl, CLE_Status iOnline)
|
||||
{
|
||||
if (pzoneserver != iZS) {
|
||||
if (pzoneserver) {
|
||||
pzoneserver->RemovePlayer();
|
||||
LSUpdate(pzoneserver);
|
||||
if (m_zone_server != iZS) {
|
||||
if (m_zone_server) {
|
||||
m_zone_server->RemovePlayer();
|
||||
LSUpdate(m_zone_server);
|
||||
}
|
||||
if (iZS) {
|
||||
iZS->AddPlayer();
|
||||
LSUpdate(iZS);
|
||||
}
|
||||
}
|
||||
pzoneserver = iZS;
|
||||
pzone = scl->zone;
|
||||
pinstance = scl->instance_id;
|
||||
pcharid = scl->charid;
|
||||
m_zone_server = iZS;
|
||||
m_zone = scl->zone;
|
||||
m_instance = scl->instance_id;
|
||||
m_char_id = scl->charid;
|
||||
|
||||
strcpy(pname, scl->name);
|
||||
if (paccountid == 0) {
|
||||
paccountid = scl->AccountID;
|
||||
strcpy(paccountname, scl->AccountName);
|
||||
strcpy(loginserver_account_name, scl->AccountName);
|
||||
pIP = scl->IP;
|
||||
pLSID = scl->LSAccountID;
|
||||
strn0cpy(plskey, scl->lskey, sizeof(plskey));
|
||||
strcpy(m_char_name, scl->name);
|
||||
if (m_account_id == 0) {
|
||||
m_account_id = scl->AccountID;
|
||||
strcpy(m_account_name, scl->AccountName);
|
||||
strcpy(m_login_account_name, scl->AccountName);
|
||||
m_ip_address = scl->IP;
|
||||
m_login_server_id = scl->LSAccountID;
|
||||
strn0cpy(m_key, scl->lskey, sizeof(m_key));
|
||||
}
|
||||
padmin = scl->Admin;
|
||||
plevel = scl->level;
|
||||
pclass_ = scl->class_;
|
||||
prace = scl->race;
|
||||
panon = scl->anon;
|
||||
ptellsoff = scl->tellsoff;
|
||||
pguild_id = scl->guild_id;
|
||||
pguild_rank = scl->guild_rank;
|
||||
pguild_tribute_opt_in = scl->guild_tribute_opt_in;
|
||||
pLFG = scl->LFG;
|
||||
gm = scl->gm;
|
||||
pClientVersion = scl->ClientVersion;
|
||||
m_admin = scl->Admin;
|
||||
m_level = scl->level;
|
||||
m_class_ = scl->class_;
|
||||
m_race = scl->race;
|
||||
m_anon = scl->anon;
|
||||
m_tells_off = scl->tellsoff;
|
||||
m_guild_id = scl->guild_id;
|
||||
m_guild_rank = scl->guild_rank;
|
||||
m_guild_tribute_opt_in = scl->guild_tribute_opt_in;
|
||||
m_lfg = scl->LFG;
|
||||
m_gm = scl->gm;
|
||||
m_client_version = scl->ClientVersion;
|
||||
|
||||
// Fields from the LFG Window
|
||||
if ((scl->LFGFromLevel != 0) && (scl->LFGToLevel != 0)) {
|
||||
pLFGFromLevel = scl->LFGFromLevel;
|
||||
pLFGToLevel = scl->LFGToLevel;
|
||||
pLFGMatchFilter = scl->LFGMatchFilter;
|
||||
memcpy(pLFGComments, scl->LFGComments, sizeof(pLFGComments));
|
||||
m_lfg_from_level = scl->LFGFromLevel;
|
||||
m_lfg_to_level = scl->LFGToLevel;
|
||||
m_lfg_match_filter = scl->LFGMatchFilter;
|
||||
memcpy(m_lfg_comments, scl->LFGComments, sizeof(m_lfg_comments));
|
||||
}
|
||||
|
||||
SetOnline(iOnline);
|
||||
@ -243,76 +219,76 @@ void ClientListEntry::Update(ZoneServer *iZS, ServerClientList_Struct *scl, CLE_
|
||||
|
||||
void ClientListEntry::LeavingZone(ZoneServer *iZS, CLE_Status iOnline)
|
||||
{
|
||||
if (iZS != 0 && iZS != pzoneserver) {
|
||||
if (iZS != 0 && iZS != m_zone_server) {
|
||||
return;
|
||||
}
|
||||
SetOnline(iOnline);
|
||||
|
||||
shared_task_manager.RemoveActiveInvitationByCharacterID(CharID());
|
||||
|
||||
if (pzoneserver) {
|
||||
pzoneserver->RemovePlayer();
|
||||
LSUpdate(pzoneserver);
|
||||
if (m_zone_server) {
|
||||
m_zone_server->RemovePlayer();
|
||||
LSUpdate(m_zone_server);
|
||||
}
|
||||
pzoneserver = 0;
|
||||
pzone = 0;
|
||||
m_zone_server = 0;
|
||||
m_zone = 0;
|
||||
}
|
||||
|
||||
void ClientListEntry::ClearVars(bool iAll)
|
||||
{
|
||||
if (iAll) {
|
||||
pOnline = CLE_Status::Never;
|
||||
stale = 0;
|
||||
m_online = CLE_Status::Never;
|
||||
m_stale = 0;
|
||||
|
||||
pLSID = 0;
|
||||
memset(loginserver_account_name, 0, sizeof(loginserver_account_name));
|
||||
memset(plskey, 0, sizeof(plskey));
|
||||
pworldadmin = 0;
|
||||
m_login_server_id = 0;
|
||||
memset(m_login_account_name, 0, sizeof(m_login_account_name));
|
||||
memset(m_key, 0, sizeof(m_key));
|
||||
m_world_admin = 0;
|
||||
|
||||
paccountid = 0;
|
||||
memset(paccountname, 0, sizeof(paccountname));
|
||||
padmin = AccountStatus::Player;
|
||||
m_account_id = 0;
|
||||
memset(m_account_name, 0, sizeof(m_account_name));
|
||||
m_admin = AccountStatus::Player;
|
||||
}
|
||||
pzoneserver = 0;
|
||||
pzone = 0;
|
||||
pcharid = 0;
|
||||
memset(pname, 0, sizeof(pname));
|
||||
plevel = 0;
|
||||
pclass_ = 0;
|
||||
prace = 0;
|
||||
panon = 0;
|
||||
ptellsoff = 0;
|
||||
pguild_id = GUILD_NONE;
|
||||
pguild_rank = 0;
|
||||
pLFG = 0;
|
||||
gm = 0;
|
||||
pClientVersion = 0;
|
||||
for (auto& elem : tell_queue) {
|
||||
m_zone_server = 0;
|
||||
m_zone = 0;
|
||||
m_char_id = 0;
|
||||
memset(m_char_name, 0, sizeof(m_char_name));
|
||||
m_level = 0;
|
||||
m_class_ = 0;
|
||||
m_race = 0;
|
||||
m_anon = 0;
|
||||
m_tells_off = 0;
|
||||
m_guild_id = GUILD_NONE;
|
||||
m_guild_rank = 0;
|
||||
m_lfg = 0;
|
||||
m_gm = 0;
|
||||
m_client_version = 0;
|
||||
for (auto &elem: m_tell_queue) {
|
||||
safe_delete_array(elem);
|
||||
}
|
||||
tell_queue.clear();
|
||||
m_tell_queue.clear();
|
||||
}
|
||||
|
||||
void ClientListEntry::Camp(ZoneServer *iZS)
|
||||
{
|
||||
if (iZS != 0 && iZS != pzoneserver) {
|
||||
if (iZS != 0 && iZS != m_zone_server) {
|
||||
return;
|
||||
}
|
||||
if (pzoneserver) {
|
||||
pzoneserver->RemovePlayer();
|
||||
LSUpdate(pzoneserver);
|
||||
if (m_zone_server) {
|
||||
m_zone_server->RemovePlayer();
|
||||
LSUpdate(m_zone_server);
|
||||
}
|
||||
|
||||
ClearVars();
|
||||
|
||||
stale = 0;
|
||||
m_stale = 0;
|
||||
}
|
||||
|
||||
bool ClientListEntry::CheckStale()
|
||||
{
|
||||
stale++;
|
||||
if (stale > 20) {
|
||||
if (pOnline > CLE_Status::Offline) {
|
||||
m_stale++;
|
||||
if (m_stale > 20) {
|
||||
if (m_online > CLE_Status::Offline) {
|
||||
SetOnline(CLE_Status::Offline);
|
||||
}
|
||||
|
||||
@ -324,48 +300,50 @@ bool ClientListEntry::CheckStale()
|
||||
bool ClientListEntry::CheckAuth(uint32 loginserver_account_id, const char *key_password)
|
||||
{
|
||||
LogDebug(
|
||||
"ls_account_id [{0}] key_password [{1}] plskey [{2}]",
|
||||
"ls_account_id [{}] key_password [{}] key [{}]",
|
||||
loginserver_account_id,
|
||||
key_password,
|
||||
plskey
|
||||
m_key
|
||||
);
|
||||
if (pLSID == loginserver_account_id && strncmp(plskey, key_password, 10) == 0) {
|
||||
|
||||
if (m_login_server_id == loginserver_account_id && strncmp(m_key, key_password, 10) == 0) {
|
||||
LogDebug(
|
||||
"ls_account_id [{0}] key_password [{1}] plskey [{2}] lsid [{3}] paccountid [{4}]",
|
||||
"ls_account_id [{}] key_password [{}] m_key [{}] lsid [{}] m_account_id [{}]",
|
||||
loginserver_account_id,
|
||||
key_password,
|
||||
plskey,
|
||||
m_key,
|
||||
LSID(),
|
||||
paccountid
|
||||
m_account_id
|
||||
);
|
||||
|
||||
if (paccountid == 0 && LSID() > 0) {
|
||||
// create account if it doesn't exist
|
||||
if (m_account_id == 0 && LSID() > 0) {
|
||||
int16 default_account_status = WorldConfig::get()->DefaultStatus;
|
||||
|
||||
paccountid = database.CreateAccount(
|
||||
loginserver_account_name,
|
||||
m_account_id = database.CreateAccount(
|
||||
m_login_account_name,
|
||||
std::string(),
|
||||
default_account_status,
|
||||
source_loginserver,
|
||||
m_source_loginserver,
|
||||
LSID()
|
||||
);
|
||||
|
||||
if (!paccountid) {
|
||||
LogInfo(
|
||||
"Error adding local account for LS login: [{0}:{1}], duplicate name",
|
||||
source_loginserver,
|
||||
loginserver_account_name
|
||||
if (!m_account_id) {
|
||||
LogError(
|
||||
"Error adding local account for LS login [{}] [{}], duplicate name",
|
||||
m_source_loginserver,
|
||||
m_login_account_name
|
||||
);
|
||||
return false;
|
||||
}
|
||||
strn0cpy(paccountname, loginserver_account_name, sizeof(paccountname));
|
||||
padmin = default_account_status;
|
||||
strn0cpy(m_account_name, m_login_account_name, sizeof(m_account_name));
|
||||
m_admin = default_account_status;
|
||||
}
|
||||
std::string lsworldadmin;
|
||||
if (database.GetVariable("honorlsworldadmin", lsworldadmin)) {
|
||||
if (Strings::ToInt(lsworldadmin) == 1 && pworldadmin != 0 && (padmin < pworldadmin || padmin == AccountStatus::Player)) {
|
||||
padmin = pworldadmin;
|
||||
if (Strings::ToInt(lsworldadmin) == 1 && m_world_admin != 0 &&
|
||||
(m_admin < m_world_admin || m_admin == AccountStatus::Player)) {
|
||||
m_admin = m_world_admin;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -380,8 +358,8 @@ void ClientListEntry::ProcessTellQueue()
|
||||
}
|
||||
|
||||
ServerPacket *pack;
|
||||
auto it = tell_queue.begin();
|
||||
while (it != tell_queue.end()) {
|
||||
auto it = m_tell_queue.begin();
|
||||
while (it != m_tell_queue.end()) {
|
||||
pack = new ServerPacket(
|
||||
ServerOP_ChannelMessage,
|
||||
sizeof(ServerChannelMessage_Struct) + strlen((*it)->message) + 1
|
||||
@ -390,8 +368,7 @@ void ClientListEntry::ProcessTellQueue()
|
||||
Server()->SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
safe_delete_array(*it);
|
||||
it = tell_queue.erase(it);
|
||||
it = m_tell_queue.erase(it);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -8,8 +8,7 @@
|
||||
#include "../common/rulesys.h"
|
||||
#include <vector>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
Never,
|
||||
Offline,
|
||||
Online,
|
||||
@ -18,7 +17,7 @@ typedef enum
|
||||
InZone
|
||||
} CLE_Status;
|
||||
|
||||
static const char * CLEStatusString[] = {
|
||||
static const char *CLEStatusString[] = {
|
||||
"Never",
|
||||
"Offline",
|
||||
"Online",
|
||||
@ -33,148 +32,131 @@ struct ServerClientList_Struct;
|
||||
class ClientListEntry {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param in_loginserver_id
|
||||
* @param in_loginserver_name
|
||||
* @param in_login_name
|
||||
* @param in_login_key
|
||||
* @param in_is_world_admin
|
||||
* @param ip
|
||||
* @param local
|
||||
*/
|
||||
ClientListEntry(
|
||||
uint32 id,
|
||||
uint32 in_loginserver_id,
|
||||
const char *in_loginserver_name,
|
||||
const char *in_login_name,
|
||||
const char *in_login_key,
|
||||
int16 in_is_world_admin = 0,
|
||||
uint32 ip = 0,
|
||||
uint32 login_server_id,
|
||||
const char *login_server_name,
|
||||
const char *account_name,
|
||||
const char *login_key,
|
||||
int16 is_world_admin = 0,
|
||||
uint32 ip_address = 0,
|
||||
uint8 local = 0
|
||||
);
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param iZS
|
||||
* @param scl
|
||||
* @param iOnline
|
||||
*/
|
||||
ClientListEntry(uint32 id, uint32 iAccID, const char* iAccName, MD5& iMD5Pass, int16 iAdmin = AccountStatus::Player);
|
||||
ClientListEntry(uint32 id, ZoneServer* iZS, ServerClientList_Struct* scl, CLE_Status iOnline);
|
||||
ClientListEntry(uint32 id, ZoneServer *z, ServerClientList_Struct *scl, CLE_Status online);
|
||||
~ClientListEntry();
|
||||
bool CheckStale();
|
||||
void Update(ZoneServer* zoneserver, ServerClientList_Struct* scl, CLE_Status iOnline = CLE_Status::InZone);
|
||||
void LSUpdate(ZoneServer* zoneserver);
|
||||
void LSZoneChange(ZoneToZone_Struct* ztz);
|
||||
bool CheckAuth(uint32 loginserver_account_id, const char* key_password);
|
||||
void SetOnline(CLE_Status iOnline = CLE_Status::Online);
|
||||
void SetChar(uint32 iCharID, const char* iCharName);
|
||||
inline CLE_Status Online() { return pOnline; }
|
||||
inline const uint32 GetID() const { return id; }
|
||||
inline const uint32 GetIP() const { return pIP; }
|
||||
inline void SetIP(const uint32& iIP) { pIP = iIP; }
|
||||
inline void KeepAlive() { stale = 0; }
|
||||
inline uint8 GetStaleCounter() const { return stale; }
|
||||
void LeavingZone(ZoneServer* iZS = 0, CLE_Status iOnline = CLE_Status::Offline);
|
||||
void Camp(ZoneServer* iZS = 0);
|
||||
bool CheckStale();
|
||||
void Update(ZoneServer *zoneserver, ServerClientList_Struct *scl, CLE_Status iOnline = CLE_Status::InZone);
|
||||
void LSUpdate(ZoneServer *zoneserver);
|
||||
void LSZoneChange(ZoneToZone_Struct *ztz);
|
||||
bool CheckAuth(uint32 loginserver_account_id, const char *key_password);
|
||||
void SetOnline(CLE_Status iOnline = CLE_Status::Online);
|
||||
void SetChar(uint32 iCharID, const char *iCharName);
|
||||
inline CLE_Status Online() { return m_online; }
|
||||
inline const uint32 GetID() const { return m_id; }
|
||||
inline const uint32 GetIP() const { return m_ip_address; }
|
||||
inline void SetIP(const uint32 &iIP) { m_ip_address = iIP; }
|
||||
inline void KeepAlive() { m_stale = 0; }
|
||||
inline uint8 GetStaleCounter() const { return m_stale; }
|
||||
void LeavingZone(ZoneServer *iZS = 0, CLE_Status iOnline = CLE_Status::Offline);
|
||||
void Camp(ZoneServer *iZS = 0);
|
||||
|
||||
// Login Server stuff
|
||||
inline const char* LoginServer() const { return source_loginserver; }
|
||||
inline uint32 LSID() const { return pLSID; }
|
||||
inline uint32 LSAccountID() const { return pLSID; }
|
||||
inline const char* LSName() const { return loginserver_account_name; }
|
||||
inline int16 WorldAdmin() const { return pworldadmin; }
|
||||
inline const char* GetLSKey() const { return plskey; }
|
||||
inline const CLE_Status GetOnline() const { return pOnline; }
|
||||
inline const char *LoginServer() const { return m_source_loginserver; }
|
||||
inline uint32 LSID() const { return m_login_server_id; }
|
||||
inline uint32 LSAccountID() const { return m_login_server_id; }
|
||||
inline const char *LSName() const { return m_login_account_name; }
|
||||
inline int16 WorldAdmin() const { return m_world_admin; }
|
||||
inline const char *GetLSKey() const { return m_key; }
|
||||
inline const CLE_Status GetOnline() const { return m_online; }
|
||||
|
||||
// Account stuff
|
||||
inline uint32 AccountID() const { return paccountid; }
|
||||
inline const char* AccountName() const { return paccountname; }
|
||||
inline int16 Admin() const { return padmin; }
|
||||
inline void SetAdmin(uint16 iAdmin) { padmin = iAdmin; }
|
||||
inline uint32 AccountID() const { return m_account_id; }
|
||||
inline const char *AccountName() const { return m_account_name; }
|
||||
inline int16 Admin() const { return m_admin; }
|
||||
inline void SetAdmin(uint16 iAdmin) { m_admin = iAdmin; }
|
||||
|
||||
// Character info
|
||||
inline ZoneServer *Server() const { return pzoneserver; }
|
||||
inline void ClearServer() { pzoneserver = 0; }
|
||||
inline uint32 CharID() const { return pcharid; }
|
||||
inline const char *name() const { return pname; }
|
||||
inline uint32 zone() const { return pzone; }
|
||||
inline uint16 instance() const { return pinstance; }
|
||||
inline uint8 level() const { return plevel; }
|
||||
inline uint8 class_() const { return pclass_; }
|
||||
inline uint16 race() const { return prace; }
|
||||
inline uint8 Anon() { return panon; }
|
||||
inline uint8 TellsOff() const { return ptellsoff; }
|
||||
inline uint32 GuildID() const { return pguild_id; }
|
||||
inline uint32 GuildRank() const { return pguild_rank; }
|
||||
inline bool GuildTributeOptIn() const { return pguild_tribute_opt_in; }
|
||||
inline void SetGuild(uint32 guild_id) { pguild_id = guild_id; }
|
||||
inline void SetGuildTributeOptIn(bool opt) { pguild_tribute_opt_in = opt; }
|
||||
inline bool LFG() const { return pLFG; }
|
||||
inline uint8 GetGM() const { return gm; }
|
||||
inline void SetGM(uint8 igm) { gm = igm; }
|
||||
inline void SetZone(uint32 zone) { pzone = zone; }
|
||||
inline bool IsLocalClient() const { return plocal; }
|
||||
inline uint8 GetLFGFromLevel() const { return pLFGFromLevel; }
|
||||
inline uint8 GetLFGToLevel() const { return pLFGToLevel; }
|
||||
inline bool GetLFGMatchFilter() const { return pLFGMatchFilter; }
|
||||
inline const char *GetLFGComments() const { return pLFGComments; }
|
||||
inline uint8 GetClientVersion() { return pClientVersion; }
|
||||
inline ZoneServer *Server() const { return m_zone_server; }
|
||||
inline void ClearServer() { m_zone_server = 0; }
|
||||
inline uint32 CharID() const { return m_char_id; }
|
||||
inline const char *name() const { return m_char_name; }
|
||||
inline uint32 zone() const { return m_zone; }
|
||||
inline uint16 instance() const { return m_instance; }
|
||||
inline uint8 level() const { return m_level; }
|
||||
inline uint8 class_() const { return m_class_; }
|
||||
inline uint16 race() const { return m_race; }
|
||||
inline uint8 Anon() { return m_anon; }
|
||||
inline uint8 TellsOff() const { return m_tells_off; }
|
||||
inline uint32 GuildID() const { return m_guild_id; }
|
||||
inline uint32 GuildRank() const { return m_guild_rank; }
|
||||
inline bool GuildTributeOptIn() const { return m_guild_tribute_opt_in; }
|
||||
inline void SetGuild(uint32 guild_id) { m_guild_id = guild_id; }
|
||||
inline void SetGuildTributeOptIn(bool opt) { m_guild_tribute_opt_in = opt; }
|
||||
inline bool LFG() const { return m_lfg; }
|
||||
inline uint8 GetGM() const { return m_gm; }
|
||||
inline void SetGM(uint8 igm) { m_gm = igm; }
|
||||
inline void SetZone(uint32 zone) { m_zone = zone; }
|
||||
inline bool IsLocalClient() const { return m_is_local; }
|
||||
inline uint8 GetLFGFromLevel() const { return m_lfg_from_level; }
|
||||
inline uint8 GetLFGToLevel() const { return m_lfg_to_level; }
|
||||
inline bool GetLFGMatchFilter() const { return m_lfg_match_filter; }
|
||||
inline const char *GetLFGComments() const { return m_lfg_comments; }
|
||||
inline uint8 GetClientVersion() { return m_client_version; }
|
||||
|
||||
inline bool TellQueueFull() const { return tell_queue.size() >= RuleI(World, TellQueueSize); }
|
||||
inline bool TellQueueEmpty() const { return tell_queue.empty(); }
|
||||
inline void PushToTellQueue(ServerChannelMessage_Struct *scm) { tell_queue.push_back(scm); }
|
||||
inline bool TellQueueFull() const { return m_tell_queue.size() >= RuleI(World, TellQueueSize); }
|
||||
inline bool TellQueueEmpty() const { return m_tell_queue.empty(); }
|
||||
inline void PushToTellQueue(ServerChannelMessage_Struct *scm) { m_tell_queue.push_back(scm); }
|
||||
void ProcessTellQueue();
|
||||
|
||||
void SetPendingDzInvite(ServerPacket* pack) { m_dz_invite.reset(pack->Copy()); };
|
||||
void SetPendingDzInvite(ServerPacket *pack) { m_dz_invite.reset(pack->Copy()); };
|
||||
std::unique_ptr<ServerPacket> GetPendingDzInvite() { return std::move(m_dz_invite); }
|
||||
|
||||
private:
|
||||
void ClearVars(bool iAll = false);
|
||||
void ClearVars(bool iAll = false);
|
||||
|
||||
const uint32 id;
|
||||
uint32 pIP;
|
||||
CLE_Status pOnline;
|
||||
uint8 stale;
|
||||
const uint32 m_id;
|
||||
uint32 m_ip_address;
|
||||
CLE_Status m_online;
|
||||
uint8 m_stale;
|
||||
|
||||
// Login Server stuff
|
||||
char source_loginserver[64]{}; //Loginserver we came from.
|
||||
uint32 pLSID;
|
||||
char loginserver_account_name[32]{};
|
||||
char plskey[16]{};
|
||||
int16 pworldadmin; // Login server's suggested admin status setting
|
||||
bool plocal;
|
||||
char m_source_loginserver[64]{}; //Loginserver we came from.
|
||||
uint32 m_login_server_id;
|
||||
char m_login_account_name[32]{};
|
||||
char m_key[16]{};
|
||||
int16 m_world_admin; // Login server's suggested admin status setting
|
||||
bool m_is_local;
|
||||
|
||||
// Account stuff
|
||||
uint32 paccountid;
|
||||
char paccountname[32]{};
|
||||
int16 padmin{};
|
||||
uint32 m_account_id;
|
||||
char m_account_name[32]{};
|
||||
int16 m_admin{};
|
||||
|
||||
// Character info
|
||||
ZoneServer* pzoneserver{};
|
||||
uint32 pzone{};
|
||||
uint16 pinstance{};
|
||||
uint32 pcharid{};
|
||||
char pname[64]{};
|
||||
uint8 plevel{};
|
||||
uint8 pclass_{};
|
||||
uint16 prace{};
|
||||
uint8 panon{};
|
||||
uint8 ptellsoff{};
|
||||
uint32 pguild_id{};
|
||||
uint32 pguild_rank;
|
||||
bool pguild_tribute_opt_in{};
|
||||
bool pLFG{};
|
||||
uint8 gm{};
|
||||
uint8 pClientVersion{};
|
||||
uint8 pLFGFromLevel{};
|
||||
uint8 pLFGToLevel{};
|
||||
bool pLFGMatchFilter{};
|
||||
char pLFGComments[64]{};
|
||||
ZoneServer *m_zone_server{};
|
||||
uint32 m_zone{};
|
||||
uint16 m_instance{};
|
||||
uint32 m_char_id{};
|
||||
char m_char_name[64]{};
|
||||
uint8 m_level{};
|
||||
uint8 m_class_{};
|
||||
uint16 m_race{};
|
||||
uint8 m_anon{};
|
||||
uint8 m_tells_off{};
|
||||
uint32 m_guild_id{};
|
||||
uint32 m_guild_rank;
|
||||
bool m_guild_tribute_opt_in{};
|
||||
bool m_lfg{};
|
||||
uint8 m_gm{};
|
||||
uint8 m_client_version{};
|
||||
uint8 m_lfg_from_level{};
|
||||
uint8 m_lfg_to_level{};
|
||||
bool m_lfg_match_filter{};
|
||||
char m_lfg_comments[64]{};
|
||||
|
||||
// Tell Queue -- really a vector :D
|
||||
std::vector<ServerChannelMessage_Struct *> tell_queue;
|
||||
std::vector<ServerChannelMessage_Struct *> m_tell_queue;
|
||||
|
||||
std::unique_ptr<ServerPacket> m_dz_invite;
|
||||
};
|
||||
|
||||
@ -331,8 +331,26 @@ void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnect
|
||||
}
|
||||
|
||||
|
||||
void ClientList::CLEAdd(uint32 iLSID, const char *iLoginServerName, const char* iLoginName, const char* iLoginKey, int16 iWorldAdmin, uint32 ip, uint8 local) {
|
||||
auto tmp = new ClientListEntry(GetNextCLEID(), iLSID, iLoginServerName, iLoginName, iLoginKey, iWorldAdmin, ip, local);
|
||||
void ClientList::CLEAdd(
|
||||
uint32 login_server_id,
|
||||
const char *login_server_name,
|
||||
const char *login_name,
|
||||
const char *login_key,
|
||||
int16 world_admin,
|
||||
uint32 ip_address,
|
||||
uint8 is_local
|
||||
)
|
||||
{
|
||||
auto tmp = new ClientListEntry(
|
||||
GetNextCLEID(),
|
||||
login_server_id,
|
||||
login_server_name,
|
||||
login_name,
|
||||
login_key,
|
||||
world_admin,
|
||||
ip_address,
|
||||
is_local
|
||||
);
|
||||
|
||||
clientlist.Append(tmp);
|
||||
}
|
||||
@ -457,19 +475,19 @@ void ClientList::CLEKeepAlive(uint32 numupdates, uint32* wid) {
|
||||
}
|
||||
}
|
||||
|
||||
ClientListEntry *ClientList::CheckAuth(uint32 iLSID, const char *iKey)
|
||||
ClientListEntry *ClientList::CheckAuth(uint32 loginserver_account_id, const char *key)
|
||||
{
|
||||
LinkedListIterator<ClientListEntry *> iterator(clientlist);
|
||||
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
if (iterator.GetData()->CheckAuth(iLSID, iKey)) {
|
||||
if (iterator.GetData()->CheckAuth(loginserver_account_id, key)) {
|
||||
return iterator.GetData();
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID)
|
||||
|
||||
@ -51,7 +51,7 @@ public:
|
||||
|
||||
void ClientUpdate(ZoneServer* zoneserver, ServerClientList_Struct* scl);
|
||||
void CLERemoveZSRef(ZoneServer* iZS);
|
||||
ClientListEntry* CheckAuth(uint32 iLSID, const char* iKey);
|
||||
ClientListEntry* CheckAuth(uint32 loginserver_account_id, const char* key);
|
||||
ClientListEntry* FindCharacter(const char* name);
|
||||
ClientListEntry* FindCLEByAccountID(uint32 iAccID);
|
||||
ClientListEntry* FindCLEByCharacterID(uint32 iCharID);
|
||||
@ -59,7 +59,7 @@ public:
|
||||
void DisconnectByIP(uint32 in_ip);
|
||||
void CLCheckStale();
|
||||
void CLEKeepAlive(uint32 numupdates, uint32* wid);
|
||||
void CLEAdd(uint32 iLSID, const char* iLoginServerName, const char* iLoginName, const char* iLoginKey, int16 iWorldAdmin = AccountStatus::Player, uint32 ip = 0, uint8 local=0);
|
||||
void CLEAdd(uint32 login_server_id, const char* login_server_name, const char* login_name, const char* login_key, int16 world_admin = AccountStatus::Player, uint32 ip_address = 0, uint8 is_local=0);
|
||||
void UpdateClientGuild(uint32 char_id, uint32 guild_id);
|
||||
bool IsAccountInGame(uint32 iLSID);
|
||||
|
||||
|
||||
@ -46,8 +46,8 @@ void LoginServer::ProcessUsertoWorldReqLeg(uint16_t opcode, EQ::Net::Packet &p)
|
||||
const WorldConfig *Config = WorldConfig::get();
|
||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||
|
||||
UsertoWorldRequestLegacy_Struct *utwr = (UsertoWorldRequestLegacy_Struct *) p.Data();
|
||||
uint32 id = database.GetAccountIDFromLSID("eqemu", utwr->lsaccountid);
|
||||
UsertoWorldRequestLegacy *utwr = (UsertoWorldRequestLegacy *) p.Data();
|
||||
uint32 id = database.GetAccountIDFromLSID("eqemu", utwr->lsaccountid);
|
||||
int16 status = database.GetAccountStatus(id);
|
||||
|
||||
LogDebug(
|
||||
@ -63,11 +63,11 @@ void LoginServer::ProcessUsertoWorldReqLeg(uint16_t opcode, EQ::Net::Packet &p)
|
||||
|
||||
ServerPacket outpack;
|
||||
outpack.opcode = ServerOP_UsertoWorldRespLeg;
|
||||
outpack.size = sizeof(UsertoWorldResponseLegacy_Struct);
|
||||
outpack.size = sizeof(UsertoWorldResponseLegacy);
|
||||
outpack.pBuffer = new uchar[outpack.size];
|
||||
memset(outpack.pBuffer, 0, outpack.size);
|
||||
|
||||
UsertoWorldResponseLegacy_Struct *utwrs = (UsertoWorldResponseLegacy_Struct *) outpack.pBuffer;
|
||||
UsertoWorldResponseLegacy *utwrs = (UsertoWorldResponseLegacy *) outpack.pBuffer;
|
||||
utwrs->lsaccountid = utwr->lsaccountid;
|
||||
utwrs->ToID = utwr->FromID;
|
||||
utwrs->worldid = utwr->worldid;
|
||||
@ -126,8 +126,8 @@ void LoginServer::ProcessUsertoWorldReq(uint16_t opcode, EQ::Net::Packet &p)
|
||||
const WorldConfig *Config = WorldConfig::get();
|
||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||
|
||||
UsertoWorldRequest_Struct *utwr = (UsertoWorldRequest_Struct *) p.Data();
|
||||
uint32 id = database.GetAccountIDFromLSID(utwr->login, utwr->lsaccountid);
|
||||
UsertoWorldRequest *utwr = (UsertoWorldRequest *) p.Data();
|
||||
uint32 id = database.GetAccountIDFromLSID(utwr->login, utwr->lsaccountid);
|
||||
int16 status = database.GetAccountStatus(id);
|
||||
|
||||
LogDebug(
|
||||
@ -143,11 +143,11 @@ void LoginServer::ProcessUsertoWorldReq(uint16_t opcode, EQ::Net::Packet &p)
|
||||
|
||||
ServerPacket outpack;
|
||||
outpack.opcode = ServerOP_UsertoWorldResp;
|
||||
outpack.size = sizeof(UsertoWorldResponse_Struct);
|
||||
outpack.size = sizeof(UsertoWorldResponse);
|
||||
outpack.pBuffer = new uchar[outpack.size];
|
||||
memset(outpack.pBuffer, 0, outpack.size);
|
||||
|
||||
UsertoWorldResponse_Struct *utwrs = (UsertoWorldResponse_Struct *) outpack.pBuffer;
|
||||
UsertoWorldResponse *utwrs = (UsertoWorldResponse *) outpack.pBuffer;
|
||||
utwrs->lsaccountid = utwr->lsaccountid;
|
||||
utwrs->ToID = utwr->FromID;
|
||||
strn0cpy(utwrs->login, utwr->login, 64);
|
||||
@ -208,27 +208,27 @@ void LoginServer::ProcessLSClientAuthLegacy(uint16_t opcode, EQ::Net::Packet &p)
|
||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||
|
||||
try {
|
||||
auto client_authentication_request = p.GetSerialize<ClientAuthLegacy_Struct>(0);
|
||||
auto r = p.GetSerialize<ClientAuthLegacy>(0);
|
||||
|
||||
LogDebug(
|
||||
"Processing Loginserver Auth Legacy | account_id [{0}] account_name [{1}] key [{2}] admin [{3}] ip [{4}] "
|
||||
"local_network [{5}]",
|
||||
client_authentication_request.loginserver_account_id,
|
||||
client_authentication_request.loginserver_account_name,
|
||||
client_authentication_request.key,
|
||||
client_authentication_request.is_world_admin,
|
||||
client_authentication_request.ip,
|
||||
client_authentication_request.is_client_from_local_network
|
||||
"Processing Loginserver Auth Legacy | account_id [{}] account_name [{}] key [{}] admin [{}] ip [{}] "
|
||||
"local_network [{}]",
|
||||
r.loginserver_account_id,
|
||||
r.loginserver_account_name,
|
||||
r.key,
|
||||
r.is_world_admin,
|
||||
r.ip_address,
|
||||
r.is_client_from_local_network
|
||||
);
|
||||
|
||||
client_list.CLEAdd(
|
||||
client_authentication_request.loginserver_account_id,
|
||||
r.loginserver_account_id,
|
||||
"eqemu",
|
||||
client_authentication_request.loginserver_account_name,
|
||||
client_authentication_request.key,
|
||||
client_authentication_request.is_world_admin,
|
||||
client_authentication_request.ip,
|
||||
client_authentication_request.is_client_from_local_network
|
||||
r.loginserver_account_name,
|
||||
r.key,
|
||||
r.is_world_admin,
|
||||
r.ip_address,
|
||||
r.is_client_from_local_network
|
||||
);
|
||||
}
|
||||
catch (std::exception &ex) {
|
||||
@ -242,28 +242,28 @@ void LoginServer::ProcessLSClientAuth(uint16_t opcode, EQ::Net::Packet &p)
|
||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||
|
||||
try {
|
||||
auto client_authentication_request = p.GetSerialize<ClientAuth_Struct>(0);
|
||||
auto r = p.GetSerialize<ClientAuth>(0);
|
||||
|
||||
LogDebug(
|
||||
"Processing Loginserver Auth | account_id [{0}] account_name [{1}] loginserver_name [{2}] key [{3}] "
|
||||
"admin [{4}] ip [{5}] local_network [{6}]",
|
||||
client_authentication_request.loginserver_account_id,
|
||||
client_authentication_request.account_name,
|
||||
client_authentication_request.loginserver_name,
|
||||
client_authentication_request.key,
|
||||
client_authentication_request.is_world_admin,
|
||||
client_authentication_request.ip,
|
||||
client_authentication_request.is_client_from_local_network
|
||||
"Processing Loginserver Auth | account_id [{}] account_name [{}] loginserver_name [{}] key [{}] "
|
||||
"admin [{}] ip [{}] local_network [{}]",
|
||||
r.loginserver_account_id,
|
||||
r.account_name,
|
||||
r.loginserver_name,
|
||||
r.key,
|
||||
r.is_world_admin,
|
||||
r.ip_address,
|
||||
r.is_client_from_local_network
|
||||
);
|
||||
|
||||
client_list.CLEAdd(
|
||||
client_authentication_request.loginserver_account_id,
|
||||
client_authentication_request.loginserver_name,
|
||||
client_authentication_request.account_name,
|
||||
client_authentication_request.key,
|
||||
client_authentication_request.is_world_admin,
|
||||
client_authentication_request.ip,
|
||||
client_authentication_request.is_client_from_local_network
|
||||
r.loginserver_account_id,
|
||||
r.loginserver_name,
|
||||
r.account_name,
|
||||
r.key,
|
||||
r.is_world_admin,
|
||||
r.ip_address,
|
||||
r.is_client_from_local_network
|
||||
);
|
||||
}
|
||||
catch (std::exception &ex) {
|
||||
|
||||
@ -35,12 +35,6 @@ WorldDatabase content_db;
|
||||
extern std::vector<RaceClassAllocation> character_create_allocations;
|
||||
extern std::vector<RaceClassCombos> character_create_race_class_combos;
|
||||
|
||||
|
||||
/**
|
||||
* @param account_id
|
||||
* @param out_app
|
||||
* @param client_version_bit
|
||||
*/
|
||||
void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **out_app, uint32 client_version_bit)
|
||||
{
|
||||
EQ::versions::ClientVersion
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user