Fix some edge case with account name not being passed to world

This commit is contained in:
Akkadius
2019-07-06 03:19:50 -05:00
parent a9969e500b
commit 0668f41de2
14 changed files with 718 additions and 382 deletions
+353 -123
View File
@@ -36,180 +36,236 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "clientlist.h"
#include "world_config.h"
extern ZSList zoneserver_list;
extern ClientList client_list;
extern uint32 numzones;
extern uint32 numplayers;
extern volatile bool RunLoops;
extern ZSList zoneserver_list;
extern ClientList client_list;
extern uint32 numzones;
extern uint32 numplayers;
extern volatile bool RunLoops;
LoginServer::LoginServer(const char* iAddress, uint16 iPort, const char* Account, const char* Password, bool legacy)
LoginServer::LoginServer(const char *iAddress, uint16 iPort, const char *Account, const char *Password, bool legacy)
{
strn0cpy(LoginServerAddress, iAddress, 256);
LoginServerPort = iPort;
LoginAccount = Account;
LoginPassword = Password;
LoginServerPort = iPort;
LoginAccount = Account;
LoginPassword = Password;
CanAccountUpdate = false;
IsLegacy = legacy;
IsLegacy = legacy;
Connect();
}
LoginServer::~LoginServer() {
LoginServer::~LoginServer()
{
}
void LoginServer::ProcessUsertoWorldReqLeg(uint16_t opcode, EQ::Net::Packet &p) {
void LoginServer::ProcessUsertoWorldReqLeg(uint16_t opcode, EQ::Net::Packet &p)
{
const WorldConfig *Config = WorldConfig::get();
Log(Logs::Detail, Logs::World_Server, "Recevied ServerPacket from LS OpCode 0x04x", opcode);
UsertoWorldRequestLegacy_Struct* utwr = (UsertoWorldRequestLegacy_Struct*)p.Data();
uint32 id = database.GetAccountIDFromLSID("eqemu", utwr->lsaccountid);
int16 status = database.CheckStatus(id);
UsertoWorldRequestLegacy_Struct *utwr = (UsertoWorldRequestLegacy_Struct *) p.Data();
uint32 id = database.GetAccountIDFromLSID("eqemu", utwr->lsaccountid);
int16 status = database.CheckStatus(id);
auto outpack = new ServerPacket;
outpack->opcode = ServerOP_UsertoWorldRespLeg;
outpack->size = sizeof(UsertoWorldResponseLegacy_Struct);
outpack->opcode = ServerOP_UsertoWorldRespLeg;
outpack->size = sizeof(UsertoWorldResponseLegacy_Struct);
outpack->pBuffer = new uchar[outpack->size];
memset(outpack->pBuffer, 0, outpack->size);
UsertoWorldResponseLegacy_Struct* utwrs = (UsertoWorldResponseLegacy_Struct*)outpack->pBuffer;
UsertoWorldResponseLegacy_Struct *utwrs = (UsertoWorldResponseLegacy_Struct *) outpack->pBuffer;
utwrs->lsaccountid = utwr->lsaccountid;
utwrs->ToID = utwr->FromID;
utwrs->ToID = utwr->FromID;
if (Config->Locked == true)
{
if ((status == 0 || status < 100) && (status != -2 || status != -1))
if (Config->Locked == true) {
if ((status == 0 || status < 100) && (status != -2 || status != -1)) {
utwrs->response = 0;
if (status >= 100)
}
if (status >= 100) {
utwrs->response = 1;
}
}
else {
utwrs->response = 1;
}
int32 x = Config->MaxClients;
if ((int32)numplayers >= x && x != -1 && x != 255 && status < 80)
if ((int32) numplayers >= x && x != -1 && x != 255 && status < 80) {
utwrs->response = -3;
}
if (status == -1)
if (status == -1) {
utwrs->response = -1;
if (status == -2)
}
if (status == -2) {
utwrs->response = -2;
}
utwrs->worldid = utwr->worldid;
SendPacket(outpack);
delete outpack;
}
void LoginServer::ProcessUsertoWorldReq(uint16_t opcode, EQ::Net::Packet &p) {
void LoginServer::ProcessUsertoWorldReq(uint16_t opcode, EQ::Net::Packet &p)
{
const WorldConfig *Config = WorldConfig::get();
Log(Logs::Detail, Logs::World_Server, "Recevied ServerPacket from LS OpCode 0x04x", opcode);
UsertoWorldRequest_Struct* utwr = (UsertoWorldRequest_Struct*)p.Data();
uint32 id = database.GetAccountIDFromLSID(utwr->login, utwr->lsaccountid);
int16 status = database.CheckStatus(id);
UsertoWorldRequest_Struct *utwr = (UsertoWorldRequest_Struct *) p.Data();
uint32 id = database.GetAccountIDFromLSID(utwr->login, utwr->lsaccountid);
int16 status = database.CheckStatus(id);
auto outpack = new ServerPacket;
outpack->opcode = ServerOP_UsertoWorldResp;
outpack->size = sizeof(UsertoWorldResponse_Struct);
outpack->opcode = ServerOP_UsertoWorldResp;
outpack->size = sizeof(UsertoWorldResponse_Struct);
outpack->pBuffer = new uchar[outpack->size];
memset(outpack->pBuffer, 0, outpack->size);
UsertoWorldResponse_Struct* utwrs = (UsertoWorldResponse_Struct*)outpack->pBuffer;
UsertoWorldResponse_Struct *utwrs = (UsertoWorldResponse_Struct *) outpack->pBuffer;
utwrs->lsaccountid = utwr->lsaccountid;
utwrs->ToID = utwr->FromID;
utwrs->ToID = utwr->FromID;
strn0cpy(utwrs->login, utwr->login, 64);
if (Config->Locked == true)
{
if ((status == 0 || status < 100) && (status != -2 || status != -1))
if (Config->Locked == true) {
if ((status == 0 || status < 100) && (status != -2 || status != -1)) {
utwrs->response = 0;
if (status >= 100)
}
if (status >= 100) {
utwrs->response = 1;
}
}
else {
utwrs->response = 1;
}
int32 x = Config->MaxClients;
if ((int32)numplayers >= x && x != -1 && x != 255 && status < 80)
if ((int32) numplayers >= x && x != -1 && x != 255 && status < 80) {
utwrs->response = -3;
}
if (status == -1)
if (status == -1) {
utwrs->response = -1;
if (status == -2)
}
if (status == -2) {
utwrs->response = -2;
}
utwrs->worldid = utwr->worldid;
SendPacket(outpack);
delete outpack;
}
void LoginServer::ProcessLSClientAuthLeg(uint16_t opcode, EQ::Net::Packet &p) {
void LoginServer::ProcessLSClientAuthLegacy(uint16_t opcode, EQ::Net::Packet &p)
{
const WorldConfig *Config = WorldConfig::get();
Log(Logs::Detail, Logs::World_Server, "Recevied ServerPacket from LS OpCode 0x04x", opcode);
Log(Logs::Detail, Logs::World_Server, "Received ServerPacket from LS OpCode 0x04x", opcode);
try {
auto slsca = p.GetSerialize<ClientAuthLegacy_Struct>(0);
auto client_authentication_request = p.GetSerialize<ClientAuthLegacy_Struct>(0);
if (RuleI(World, AccountSessionLimit) >= 0) {
// Enforce the limit on the number of characters on the same account that can be
// online at the same time.
client_list.EnforceSessionLimit(slsca.lsaccount_id);
client_list.EnforceSessionLimit(client_authentication_request.loginserver_account_id);
}
client_list.CLEAdd(slsca.lsaccount_id, "eqemu", slsca.name, slsca.key, slsca.worldadmin, slsca.ip, slsca.local);
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
);
client_list.CLEAdd(
client_authentication_request.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
);
}
catch (std::exception &ex) {
LogF(Logs::General, Logs::Error, "Error parsing LSClientAuth packet from world.\n{0}", ex.what());
LogError("Error parsing ClientAuthLegacy packet from world\nReason [{0}]", ex.what());
}
}
void LoginServer::ProcessLSClientAuth(uint16_t opcode, EQ::Net::Packet &p) {
void LoginServer::ProcessLSClientAuth(uint16_t opcode, EQ::Net::Packet &p)
{
const WorldConfig *Config = WorldConfig::get();
Log(Logs::Detail, Logs::World_Server, "Recevied ServerPacket from LS OpCode 0x04x", opcode);
Log(Logs::Detail, Logs::World_Server, "Received ServerPacket from LS OpCode 0x04x", opcode);
try {
auto slsca = p.GetSerialize<ClientAuth_Struct>(0);
auto client_authentication_request = p.GetSerialize<ClientAuth_Struct>(0);
if (RuleI(World, AccountSessionLimit) >= 0) {
// Enforce the limit on the number of characters on the same account that can be
// online at the same time.
client_list.EnforceSessionLimit(slsca.lsaccount_id);
client_list.EnforceSessionLimit(client_authentication_request.loginserver_account_id);
}
client_list.CLEAdd(slsca.lsaccount_id, slsca.lsname, slsca.name, slsca.key, slsca.worldadmin, slsca.ip, slsca.local);
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
);
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
);
}
catch (std::exception &ex) {
LogF(Logs::General, Logs::Error, "Error parsing LSClientAuth packet from world.\n{0}", ex.what());
LogError("Error parsing ClientAuth packet from world\nReason [{0}]", ex.what());
}
}
void LoginServer::ProcessLSFatalError(uint16_t opcode, EQ::Net::Packet &p) {
void LoginServer::ProcessLSFatalError(uint16_t opcode, EQ::Net::Packet &p)
{
const WorldConfig *Config = WorldConfig::get();
Log(Logs::Detail, Logs::World_Server, "Recevied ServerPacket from LS OpCode 0x04x", opcode);
Log(Logs::Detail, Logs::World_Server, "Login server responded with FatalError.");
if (p.Length() > 1) {
Log(Logs::Detail, Logs::World_Server, " %s", (const char*)p.Data());
Log(Logs::Detail, Logs::World_Server, " %s", (const char *) p.Data());
}
}
void LoginServer::ProcessSystemwideMessage(uint16_t opcode, EQ::Net::Packet &p) {
void LoginServer::ProcessSystemwideMessage(uint16_t opcode, EQ::Net::Packet &p)
{
const WorldConfig *Config = WorldConfig::get();
Log(Logs::Detail, Logs::World_Server, "Recevied ServerPacket from LS OpCode 0x04x", opcode);
ServerSystemwideMessage* swm = (ServerSystemwideMessage*)p.Data();
ServerSystemwideMessage *swm = (ServerSystemwideMessage *) p.Data();
zoneserver_list.SendEmoteMessageRaw(0, 0, 0, swm->type, swm->message);
}
void LoginServer::ProcessLSRemoteAddr(uint16_t opcode, EQ::Net::Packet &p) {
void LoginServer::ProcessLSRemoteAddr(uint16_t opcode, EQ::Net::Packet &p)
{
const WorldConfig *Config = WorldConfig::get();
Log(Logs::Detail, Logs::World_Server, "Recevied ServerPacket from LS OpCode 0x04x", opcode);
if (!Config->WorldAddress.length()) {
WorldConfig::SetWorldAddress((char *)p.Data());
Log(Logs::Detail, Logs::World_Server, "Loginserver provided %s as world address", (const char*)p.Data());
WorldConfig::SetWorldAddress((char *) p.Data());
Log(Logs::Detail, Logs::World_Server, "Loginserver provided %s as world address", (const char *) p.Data());
}
}
void LoginServer::ProcessLSAccountUpdate(uint16_t opcode, EQ::Net::Packet &p) {
void LoginServer::ProcessLSAccountUpdate(uint16_t opcode, EQ::Net::Packet &p)
{
const WorldConfig *Config = WorldConfig::get();
Log(Logs::Detail, Logs::World_Server, "Recevied ServerPacket from LS OpCode 0x04x", opcode);
@@ -217,7 +273,8 @@ void LoginServer::ProcessLSAccountUpdate(uint16_t opcode, EQ::Net::Packet &p) {
CanAccountUpdate = true;
}
bool LoginServer::Connect() {
bool LoginServer::Connect()
{
char errbuf[1024];
if ((LoginServerIP = ResolveIP(LoginServerAddress, errbuf)) == 0) {
Log(Logs::Detail, Logs::World_Server, "Unable to resolve '%s' to an IP.", LoginServerAddress);
@@ -225,88 +282,252 @@ bool LoginServer::Connect() {
}
if (LoginServerIP == 0 || LoginServerPort == 0) {
Log(Logs::Detail, Logs::World_Server, "Connect info incomplete, cannot connect: %s:%d", LoginServerAddress, LoginServerPort);
LogInfo(
"Connect info incomplete, cannot connect: [{0}:{1}]",
LoginServerAddress,
LoginServerPort
);
return false;
}
if (IsLegacy) {
legacy_client.reset(new EQ::Net::ServertalkLegacyClient(LoginServerAddress, LoginServerPort, false));
legacy_client->OnConnect([this](EQ::Net::ServertalkLegacyClient *client) {
if (client) {
Log(Logs::Detail, Logs::World_Server, "Connected to Legacy Loginserver: %s:%d", LoginServerAddress, LoginServerPort);
SendInfo();
SendStatus();
zoneserver_list.SendLSZones();
legacy_client->OnConnect(
[this](EQ::Net::ServertalkLegacyClient *client) {
if (client) {
LogInfo(
"Connected to Legacy Loginserver: [{0}:{1}]",
LoginServerAddress,
LoginServerPort
);
statusupdate_timer.reset(new EQ::Timer(LoginServer_StatusUpdateInterval, true, [this](EQ::Timer *t) {
SendInfo();
SendStatus();
}));
}
else {
Log(Logs::Detail, Logs::World_Server, "Could not connect to Legacy Loginserver: %s:%d", LoginServerAddress, LoginServerPort);
}
});
zoneserver_list.SendLSZones();
legacy_client->OnMessage(ServerOP_UsertoWorldReqLeg, std::bind(&LoginServer::ProcessUsertoWorldReqLeg, this, std::placeholders::_1, std::placeholders::_2));
legacy_client->OnMessage(ServerOP_UsertoWorldReq, std::bind(&LoginServer::ProcessUsertoWorldReq, this, std::placeholders::_1, std::placeholders::_2));
legacy_client->OnMessage(ServerOP_LSClientAuthLeg, std::bind(&LoginServer::ProcessLSClientAuthLeg, this, std::placeholders::_1, std::placeholders::_2));
legacy_client->OnMessage(ServerOP_LSClientAuth, std::bind(&LoginServer::ProcessLSClientAuth, this, std::placeholders::_1, std::placeholders::_2));
legacy_client->OnMessage(ServerOP_LSFatalError, std::bind(&LoginServer::ProcessLSFatalError, this, std::placeholders::_1, std::placeholders::_2));
legacy_client->OnMessage(ServerOP_SystemwideMessage, std::bind(&LoginServer::ProcessSystemwideMessage, this, std::placeholders::_1, std::placeholders::_2));
legacy_client->OnMessage(ServerOP_LSRemoteAddr, std::bind(&LoginServer::ProcessLSRemoteAddr, this, std::placeholders::_1, std::placeholders::_2));
legacy_client->OnMessage(ServerOP_LSAccountUpdate, std::bind(&LoginServer::ProcessLSAccountUpdate, this, std::placeholders::_1, std::placeholders::_2));
statusupdate_timer.reset(
new EQ::Timer(
LoginServer_StatusUpdateInterval, true, [this](EQ::Timer *t) {
SendStatus();
}
)
);
}
else {
LogInfo(
"Could not connect to Legacy Loginserver: [{0}:{1}]",
LoginServerAddress,
LoginServerPort
);
}
}
);
legacy_client->OnMessage(
ServerOP_UsertoWorldReqLeg,
std::bind(
&LoginServer::ProcessUsertoWorldReqLeg,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
legacy_client->OnMessage(
ServerOP_UsertoWorldReq,
std::bind(
&LoginServer::ProcessUsertoWorldReq,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
legacy_client->OnMessage(
ServerOP_LSClientAuthLeg,
std::bind(
&LoginServer::ProcessLSClientAuthLegacy,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
legacy_client->OnMessage(
ServerOP_LSClientAuth,
std::bind(
&LoginServer::ProcessLSClientAuth,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
legacy_client->OnMessage(
ServerOP_LSFatalError,
std::bind(
&LoginServer::ProcessLSFatalError,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
legacy_client->OnMessage(
ServerOP_SystemwideMessage,
std::bind(
&LoginServer::ProcessSystemwideMessage,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
legacy_client->OnMessage(
ServerOP_LSRemoteAddr,
std::bind(
&LoginServer::ProcessLSRemoteAddr,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
legacy_client->OnMessage(
ServerOP_LSAccountUpdate,
std::bind(
&LoginServer::ProcessLSAccountUpdate,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
}
else {
client.reset(new EQ::Net::ServertalkClient(LoginServerAddress, LoginServerPort, false, "World", ""));
client->OnConnect([this](EQ::Net::ServertalkClient *client) {
if (client) {
Log(Logs::Detail, Logs::World_Server, "Connected to Loginserver: %s:%d", LoginServerAddress, LoginServerPort);
SendInfo();
SendStatus();
zoneserver_list.SendLSZones();
statusupdate_timer.reset(new EQ::Timer(LoginServer_StatusUpdateInterval, true, [this](EQ::Timer *t) {
client->OnConnect(
[this](EQ::Net::ServertalkClient *client) {
if (client) {
LogInfo(
"Connected to Loginserver: {0}:{1}",
LoginServerAddress,
LoginServerPort
);
SendInfo();
SendStatus();
}));
}
else {
Log(Logs::Detail, Logs::World_Server, "Could not connect to Loginserver: %s:%d", LoginServerAddress, LoginServerPort);
}
});
zoneserver_list.SendLSZones();
client->OnMessage(ServerOP_UsertoWorldReqLeg, std::bind(&LoginServer::ProcessUsertoWorldReqLeg, this, std::placeholders::_1, std::placeholders::_2));
client->OnMessage(ServerOP_UsertoWorldReq, std::bind(&LoginServer::ProcessUsertoWorldReq, this, std::placeholders::_1, std::placeholders::_2));
client->OnMessage(ServerOP_LSClientAuthLeg, std::bind(&LoginServer::ProcessLSClientAuthLeg, this, std::placeholders::_1, std::placeholders::_2));
client->OnMessage(ServerOP_LSClientAuth, std::bind(&LoginServer::ProcessLSClientAuth, this, std::placeholders::_1, std::placeholders::_2));
client->OnMessage(ServerOP_LSFatalError, std::bind(&LoginServer::ProcessLSFatalError, this, std::placeholders::_1, std::placeholders::_2));
client->OnMessage(ServerOP_SystemwideMessage, std::bind(&LoginServer::ProcessSystemwideMessage, this, std::placeholders::_1, std::placeholders::_2));
client->OnMessage(ServerOP_LSRemoteAddr, std::bind(&LoginServer::ProcessLSRemoteAddr, this, std::placeholders::_1, std::placeholders::_2));
client->OnMessage(ServerOP_LSAccountUpdate, std::bind(&LoginServer::ProcessLSAccountUpdate, this, std::placeholders::_1, std::placeholders::_2));
statusupdate_timer.reset(
new EQ::Timer(
LoginServer_StatusUpdateInterval, true, [this](EQ::Timer *t) {
SendStatus();
}
));
}
else {
LogInfo(
"Could not connect to Loginserver: {0}:{1}",
LoginServerAddress,
LoginServerPort
);
}
}
);
client->OnMessage(
ServerOP_UsertoWorldReqLeg,
std::bind(
&LoginServer::ProcessUsertoWorldReqLeg,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
client->OnMessage(
ServerOP_UsertoWorldReq,
std::bind(
&LoginServer::ProcessUsertoWorldReq,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
client->OnMessage(
ServerOP_LSClientAuthLeg,
std::bind(
&LoginServer::ProcessLSClientAuthLegacy,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
client->OnMessage(
ServerOP_LSClientAuth,
std::bind(
&LoginServer::ProcessLSClientAuth,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
client->OnMessage(
ServerOP_LSFatalError,
std::bind(
&LoginServer::ProcessLSFatalError,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
client->OnMessage(
ServerOP_SystemwideMessage,
std::bind(
&LoginServer::ProcessSystemwideMessage,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
client->OnMessage(
ServerOP_LSRemoteAddr,
std::bind(
&LoginServer::ProcessLSRemoteAddr,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
client->OnMessage(
ServerOP_LSAccountUpdate,
std::bind(
&LoginServer::ProcessLSAccountUpdate,
this,
std::placeholders::_1,
std::placeholders::_2
)
);
}
return true;
}
void LoginServer::SendInfo() {
void LoginServer::SendInfo()
{
const WorldConfig *Config = WorldConfig::get();
auto pack = new ServerPacket;
pack->opcode = ServerOP_NewLSInfo;
pack->size = sizeof(ServerNewLSInfo_Struct);
pack->opcode = ServerOP_NewLSInfo;
pack->size = sizeof(ServerNewLSInfo_Struct);
pack->pBuffer = new uchar[pack->size];
memset(pack->pBuffer, 0, pack->size);
ServerNewLSInfo_Struct* lsi = (ServerNewLSInfo_Struct*)pack->pBuffer;
ServerNewLSInfo_Struct *lsi = (ServerNewLSInfo_Struct *) pack->pBuffer;
strcpy(lsi->protocolversion, EQEMU_PROTOCOL_VERSION);
strcpy(lsi->serverversion, LOGIN_VERSION);
strcpy(lsi->name, Config->LongName.c_str());
strcpy(lsi->shortname, Config->ShortName.c_str());
strn0cpy(lsi->account, LoginAccount.c_str(), 30);
strn0cpy(lsi->password, LoginPassword.c_str(), 30);
if (Config->WorldAddress.length())
if (Config->WorldAddress.length()) {
strcpy(lsi->remote_address, Config->WorldAddress.c_str());
if (Config->LocalAddress.length())
}
if (Config->LocalAddress.length()) {
strcpy(lsi->local_address, Config->LocalAddress.c_str());
}
else {
auto local_addr = IsLegacy ? legacy_client->Handle()->LocalIP() : client->Handle()->LocalIP();
strcpy(lsi->local_address, local_addr.c_str());
@@ -316,22 +537,26 @@ void LoginServer::SendInfo() {
delete pack;
}
void LoginServer::SendStatus() {
void LoginServer::SendStatus()
{
auto pack = new ServerPacket;
pack->opcode = ServerOP_LSStatus;
pack->size = sizeof(ServerLSStatus_Struct);
pack->opcode = ServerOP_LSStatus;
pack->size = sizeof(ServerLSStatus_Struct);
pack->pBuffer = new uchar[pack->size];
memset(pack->pBuffer, 0, pack->size);
ServerLSStatus_Struct* lss = (ServerLSStatus_Struct*)pack->pBuffer;
ServerLSStatus_Struct *lss = (ServerLSStatus_Struct *) pack->pBuffer;
if (WorldConfig::get()->Locked)
if (WorldConfig::get()->Locked) {
lss->status = -2;
else if (numzones <= 0)
}
else if (numzones <= 0) {
lss->status = -2;
else
}
else {
lss->status = numplayers;
}
lss->num_zones = numzones;
lss->num_zones = numzones;
lss->num_players = numplayers;
SendPacket(pack);
delete pack;
@@ -351,10 +576,15 @@ void LoginServer::SendPacket(ServerPacket *pack)
}
}
void LoginServer::SendAccountUpdate(ServerPacket* pack) {
ServerLSAccountUpdate_Struct* s = (ServerLSAccountUpdate_Struct *)pack->pBuffer;
void LoginServer::SendAccountUpdate(ServerPacket *pack)
{
ServerLSAccountUpdate_Struct *s = (ServerLSAccountUpdate_Struct *) pack->pBuffer;
if (CanUpdate()) {
Log(Logs::Detail, Logs::World_Server, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d", LoginServerAddress, LoginServerPort);
Log(Logs::Detail,
Logs::World_Server,
"Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",
LoginServerAddress,
LoginServerPort);
strn0cpy(s->worldaccount, LoginAccount.c_str(), 30);
strn0cpy(s->worldpassword, LoginPassword.c_str(), 30);
SendPacket(pack);