Logging / initializers [skip ci]

This commit is contained in:
Akkadius 2019-07-10 00:11:17 -05:00
parent 6e550ecc75
commit 2a927c5c80
5 changed files with 36 additions and 33 deletions

View File

@ -1210,19 +1210,25 @@ bool Database::AddToNameFilter(const char* name) {
return true;
}
/**
* @param in_loginserver_id
* @param in_loginserver_account_id
* @param in_account_name
* @param in_status
* @return
*/
uint32 Database::GetAccountIDFromLSID(
const std::string &iLoginServer,
uint32 iLSID, char *oAccountName,
int16 *oStatus
const std::string &in_loginserver_id,
uint32 in_loginserver_account_id,
char *in_account_name,
int16 *in_status
)
{
uint32 account_id = 0;
//iLoginServer is set by config so don't need to worry about escaping it.
auto query = fmt::format(
"SELECT id, name, status FROM account WHERE lsaccount_id = {0} AND ls_id = '{1}'",
iLSID,
iLoginServer
in_loginserver_account_id,
in_loginserver_id
);
auto results = QueryDatabase(query);
@ -1236,13 +1242,13 @@ uint32 Database::GetAccountIDFromLSID(
}
for (auto row = results.begin(); row != results.end(); ++row) {
account_id = atoi(row[0]);
account_id = std::stoi(row[0]);
if (oAccountName) {
strcpy(oAccountName, row[1]);
if (in_account_name) {
strcpy(in_account_name, row[1]);
}
if (oStatus) {
*oStatus = atoi(row[2]);
if (in_status) {
*in_status = std::stoi(row[2]);
}
}

View File

@ -184,7 +184,7 @@ public:
uint32 CheckLogin(const char* name, const char* password, const char *loginserver, int16* oStatus = 0);
uint32 CreateAccount(const char* name, const char* password, int16 status, const char* loginserver, uint32 lsaccount_id);
uint32 GetAccountIDFromLSID(const std::string& iLoginServer, uint32 iLSID, char* oAccountName = 0, int16* oStatus = 0);
uint32 GetAccountIDFromLSID(const std::string& in_loginserver_id, uint32 in_loginserver_account_id, char* in_account_name = 0, int16* in_status = 0);
uint8 GetAgreementFlag(uint32 acctid);
void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus);

View File

@ -394,35 +394,36 @@ void Client::SendPostEnterWorld() {
safe_delete(outapp);
}
bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) {
bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
{
if (app->size != sizeof(LoginInfo_Struct)) {
return false;
}
LoginInfo_Struct *li=(LoginInfo_Struct *)app->pBuffer;
auto *login_info = (LoginInfo_Struct *) app->pBuffer;
// Quagmire - max len for name is 18, pass 15
char name[19] = {0};
char name[19] = {0};
char password[16] = {0};
strn0cpy(name, (char*)li->login_info,18);
strn0cpy(password, (char*)&(li->login_info[strlen(name)+1]), 15);
strn0cpy(name, (char *) login_info->login_info, 18);
strn0cpy(password, (char *) &(login_info->login_info[strlen(name) + 1]), 15);
LogDebug("Receiving Login Info Packet from Client | name [{0}] password [{1}]", name, password);
if (strlen(password) <= 1) {
Log(Logs::Detail, Logs::World_Server, "Login without a password");
return false;
}
is_player_zoning = (li->zoning == 1);
LogDebug("Receiving Login Info Packet from Client | name [{0}] password [{1}]", name, password);
uint32 id = atoi(name);
is_player_zoning = (login_info->zoning == 1);
uint32 id = std::stoi(name);
if (id == 0) {
LogWarning("Receiving Login Info Packet from Client | account_id is 0 - disconnecting");
return false;
}
if (cle = client_list.CheckAuth(id, password)) {
if ((cle = client_list.CheckAuth(id, password))) {
if (!is_player_zoning) {
// Track who is in and who is out of the game
char *inout= (char *) "";

View File

@ -80,10 +80,6 @@ ClientListEntry::ClientListEntry(
pworldadmin = in_is_world_admin;
plocal = (local == 1);
pinstance = 0;
pLFGFromLevel = 0;
pLFGToLevel = 0;
pLFGMatchFilter = false;
memset(pLFGComments, 0, 64);
}

View File

@ -138,7 +138,7 @@ private:
// Character info
ZoneServer* pzoneserver{};
uint32 pzone{};
uint16 pinstance;
uint16 pinstance{};
uint32 pcharid{};
char pname[64]{};
uint8 plevel{};
@ -150,9 +150,9 @@ private:
bool pLFG{};
uint8 gm{};
uint8 pClientVersion{};
uint8 pLFGFromLevel;
uint8 pLFGToLevel;
bool pLFGMatchFilter;
uint8 pLFGFromLevel{};
uint8 pLFGToLevel{};
bool pLFGMatchFilter{};
char pLFGComments[64]{};
// Tell Queue -- really a vector :D