mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-01 11:36:36 +00:00
Merge fix
This commit is contained in:
+107
-144
@@ -158,7 +158,7 @@ void Client::SendEnterWorld(std::string name)
|
||||
eqs->Close();
|
||||
return;
|
||||
} else {
|
||||
Log(Logs::Detail, Logs::World_Server,"Telling client to continue session.");
|
||||
LogInfo("Telling client to continue session");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ void Client::SendCharInfo() {
|
||||
QueuePacket(outapp);
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::World_Server, "[Error] Database did not return an OP_SendCharInfo packet for account %u", GetAccountID());
|
||||
LogInfo("[Error] Database did not return an OP_SendCharInfo packet for account [{}]", GetAccountID());
|
||||
}
|
||||
safe_delete(outapp);
|
||||
}
|
||||
@@ -394,70 +394,40 @@ 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) {
|
||||
// TODO: Find out how to tell the client wrong username/password
|
||||
Log(Logs::Detail, Logs::World_Server,"Login without a password");
|
||||
LogInfo("Login without a password");
|
||||
return false;
|
||||
}
|
||||
|
||||
is_player_zoning=(li->zoning==1);
|
||||
is_player_zoning = (login_info->zoning == 1);
|
||||
|
||||
#ifdef IPBASED_AUTH_HACK
|
||||
struct in_addr tmpip;
|
||||
tmpip.s_addr = ip;
|
||||
#endif
|
||||
uint32 id=0;
|
||||
bool minilogin = loginserverlist.MiniLogin();
|
||||
if(minilogin){
|
||||
struct in_addr miniip;
|
||||
miniip.s_addr = ip;
|
||||
id = database.GetMiniLoginAccount(inet_ntoa(miniip));
|
||||
}
|
||||
else if(strncasecmp(name, "LS#", 3) == 0)
|
||||
id=atoi(&name[3]);
|
||||
else if(database.GetAccountIDByName(name)){
|
||||
int16 status = 0;
|
||||
uint32 lsid = 0;
|
||||
id = database.GetAccountIDByName(name, &status, &lsid);
|
||||
}
|
||||
else
|
||||
id=atoi(name);
|
||||
if (loginserverlist.Connected() == false && !is_player_zoning) {
|
||||
Log(Logs::General, Logs::World_Server,"Error: Login server login while not connected to login server.");
|
||||
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(name, password)) || (cle = client_list.CheckAuth(id, password))))
|
||||
{
|
||||
if (cle->AccountID() == 0 || (!minilogin && cle->LSID()==0)) {
|
||||
Log(Logs::General, Logs::World_Server,"ID is 0. Is this server connected to minilogin?");
|
||||
if (!minilogin) {
|
||||
Log(Logs::General, Logs::World_Server, "If so you forget the minilogin variable...");
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::World_Server, "Could not find a minilogin account, verify ip address logging into minilogin is the same that is in your account table.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(minilogin){
|
||||
cle->SetOnline();
|
||||
WorldConfig::DisableStats();
|
||||
Log(Logs::General, Logs::World_Server, "MiniLogin Account #%d",cle->AccountID());
|
||||
}
|
||||
else if (!is_player_zoning) {
|
||||
LogClientLogin("[HandleSendLoginInfoPacket] Checking Auth id [{}]", id);
|
||||
|
||||
if ((cle = client_list.CheckAuth(id, password))) {
|
||||
LogClientLogin("[HandleSendLoginInfoPacket] Checking Auth id [{}] passed", id);
|
||||
if (!is_player_zoning) {
|
||||
// Track who is in and who is out of the game
|
||||
char *inout= (char *) "";
|
||||
|
||||
@@ -469,24 +439,22 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) {
|
||||
// Game -> Char Select
|
||||
inout=(char *) "Out";
|
||||
}
|
||||
|
||||
|
||||
// Always at Char select at this point.
|
||||
// Either from a fresh client launch or coming back from the game.
|
||||
// Exiting the game entirely does not come through here.
|
||||
// Could use a Logging Out Completely message somewhere.
|
||||
cle->SetOnline(CLE_Status::CharSelect);
|
||||
|
||||
Log(Logs::General, Logs::World_Server,
|
||||
"Account (%s) Logging(%s) to character select :: LSID: %d ",
|
||||
cle->AccountName(), inout, cle->LSID());
|
||||
LogInfo("Account ({}) Logging({}) to character select :: LSID [{}] ", cle->AccountName(), inout, cle->LSID());
|
||||
}
|
||||
else {
|
||||
cle->SetOnline();
|
||||
}
|
||||
|
||||
|
||||
const WorldConfig *Config=WorldConfig::get();
|
||||
|
||||
if(Config->UpdateStats){
|
||||
|
||||
if(Config->UpdateStats) {
|
||||
auto pack = new ServerPacket;
|
||||
pack->opcode = ServerOP_LSPlayerJoinWorld;
|
||||
pack->size = sizeof(ServerLSPlayerJoinWorld_Struct);
|
||||
@@ -498,10 +466,10 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) {
|
||||
loginserverlist.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
|
||||
if (!is_player_zoning)
|
||||
SendGuildList();
|
||||
|
||||
|
||||
SendLogServer();
|
||||
SendApproveWorld();
|
||||
SendEnterWorld(cle->name());
|
||||
@@ -512,24 +480,19 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) {
|
||||
database.LoginIP(cle->AccountID(), long2ip(GetIP()).c_str());
|
||||
}
|
||||
|
||||
cle->SetIP(GetIP());
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// TODO: Find out how to tell the client wrong username/password
|
||||
Log(Logs::Detail, Logs::World_Server,"Bad/Expired session key '%s'",name);
|
||||
LogInfo("Bad/Expired session key [{}]", name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!cle)
|
||||
return true;
|
||||
|
||||
cle->SetIP(GetIP());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app)
|
||||
{
|
||||
if (GetAccountID() == 0) {
|
||||
Log(Logs::Detail, Logs::World_Server,"Name approval request with no logged in account");
|
||||
LogInfo("Name approval request with no logged in account");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -537,7 +500,7 @@ bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app)
|
||||
uchar race = app->pBuffer[64];
|
||||
uchar clas = app->pBuffer[68];
|
||||
|
||||
Log(Logs::Detail, Logs::World_Server, "Name approval request. Name=%s, race=%s, class=%s", char_name, GetRaceIDName(race), GetClassIDName(clas));
|
||||
LogInfo("Name approval request. Name=[{}], race=[{}], class=[{}]", char_name, GetRaceIDName(race), GetClassIDName(clas));
|
||||
|
||||
EQApplicationPacket *outapp;
|
||||
outapp = new EQApplicationPacket;
|
||||
@@ -698,11 +661,11 @@ bool Client::HandleCharacterCreateRequestPacket(const EQApplicationPacket *app)
|
||||
|
||||
bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) {
|
||||
if (GetAccountID() == 0) {
|
||||
Log(Logs::Detail, Logs::World_Server,"Account ID not set; unable to create character.");
|
||||
LogInfo("Account ID not set; unable to create character");
|
||||
return false;
|
||||
}
|
||||
else if (app->size != sizeof(CharCreate_Struct)) {
|
||||
Log(Logs::Detail, Logs::World_Server,"Wrong size on OP_CharacterCreate. Got: %d, Expected: %d",app->size,sizeof(CharCreate_Struct));
|
||||
LogInfo("Wrong size on OP_CharacterCreate. Got: [{}], Expected: [{}]", app->size, sizeof(CharCreate_Struct));
|
||||
DumpPacket(app);
|
||||
// the previous behavior was essentially returning true here
|
||||
// but that seems a bit odd to me.
|
||||
@@ -729,14 +692,14 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) {
|
||||
|
||||
bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
|
||||
if (GetAccountID() == 0) {
|
||||
Log(Logs::Detail, Logs::World_Server,"Enter world with no logged in account");
|
||||
LogInfo("Enter world with no logged in account");
|
||||
eqs->Close();
|
||||
return true;
|
||||
}
|
||||
|
||||
if(GetAdmin() < 0)
|
||||
{
|
||||
Log(Logs::Detail, Logs::World_Server,"Account banned or suspended.");
|
||||
LogInfo("Account banned or suspended");
|
||||
eqs->Close();
|
||||
return true;
|
||||
}
|
||||
@@ -752,14 +715,14 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
|
||||
uint32 tmpaccid = 0;
|
||||
charid = database.GetCharacterInfo(char_name, &tmpaccid, &zone_id, &instance_id);
|
||||
if (charid == 0 || tmpaccid != GetAccountID()) {
|
||||
Log(Logs::Detail, Logs::World_Server,"Could not get CharInfo for '%s'",char_name);
|
||||
LogInfo("Could not get CharInfo for [{}]", char_name);
|
||||
eqs->Close();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make sure this account owns this character
|
||||
if (tmpaccid != GetAccountID()) {
|
||||
Log(Logs::Detail, Logs::World_Server,"This account does not own the character named '%s'",char_name);
|
||||
LogInfo("This account does not own the character named [{}]", char_name);
|
||||
eqs->Close();
|
||||
return true;
|
||||
}
|
||||
@@ -801,7 +764,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
|
||||
zone_id = database.MoveCharacterToBind(charid, 4);
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::World_Server, "'%s' is trying to go home before they're able...", char_name);
|
||||
LogInfo("[{}] is trying to go home before they're able", char_name);
|
||||
database.SetHackerFlag(GetAccountName(), char_name, "MQGoHome: player tried to go home before they were able.");
|
||||
eqs->Close();
|
||||
return true;
|
||||
@@ -825,7 +788,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
|
||||
database.MoveCharacterToZone(charid, database.GetZoneName(zone_id));
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::World_Server, "'%s' is trying to go to tutorial but are not allowed...", char_name);
|
||||
LogInfo("[{}] is trying to go to tutorial but are not allowed", char_name);
|
||||
database.SetHackerFlag(GetAccountName(), char_name, "MQTutorial: player tried to enter the tutorial without having tutorial enabled for this character.");
|
||||
eqs->Close();
|
||||
return true;
|
||||
@@ -836,7 +799,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
|
||||
if (zone_id == 0 || !database.GetZoneName(zone_id)) {
|
||||
// This is to save people in an invalid zone, once it's removed from the DB
|
||||
database.MoveCharacterToZone(charid, "arena");
|
||||
Log(Logs::Detail, Logs::World_Server, "Zone not found in database zone_id=%i, moveing char to arena character:%s", zone_id, char_name);
|
||||
LogInfo("Zone not found in database zone_id=[{}], moveing char to arena character:[{}]", zone_id, char_name);
|
||||
}
|
||||
|
||||
if(instance_id > 0)
|
||||
@@ -981,7 +944,7 @@ bool Client::HandleDeleteCharacterPacket(const EQApplicationPacket *app) {
|
||||
|
||||
uint32 char_acct_id = database.GetAccountIDByChar((char*)app->pBuffer);
|
||||
if(char_acct_id == GetAccountID()) {
|
||||
Log(Logs::Detail, Logs::World_Server,"Delete character: %s",app->pBuffer);
|
||||
LogInfo("Delete character: [{}]", app->pBuffer);
|
||||
database.DeleteCharacter((char *)app->pBuffer);
|
||||
SendCharInfo();
|
||||
}
|
||||
@@ -1002,24 +965,24 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
||||
|
||||
EmuOpcode opcode = app->GetOpcode();
|
||||
|
||||
Log(Logs::Detail, Logs::World_Server,"Recevied EQApplicationPacket");
|
||||
LogNetcode("Received EQApplicationPacket [{:#04x}]", opcode);
|
||||
|
||||
if (!eqs->CheckState(ESTABLISHED)) {
|
||||
Log(Logs::Detail, Logs::World_Server,"Client disconnected (net inactive on send)");
|
||||
LogInfo("Client disconnected (net inactive on send)");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Voidd: Anti-GM Account hack, Checks source ip against valid GM Account IP Addresses
|
||||
if (RuleB(World, GMAccountIPList) && this->GetAdmin() >= (RuleI(World, MinGMAntiHackStatus))) {
|
||||
if(!database.CheckGMIPs(long2ip(this->GetIP()).c_str(), this->GetAccountID())) {
|
||||
Log(Logs::Detail, Logs::World_Server,"GM Account not permited from source address %s and accountid %i", long2ip(this->GetIP()).c_str(), this->GetAccountID());
|
||||
LogInfo("GM Account not permited from source address [{}] and accountid [{}]", long2ip(this->GetIP()).c_str(), this->GetAccountID());
|
||||
eqs->Close();
|
||||
}
|
||||
}
|
||||
|
||||
if (GetAccountID() == 0 && opcode != OP_SendLoginInfo) {
|
||||
// Got a packet other than OP_SendLoginInfo when not logged in
|
||||
Log(Logs::Detail, Logs::World_Server,"Expecting OP_SendLoginInfo, got %s", OpcodeNames[opcode]);
|
||||
LogInfo("Expecting OP_SendLoginInfo, got [{}]", OpcodeNames[opcode]);
|
||||
return false;
|
||||
}
|
||||
else if (opcode == OP_AckPacket) {
|
||||
@@ -1098,7 +1061,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
||||
}
|
||||
default:
|
||||
{
|
||||
Log(Logs::Detail, Logs::World_Server,"Received unknown EQApplicationPacket");
|
||||
LogNetcode("Received unknown EQApplicationPacket");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1116,7 +1079,7 @@ bool Client::Process() {
|
||||
to.sin_addr.s_addr = ip;
|
||||
|
||||
if (autobootup_timeout.Check()) {
|
||||
Log(Logs::General, Logs::World_Server, "Zone bootup timer expired, bootup failed or too slow.");
|
||||
LogInfo("Zone bootup timer expired, bootup failed or too slow");
|
||||
TellClientZoneUnavailable();
|
||||
}
|
||||
|
||||
@@ -1150,7 +1113,7 @@ bool Client::Process() {
|
||||
loginserverlist.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
Log(Logs::Detail, Logs::World_Server,"Client disconnected (not active in process)");
|
||||
LogInfo("Client disconnected (not active in process)");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1206,17 +1169,17 @@ void Client::EnterWorld(bool TryBootup) {
|
||||
}
|
||||
else {
|
||||
if (TryBootup) {
|
||||
Log(Logs::General, Logs::World_Server, "Attempting autobootup of %s (%d:%d)", 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) {
|
||||
Log(Logs::General, Logs::World_Server, "No zoneserver available to boot up.");
|
||||
LogInfo("No zoneserver available to boot up");
|
||||
TellClientZoneUnavailable();
|
||||
}
|
||||
return;
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::World_Server, "Requested zone %s is not running.", zone_name);
|
||||
LogInfo("Requested zone [{}] is not running", zone_name);
|
||||
TellClientZoneUnavailable();
|
||||
return;
|
||||
}
|
||||
@@ -1225,7 +1188,7 @@ void Client::EnterWorld(bool TryBootup) {
|
||||
zone_waiting_for_bootup = 0;
|
||||
|
||||
if (GetAdmin() < 80 && zoneserver_list.IsZoneLocked(zone_id)) {
|
||||
Log(Logs::General, Logs::World_Server, "Enter world failed. Zone is locked.");
|
||||
LogInfo("Enter world failed. Zone is locked");
|
||||
TellClientZoneUnavailable();
|
||||
return;
|
||||
}
|
||||
@@ -1238,8 +1201,8 @@ void Client::EnterWorld(bool TryBootup) {
|
||||
cle->SetChar(charid, char_name);
|
||||
database.UpdateLiveChar(char_name, GetAccountID());
|
||||
|
||||
Log(Logs::General, Logs::World_Server,
|
||||
"(%s) %s %s (Zone ID %d: Instance ID: %d) ",
|
||||
LogInfo(
|
||||
"({}) [{}] [{}] (Zone ID [{}]: Instance ID: [{}]) ",
|
||||
char_name,
|
||||
(seen_character_select ? "Zoning from character select" : "Zoning to"),
|
||||
zone_name,
|
||||
@@ -1281,9 +1244,9 @@ void Client::Clearance(int8 response)
|
||||
{
|
||||
if (zs == 0)
|
||||
{
|
||||
Log(Logs::Detail, Logs::World_Server,"Unable to find zoneserver in Client::Clearance!!");
|
||||
LogInfo("Unable to find zoneserver in Client::Clearance!!");
|
||||
} else {
|
||||
Log(Logs::Detail, Logs::World_Server, "Invalid response %d in Client::Clearance", response);
|
||||
LogInfo("Invalid response [{}] in Client::Clearance", response);
|
||||
}
|
||||
|
||||
TellClientZoneUnavailable();
|
||||
@@ -1293,20 +1256,20 @@ void Client::Clearance(int8 response)
|
||||
EQApplicationPacket* outapp;
|
||||
|
||||
if (zs->GetCAddress() == nullptr) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Unable to do zs->GetCAddress() in Client::Clearance!!");
|
||||
LogInfo("Unable to do zs->GetCAddress() in Client::Clearance!!");
|
||||
TellClientZoneUnavailable();
|
||||
return;
|
||||
}
|
||||
|
||||
if (zone_id == 0) {
|
||||
Log(Logs::Detail, Logs::World_Server, "zoneID is nullptr in Client::Clearance!!");
|
||||
LogInfo("zoneID is nullptr in Client::Clearance!!");
|
||||
TellClientZoneUnavailable();
|
||||
return;
|
||||
}
|
||||
|
||||
const char* zonename = database.GetZoneName(zone_id);
|
||||
if (zonename == 0) {
|
||||
Log(Logs::Detail, Logs::World_Server, "zonename is nullptr in Client::Clearance!!");
|
||||
LogInfo("zonename is nullptr in Client::Clearance!!");
|
||||
TellClientZoneUnavailable();
|
||||
return;
|
||||
}
|
||||
@@ -1330,10 +1293,10 @@ void Client::Clearance(int8 response)
|
||||
|
||||
if(strcmp(zs_addr, "127.0.0.1") == 0)
|
||||
{
|
||||
Log(Logs::Detail, Logs::World_Server, "Local zone address was %s, setting local address to: %s", zs_addr, WorldConfig::get()->LocalAddress.c_str());
|
||||
LogInfo("Local zone address was [{}], setting local address to: [{}]", zs_addr, WorldConfig::get()->LocalAddress.c_str());
|
||||
zs_addr = WorldConfig::get()->LocalAddress.c_str();
|
||||
} else {
|
||||
Log(Logs::Detail, Logs::World_Server, "Local zone address %s", zs_addr);
|
||||
LogInfo("Local zone address [{}]", zs_addr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1348,7 +1311,7 @@ void Client::Clearance(int8 response)
|
||||
|
||||
strcpy(zsi->ip, zs_addr);
|
||||
zsi->port =zs->GetCPort();
|
||||
Log(Logs::Detail, Logs::World_Server,"Sending client to zone %s (%d:%d) at %s:%d",zonename,zone_id,instance_id,zsi->ip,zsi->port);
|
||||
LogInfo("Sending client to zone [{}] ([{}]:[{}]) at [{}]:[{}]", zonename, zone_id, instance_id, zsi->ip, zsi->port);
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
|
||||
@@ -1380,7 +1343,7 @@ bool Client::GenPassKey(char* key) {
|
||||
}
|
||||
|
||||
void Client::QueuePacket(const EQApplicationPacket* app, bool ack_req) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Sending EQApplicationPacket OpCode 0x%04x",app->GetOpcode());
|
||||
LogNetcode("Sending EQApplicationPacket OpCode {:#04x}", app->GetOpcode());
|
||||
|
||||
ack_req = true; // It's broke right now, dont delete this line till fix it. =P
|
||||
eqs->QueuePacket(app, ack_req);
|
||||
@@ -1468,27 +1431,27 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
|
||||
in.s_addr = GetIP();
|
||||
|
||||
Log(Logs::Detail, Logs::World_Server, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort());
|
||||
Log(Logs::Detail, Logs::World_Server, "Name: %s", name);
|
||||
Log(Logs::Detail, Logs::World_Server, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s",
|
||||
LogInfo("Character creation request from [{}] LS#[{}] ([{}]:[{}]) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort());
|
||||
LogInfo("Name: [{}]", name);
|
||||
Log(Logs::Detail, Logs::WorldServer, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s",
|
||||
cc->race, cc->class_, cc->gender, cc->deity, cc->start_zone, cc->tutorial ? "true" : "false");
|
||||
Log(Logs::Detail, Logs::World_Server, "STR STA AGI DEX WIS INT CHA Total");
|
||||
Log(Logs::Detail, Logs::World_Server, "%3d %3d %3d %3d %3d %3d %3d %3d",
|
||||
LogInfo("STR STA AGI DEX WIS INT CHA Total");
|
||||
Log(Logs::Detail, Logs::WorldServer, "%3d %3d %3d %3d %3d %3d %3d %3d",
|
||||
cc->STR, cc->STA, cc->AGI, cc->DEX, cc->WIS, cc->INT, cc->CHA,
|
||||
stats_sum);
|
||||
Log(Logs::Detail, Logs::World_Server, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2);
|
||||
Log(Logs::Detail, Logs::World_Server, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor);
|
||||
Log(Logs::Detail, Logs::World_Server, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor);
|
||||
LogInfo("Face: [{}] Eye colors: [{}] [{}]", cc->face, cc->eyecolor1, cc->eyecolor2);
|
||||
LogInfo("Hairstyle: [{}] Haircolor: [{}]", cc->hairstyle, cc->haircolor);
|
||||
LogInfo("Beard: [{}] Beardcolor: [{}]", cc->beard, cc->beardcolor);
|
||||
|
||||
/* Validate the char creation struct */
|
||||
if (m_ClientVersionBit & EQEmu::versions::maskSoFAndLater) {
|
||||
if (!CheckCharCreateInfoSoF(cc)) {
|
||||
Log(Logs::Detail, Logs::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)");
|
||||
LogInfo("CheckCharCreateInfo did not validate the request (bad race/class/stats)");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!CheckCharCreateInfoTitanium(cc)) {
|
||||
Log(Logs::Detail, Logs::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)");
|
||||
LogInfo("CheckCharCreateInfo did not validate the request (bad race/class/stats)");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1550,14 +1513,14 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
|
||||
/* If it is an SoF Client and the SoF Start Zone rule is set, send new chars there */
|
||||
if (m_ClientVersionBit & EQEmu::versions::maskSoFAndLater) {
|
||||
Log(Logs::Detail, Logs::World_Server,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID));
|
||||
LogInfo("Found 'SoFStartZoneID' rule setting: [{}]", RuleI(World, SoFStartZoneID));
|
||||
if (RuleI(World, SoFStartZoneID) > 0) {
|
||||
pp.zone_id = RuleI(World, SoFStartZoneID);
|
||||
cc->start_zone = pp.zone_id;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::World_Server, "Found 'TitaniumStartZoneID' rule setting: %i", RuleI(World, TitaniumStartZoneID));
|
||||
LogInfo("Found 'TitaniumStartZoneID' rule setting: [{}]", RuleI(World, TitaniumStartZoneID));
|
||||
if (RuleI(World, TitaniumStartZoneID) > 0) { /* if there's a startzone variable put them in there */
|
||||
|
||||
pp.zone_id = RuleI(World, TitaniumStartZoneID);
|
||||
@@ -1617,12 +1580,12 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
pp.binds[0].heading = pp.heading;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::World_Server,"Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f",
|
||||
Log(Logs::Detail, Logs::WorldServer, "Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f",
|
||||
database.GetZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading);
|
||||
Log(Logs::Detail, Logs::World_Server,"Bind location: %s (%d) %0.2f, %0.2f, %0.2f",
|
||||
database.GetZoneName(pp.binds[0].zoneId), pp.binds[0].zoneId, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z);
|
||||
Log(Logs::Detail, Logs::World_Server,"Home location: %s (%d) %0.2f, %0.2f, %0.2f",
|
||||
database.GetZoneName(pp.binds[4].zoneId), pp.binds[4].zoneId, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z);
|
||||
Log(Logs::Detail, Logs::WorldServer, "Bind location: %s (%d) %0.2f, %0.2f, %0.2f",
|
||||
database.GetZoneName(pp.binds[0].zoneId), pp.binds[0].zoneId, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z);
|
||||
Log(Logs::Detail, Logs::WorldServer, "Home location: %s (%d) %0.2f, %0.2f, %0.2f",
|
||||
database.GetZoneName(pp.binds[4].zoneId), pp.binds[4].zoneId, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z);
|
||||
|
||||
/* Starting Items inventory */
|
||||
database.SetStartingItems(&pp, &inv, pp.race, pp.class_, pp.deity, pp.zone_id, pp.name, GetAdmin());
|
||||
@@ -1630,10 +1593,10 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
// now we give the pp and the inv we made to StoreCharacter
|
||||
// to see if we can store it
|
||||
if (!database.StoreCharacter(GetAccountID(), &pp, &inv)) {
|
||||
Log(Logs::Detail, Logs::World_Server,"Character creation failed: %s", pp.name);
|
||||
LogInfo("Character creation failed: [{}]", pp.name);
|
||||
return false;
|
||||
}
|
||||
Log(Logs::Detail, Logs::World_Server,"Character creation successful: %s", pp.name);
|
||||
LogInfo("Character creation successful: [{}]", pp.name);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1643,7 +1606,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
|
||||
if (!cc)
|
||||
return false;
|
||||
|
||||
Log(Logs::Detail, Logs::World_Server, "Validating char creation info...");
|
||||
LogInfo("Validating char creation info");
|
||||
|
||||
RaceClassCombos class_combo;
|
||||
bool found = false;
|
||||
@@ -1660,7 +1623,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Could not find class/race/deity/start_zone combination");
|
||||
LogInfo("Could not find class/race/deity/start_zone combination");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1677,7 +1640,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Could not find starting stats for selected character combo, cannot verify stats");
|
||||
LogInfo("Could not find starting stats for selected character combo, cannot verify stats");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1690,37 +1653,37 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
|
||||
allocation.DefaultPointAllocation[6];
|
||||
|
||||
if (cc->STR > allocation.BaseStats[0] + max_stats || cc->STR < allocation.BaseStats[0]) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Strength out of range");
|
||||
LogInfo("Strength out of range");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cc->DEX > allocation.BaseStats[1] + max_stats || cc->DEX < allocation.BaseStats[1]) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Dexterity out of range");
|
||||
LogInfo("Dexterity out of range");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cc->AGI > allocation.BaseStats[2] + max_stats || cc->AGI < allocation.BaseStats[2]) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Agility out of range");
|
||||
LogInfo("Agility out of range");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cc->STA > allocation.BaseStats[3] + max_stats || cc->STA < allocation.BaseStats[3]) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Stamina out of range");
|
||||
LogInfo("Stamina out of range");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cc->INT > allocation.BaseStats[4] + max_stats || cc->INT < allocation.BaseStats[4]) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Intelligence out of range");
|
||||
LogInfo("Intelligence out of range");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cc->WIS > allocation.BaseStats[5] + max_stats || cc->WIS < allocation.BaseStats[5]) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Wisdom out of range");
|
||||
LogInfo("Wisdom out of range");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cc->CHA > allocation.BaseStats[6] + max_stats || cc->CHA < allocation.BaseStats[6]) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Charisma out of range");
|
||||
LogInfo("Charisma out of range");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1733,7 +1696,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
|
||||
current_stats += cc->WIS - allocation.BaseStats[5];
|
||||
current_stats += cc->CHA - allocation.BaseStats[6];
|
||||
if (current_stats > max_stats) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Current Stats > Maximum Stats");
|
||||
LogInfo("Current Stats > Maximum Stats");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1814,7 +1777,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
|
||||
if (!cc)
|
||||
return false;
|
||||
|
||||
Log(Logs::Detail, Logs::World_Server,"Validating char creation info...");
|
||||
LogInfo("Validating char creation info");
|
||||
|
||||
classtemp = cc->class_ - 1;
|
||||
racetemp = cc->race - 1;
|
||||
@@ -1827,16 +1790,16 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
|
||||
// if out of range looking it up in the table would crash stuff
|
||||
// so we return from these
|
||||
if (classtemp >= PLAYER_CLASS_COUNT) {
|
||||
Log(Logs::Detail, Logs::World_Server," class is out of range");
|
||||
LogInfo(" class is out of range");
|
||||
return false;
|
||||
}
|
||||
if (racetemp >= _TABLE_RACES) {
|
||||
Log(Logs::Detail, Logs::World_Server," race is out of range");
|
||||
LogInfo(" race is out of range");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ClassRaceLookupTable[classtemp][racetemp]) { //Lookup table better than a bunch of ifs?
|
||||
Log(Logs::Detail, Logs::World_Server," invalid race/class combination");
|
||||
LogInfo(" invalid race/class combination");
|
||||
// we return from this one, since if it's an invalid combination our table
|
||||
// doesn't have meaningful values for the stats
|
||||
return false;
|
||||
@@ -1864,43 +1827,43 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
|
||||
// that are messed up not just the first hit
|
||||
|
||||
if (bTOTAL + stat_points != cTOTAL) {
|
||||
Log(Logs::Detail, Logs::World_Server," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL);
|
||||
LogInfo(" stat points total doesn't match expected value: expecting [{}] got [{}]", bTOTAL + stat_points, cTOTAL);
|
||||
Charerrors++;
|
||||
}
|
||||
|
||||
if (cc->STR > bSTR + stat_points || cc->STR < bSTR) {
|
||||
Log(Logs::Detail, Logs::World_Server," stat STR is out of range");
|
||||
LogInfo(" stat STR is out of range");
|
||||
Charerrors++;
|
||||
}
|
||||
if (cc->STA > bSTA + stat_points || cc->STA < bSTA) {
|
||||
Log(Logs::Detail, Logs::World_Server," stat STA is out of range");
|
||||
LogInfo(" stat STA is out of range");
|
||||
Charerrors++;
|
||||
}
|
||||
if (cc->AGI > bAGI + stat_points || cc->AGI < bAGI) {
|
||||
Log(Logs::Detail, Logs::World_Server," stat AGI is out of range");
|
||||
LogInfo(" stat AGI is out of range");
|
||||
Charerrors++;
|
||||
}
|
||||
if (cc->DEX > bDEX + stat_points || cc->DEX < bDEX) {
|
||||
Log(Logs::Detail, Logs::World_Server," stat DEX is out of range");
|
||||
LogInfo(" stat DEX is out of range");
|
||||
Charerrors++;
|
||||
}
|
||||
if (cc->WIS > bWIS + stat_points || cc->WIS < bWIS) {
|
||||
Log(Logs::Detail, Logs::World_Server," stat WIS is out of range");
|
||||
LogInfo(" stat WIS is out of range");
|
||||
Charerrors++;
|
||||
}
|
||||
if (cc->INT > bINT + stat_points || cc->INT < bINT) {
|
||||
Log(Logs::Detail, Logs::World_Server," stat INT is out of range");
|
||||
LogInfo(" stat INT is out of range");
|
||||
Charerrors++;
|
||||
}
|
||||
if (cc->CHA > bCHA + stat_points || cc->CHA < bCHA) {
|
||||
Log(Logs::Detail, Logs::World_Server," stat CHA is out of range");
|
||||
LogInfo(" stat CHA is out of range");
|
||||
Charerrors++;
|
||||
}
|
||||
|
||||
/*TODO: Check for deity/class/race.. it'd be nice, but probably of any real use to hack(faction, deity based items are all I can think of)
|
||||
I am NOT writing those tables - kathgar*/
|
||||
|
||||
Log(Logs::Detail, Logs::World_Server,"Found %d errors in character creation request", Charerrors);
|
||||
LogInfo("Found [{}] errors in character creation request", Charerrors);
|
||||
|
||||
return Charerrors == 0;
|
||||
}
|
||||
|
||||
+201
-142
@@ -26,61 +26,71 @@
|
||||
#include "../common/guilds.h"
|
||||
#include "../common/string_util.h"
|
||||
|
||||
extern uint32 numplayers;
|
||||
extern uint32 numplayers;
|
||||
extern LoginServerList loginserverlist;
|
||||
extern ClientList client_list;
|
||||
extern volatile bool RunLoops;
|
||||
extern ClientList client_list;
|
||||
extern volatile bool RunLoops;
|
||||
|
||||
ClientListEntry::ClientListEntry(uint32 in_id, uint32 iLSID, const char* iLoginName, const char* iLoginKey, int16 iWorldAdmin, uint32 ip, uint8 local)
|
||||
: id(in_id)
|
||||
/**
|
||||
* @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,
|
||||
uint8 local
|
||||
)
|
||||
: id(in_id)
|
||||
{
|
||||
ClearVars(true);
|
||||
|
||||
pIP = ip;
|
||||
pLSID = iLSID;
|
||||
if(iLSID > 0)
|
||||
paccountid = database.GetAccountIDFromLSID(iLSID, paccountname, &padmin);
|
||||
strn0cpy(plsname, iLoginName, sizeof(plsname));
|
||||
strn0cpy(plskey, iLoginKey, sizeof(plskey));
|
||||
pworldadmin = iWorldAdmin;
|
||||
plocal=(local==1);
|
||||
LogDebug(
|
||||
"ClientListEntry 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,
|
||||
local
|
||||
);
|
||||
|
||||
pIP = ip;
|
||||
pLSID = in_loginserver_id;
|
||||
if (in_loginserver_id > 0) {
|
||||
paccountid = database.GetAccountIDFromLSID(in_loginserver_name, in_loginserver_id, paccountname, &padmin);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
pinstance = 0;
|
||||
pLFGFromLevel = 0;
|
||||
pLFGToLevel = 0;
|
||||
pLFGMatchFilter = false;
|
||||
memset(pLFGComments, 0, 64);
|
||||
}
|
||||
|
||||
ClientListEntry::ClientListEntry(uint32 in_id, uint32 iAccID, const char* iAccName, MD5& iMD5Pass, int16 iAdmin)
|
||||
: id(in_id)
|
||||
ClientListEntry::ClientListEntry(uint32 in_id, ZoneServer *iZS, ServerClientList_Struct *scl, CLE_Status iOnline)
|
||||
: id(in_id)
|
||||
{
|
||||
ClearVars(true);
|
||||
|
||||
pIP = 0;
|
||||
pLSID = 0;
|
||||
pworldadmin = 0;
|
||||
|
||||
paccountid = iAccID;
|
||||
strn0cpy(paccountname, iAccName, sizeof(paccountname));
|
||||
pMD5Pass = iMD5Pass;
|
||||
padmin = iAdmin;
|
||||
|
||||
pinstance = 0;
|
||||
pLFGFromLevel = 0;
|
||||
pLFGToLevel = 0;
|
||||
pLFGMatchFilter = false;
|
||||
memset(pLFGComments, 0, 64);
|
||||
}
|
||||
|
||||
ClientListEntry::ClientListEntry(uint32 in_id, ZoneServer* iZS, ServerClientList_Struct* scl, CLE_Status iOnline)
|
||||
: id(in_id)
|
||||
{
|
||||
ClearVars(true);
|
||||
|
||||
pIP = 0;
|
||||
pIP = 0;
|
||||
pLSID = scl->LSAccountID;
|
||||
strn0cpy(plsname, scl->name, sizeof(plsname));
|
||||
strn0cpy(loginserver_account_name, scl->name, sizeof(loginserver_account_name));
|
||||
strn0cpy(plskey, scl->lskey, sizeof(plskey));
|
||||
pworldadmin = 0;
|
||||
|
||||
@@ -88,19 +98,22 @@ ClientListEntry::ClientListEntry(uint32 in_id, ZoneServer* iZS, ServerClientList
|
||||
strn0cpy(paccountname, scl->AccountName, sizeof(paccountname));
|
||||
padmin = scl->Admin;
|
||||
|
||||
pinstance = 0;
|
||||
pLFGFromLevel = 0;
|
||||
pLFGToLevel = 0;
|
||||
pinstance = 0;
|
||||
pLFGFromLevel = 0;
|
||||
pLFGToLevel = 0;
|
||||
pLFGMatchFilter = false;
|
||||
memset(pLFGComments, 0, 64);
|
||||
|
||||
if (iOnline >= CLE_Status::Zoning)
|
||||
if (iOnline >= CLE_Status::Zoning) {
|
||||
Update(iZS, scl, iOnline);
|
||||
else
|
||||
}
|
||||
else {
|
||||
SetOnline(iOnline);
|
||||
}
|
||||
}
|
||||
|
||||
ClientListEntry::~ClientListEntry() {
|
||||
ClientListEntry::~ClientListEntry()
|
||||
{
|
||||
if (RunLoops) {
|
||||
Camp(); // updates zoneserver's numplayers
|
||||
client_list.RemoveCLEReferances(this);
|
||||
@@ -110,99 +123,118 @@ ClientListEntry::~ClientListEntry() {
|
||||
tell_queue.clear();
|
||||
}
|
||||
|
||||
void ClientListEntry::SetChar(uint32 iCharID, const char* iCharName) {
|
||||
void ClientListEntry::SetChar(uint32 iCharID, const char *iCharName)
|
||||
{
|
||||
pcharid = iCharID;
|
||||
strn0cpy(pname, iCharName, sizeof(pname));
|
||||
}
|
||||
|
||||
void ClientListEntry::SetOnline(ZoneServer* iZS, CLE_Status iOnline) {
|
||||
if (iZS == this->Server())
|
||||
void ClientListEntry::SetOnline(ZoneServer *iZS, CLE_Status iOnline)
|
||||
{
|
||||
if (iZS == this->Server()) {
|
||||
SetOnline(iOnline);
|
||||
}
|
||||
}
|
||||
|
||||
void ClientListEntry::SetOnline(CLE_Status iOnline) {
|
||||
Log(Logs::General, Logs::World_Server, "ClientListEntry::SetOnline for %s(%i) = %i", AccountName(), AccountID(), iOnline);
|
||||
void ClientListEntry::SetOnline(CLE_Status iOnline)
|
||||
{
|
||||
LogClientLogin(
|
||||
"ClientListEntry::SetOnline for [{}] ({}) = [{}] ({})",
|
||||
AccountName(),
|
||||
AccountID(),
|
||||
CLEStatusString[CLE_Status::Online],
|
||||
iOnline
|
||||
);
|
||||
|
||||
if (iOnline >= CLE_Status::Online && pOnline < CLE_Status::Online)
|
||||
if (iOnline >= CLE_Status::Online && pOnline < CLE_Status::Online) {
|
||||
numplayers++;
|
||||
}
|
||||
else if (iOnline < CLE_Status::Online && pOnline >= CLE_Status::Online) {
|
||||
numplayers--;
|
||||
}
|
||||
if (iOnline != CLE_Status::Online || pOnline < CLE_Status::Online)
|
||||
if (iOnline != CLE_Status::Online || pOnline < CLE_Status::Online) {
|
||||
pOnline = iOnline;
|
||||
if (iOnline < CLE_Status::Zoning)
|
||||
}
|
||||
if (iOnline < CLE_Status::Zoning) {
|
||||
Camp();
|
||||
if (pOnline >= CLE_Status::Online)
|
||||
}
|
||||
if (pOnline >= CLE_Status::Online) {
|
||||
stale = 0;
|
||||
}
|
||||
}
|
||||
void ClientListEntry::LSUpdate(ZoneServer* iZS){
|
||||
if(WorldConfig::get()->UpdateStats){
|
||||
|
||||
void ClientListEntry::LSUpdate(ZoneServer *iZS)
|
||||
{
|
||||
if (WorldConfig::get()->UpdateStats) {
|
||||
auto pack = new ServerPacket;
|
||||
pack->opcode = ServerOP_LSZoneInfo;
|
||||
pack->size = sizeof(ZoneInfo_Struct);
|
||||
pack->opcode = ServerOP_LSZoneInfo;
|
||||
pack->size = sizeof(ZoneInfo_Struct);
|
||||
pack->pBuffer = new uchar[pack->size];
|
||||
ZoneInfo_Struct* zone =(ZoneInfo_Struct*)pack->pBuffer;
|
||||
zone->count=iZS->NumPlayers();
|
||||
zone->zone = iZS->GetZoneID();
|
||||
ZoneInfo_Struct *zone = (ZoneInfo_Struct *) pack->pBuffer;
|
||||
zone->count = iZS->NumPlayers();
|
||||
zone->zone = iZS->GetZoneID();
|
||||
zone->zone_wid = iZS->GetID();
|
||||
loginserverlist.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
}
|
||||
void ClientListEntry::LSZoneChange(ZoneToZone_Struct* ztz){
|
||||
if(WorldConfig::get()->UpdateStats){
|
||||
void ClientListEntry::LSZoneChange(ZoneToZone_Struct *ztz)
|
||||
{
|
||||
if (WorldConfig::get()->UpdateStats) {
|
||||
auto pack = new ServerPacket;
|
||||
pack->opcode = ServerOP_LSPlayerZoneChange;
|
||||
pack->size = sizeof(ServerLSPlayerZoneChange_Struct);
|
||||
pack->opcode = ServerOP_LSPlayerZoneChange;
|
||||
pack->size = sizeof(ServerLSPlayerZoneChange_Struct);
|
||||
pack->pBuffer = new uchar[pack->size];
|
||||
ServerLSPlayerZoneChange_Struct* zonechange =(ServerLSPlayerZoneChange_Struct*)pack->pBuffer;
|
||||
ServerLSPlayerZoneChange_Struct *zonechange = (ServerLSPlayerZoneChange_Struct *) pack->pBuffer;
|
||||
zonechange->lsaccount_id = LSID();
|
||||
zonechange->from = ztz->current_zone_id;
|
||||
zonechange->to = ztz->requested_zone_id;
|
||||
zonechange->from = ztz->current_zone_id;
|
||||
zonechange->to = ztz->requested_zone_id;
|
||||
loginserverlist.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
}
|
||||
void ClientListEntry::Update(ZoneServer* iZS, ServerClientList_Struct* scl, CLE_Status iOnline) {
|
||||
|
||||
void ClientListEntry::Update(ZoneServer *iZS, ServerClientList_Struct *scl, CLE_Status iOnline)
|
||||
{
|
||||
if (pzoneserver != iZS) {
|
||||
if (pzoneserver){
|
||||
if (pzoneserver) {
|
||||
pzoneserver->RemovePlayer();
|
||||
LSUpdate(pzoneserver);
|
||||
}
|
||||
if (iZS){
|
||||
if (iZS) {
|
||||
iZS->AddPlayer();
|
||||
LSUpdate(iZS);
|
||||
}
|
||||
}
|
||||
pzoneserver = iZS;
|
||||
pzone = scl->zone;
|
||||
pinstance = scl->instance_id;
|
||||
pcharid = scl->charid;
|
||||
pzoneserver = iZS;
|
||||
pzone = scl->zone;
|
||||
pinstance = scl->instance_id;
|
||||
pcharid = scl->charid;
|
||||
|
||||
strcpy(pname, scl->name);
|
||||
if (paccountid == 0) {
|
||||
paccountid = scl->AccountID;
|
||||
strcpy(paccountname, scl->AccountName);
|
||||
strcpy(plsname, scl->AccountName);
|
||||
pIP = scl->IP;
|
||||
strcpy(loginserver_account_name, scl->AccountName);
|
||||
pIP = scl->IP;
|
||||
pLSID = scl->LSAccountID;
|
||||
strn0cpy(plskey, scl->lskey, sizeof(plskey));
|
||||
}
|
||||
padmin = scl->Admin;
|
||||
plevel = scl->level;
|
||||
pclass_ = scl->class_;
|
||||
prace = scl->race;
|
||||
panon = scl->anon;
|
||||
ptellsoff = scl->tellsoff;
|
||||
pguild_id = scl->guild_id;
|
||||
pLFG = scl->LFG;
|
||||
gm = scl->gm;
|
||||
padmin = scl->Admin;
|
||||
plevel = scl->level;
|
||||
pclass_ = scl->class_;
|
||||
prace = scl->race;
|
||||
panon = scl->anon;
|
||||
ptellsoff = scl->tellsoff;
|
||||
pguild_id = scl->guild_id;
|
||||
pLFG = scl->LFG;
|
||||
gm = scl->gm;
|
||||
pClientVersion = scl->ClientVersion;
|
||||
|
||||
// Fields from the LFG Window
|
||||
if((scl->LFGFromLevel != 0) && (scl->LFGToLevel != 0)) {
|
||||
pLFGFromLevel = scl->LFGFromLevel;
|
||||
pLFGToLevel = scl->LFGToLevel;
|
||||
if ((scl->LFGFromLevel != 0) && (scl->LFGToLevel != 0)) {
|
||||
pLFGFromLevel = scl->LFGFromLevel;
|
||||
pLFGToLevel = scl->LFGToLevel;
|
||||
pLFGMatchFilter = scl->LFGMatchFilter;
|
||||
memcpy(pLFGComments, scl->LFGComments, sizeof(pLFGComments));
|
||||
}
|
||||
@@ -210,26 +242,29 @@ void ClientListEntry::Update(ZoneServer* iZS, ServerClientList_Struct* scl, CLE_
|
||||
SetOnline(iOnline);
|
||||
}
|
||||
|
||||
void ClientListEntry::LeavingZone(ZoneServer* iZS, CLE_Status iOnline) {
|
||||
if (iZS != 0 && iZS != pzoneserver)
|
||||
void ClientListEntry::LeavingZone(ZoneServer *iZS, CLE_Status iOnline)
|
||||
{
|
||||
if (iZS != 0 && iZS != pzoneserver) {
|
||||
return;
|
||||
}
|
||||
SetOnline(iOnline);
|
||||
|
||||
if (pzoneserver){
|
||||
if (pzoneserver) {
|
||||
pzoneserver->RemovePlayer();
|
||||
LSUpdate(pzoneserver);
|
||||
}
|
||||
pzoneserver = 0;
|
||||
pzone = 0;
|
||||
pzone = 0;
|
||||
}
|
||||
|
||||
void ClientListEntry::ClearVars(bool iAll) {
|
||||
void ClientListEntry::ClearVars(bool iAll)
|
||||
{
|
||||
if (iAll) {
|
||||
pOnline = CLE_Status::Never;
|
||||
stale = 0;
|
||||
stale = 0;
|
||||
|
||||
pLSID = 0;
|
||||
memset(plsname, 0, sizeof(plsname));
|
||||
memset(loginserver_account_name, 0, sizeof(loginserver_account_name));
|
||||
memset(plskey, 0, sizeof(plskey));
|
||||
pworldadmin = 0;
|
||||
|
||||
@@ -238,27 +273,29 @@ void ClientListEntry::ClearVars(bool iAll) {
|
||||
padmin = 0;
|
||||
}
|
||||
pzoneserver = 0;
|
||||
pzone = 0;
|
||||
pcharid = 0;
|
||||
pzone = 0;
|
||||
pcharid = 0;
|
||||
memset(pname, 0, sizeof(pname));
|
||||
plevel = 0;
|
||||
pclass_ = 0;
|
||||
prace = 0;
|
||||
panon = 0;
|
||||
ptellsoff = 0;
|
||||
pguild_id = GUILD_NONE;
|
||||
pLFG = 0;
|
||||
gm = 0;
|
||||
plevel = 0;
|
||||
pclass_ = 0;
|
||||
prace = 0;
|
||||
panon = 0;
|
||||
ptellsoff = 0;
|
||||
pguild_id = GUILD_NONE;
|
||||
pLFG = 0;
|
||||
gm = 0;
|
||||
pClientVersion = 0;
|
||||
for (auto &elem : tell_queue)
|
||||
safe_delete_array(elem);
|
||||
tell_queue.clear();
|
||||
}
|
||||
|
||||
void ClientListEntry::Camp(ZoneServer* iZS) {
|
||||
if (iZS != 0 && iZS != pzoneserver)
|
||||
void ClientListEntry::Camp(ZoneServer *iZS)
|
||||
{
|
||||
if (iZS != 0 && iZS != pzoneserver) {
|
||||
return;
|
||||
if (pzoneserver){
|
||||
}
|
||||
if (pzoneserver) {
|
||||
pzoneserver->RemovePlayer();
|
||||
LSUpdate(pzoneserver);
|
||||
}
|
||||
@@ -268,48 +305,66 @@ void ClientListEntry::Camp(ZoneServer* iZS) {
|
||||
stale = 0;
|
||||
}
|
||||
|
||||
bool ClientListEntry::CheckStale() {
|
||||
bool ClientListEntry::CheckStale()
|
||||
{
|
||||
stale++;
|
||||
if (stale > 20) {
|
||||
if (pOnline > CLE_Status::Offline)
|
||||
if (pOnline > CLE_Status::Offline) {
|
||||
SetOnline(CLE_Status::Offline);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ClientListEntry::CheckAuth(uint32 iLSID, const char* iKey) {
|
||||
if (strncmp(plskey, iKey,10) == 0) {
|
||||
if (paccountid == 0 && LSID()>0) {
|
||||
int16 tmpStatus = WorldConfig::get()->DefaultStatus;
|
||||
paccountid = database.CreateAccount(plsname, 0, tmpStatus, LSID());
|
||||
bool ClientListEntry::CheckAuth(uint32 loginserver_account_id, const char *key_password)
|
||||
{
|
||||
LogDebug(
|
||||
"ClientListEntry::CheckAuth ls_account_id [{0}] key_password [{1}] plskey [{2}]",
|
||||
loginserver_account_id,
|
||||
key_password,
|
||||
plskey
|
||||
);
|
||||
if (pLSID == loginserver_account_id && strncmp(plskey, key_password, 10) == 0) {
|
||||
|
||||
LogDebug(
|
||||
"ClientListEntry::CheckAuth ls_account_id [{0}] key_password [{1}] plskey [{2}] lsid [{3}] paccountid [{4}]",
|
||||
loginserver_account_id,
|
||||
key_password,
|
||||
plskey,
|
||||
LSID(),
|
||||
paccountid
|
||||
);
|
||||
|
||||
if (paccountid == 0 && LSID() > 0) {
|
||||
int16 default_account_status = WorldConfig::get()->DefaultStatus;
|
||||
|
||||
paccountid = database.CreateAccount(
|
||||
loginserver_account_name,
|
||||
0,
|
||||
default_account_status,
|
||||
source_loginserver,
|
||||
LSID()
|
||||
);
|
||||
|
||||
if (!paccountid) {
|
||||
Log(Logs::Detail, Logs::World_Server,"Error adding local account for LS login: '%s', duplicate name?" ,plsname);
|
||||
LogInfo(
|
||||
"Error adding local account for LS login: [{0}:{1}], duplicate name",
|
||||
source_loginserver,
|
||||
loginserver_account_name
|
||||
);
|
||||
return false;
|
||||
}
|
||||
strn0cpy(paccountname, plsname, sizeof(paccountname));
|
||||
padmin = tmpStatus;
|
||||
strn0cpy(paccountname, loginserver_account_name, sizeof(paccountname));
|
||||
padmin = default_account_status;
|
||||
}
|
||||
std::string lsworldadmin;
|
||||
if (database.GetVariable("honorlsworldadmin", lsworldadmin))
|
||||
if (atoi(lsworldadmin.c_str()) == 1 && pworldadmin != 0 && (padmin < pworldadmin || padmin == 0))
|
||||
if (database.GetVariable("honorlsworldadmin", lsworldadmin)) {
|
||||
if (atoi(lsworldadmin.c_str()) == 1 && pworldadmin != 0 && (padmin < pworldadmin || padmin == 0)) {
|
||||
padmin = pworldadmin;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ClientListEntry::CheckAuth(const char* iName, MD5& iMD5Password) {
|
||||
if (LSAccountID() == 0 && strcmp(paccountname, iName) == 0 && pMD5Pass == iMD5Password)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ClientListEntry::CheckAuth(uint32 id, const char* iKey, uint32 ip) {
|
||||
if (pIP==ip && strncmp(plskey, iKey,10) == 0){
|
||||
paccountid = id;
|
||||
database.GetAccountFromID(id,paccountname,&padmin);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -317,13 +372,17 @@ bool ClientListEntry::CheckAuth(uint32 id, const char* iKey, uint32 ip) {
|
||||
|
||||
void ClientListEntry::ProcessTellQueue()
|
||||
{
|
||||
if (!Server())
|
||||
if (!Server()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ServerPacket *pack;
|
||||
auto it = tell_queue.begin();
|
||||
auto it = tell_queue.begin();
|
||||
while (it != tell_queue.end()) {
|
||||
pack = new ServerPacket(ServerOP_ChannelMessage, sizeof(ServerChannelMessage_Struct) + strlen((*it)->message) + 1);
|
||||
pack = new ServerPacket(
|
||||
ServerOP_ChannelMessage,
|
||||
sizeof(ServerChannelMessage_Struct) + strlen((*it)->message) + 1
|
||||
);
|
||||
memcpy(pack->pBuffer, *it, pack->size);
|
||||
Server()->SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
|
||||
+63
-25
@@ -18,12 +18,48 @@ typedef enum
|
||||
InZone
|
||||
} CLE_Status;
|
||||
|
||||
static const char * CLEStatusString[] = {
|
||||
"Never",
|
||||
"Offline",
|
||||
"Online",
|
||||
"CharSelect",
|
||||
"Zoning",
|
||||
"InZone"
|
||||
};
|
||||
|
||||
class ZoneServer;
|
||||
struct ServerClientList_Struct;
|
||||
|
||||
class ClientListEntry {
|
||||
public:
|
||||
ClientListEntry(uint32 id, uint32 iLSID, const char* iLoginName, const char* iLoginKey, int16 iWorldAdmin = 0, uint32 ip = 0, uint8 local=0);
|
||||
|
||||
/**
|
||||
* @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,
|
||||
uint8 local = 0
|
||||
);
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param iZS
|
||||
* @param scl
|
||||
* @param iOnline
|
||||
*/
|
||||
ClientListEntry(uint32 id, uint32 iAccID, const char* iAccName, MD5& iMD5Pass, int16 iAdmin = 0);
|
||||
ClientListEntry(uint32 id, ZoneServer* iZS, ServerClientList_Struct* scl, CLE_Status iOnline);
|
||||
~ClientListEntry();
|
||||
@@ -31,7 +67,7 @@ public:
|
||||
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 iLSID, const char* key);
|
||||
bool CheckAuth(uint32 loginserver_account_id, const char* key_password);
|
||||
bool CheckAuth(const char* iName, MD5& iMD5Password);
|
||||
bool CheckAuth(uint32 id, const char* key, uint32 ip);
|
||||
void SetOnline(ZoneServer* iZS, CLE_Status iOnline);
|
||||
@@ -47,9 +83,10 @@ public:
|
||||
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 plsname; }
|
||||
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; }
|
||||
@@ -99,37 +136,38 @@ private:
|
||||
uint8 stale;
|
||||
|
||||
// Login Server stuff
|
||||
char source_loginserver[64]{}; //Loginserver we came from.
|
||||
uint32 pLSID;
|
||||
char plsname[32];
|
||||
char plskey[16];
|
||||
char loginserver_account_name[32]{};
|
||||
char plskey[16]{};
|
||||
int16 pworldadmin; // Login server's suggested admin status setting
|
||||
bool plocal;
|
||||
|
||||
// Account stuff
|
||||
uint32 paccountid;
|
||||
char paccountname[32];
|
||||
char paccountname[32]{};
|
||||
MD5 pMD5Pass;
|
||||
int16 padmin;
|
||||
int16 padmin{};
|
||||
|
||||
// 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;
|
||||
bool pLFG;
|
||||
uint8 gm;
|
||||
uint8 pClientVersion;
|
||||
uint8 pLFGFromLevel;
|
||||
uint8 pLFGToLevel;
|
||||
bool pLFGMatchFilter;
|
||||
char pLFGComments[64];
|
||||
ZoneServer* pzoneserver{};
|
||||
uint32 pzone{};
|
||||
uint16 pinstance{};
|
||||
uint32 pcharid{};
|
||||
char pname[64]{};
|
||||
uint8 plevel{};
|
||||
uint8 pclass_{};
|
||||
uint16 prace{};
|
||||
uint8 panon{};
|
||||
uint8 ptellsoff{};
|
||||
uint32 pguild_id{};
|
||||
bool pLFG{};
|
||||
uint8 gm{};
|
||||
uint8 pClientVersion{};
|
||||
uint8 pLFGFromLevel{};
|
||||
uint8 pLFGToLevel{};
|
||||
bool pLFGMatchFilter{};
|
||||
char pLFGComments[64]{};
|
||||
|
||||
// Tell Queue -- really a vector :D
|
||||
std::vector<ServerChannelMessage_Struct *> tell_queue;
|
||||
|
||||
+39
-61
@@ -63,7 +63,7 @@ void ClientList::Process() {
|
||||
if (!iterator.GetData()->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());
|
||||
LogInfo("Removing client from [{}]:[{}]", inet_ntoa(in), iterator.GetData()->GetPort());
|
||||
iterator.RemoveCurrent();
|
||||
}
|
||||
else
|
||||
@@ -110,16 +110,16 @@ void ClientList::GetCLEIP(uint32 iIP) {
|
||||
countCLEIPs = iterator.GetData();
|
||||
if ((countCLEIPs->GetIP() == iIP) && ((countCLEIPs->Admin() < (RuleI(World, ExemptMaxClientsStatus))) || (RuleI(World, ExemptMaxClientsStatus) < 0))) { // 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
|
||||
Log(Logs::General, Logs::Client_Login, "Account ID: %i Account Name: %s IP: %s.", countCLEIPs->LSID(), countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str());
|
||||
LogClientLogin("Account ID: [{}] Account Name: [{}] IP: [{}]", countCLEIPs->LSID(), countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str());
|
||||
if (RuleB(World, EnableIPExemptions)) {
|
||||
Log(Logs::General, Logs::Client_Login, "Account ID: %i Account Name: %s IP: %s IP Instances: %i Max IP Instances: %i", countCLEIPs->LSID(), countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str(), IPInstances, database.GetIPExemption(long2ip(countCLEIPs->GetIP()).c_str()));
|
||||
LogClientLogin("Account ID: [{}] Account Name: [{}] IP: [{}] IP Instances: [{}] Max IP Instances: [{}]", countCLEIPs->LSID(), countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str(), IPInstances, database.GetIPExemption(long2ip(countCLEIPs->GetIP()).c_str()));
|
||||
if (IPInstances > database.GetIPExemption(long2ip(countCLEIPs->GetIP()).c_str())) {
|
||||
if(RuleB(World, IPLimitDisconnectAll)) {
|
||||
Log(Logs::General, Logs::Client_Login, "Disconnect: All accounts on IP %s", long2ip(countCLEIPs->GetIP()).c_str());
|
||||
LogClientLogin("Disconnect: All accounts on IP [{}]", long2ip(countCLEIPs->GetIP()).c_str());
|
||||
DisconnectByIP(iIP);
|
||||
return;
|
||||
} else {
|
||||
Log(Logs::General, Logs::Client_Login, "Disconnect: Account %s on IP %s.", countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str());
|
||||
LogClientLogin("Disconnect: Account [{}] on IP [{}]", countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str());
|
||||
countCLEIPs->SetOnline(CLE_Status::Offline);
|
||||
iterator.RemoveCurrent();
|
||||
continue;
|
||||
@@ -128,14 +128,14 @@ void ClientList::GetCLEIP(uint32 iIP) {
|
||||
} else {
|
||||
if (IPInstances > (RuleI(World, MaxClientsPerIP))) { // If the number of connections exceeds the lower limit
|
||||
if (RuleB(World, MaxClientsSetByStatus)) { // If MaxClientsSetByStatus is set to True, override other IP Limit Rules
|
||||
Log(Logs::General, Logs::Client_Login, "Account ID: %i Account Name: %s IP: %s IP Instances: %i Max IP Instances: %i", countCLEIPs->LSID(), countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str(), IPInstances, countCLEIPs->Admin());
|
||||
LogClientLogin("Account ID: [{}] Account Name: [{}] IP: [{}] IP Instances: [{}] Max IP Instances: [{}]", countCLEIPs->LSID(), countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str(), IPInstances, countCLEIPs->Admin());
|
||||
if (IPInstances > countCLEIPs->Admin()) { // The IP Limit is set by the status of the account if status > MaxClientsPerIP
|
||||
if(RuleB(World, IPLimitDisconnectAll)) {
|
||||
Log(Logs::General, Logs::Client_Login, "Disconnect: All accounts on IP %s", long2ip(countCLEIPs->GetIP()).c_str());
|
||||
LogClientLogin("Disconnect: All accounts on IP [{}]", long2ip(countCLEIPs->GetIP()).c_str());
|
||||
DisconnectByIP(iIP);
|
||||
return;
|
||||
} else {
|
||||
Log(Logs::General, Logs::Client_Login, "Disconnect: Account %s on IP %s.", countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str());
|
||||
LogClientLogin("Disconnect: Account [{}] on IP [{}]", countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str());
|
||||
countCLEIPs->SetOnline(CLE_Status::Offline); // Remove the connection
|
||||
iterator.RemoveCurrent();
|
||||
continue;
|
||||
@@ -143,22 +143,22 @@ void ClientList::GetCLEIP(uint32 iIP) {
|
||||
}
|
||||
} else if ((countCLEIPs->Admin() < RuleI(World, AddMaxClientsStatus)) || (RuleI(World, AddMaxClientsStatus) < 0)) { // Else if the Admin status of the connection is not eligible for the higher limit, or there is no higher limit (AddMaxClientStatus < 0)
|
||||
if(RuleB(World, IPLimitDisconnectAll)) {
|
||||
Log(Logs::General, Logs::Client_Login, "Disconnect: All accounts on IP %s", long2ip(countCLEIPs->GetIP()).c_str());
|
||||
LogClientLogin("Disconnect: All accounts on IP [{}]", long2ip(countCLEIPs->GetIP()).c_str());
|
||||
DisconnectByIP(iIP);
|
||||
return;
|
||||
} else {
|
||||
Log(Logs::General, Logs::Client_Login, "Disconnect: Account %s on IP %s.", countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str());
|
||||
LogClientLogin("Disconnect: Account [{}] on IP [{}]", countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str());
|
||||
countCLEIPs->SetOnline(CLE_Status::Offline); // Remove the connection
|
||||
iterator.RemoveCurrent();
|
||||
continue;
|
||||
}
|
||||
} else if (IPInstances > RuleI(World, AddMaxClientsPerIP)) { // else they are eligible for the higher limit, but if they exceed that
|
||||
if(RuleB(World, IPLimitDisconnectAll)) {
|
||||
Log(Logs::General, Logs::Client_Login, "Disconnect: All accounts on IP %s", long2ip(countCLEIPs->GetIP()).c_str());
|
||||
LogClientLogin("Disconnect: All accounts on IP [{}]", long2ip(countCLEIPs->GetIP()).c_str());
|
||||
DisconnectByIP(iIP);
|
||||
return;
|
||||
} else {
|
||||
Log(Logs::General, Logs::Client_Login, "Disconnect: Account %s on IP %s.", countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str());
|
||||
LogClientLogin("Disconnect: Account [{}] on IP [{}]", countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str());
|
||||
countCLEIPs->SetOnline(CLE_Status::Offline); // Remove the connection
|
||||
iterator.RemoveCurrent();
|
||||
continue;
|
||||
@@ -253,6 +253,19 @@ ClientListEntry* ClientList::FindCLEByCharacterID(uint32 iCharID) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ClientListEntry* ClientList::FindCLEByLSID(uint32 iLSID) {
|
||||
LinkedListIterator<ClientListEntry*> iterator(clientlist);
|
||||
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
if (iterator.GetData()->LSID() == iLSID) {
|
||||
return iterator.GetData();
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnection* connection, const char* iName) {
|
||||
LinkedListIterator<ClientListEntry*> iterator(clientlist);
|
||||
char* output = 0;
|
||||
@@ -301,8 +314,8 @@ void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnect
|
||||
}
|
||||
|
||||
|
||||
void ClientList::CLEAdd(uint32 iLSID, const char* iLoginName, const char* iLoginKey, int16 iWorldAdmin, uint32 ip, uint8 local) {
|
||||
auto tmp = new ClientListEntry(GetNextCLEID(), iLSID, iLoginName, iLoginKey, iWorldAdmin, ip, local);
|
||||
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);
|
||||
|
||||
clientlist.Append(tmp);
|
||||
}
|
||||
@@ -362,52 +375,18 @@ void ClientList::CLEKeepAlive(uint32 numupdates, uint32* wid) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ClientListEntry* ClientList::CheckAuth(uint32 id, const char* iKey, uint32 ip ) {
|
||||
LinkedListIterator<ClientListEntry*> iterator(clientlist);
|
||||
ClientListEntry *ClientList::CheckAuth(uint32 iLSID, const char *iKey)
|
||||
{
|
||||
LinkedListIterator<ClientListEntry *> iterator(clientlist);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
if (iterator.GetData()->CheckAuth(id, iKey, ip))
|
||||
while (iterator.MoreElements()) {
|
||||
if (iterator.GetData()->CheckAuth(iLSID, iKey)) {
|
||||
return iterator.GetData();
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
ClientListEntry* ClientList::CheckAuth(uint32 iLSID, const char* iKey) {
|
||||
LinkedListIterator<ClientListEntry*> iterator(clientlist);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
if (iterator.GetData()->CheckAuth(iLSID, iKey))
|
||||
return iterator.GetData();
|
||||
iterator.Advance();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ClientListEntry* ClientList::CheckAuth(const char* iName, const char* iPassword) {
|
||||
LinkedListIterator<ClientListEntry*> iterator(clientlist);
|
||||
MD5 tmpMD5(iPassword);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
if (iterator.GetData()->CheckAuth(iName, tmpMD5))
|
||||
return iterator.GetData();
|
||||
iterator.Advance();
|
||||
}
|
||||
int16 tmpadmin;
|
||||
|
||||
//Log.LogDebugType(Logs::Detail, Logs::World_Server,"Login with '%s' and '%s'", iName, iPassword);
|
||||
|
||||
uint32 accid = database.CheckLogin(iName, iPassword, &tmpadmin);
|
||||
if (accid) {
|
||||
uint32 lsid = 0;
|
||||
database.GetAccountIDByName(iName, &tmpadmin, &lsid);
|
||||
auto tmp = new ClientListEntry(GetNextCLEID(), lsid, iName, tmpMD5, tmpadmin, 0, 0);
|
||||
clientlist.Append(tmp);
|
||||
return tmp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -420,7 +399,7 @@ void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID)
|
||||
|
||||
if(!from)
|
||||
{
|
||||
Log(Logs::Detail, Logs::World_Server,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID);
|
||||
LogInfo("Invalid client. FromID=[{}] GuildID=[{}]", FromID, GuildID);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -745,7 +724,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S
|
||||
safe_delete_array(output);
|
||||
}
|
||||
catch(...){
|
||||
Log(Logs::Detail, Logs::World_Server,"Unknown error in world's SendWhoAll (probably mem error), ignoring...");
|
||||
LogInfo("Unknown error in world's SendWhoAll (probably mem error), ignoring");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -888,7 +867,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon
|
||||
safe_delete(pack2);
|
||||
}
|
||||
catch(...){
|
||||
Log(Logs::Detail, Logs::World_Server,"Unknown error in world's SendFriendsWho (probably mem error), ignoring...");
|
||||
LogInfo("Unknown error in world's SendFriendsWho (probably mem error), ignoring");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1124,7 +1103,6 @@ Client* ClientList::FindByAccountID(uint32 account_id) {
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
Log(Logs::Detail, Logs::World_Server, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData());
|
||||
if (iterator.GetData()->GetAccountID() == account_id) {
|
||||
Client* tmp = iterator.GetData();
|
||||
return tmp;
|
||||
@@ -1139,7 +1117,6 @@ Client* ClientList::FindByName(char* charname) {
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
Log(Logs::Detail, Logs::World_Server, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData());
|
||||
if (iterator.GetData()->GetCharName() == charname) {
|
||||
Client* tmp = iterator.GetData();
|
||||
return tmp;
|
||||
@@ -1264,15 +1241,16 @@ void ClientList::UpdateClientGuild(uint32 char_id, uint32 guild_id) {
|
||||
|
||||
void ClientList::RemoveCLEByLSID(uint32 iLSID)
|
||||
{
|
||||
LinkedListIterator<ClientListEntry*> iterator(clientlist);
|
||||
LinkedListIterator<ClientListEntry *> iterator(clientlist);
|
||||
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
if (iterator.GetData()->LSAccountID() == iLSID) {
|
||||
iterator.RemoveCurrent();
|
||||
}
|
||||
else
|
||||
else {
|
||||
iterator.Advance();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -52,18 +52,17 @@ public:
|
||||
void ClientUpdate(ZoneServer* zoneserver, ServerClientList_Struct* scl);
|
||||
void CLERemoveZSRef(ZoneServer* iZS);
|
||||
ClientListEntry* CheckAuth(uint32 iLSID, const char* iKey);
|
||||
ClientListEntry* CheckAuth(const char* iName, const char* iPassword);
|
||||
ClientListEntry* CheckAuth(uint32 id, const char* iKey, uint32 ip);
|
||||
ClientListEntry* FindCharacter(const char* name);
|
||||
ClientListEntry* FindCLEByAccountID(uint32 iAccID);
|
||||
ClientListEntry* FindCLEByCharacterID(uint32 iCharID);
|
||||
ClientListEntry* FindCLEByLSID(uint32 iLSID);
|
||||
ClientListEntry* GetCLE(uint32 iID);
|
||||
void GetCLEIP(uint32 iIP);
|
||||
uint32 GetCLEIPCount(uint32 iLSAccountID);
|
||||
void DisconnectByIP(uint32 iIP);
|
||||
void CLCheckStale();
|
||||
void CLEKeepAlive(uint32 numupdates, uint32* wid);
|
||||
void CLEAdd(uint32 iLSID, const char* iLoginName, const char* iLoginKey, int16 iWorldAdmin = 0, uint32 ip = 0, uint8 local=0);
|
||||
void CLEAdd(uint32 iLSID, const char* iLoginServerName, const char* iLoginName, const char* iLoginKey, int16 iWorldAdmin = 0, uint32 ip = 0, uint8 local=0);
|
||||
void UpdateClientGuild(uint32 char_id, uint32 guild_id);
|
||||
void RemoveCLEByLSID(uint32 iLSID);
|
||||
bool IsAccountInGame(uint32 iLSID);
|
||||
|
||||
+20
-14
@@ -44,7 +44,14 @@ extern LoginServerList loginserverlist;
|
||||
struct EQ::Net::ConsoleLoginStatus CheckLogin(const std::string &username, const std::string &password)
|
||||
{
|
||||
struct EQ::Net::ConsoleLoginStatus ret;
|
||||
ret.account_id = database.CheckLogin(username.c_str(), password.c_str());
|
||||
|
||||
std::string prefix = "eqemu";
|
||||
std::string raw_user = "";
|
||||
|
||||
ParseAccountString(username, raw_user, prefix);
|
||||
|
||||
ret.account_id = database.CheckLogin(raw_user.c_str(), password.c_str(), prefix.c_str());
|
||||
|
||||
if (ret.account_id == 0) {
|
||||
return ret;
|
||||
}
|
||||
@@ -229,6 +236,7 @@ void ConsoleMd5(
|
||||
|
||||
uint8 md5[16];
|
||||
MD5::Generate((const uchar *) args[0].c_str(), strlen(args[0].c_str()), md5);
|
||||
|
||||
connection->SendLine(
|
||||
StringFormat(
|
||||
"MD5: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||
@@ -248,7 +256,8 @@ void ConsoleMd5(
|
||||
md5[13],
|
||||
md5[14],
|
||||
md5[15]
|
||||
));
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -581,7 +590,7 @@ void ConsoleZoneBootup(
|
||||
strcpy(&tmpname[1], connection->UserName().c_str());
|
||||
|
||||
Log(Logs::Detail,
|
||||
Logs::World_Server,
|
||||
Logs::WorldServer,
|
||||
"Console ZoneBootup: %s, %s, %s",
|
||||
tmpname,
|
||||
args[1].c_str(),
|
||||
@@ -711,20 +720,17 @@ void ConsoleSetPass(
|
||||
connection->SendLine("Format: setpass accountname password");
|
||||
}
|
||||
else {
|
||||
std::string prefix = "eqemu";
|
||||
std::string raw_user = "";
|
||||
|
||||
ParseAccountString(args[0], raw_user, prefix);
|
||||
|
||||
int16 tmpstatus = 0;
|
||||
uint32 tmpid = database.GetAccountIDByName(args[0].c_str(), &tmpstatus);
|
||||
uint32 tmpid = database.GetAccountIDByName(raw_user.c_str(), prefix.c_str(), &tmpstatus);
|
||||
|
||||
if (!tmpid) {
|
||||
connection->SendLine("Error: Account not found");
|
||||
}
|
||||
else if (tmpstatus > connection->Admin()) {
|
||||
connection->SendLine("Cannot change password: Account's status is higher than yours");
|
||||
}
|
||||
else if (database.SetLocalPassword(tmpid, args[1].c_str())) {
|
||||
connection->SendLine("Password changed.");
|
||||
}
|
||||
else {
|
||||
connection->SendLine("Error changing password.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -901,4 +907,4 @@ void RegisterConsoleFunctions(std::unique_ptr<EQ::Net::ConsoleServer>& console)
|
||||
console->RegisterCall("zonestatus", 50, "zonestatus", std::bind(ConsoleZoneStatus, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));console->RegisterCall("ping", 50, "ping", std::bind(ConsoleNull, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
console->RegisterCall("quit", 50, "quit", std::bind(ConsoleQuit, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
console->RegisterCall("exit", 50, "exit", std::bind(ConsoleQuit, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -88,7 +88,7 @@ void Console::Die() {
|
||||
state = CONSOLE_STATE_CLOSED;
|
||||
struct in_addr in;
|
||||
in.s_addr = GetIP();
|
||||
Log(Logs::Detail, Logs::World_Server,"Removing console from %s:%d",inet_ntoa(in),GetPort());
|
||||
LogInfo("Removing console from [{}]:[{}]",inet_ntoa(in),GetPort());
|
||||
tcpc->Disconnect();
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ bool Console::Process() {
|
||||
if (!tcpc->Connected()) {
|
||||
struct in_addr in;
|
||||
in.s_addr = GetIP();
|
||||
Log(Logs::Detail, Logs::World_Server,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort());
|
||||
LogInfo("Removing console (!tcpc->Connected) from [{}]:[{}]",inet_ntoa(in),GetPort());
|
||||
return false;
|
||||
}
|
||||
//if we have not gotten the special markers after this timer, send login prompt
|
||||
@@ -252,7 +252,7 @@ bool Console::Process() {
|
||||
SendMessage(1, "Timeout, disconnecting...");
|
||||
struct in_addr in;
|
||||
in.s_addr = GetIP();
|
||||
Log(Logs::Detail, Logs::World_Server,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort());
|
||||
LogInfo("TCP connection timeout from [{}]:[{}]",inet_ntoa(in),GetPort());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -261,29 +261,29 @@ bool Console::Process() {
|
||||
in.s_addr = GetIP();
|
||||
if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeZone) {
|
||||
auto zs = new ZoneServer(tcpc);
|
||||
Log(Logs::Detail, Logs::World_Server,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort());
|
||||
LogInfo("New zoneserver #[{}] from [{}]:[{}]", zs->GetID(), inet_ntoa(in), GetPort());
|
||||
zoneserver_list.Add(zs);
|
||||
numzones++;
|
||||
tcpc = 0;
|
||||
} else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeLauncher) {
|
||||
Log(Logs::Detail, Logs::World_Server,"New launcher from %s:%d", inet_ntoa(in), GetPort());
|
||||
LogInfo("New launcher from [{}]:[{}]", inet_ntoa(in), GetPort());
|
||||
launcher_list.Add(tcpc);
|
||||
tcpc = 0;
|
||||
}
|
||||
else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeUCS)
|
||||
{
|
||||
Log(Logs::Detail, Logs::World_Server,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort());
|
||||
LogInfo("New UCS Connection from [{}]:[{}]", inet_ntoa(in), GetPort());
|
||||
UCSLink.SetConnection(tcpc);
|
||||
tcpc = 0;
|
||||
}
|
||||
else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeQueryServ)
|
||||
{
|
||||
Log(Logs::Detail, Logs::World_Server,"New QS Connection from %s:%d", inet_ntoa(in), GetPort());
|
||||
LogInfo("New QS Connection from [{}]:[{}]", inet_ntoa(in), GetPort());
|
||||
QSLink.SetConnection(tcpc);
|
||||
tcpc = 0;
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::World_Server,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort());
|
||||
LogInfo("Unsupported packet mode from [{}]:[{}]", inet_ntoa(in), GetPort());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -440,7 +440,7 @@ void Console::ProcessCommand(const char* command) {
|
||||
state = CONSOLE_STATE_CLOSED;
|
||||
return;
|
||||
}
|
||||
Log(Logs::Detail, Logs::World_Server,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin);
|
||||
LogInfo("TCP console authenticated: Username=[{}], Admin=[{}]",paccountname,admin);
|
||||
SendMessage(1, 0);
|
||||
SendMessage(2, "Login accepted.");
|
||||
state = CONSOLE_STATE_CONNECTED;
|
||||
@@ -737,7 +737,7 @@ void Console::ProcessCommand(const char* command) {
|
||||
tmpname[0] = '*';
|
||||
strcpy(&tmpname[1], paccountname);
|
||||
|
||||
Log(Logs::Detail, Logs::World_Server,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]);
|
||||
LogInfo("Console ZoneBootup: [{}], [{}], [{}]",tmpname,sep.arg[2],sep.arg[1]);
|
||||
zoneserver_list.SOPZoneBootup(tmpname, atoi(sep.arg[1]), sep.arg[2], (bool) (strcasecmp(sep.arg[3], "static") == 0));
|
||||
}
|
||||
}
|
||||
@@ -821,7 +821,7 @@ void Console::ProcessCommand(const char* command) {
|
||||
#endif
|
||||
RunLoops = true;
|
||||
SendMessage(1, " Login Server Reconnect manually restarted by Console");
|
||||
Log(Logs::Detail, Logs::World_Server,"Login Server Reconnect manually restarted by Console");
|
||||
LogInfo("Login Server Reconnect manually restarted by Console");
|
||||
}
|
||||
else if (strcasecmp(sep.arg[0], "zonelock") == 0 && admin >= consoleZoneStatus) {
|
||||
if (strcasecmp(sep.arg[1], "list") == 0) {
|
||||
|
||||
@@ -42,7 +42,7 @@ void EQLConfig::LoadSettings() {
|
||||
std::string query = StringFormat("SELECT dynamics FROM launcher WHERE name = '%s'", namebuf);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::General, Logs::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str());
|
||||
LogError("EQLConfig::LoadSettings: {}", results.ErrorMessage().c_str());
|
||||
}
|
||||
else {
|
||||
auto row = results.begin();
|
||||
@@ -52,7 +52,7 @@ void EQLConfig::LoadSettings() {
|
||||
query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf);
|
||||
results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::General, Logs::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str());
|
||||
LogError("EQLConfig::LoadSettings: {}", results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) {
|
||||
res = m_zones.find(short_name);
|
||||
if(res == m_zones.end()) {
|
||||
//not found.
|
||||
Log(Logs::General, Logs::Error, "Update for unknown zone %s", short_name);
|
||||
LogError("Update for unknown zone {}", short_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) {
|
||||
res = m_zones.find(short_name);
|
||||
if(res == m_zones.end()) {
|
||||
//not found.
|
||||
Log(Logs::General, Logs::Error, "Update for unknown zone %s", short_name);
|
||||
LogError("Update for unknown zone {}", short_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -139,11 +139,11 @@ bool EQWHTTPHandler::CheckAuth() const {
|
||||
int16 status = 0;
|
||||
uint32 acctid = database.CheckLogin(m_username.c_str(), m_password.c_str(), &status);
|
||||
if(acctid == 0) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str());
|
||||
LogInfo("Login autentication failed for [{}] with [{}]", m_username.c_str(), m_password.c_str());
|
||||
return(false);
|
||||
}
|
||||
if(status < httpLoginStatus) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Login of %s failed: status too low.", m_username.c_str());
|
||||
LogInfo("Login of [{}] failed: status too low", m_username.c_str());
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -278,29 +278,29 @@ void EQWHTTPServer::CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP
|
||||
}
|
||||
|
||||
void EQWHTTPServer::Stop() {
|
||||
Log(Logs::Detail, Logs::World_Server, "Requesting that HTTP Service stop.");
|
||||
LogInfo("Requesting that HTTP Service stop");
|
||||
m_running = false;
|
||||
Close();
|
||||
}
|
||||
|
||||
bool EQWHTTPServer::Start(uint16 port, const char *mime_file) {
|
||||
if(m_running) {
|
||||
Log(Logs::Detail, Logs::World_Server, "HTTP Service is already running on port %d", m_port);
|
||||
LogInfo("HTTP Service is already running on port [{}]", m_port);
|
||||
return(false);
|
||||
}
|
||||
|
||||
//load up our nice mime types
|
||||
if(!EQWHTTPHandler::LoadMimeTypes(mime_file)) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Failed to load mime types from '%s'", mime_file);
|
||||
LogInfo("Failed to load mime types from [{}]", mime_file);
|
||||
return(false);
|
||||
} else {
|
||||
Log(Logs::Detail, Logs::World_Server, "Loaded mime types from %s", mime_file);
|
||||
LogInfo("Loaded mime types from [{}]", mime_file);
|
||||
}
|
||||
|
||||
//fire up the server thread
|
||||
char errbuf[TCPServer_ErrorBufferSize];
|
||||
if(!Open(port, errbuf)) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Unable to bind to port %d for HTTP service: %s", port, errbuf);
|
||||
LogInfo("Unable to bind to port [{}] for HTTP service: [{}]", port, errbuf);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ EQWParser::EQWParser() {
|
||||
my_perl = perl_alloc();
|
||||
_empty_sv = newSV(0);
|
||||
if (!my_perl) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Error: perl_alloc failed!");
|
||||
LogInfo("Error: perl_alloc failed!");
|
||||
}
|
||||
else {
|
||||
DoInit();
|
||||
@@ -184,10 +184,10 @@ void EQWParser::DoInit() {
|
||||
|
||||
|
||||
#ifdef EMBPERL_PLUGIN
|
||||
Log(Logs::Detail, Logs::World_Server, "Loading worldui perl plugins.");
|
||||
LogInfo("Loading worldui perl plugins");
|
||||
std::string err;
|
||||
if(!eval_file("world", "worldui.pl", err)) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Warning - world.pl: %s", err.c_str());
|
||||
LogInfo("Warning - world.pl: [{}]", err.c_str());
|
||||
}
|
||||
|
||||
eval_pv(
|
||||
|
||||
@@ -79,25 +79,25 @@ void LauncherLink::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
|
||||
break;
|
||||
}
|
||||
case ServerOP_ZAAuth: {
|
||||
Log(Logs::Detail, Logs::World_Server, "Got authentication from %s when they are already authenticated.", m_name.c_str());
|
||||
LogInfo("Got authentication from [{}] when they are already authenticated", m_name.c_str());
|
||||
break;
|
||||
}
|
||||
case ServerOP_LauncherConnectInfo: {
|
||||
const LauncherConnectInfo *it = (const LauncherConnectInfo *)pack->pBuffer;
|
||||
if (HasName()) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name);
|
||||
LogInfo("Launcher [{}] received an additional connect packet with name [{}]. Ignoring", m_name.c_str(), it->name);
|
||||
break;
|
||||
}
|
||||
m_name = it->name;
|
||||
|
||||
EQLConfig *config = launcher_list.GetConfig(m_name.c_str());
|
||||
if (config == nullptr) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Unknown launcher '%s' connected. Disconnecting.", it->name);
|
||||
LogInfo("Unknown launcher [{}] connected. Disconnecting", it->name);
|
||||
Disconnect();
|
||||
break;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::World_Server, "Launcher Identified itself as '%s'. Loading zone list.", it->name);
|
||||
LogInfo("Launcher Identified itself as [{}]. Loading zone list", it->name);
|
||||
|
||||
std::vector<LauncherZone> result;
|
||||
//database.GetLauncherZones(it->name, result);
|
||||
@@ -111,7 +111,7 @@ void LauncherLink::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
|
||||
zs.port = cur->port;
|
||||
zs.up = false;
|
||||
zs.starts = 0;
|
||||
Log(Logs::Detail, Logs::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port);
|
||||
LogInfo("[{}]: Loaded zone [{}] on port [{}]", m_name.c_str(), cur->name.c_str(), zs.port);
|
||||
m_states[cur->name] = zs;
|
||||
}
|
||||
|
||||
@@ -127,17 +127,17 @@ void LauncherLink::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
|
||||
std::map<std::string, ZoneState>::iterator res;
|
||||
res = m_states.find(it->short_name);
|
||||
if (res == m_states.end()) {
|
||||
Log(Logs::Detail, Logs::World_Server, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name);
|
||||
LogInfo("[{}]: reported state for zone [{}] which it does not have", m_name.c_str(), it->short_name);
|
||||
break;
|
||||
}
|
||||
Log(Logs::Detail, Logs::World_Server, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running ? "STARTED" : "STOPPED", it->start_count);
|
||||
LogInfo("[{}]: [{}] reported state [{}] ([{}] starts)", m_name.c_str(), it->short_name, it->running ? "STARTED" : "STOPPED", it->start_count);
|
||||
res->second.up = it->running;
|
||||
res->second.starts = it->start_count;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Log(Logs::Detail, Logs::World_Server, "Unknown ServerOPcode from launcher 0x%04x, size %d", pack->opcode, pack->size);
|
||||
LogInfo("Unknown ServerOPcode from launcher {:#04x}, size [{}]", pack->opcode, pack->size);
|
||||
DumpPacket(pack->pBuffer, pack->size);
|
||||
break;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ void LauncherLink::BootZone(const char *short_name, uint16 port) {
|
||||
zs.port = port;
|
||||
zs.up = false;
|
||||
zs.starts = 0;
|
||||
Log(Logs::Detail, Logs::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port);
|
||||
LogInfo("[{}]: Loaded zone [{}] on port [{}]", m_name.c_str(), short_name, zs.port);
|
||||
m_states[short_name] = zs;
|
||||
|
||||
StartZone(short_name, port);
|
||||
|
||||
@@ -65,10 +65,10 @@ void LauncherList::Process() {
|
||||
std::map<std::string, LauncherLink *>::iterator res;
|
||||
res = m_launchers.find(name);
|
||||
if (res != m_launchers.end()) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Ghosting launcher %s", name.c_str());
|
||||
LogInfo("Ghosting launcher [{}]", name.c_str());
|
||||
delete res->second;
|
||||
}
|
||||
Log(Logs::Detail, Logs::World_Server, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str());
|
||||
LogInfo("Removing pending launcher [{}]. Adding [{}] to active list", l->GetID(), name.c_str());
|
||||
//put the launcher in the list.
|
||||
m_launchers[name] = l;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ LauncherLink *LauncherList::FindByZone(const char *short_name) {
|
||||
|
||||
void LauncherList::Add(std::shared_ptr<EQ::Net::ServertalkServerConnection> conn) {
|
||||
auto it = new LauncherLink(nextID++, conn);
|
||||
Log(Logs::Detail, Logs::World_Server, "Adding pending launcher %d", it->GetID());
|
||||
LogInfo("Adding pending launcher [{}]", it->GetID());
|
||||
m_pendingLaunchers.push_back(it);
|
||||
}
|
||||
|
||||
|
||||
+465
-172
@@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "../common/packet_dump.h"
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/eqemu_logsys_fmt.h"
|
||||
#include "login_server.h"
|
||||
#include "login_server_list.h"
|
||||
#include "zoneserver.h"
|
||||
@@ -38,48 +37,63 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "cliententry.h"
|
||||
#include "world_config.h"
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
strn0cpy(LoginServerAddress, iAddress, 256);
|
||||
LoginServerPort = iPort;
|
||||
strn0cpy(LoginAccount, Account, 31);
|
||||
strn0cpy(LoginPassword, Password, 31);
|
||||
LoginServerPort = iPort;
|
||||
LoginAccount = Account;
|
||||
LoginPassword = Password;
|
||||
CanAccountUpdate = false;
|
||||
IsLegacy = legacy;
|
||||
IsLegacy = legacy;
|
||||
Connect();
|
||||
}
|
||||
|
||||
LoginServer::~LoginServer() {
|
||||
LoginServer::~LoginServer()
|
||||
{
|
||||
}
|
||||
|
||||
void LoginServer::ProcessUsertoWorldReq(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);
|
||||
LogNetcode("[ProcessUsertoWorldReqLeg] Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||
|
||||
UsertoWorldRequest_Struct* utwr = (UsertoWorldRequest_Struct*)p.Data();
|
||||
uint32 id = database.GetAccountIDFromLSID(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);
|
||||
|
||||
LogDebug(
|
||||
"[ProcessUsertoWorldReqLeg] id [{}] status [{}] account_id [{}] world_id [{}] from_id [{}] to_id [{}] ip [{}]",
|
||||
id,
|
||||
status,
|
||||
utwr->lsaccountid,
|
||||
utwr->worldid,
|
||||
utwr->FromID,
|
||||
utwr->ToID,
|
||||
utwr->IPAddr
|
||||
);
|
||||
|
||||
ServerPacket outpack;
|
||||
outpack.opcode = ServerOP_UsertoWorldResp;
|
||||
outpack.size = sizeof(UsertoWorldResponse_Struct);
|
||||
outpack.opcode = ServerOP_UsertoWorldRespLeg;
|
||||
outpack.size = sizeof(UsertoWorldResponseLegacy_Struct);
|
||||
outpack.pBuffer = new uchar[outpack.size];
|
||||
memset(outpack.pBuffer, 0, outpack.size);
|
||||
UsertoWorldResponse_Struct* utwrs = (UsertoWorldResponse_Struct*)outpack.pBuffer;
|
||||
utwrs->lsaccountid = utwr->lsaccountid;
|
||||
utwrs->ToID = utwr->FromID;
|
||||
utwrs->worldid = utwr->worldid;
|
||||
utwrs->response = UserToWorldStatusSuccess;
|
||||
|
||||
if (Config->Locked == true)
|
||||
{
|
||||
UsertoWorldResponseLegacy_Struct *utwrs = (UsertoWorldResponseLegacy_Struct *) outpack.pBuffer;
|
||||
utwrs->lsaccountid = utwr->lsaccountid;
|
||||
utwrs->ToID = utwr->FromID;
|
||||
utwrs->worldid = utwr->worldid;
|
||||
utwrs->response = UserToWorldStatusSuccess;
|
||||
|
||||
if (Config->Locked) {
|
||||
if (status < 100) {
|
||||
LogDebug("[ProcessUsertoWorldReqLeg] Server locked and status is not high enough for account_id [{0}]", utwr->lsaccountid);
|
||||
utwrs->response = UserToWorldStatusWorldUnavail;
|
||||
SendPacket(&outpack);
|
||||
return;
|
||||
@@ -87,19 +101,22 @@ void LoginServer::ProcessUsertoWorldReq(uint16_t opcode, EQ::Net::Packet &p) {
|
||||
}
|
||||
|
||||
int32 x = Config->MaxClients;
|
||||
if ((int32)numplayers >= x && x != -1 && x != 255 && status < 80) {
|
||||
if ((int32) numplayers >= x && x != -1 && x != 255 && status < 80) {
|
||||
LogDebug("[ProcessUsertoWorldReqLeg] World at capacity account_id [{0}]", utwr->lsaccountid);
|
||||
utwrs->response = UserToWorldStatusWorldAtCapacity;
|
||||
SendPacket(&outpack);
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == -1) {
|
||||
LogDebug("[ProcessUsertoWorldReqLeg] User suspended account_id [{0}]", utwr->lsaccountid);
|
||||
utwrs->response = UserToWorldStatusSuspended;
|
||||
SendPacket(&outpack);
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == -2) {
|
||||
LogDebug("[ProcessUsertoWorldReqLeg] User banned account_id [{0}]", utwr->lsaccountid);
|
||||
utwrs->response = UserToWorldStatusBanned;
|
||||
SendPacket(&outpack);
|
||||
return;
|
||||
@@ -107,217 +124,498 @@ void LoginServer::ProcessUsertoWorldReq(uint16_t opcode, EQ::Net::Packet &p) {
|
||||
|
||||
if (RuleB(World, EnforceCharacterLimitAtLogin)) {
|
||||
if (client_list.IsAccountInGame(utwr->lsaccountid)) {
|
||||
LogDebug("[ProcessUsertoWorldReqLeg] User already online account_id [{0}]", utwr->lsaccountid);
|
||||
utwrs->response = UserToWorldStatusAlreadyOnline;
|
||||
SendPacket(&outpack);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LogDebug("[ProcessUsertoWorldReqLeg] Sent response to account_id [{0}]", utwr->lsaccountid);
|
||||
|
||||
SendPacket(&outpack);
|
||||
}
|
||||
|
||||
void LoginServer::ProcessLSClientAuth(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);
|
||||
LogNetcode("[ProcessUsertoWorldReq] Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||
|
||||
UsertoWorldRequest_Struct *utwr = (UsertoWorldRequest_Struct *) p.Data();
|
||||
uint32 id = database.GetAccountIDFromLSID(utwr->login, utwr->lsaccountid);
|
||||
int16 status = database.CheckStatus(id);
|
||||
|
||||
LogDebug(
|
||||
"[ProcessUsertoWorldReq] id [{}] status [{}] account_id [{}] world_id [{}] from_id [{}] to_id [{}] ip [{}]",
|
||||
id,
|
||||
status,
|
||||
utwr->lsaccountid,
|
||||
utwr->worldid,
|
||||
utwr->FromID,
|
||||
utwr->ToID,
|
||||
utwr->IPAddr
|
||||
);
|
||||
|
||||
ServerPacket outpack;
|
||||
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;
|
||||
utwrs->lsaccountid = utwr->lsaccountid;
|
||||
utwrs->ToID = utwr->FromID;
|
||||
strn0cpy(utwrs->login, utwr->login, 64);
|
||||
utwrs->worldid = utwr->worldid;
|
||||
utwrs->response = UserToWorldStatusSuccess;
|
||||
|
||||
if (Config->Locked == true) {
|
||||
if (status < 100) {
|
||||
LogDebug("[ProcessUsertoWorldReq] Server locked and status is not high enough for account_id [{0}]", utwr->lsaccountid);
|
||||
utwrs->response = UserToWorldStatusWorldUnavail;
|
||||
SendPacket(&outpack);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int32 x = Config->MaxClients;
|
||||
if ((int32) numplayers >= x && x != -1 && x != 255 && status < 80) {
|
||||
LogDebug("[ProcessUsertoWorldReq] World at capacity account_id [{0}]", utwr->lsaccountid);
|
||||
utwrs->response = UserToWorldStatusWorldAtCapacity;
|
||||
SendPacket(&outpack);
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == -1) {
|
||||
LogDebug("[ProcessUsertoWorldReq] User suspended account_id [{0}]", utwr->lsaccountid);
|
||||
utwrs->response = UserToWorldStatusSuspended;
|
||||
SendPacket(&outpack);
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == -2) {
|
||||
LogDebug("[ProcessUsertoWorldReq] User banned account_id [{0}]", utwr->lsaccountid);
|
||||
utwrs->response = UserToWorldStatusBanned;
|
||||
SendPacket(&outpack);
|
||||
return;
|
||||
}
|
||||
|
||||
if (RuleB(World, EnforceCharacterLimitAtLogin)) {
|
||||
if (client_list.IsAccountInGame(utwr->lsaccountid)) {
|
||||
LogDebug("[ProcessUsertoWorldReq] User already online account_id [{0}]", utwr->lsaccountid);
|
||||
utwrs->response = UserToWorldStatusAlreadyOnline;
|
||||
SendPacket(&outpack);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LogDebug("[ProcessUsertoWorldReq] Sent response to account_id [{0}]", utwr->lsaccountid);
|
||||
|
||||
SendPacket(&outpack);
|
||||
}
|
||||
|
||||
void LoginServer::ProcessLSClientAuthLegacy(uint16_t opcode, EQ::Net::Packet &p)
|
||||
{
|
||||
const WorldConfig *Config = WorldConfig::get();
|
||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||
|
||||
try {
|
||||
auto slsca = p.GetSerialize<ClientAuth_Struct>(0);
|
||||
client_list.CLEAdd(slsca.lsaccount_id, slsca.name, slsca.key, slsca.worldadmin, slsca.ip, slsca.local);
|
||||
auto client_authentication_request = p.GetSerialize<ClientAuthLegacy_Struct>(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
|
||||
);
|
||||
|
||||
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::ProcessLSFatalError(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);
|
||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||
|
||||
Log(Logs::Detail, Logs::World_Server, "Login server responded with FatalError.");
|
||||
try {
|
||||
auto client_authentication_request = p.GetSerialize<ClientAuth_Struct>(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
|
||||
);
|
||||
|
||||
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) {
|
||||
LogError("Error parsing ClientAuth packet from world\nReason [{0}]", ex.what());
|
||||
}
|
||||
}
|
||||
|
||||
void LoginServer::ProcessLSFatalError(uint16_t opcode, EQ::Net::Packet &p)
|
||||
{
|
||||
const WorldConfig *Config = WorldConfig::get();
|
||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||
|
||||
LogInfo("Login server responded with FatalError");
|
||||
if (p.Length() > 1) {
|
||||
Log(Logs::Detail, Logs::World_Server, " %s", (const char*)p.Data());
|
||||
LogError("Error [{}]", (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);
|
||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", 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);
|
||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", 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());
|
||||
LogInfo("Loginserver provided [{}] 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);
|
||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||
|
||||
Log(Logs::Detail, Logs::World_Server, "Received ServerOP_LSAccountUpdate packet from loginserver");
|
||||
LogNetcode("Received ServerOP_LSAccountUpdate packet from loginserver");
|
||||
CanAccountUpdate = true;
|
||||
}
|
||||
|
||||
bool LoginServer::Connect() {
|
||||
std::string tmp;
|
||||
if (database.GetVariable("loginType", tmp) && strcasecmp(tmp.c_str(), "MinILogin") == 0) {
|
||||
minilogin = true;
|
||||
Log(Logs::Detail, Logs::World_Server, "Setting World to MiniLogin Server type");
|
||||
}
|
||||
else
|
||||
minilogin = false;
|
||||
|
||||
if (minilogin && WorldConfig::get()->WorldAddress.length() == 0) {
|
||||
Log(Logs::Detail, Logs::World_Server, "**** For minilogin to work, you need to set the <address> element in the <world> section.");
|
||||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
LogInfo("Unable to resolve [{}] to an IP", LoginServerAddress);
|
||||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
if (minilogin)
|
||||
legacy_client->OnConnect(
|
||||
[this](EQ::Net::ServertalkLegacyClient *client) {
|
||||
if (client) {
|
||||
LogInfo(
|
||||
"Connected to Legacy Loginserver: [{0}:{1}]",
|
||||
LoginServerAddress,
|
||||
LoginServerPort
|
||||
);
|
||||
|
||||
SendInfo();
|
||||
else
|
||||
SendNewInfo();
|
||||
SendStatus();
|
||||
zoneserver_list.SendLSZones();
|
||||
|
||||
statusupdate_timer.reset(new EQ::Timer(LoginServer_StatusUpdateInterval, true, [this](EQ::Timer *t) {
|
||||
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_UsertoWorldReq, std::bind(&LoginServer::ProcessUsertoWorldReq, 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);
|
||||
if (minilogin)
|
||||
client->OnConnect(
|
||||
[this](EQ::Net::ServertalkClient *client) {
|
||||
if (client) {
|
||||
LogInfo(
|
||||
"Connected to Loginserver: [{0}:{1}]",
|
||||
LoginServerAddress,
|
||||
LoginServerPort
|
||||
);
|
||||
SendInfo();
|
||||
else
|
||||
SendNewInfo();
|
||||
SendStatus();
|
||||
zoneserver_list.SendLSZones();
|
||||
|
||||
statusupdate_timer.reset(new EQ::Timer(LoginServer_StatusUpdateInterval, true, [this](EQ::Timer *t) {
|
||||
SendStatus();
|
||||
}));
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::World_Server, "Could not connect to Loginserver: %s:%d", LoginServerAddress, LoginServerPort);
|
||||
}
|
||||
});
|
||||
zoneserver_list.SendLSZones();
|
||||
|
||||
client->OnMessage(ServerOP_UsertoWorldReq, std::bind(&LoginServer::ProcessUsertoWorldReq, 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
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
m_keepalive.reset(new EQ::Timer(5000, true, std::bind(&LoginServer::OnKeepAlive, this, std::placeholders::_1)));
|
||||
|
||||
return true;
|
||||
}
|
||||
void LoginServer::SendInfo() {
|
||||
|
||||
void LoginServer::SendInfo()
|
||||
{
|
||||
const WorldConfig *Config = WorldConfig::get();
|
||||
|
||||
auto pack = new ServerPacket;
|
||||
pack->opcode = ServerOP_LSInfo;
|
||||
pack->size = sizeof(ServerLSInfo_Struct);
|
||||
pack->opcode = ServerOP_NewLSInfo;
|
||||
pack->size = sizeof(ServerNewLSInfo_Struct);
|
||||
pack->pBuffer = new uchar[pack->size];
|
||||
memset(pack->pBuffer, 0, pack->size);
|
||||
ServerLSInfo_Struct* lsi = (ServerLSInfo_Struct*)pack->pBuffer;
|
||||
strcpy(lsi->protocolversion, EQEMU_PROTOCOL_VERSION);
|
||||
strcpy(lsi->serverversion, LOGIN_VERSION);
|
||||
strcpy(lsi->name, Config->LongName.c_str());
|
||||
strcpy(lsi->account, LoginAccount);
|
||||
strcpy(lsi->password, LoginPassword);
|
||||
strcpy(lsi->address, Config->WorldAddress.c_str());
|
||||
SendPacket(pack);
|
||||
delete pack;
|
||||
}
|
||||
|
||||
void LoginServer::SendNewInfo() {
|
||||
const WorldConfig *Config = WorldConfig::get();
|
||||
|
||||
auto pack = new ServerPacket;
|
||||
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;
|
||||
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());
|
||||
strcpy(lsi->account, LoginAccount);
|
||||
strcpy(lsi->password, LoginPassword);
|
||||
if (Config->WorldAddress.length())
|
||||
strcpy(lsi->remote_address, Config->WorldAddress.c_str());
|
||||
if (Config->LocalAddress.length())
|
||||
strcpy(lsi->local_address, Config->LocalAddress.c_str());
|
||||
ServerNewLSInfo_Struct *lsi = (ServerNewLSInfo_Struct *) pack->pBuffer;
|
||||
strcpy(lsi->protocol_version, EQEMU_PROTOCOL_VERSION);
|
||||
strcpy(lsi->server_version, LOGIN_VERSION);
|
||||
strcpy(lsi->server_long_name, Config->LongName.c_str());
|
||||
strcpy(lsi->server_short_name, Config->ShortName.c_str());
|
||||
strn0cpy(lsi->account_name, LoginAccount.c_str(), 30);
|
||||
strn0cpy(lsi->account_password, LoginPassword.c_str(), 30);
|
||||
if (Config->WorldAddress.length()) {
|
||||
strcpy(lsi->remote_ip_address, Config->WorldAddress.c_str());
|
||||
}
|
||||
if (Config->LocalAddress.length()) {
|
||||
strcpy(lsi->local_ip_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());
|
||||
WorldConfig::SetLocalAddress(lsi->local_address);
|
||||
strcpy(lsi->local_ip_address, local_addr.c_str());
|
||||
WorldConfig::SetLocalAddress(lsi->local_ip_address);
|
||||
}
|
||||
SendPacket(pack);
|
||||
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;
|
||||
auto loginserver_status = (ServerLSStatus_Struct *) pack->pBuffer;
|
||||
|
||||
if (WorldConfig::get()->Locked)
|
||||
lss->status = -2;
|
||||
else if (numzones <= 0)
|
||||
lss->status = -2;
|
||||
else
|
||||
lss->status = numplayers;
|
||||
if (WorldConfig::get()->Locked) {
|
||||
loginserver_status->status = -2;
|
||||
}
|
||||
else if (numzones <= 0) {
|
||||
loginserver_status->status = -2;
|
||||
}
|
||||
else {
|
||||
loginserver_status->status = numplayers;
|
||||
}
|
||||
|
||||
lss->num_zones = numzones;
|
||||
lss->num_players = numplayers;
|
||||
loginserver_status->num_zones = numzones;
|
||||
loginserver_status->num_players = numplayers;
|
||||
SendPacket(pack);
|
||||
delete pack;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pack
|
||||
*/
|
||||
void LoginServer::SendPacket(ServerPacket *pack)
|
||||
{
|
||||
if (IsLegacy) {
|
||||
@@ -332,28 +630,23 @@ void LoginServer::SendPacket(ServerPacket *pack)
|
||||
}
|
||||
}
|
||||
|
||||
void LoginServer::SendAccountUpdate(ServerPacket* pack) {
|
||||
ServerLSAccountUpdate_Struct* s = (ServerLSAccountUpdate_Struct *)pack->pBuffer;
|
||||
void LoginServer::SendAccountUpdate(ServerPacket *pack)
|
||||
{
|
||||
auto *ls_account_update = (ServerLSAccountUpdate_Struct *) pack->pBuffer;
|
||||
if (CanUpdate()) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d", LoginServerAddress, LoginServerPort);
|
||||
strn0cpy(s->worldaccount, LoginAccount, 30);
|
||||
strn0cpy(s->worldpassword, LoginPassword, 30);
|
||||
LogInfo(
|
||||
"Sending ServerOP_LSAccountUpdate packet to loginserver: [{0}]:[{1}]",
|
||||
LoginServerAddress,
|
||||
LoginServerPort
|
||||
);
|
||||
strn0cpy(ls_account_update->worldaccount, LoginAccount.c_str(), 30);
|
||||
strn0cpy(ls_account_update->worldpassword, LoginPassword.c_str(), 30);
|
||||
SendPacket(pack);
|
||||
}
|
||||
}
|
||||
|
||||
bool LoginServer::Connected()
|
||||
void LoginServer::OnKeepAlive(EQ::Timer *t)
|
||||
{
|
||||
if (IsLegacy) {
|
||||
if (legacy_client) {
|
||||
return legacy_client->Connected();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (client) {
|
||||
return client->Connected();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
ServerPacket pack(ServerOP_KeepAlive, 0);
|
||||
SendPacket(&pack);
|
||||
}
|
||||
@@ -35,34 +35,35 @@ public:
|
||||
~LoginServer();
|
||||
|
||||
bool Connect();
|
||||
|
||||
void SendInfo();
|
||||
void SendNewInfo();
|
||||
void SendStatus();
|
||||
|
||||
void SendPacket(ServerPacket* pack);
|
||||
void SendAccountUpdate(ServerPacket* pack);
|
||||
bool Connected();
|
||||
bool MiniLogin() { return minilogin; }
|
||||
bool Connected() { return IsLegacy ? legacy_client->Connected() : client->Connected(); }
|
||||
bool CanUpdate() { return CanAccountUpdate; }
|
||||
|
||||
private:
|
||||
void ProcessUsertoWorldReqLeg(uint16_t opcode, EQ::Net::Packet &p);
|
||||
void ProcessUsertoWorldReq(uint16_t opcode, EQ::Net::Packet &p);
|
||||
void ProcessLSClientAuth(uint16_t opcode, EQ::Net::Packet &p);
|
||||
void ProcessLSClientAuthLegacy(uint16_t opcode, EQ::Net::Packet &p);
|
||||
void ProcessLSFatalError(uint16_t opcode, EQ::Net::Packet &p);
|
||||
void ProcessSystemwideMessage(uint16_t opcode, EQ::Net::Packet &p);
|
||||
void ProcessLSRemoteAddr(uint16_t opcode, EQ::Net::Packet &p);
|
||||
void ProcessLSAccountUpdate(uint16_t opcode, EQ::Net::Packet &p);
|
||||
|
||||
bool minilogin;
|
||||
void OnKeepAlive(EQ::Timer *t);
|
||||
std::unique_ptr<EQ::Timer> m_keepalive;
|
||||
|
||||
std::unique_ptr<EQ::Net::ServertalkClient> client;
|
||||
std::unique_ptr<EQ::Net::ServertalkLegacyClient> legacy_client;
|
||||
std::unique_ptr<EQ::Timer> statusupdate_timer;
|
||||
char LoginServerAddress[256];
|
||||
uint32 LoginServerIP;
|
||||
uint16 LoginServerPort;
|
||||
char LoginAccount[32];
|
||||
char LoginPassword[32];
|
||||
std::string LoginAccount;
|
||||
std::string LoginPassword;
|
||||
bool CanAccountUpdate;
|
||||
bool IsLegacy;
|
||||
};
|
||||
|
||||
@@ -63,14 +63,6 @@ bool LoginServerList::SendInfo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LoginServerList::SendNewInfo() {
|
||||
for (auto &iter : m_list) {
|
||||
(*iter).SendNewInfo();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LoginServerList::SendStatus() {
|
||||
for (auto &iter : m_list) {
|
||||
(*iter).SendStatus();
|
||||
@@ -88,7 +80,7 @@ bool LoginServerList::SendPacket(ServerPacket* pack) {
|
||||
}
|
||||
|
||||
bool LoginServerList::SendAccountUpdate(ServerPacket* pack) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers");
|
||||
LogInfo("Requested to send ServerOP_LSAccountUpdate packet to all loginservers");
|
||||
for (auto &iter : m_list) {
|
||||
if ((*iter).CanUpdate()) {
|
||||
(*iter).SendAccountUpdate(pack);
|
||||
@@ -118,16 +110,6 @@ bool LoginServerList::AllConnected() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LoginServerList::MiniLogin() {
|
||||
for (auto &iter : m_list) {
|
||||
if ((*iter).MiniLogin()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LoginServerList::CanUpdate() {
|
||||
for (auto &iter : m_list) {
|
||||
if ((*iter).CanUpdate()) {
|
||||
|
||||
@@ -18,14 +18,12 @@ public:
|
||||
void Add(const char*, uint16, const char*, const char*, bool);
|
||||
|
||||
bool SendInfo();
|
||||
bool SendNewInfo();
|
||||
bool SendStatus();
|
||||
|
||||
bool SendPacket(ServerPacket *pack);
|
||||
bool SendAccountUpdate(ServerPacket *pack);
|
||||
bool Connected();
|
||||
bool AllConnected();
|
||||
bool MiniLogin();
|
||||
bool CanUpdate();
|
||||
size_t GetServerCount() const { return m_list.size(); }
|
||||
|
||||
|
||||
+121
-84
@@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/eqemu_logsys_fmt.h"
|
||||
#include "../common/queue.h"
|
||||
#include "../common/timer.h"
|
||||
#include "../common/eq_packet.h"
|
||||
@@ -119,18 +118,20 @@ int main(int argc, char** argv) {
|
||||
LogSys.LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
/* If eqemu_config.json does not exist - create it from conversion... */
|
||||
if (!std::ifstream("eqemu_config.json")) {
|
||||
/**
|
||||
* Auto convert json config from xml
|
||||
*/
|
||||
if (!std::ifstream("eqemu_config.json") && std::ifstream("eqemu_config.xml")) {
|
||||
CheckForServerScript(true);
|
||||
/* Run EQEmu Server script (Checks for database updates) */
|
||||
if(system("perl eqemu_server.pl convert_xml"));
|
||||
}
|
||||
else {
|
||||
/* Download EQEmu Server Maintenance Script if doesn't exist */
|
||||
CheckForServerScript();
|
||||
}
|
||||
|
||||
/* Database Version Check */
|
||||
/**
|
||||
* Database version
|
||||
*/
|
||||
uint32 Database_Version = CURRENT_BINARY_DATABASE_VERSION;
|
||||
uint32 Bots_Database_Version = CURRENT_BINARY_BOTS_DATABASE_VERSION;
|
||||
if (argc >= 2) {
|
||||
@@ -141,60 +142,74 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
// Load server configuration
|
||||
Log(Logs::General, Logs::World_Server, "Loading server configuration..");
|
||||
LogInfo("Loading server configuration");
|
||||
if (!WorldConfig::LoadConfig()) {
|
||||
Log(Logs::General, Logs::World_Server, "Loading server configuration failed.");
|
||||
LogError("Loading server configuration failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Config = WorldConfig::get();
|
||||
|
||||
Log(Logs::General, Logs::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION);
|
||||
LogInfo("CURRENT_VERSION: [{}]", CURRENT_VERSION);
|
||||
|
||||
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
|
||||
Log(Logs::General, Logs::World_Server, "Could not set signal handler");
|
||||
LogError("Could not set signal handler");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
||||
Log(Logs::General, Logs::World_Server, "Could not set signal handler");
|
||||
LogError("Could not set signal handler");
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
|
||||
Log(Logs::General, Logs::World_Server, "Could not set signal handler");
|
||||
LogError("Could not set signal handler");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
// add login server config to list
|
||||
/**
|
||||
* Add Loginserver
|
||||
*/
|
||||
if (Config->LoginCount == 0) {
|
||||
if (Config->LoginHost.length()) {
|
||||
loginserverlist.Add(Config->LoginHost.c_str(), Config->LoginPort, Config->LoginAccount.c_str(), Config->LoginPassword.c_str(), Config->LoginLegacy);
|
||||
Log(Logs::General, Logs::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort);
|
||||
loginserverlist.Add(
|
||||
Config->LoginHost.c_str(),
|
||||
Config->LoginPort,
|
||||
Config->LoginAccount.c_str(),
|
||||
Config->LoginPassword.c_str(),
|
||||
Config->LoginLegacy
|
||||
);
|
||||
LogInfo("Added loginserver [{}]:[{}]", Config->LoginHost.c_str(), Config->LoginPort);
|
||||
}
|
||||
}
|
||||
else {
|
||||
LinkedList<LoginConfig*> loginlist = Config->loginlist;
|
||||
LinkedListIterator<LoginConfig*> iterator(loginlist);
|
||||
LinkedList<LoginConfig *> loginlist = Config->loginlist;
|
||||
LinkedListIterator<LoginConfig *> iterator(loginlist);
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
loginserverlist.Add(iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort, iterator.GetData()->LoginAccount.c_str(), iterator.GetData()->LoginPassword.c_str(),
|
||||
iterator.GetData()->LoginLegacy);
|
||||
Log(Logs::General, Logs::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort);
|
||||
loginserverlist.Add(
|
||||
iterator.GetData()->LoginHost.c_str(),
|
||||
iterator.GetData()->LoginPort,
|
||||
iterator.GetData()->LoginAccount.c_str(),
|
||||
iterator.GetData()->LoginPassword.c_str(),
|
||||
iterator.GetData()->LoginLegacy
|
||||
);
|
||||
|
||||
LogInfo("Added loginserver [{}]:[{}]", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort);
|
||||
iterator.Advance();
|
||||
}
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::World_Server, "Connecting to MySQL %s@%s:%i...", Config->DatabaseUsername.c_str(), Config->DatabaseHost.c_str(), Config->DatabasePort);
|
||||
LogInfo("Connecting to MySQL [{}]@[{}]:[{}]", Config->DatabaseUsername.c_str(), Config->DatabaseHost.c_str(), Config->DatabasePort);
|
||||
if (!database.Connect(
|
||||
Config->DatabaseHost.c_str(),
|
||||
Config->DatabaseUsername.c_str(),
|
||||
Config->DatabasePassword.c_str(),
|
||||
Config->DatabaseDB.c_str(),
|
||||
Config->DatabasePort)) {
|
||||
Log(Logs::General, Logs::World_Server, "Cannot continue without a database connection.");
|
||||
LogError("Cannot continue without a database connection");
|
||||
return 1;
|
||||
}
|
||||
guild_mgr.SetDatabase(&database);
|
||||
@@ -230,7 +245,12 @@ int main(int argc, char** argv) {
|
||||
if (argc == 5) {
|
||||
if (Seperator::IsNumber(argv[4])) {
|
||||
if (atoi(argv[4]) >= 0 && atoi(argv[4]) <= 255) {
|
||||
if (database.CreateAccount(argv[2], argv[3], atoi(argv[4])) == 0) {
|
||||
std::string user;
|
||||
std::string loginserver;
|
||||
|
||||
ParseAccountString(argv[2], user, loginserver);
|
||||
|
||||
if (database.CreateAccount(argv[2], argv[3], atoi(argv[4]), loginserver.c_str(), 0) == 0) {
|
||||
std::cerr << "database.CreateAccount failed." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
@@ -298,70 +318,85 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
if (!ignore_db) {
|
||||
Log(Logs::General, Logs::World_Server, "Checking Database Conversions..");
|
||||
LogInfo("Checking Database Conversions");
|
||||
database.CheckDatabaseConversions();
|
||||
}
|
||||
Log(Logs::General, Logs::World_Server, "Loading variables..");
|
||||
LogInfo("Loading variables");
|
||||
database.LoadVariables();
|
||||
|
||||
std::string hotfix_name;
|
||||
if (database.GetVariable("hotfix_name", hotfix_name)) {
|
||||
if (!hotfix_name.empty()) {
|
||||
Log(Logs::General, Logs::Zone_Server, "Current hotfix in use: '%s'", hotfix_name.c_str());
|
||||
LogInfo("Current hotfix in use: [{}]", hotfix_name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::World_Server, "Purging expired data buckets...");
|
||||
LogInfo("Purging expired data buckets");
|
||||
database.PurgeAllDeletedDataBuckets();
|
||||
|
||||
Log(Logs::General, Logs::World_Server, "Loading zones..");
|
||||
LogInfo("Loading zones");
|
||||
database.LoadZoneNames();
|
||||
Log(Logs::General, Logs::World_Server, "Clearing groups..");
|
||||
LogInfo("Clearing groups");
|
||||
database.ClearGroup();
|
||||
Log(Logs::General, Logs::World_Server, "Clearing raids..");
|
||||
LogInfo("Clearing raids");
|
||||
database.ClearRaid();
|
||||
database.ClearRaidDetails();
|
||||
database.ClearRaidLeader();
|
||||
Log(Logs::General, Logs::World_Server, "Clearing inventory snapshots..");
|
||||
LogInfo("Clearing inventory snapshots");
|
||||
database.ClearInvSnapshots();
|
||||
Log(Logs::General, Logs::World_Server, "Loading items..");
|
||||
LogInfo("Loading items");
|
||||
if (!database.LoadItems(hotfix_name))
|
||||
Log(Logs::General, Logs::World_Server, "Error: Could not load item data. But ignoring");
|
||||
Log(Logs::General, Logs::World_Server, "Loading skill caps..");
|
||||
LogError("Error: Could not load item data. But ignoring");
|
||||
LogInfo("Loading skill caps");
|
||||
if (!database.LoadSkillCaps(std::string(hotfix_name)))
|
||||
Log(Logs::General, Logs::World_Server, "Error: Could not load skill cap data. But ignoring");
|
||||
Log(Logs::General, Logs::World_Server, "Loading guilds..");
|
||||
LogError("Error: Could not load skill cap data. But ignoring");
|
||||
|
||||
|
||||
LogInfo("Loading guilds");
|
||||
guild_mgr.LoadGuilds();
|
||||
|
||||
//rules:
|
||||
{
|
||||
if (!RuleManager::Instance()->UpdateOrphanedRules(&database)) {
|
||||
LogInfo("Failed to process 'Orphaned Rules' update operation.");
|
||||
}
|
||||
|
||||
if (!RuleManager::Instance()->UpdateInjectedRules(&database, "default")) {
|
||||
LogInfo("Failed to process 'Injected Rules' for ruleset 'default' update operation.");
|
||||
}
|
||||
|
||||
std::string tmp;
|
||||
if (database.GetVariable("RuleSet", tmp)) {
|
||||
Log(Logs::General, Logs::World_Server, "Loading rule set '%s'", tmp.c_str());
|
||||
LogInfo("Loading rule set [{}]", tmp.c_str());
|
||||
|
||||
if (!RuleManager::Instance()->LoadRules(&database, tmp.c_str(), false)) {
|
||||
Log(Logs::General, Logs::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp.c_str());
|
||||
LogInfo("Failed to load ruleset [{}], falling back to defaults", tmp.c_str());
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if (!RuleManager::Instance()->LoadRules(&database, "default", false)) {
|
||||
Log(Logs::General, Logs::World_Server, "No rule set configured, using default rules");
|
||||
LogInfo("No rule set configured, using default rules");
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::World_Server, "Loaded default rule set 'default'", tmp.c_str());
|
||||
LogInfo("Loaded default rule set [default]", tmp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::InitializeDynamicLookups();
|
||||
Log(Logs::General, Logs::World_Server, "Initialized dynamic dictionary entries");
|
||||
if (!RuleManager::Instance()->RestoreRuleNotes(&database)) {
|
||||
LogInfo("Failed to process 'Restore Rule Notes' update operation.");
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::InitializeDynamicLookups();
|
||||
LogInfo("Initialized dynamic dictionary entries");
|
||||
|
||||
if (RuleB(World, ClearTempMerchantlist)) {
|
||||
Log(Logs::General, Logs::World_Server, "Clearing temporary merchant lists..");
|
||||
LogInfo("Clearing temporary merchant lists");
|
||||
database.ClearMerchantTemp();
|
||||
}
|
||||
|
||||
RuleManager::Instance()->SaveRules(&database);
|
||||
|
||||
Log(Logs::General, Logs::World_Server, "Loading EQ time of day..");
|
||||
LogInfo("Loading EQ time of day");
|
||||
TimeOfDay_Struct eqTime;
|
||||
time_t realtime;
|
||||
eqTime = database.LoadTime(realtime);
|
||||
@@ -369,7 +404,7 @@ int main(int argc, char** argv) {
|
||||
Timer EQTimeTimer(600000);
|
||||
EQTimeTimer.Start(600000);
|
||||
|
||||
Log(Logs::General, Logs::World_Server, "Loading launcher list..");
|
||||
LogInfo("Loading launcher list");
|
||||
launcher_list.LoadList();
|
||||
|
||||
std::string tmp;
|
||||
@@ -377,37 +412,37 @@ int main(int argc, char** argv) {
|
||||
if (tmp.length() == 1 && tmp[0] == '1') {
|
||||
holdzones = true;
|
||||
}
|
||||
Log(Logs::General, Logs::World_Server, "Reboot zone modes %s", holdzones ? "ON" : "OFF");
|
||||
LogInfo("Reboot zone modes [{}]", holdzones ? "ON" : "OFF");
|
||||
|
||||
Log(Logs::General, Logs::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses());
|
||||
LogInfo("Deleted [{}] stale player corpses from database", database.DeleteStalePlayerCorpses());
|
||||
|
||||
Log(Logs::General, Logs::World_Server, "Loading adventures...");
|
||||
LogInfo("Loading adventures");
|
||||
if (!adventure_manager.LoadAdventureTemplates())
|
||||
{
|
||||
Log(Logs::General, Logs::World_Server, "Unable to load adventure templates.");
|
||||
LogInfo("Unable to load adventure templates");
|
||||
}
|
||||
|
||||
if (!adventure_manager.LoadAdventureEntries())
|
||||
{
|
||||
Log(Logs::General, Logs::World_Server, "Unable to load adventure templates.");
|
||||
LogInfo("Unable to load adventure templates");
|
||||
}
|
||||
|
||||
adventure_manager.Load();
|
||||
adventure_manager.LoadLeaderboardInfo();
|
||||
|
||||
Log(Logs::General, Logs::World_Server, "Purging expired instances");
|
||||
LogInfo("Purging expired instances");
|
||||
database.PurgeExpiredInstances();
|
||||
|
||||
Timer PurgeInstanceTimer(450000);
|
||||
PurgeInstanceTimer.Start(450000);
|
||||
|
||||
Log(Logs::General, Logs::World_Server, "Loading char create info...");
|
||||
LogInfo("Loading char create info");
|
||||
database.LoadCharacterCreateAllocations();
|
||||
database.LoadCharacterCreateCombos();
|
||||
|
||||
std::unique_ptr<EQ::Net::ConsoleServer> console;
|
||||
if (Config->TelnetEnabled) {
|
||||
Log(Logs::General, Logs::World_Server, "Console (TCP) listener started.");
|
||||
LogInfo("Console (TCP) listener started");
|
||||
console.reset(new EQ::Net::ConsoleServer(Config->TelnetIP, Config->TelnetTCPPort));
|
||||
RegisterConsoleFunctions(console);
|
||||
}
|
||||
@@ -420,18 +455,20 @@ int main(int argc, char** argv) {
|
||||
server_opts.ipv6 = false;
|
||||
server_opts.credentials = Config->SharedKey;
|
||||
server_connection->Listen(server_opts);
|
||||
Log(Logs::General, Logs::World_Server, "Server (TCP) listener started.");
|
||||
LogInfo("Server (TCP) listener started");
|
||||
|
||||
server_connection->OnConnectionIdentified("Zone", [&console](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
|
||||
LogF(Logs::General, Logs::World_Server, "New Zone Server connection from {2} at {0}:{1}",
|
||||
connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID());
|
||||
server_connection->OnConnectionIdentified(
|
||||
"Zone", [&console](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
|
||||
LogInfo("New Zone Server connection from [{2}] at [{0}:{1}]",
|
||||
connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID());
|
||||
|
||||
numzones++;
|
||||
zoneserver_list.Add(new ZoneServer(connection, console.get()));
|
||||
});
|
||||
numzones++;
|
||||
zoneserver_list.Add(new ZoneServer(connection, console.get()));
|
||||
}
|
||||
);
|
||||
|
||||
server_connection->OnConnectionRemoved("Zone", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
|
||||
LogF(Logs::General, Logs::World_Server, "Removed Zone Server connection from {0}",
|
||||
LogInfo("Removed Zone Server connection from [{0}]",
|
||||
connection->GetUUID());
|
||||
|
||||
numzones--;
|
||||
@@ -439,35 +476,35 @@ int main(int argc, char** argv) {
|
||||
});
|
||||
|
||||
server_connection->OnConnectionIdentified("Launcher", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
|
||||
LogF(Logs::General, Logs::World_Server, "New Launcher connection from {2} at {0}:{1}",
|
||||
LogInfo("New Launcher connection from [{2}] at [{0}:{1}]",
|
||||
connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID());
|
||||
|
||||
launcher_list.Add(connection);
|
||||
});
|
||||
|
||||
server_connection->OnConnectionRemoved("Launcher", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
|
||||
LogF(Logs::General, Logs::World_Server, "Removed Launcher connection from {0}",
|
||||
LogInfo("Removed Launcher connection from [{0}]",
|
||||
connection->GetUUID());
|
||||
|
||||
launcher_list.Remove(connection);
|
||||
});
|
||||
|
||||
server_connection->OnConnectionIdentified("QueryServ", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
|
||||
LogF(Logs::General, Logs::World_Server, "New Query Server connection from {2} at {0}:{1}",
|
||||
LogInfo("New Query Server connection from [{2}] at [{0}:{1}]",
|
||||
connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID());
|
||||
|
||||
QSLink.AddConnection(connection);
|
||||
});
|
||||
|
||||
server_connection->OnConnectionRemoved("QueryServ", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
|
||||
LogF(Logs::General, Logs::World_Server, "Removed Query Server connection from {0}",
|
||||
LogInfo("Removed Query Server connection from [{0}]",
|
||||
connection->GetUUID());
|
||||
|
||||
QSLink.RemoveConnection(connection);
|
||||
});
|
||||
|
||||
server_connection->OnConnectionIdentified("UCS", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
|
||||
LogF(Logs::General, Logs::World_Server, "New UCS Server connection from {2} at {0}:{1}",
|
||||
LogInfo("New UCS Server connection from [{2}] at [{0}:{1}]",
|
||||
connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID());
|
||||
|
||||
UCSLink.SetConnection(connection);
|
||||
@@ -476,7 +513,7 @@ int main(int argc, char** argv) {
|
||||
});
|
||||
|
||||
server_connection->OnConnectionRemoved("UCS", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
|
||||
LogF(Logs::General, Logs::World_Server, "Removed Query Server connection from {0}",
|
||||
LogInfo("Removed UCS Server connection from [{0}]",
|
||||
connection->GetUUID());
|
||||
|
||||
UCSLink.SetConnection(nullptr);
|
||||
@@ -485,14 +522,14 @@ int main(int argc, char** argv) {
|
||||
});
|
||||
|
||||
server_connection->OnConnectionIdentified("WebInterface", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
|
||||
LogF(Logs::General, Logs::World_Server, "New WebInterface Server connection from {2} at {0}:{1}",
|
||||
LogInfo("New WebInterface Server connection from [{2}] at [{0}:{1}]",
|
||||
connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID());
|
||||
|
||||
web_interface.AddConnection(connection);
|
||||
});
|
||||
|
||||
server_connection->OnConnectionRemoved("WebInterface", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
|
||||
LogF(Logs::General, Logs::World_Server, "Removed WebInterface Server connection from {0}",
|
||||
LogInfo("Removed WebInterface Server connection from [{0}]",
|
||||
connection->GetUUID());
|
||||
|
||||
web_interface.RemoveConnection(connection);
|
||||
@@ -522,7 +559,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
eqsm.OnNewConnection([&stream_identifier](std::shared_ptr<EQ::Net::EQStream> stream) {
|
||||
stream_identifier.AddStream(stream);
|
||||
LogF(Logs::Detail, Logs::World_Server, "New connection from IP {0}:{1}", stream->GetRemoteIP(), ntohs(stream->GetRemotePort()));
|
||||
LogInfo("New connection from IP {0}:{1}", stream->GetRemoteIP(), ntohs(stream->GetRemotePort()));
|
||||
});
|
||||
|
||||
while (RunLoops) {
|
||||
@@ -535,23 +572,23 @@ int main(int argc, char** argv) {
|
||||
//check the stream identifier for any now-identified streams
|
||||
while ((eqsi = stream_identifier.PopIdentified())) {
|
||||
//now that we know what patch they are running, start up their client object
|
||||
struct in_addr in;
|
||||
struct in_addr in{};
|
||||
in.s_addr = eqsi->GetRemoteIP();
|
||||
if (RuleB(World, UseBannedIPsTable)) { //Lieka: Check to see if we have the responsibility for blocking IPs.
|
||||
Log(Logs::Detail, Logs::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in));
|
||||
LogInfo("Checking inbound connection [{}] against BannedIPs table", inet_ntoa(in));
|
||||
if (!database.CheckBannedIPs(inet_ntoa(in))) { //Lieka: Check inbound IP against banned IP table.
|
||||
Log(Logs::Detail, Logs::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in));
|
||||
LogInfo("Connection [{}] PASSED banned IPs check. Processing connection", inet_ntoa(in));
|
||||
auto client = new Client(eqsi);
|
||||
// @merth: client->zoneattempt=0;
|
||||
client_list.Add(client);
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in));
|
||||
LogInfo("Connection from [{}] failed banned IPs check. Closing connection", inet_ntoa(in));
|
||||
eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream.
|
||||
}
|
||||
}
|
||||
if (!RuleB(World, UseBannedIPsTable)) {
|
||||
Log(Logs::Detail, Logs::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
|
||||
LogInfo("New connection from [{}]:[{}], processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
|
||||
auto client = new Client(eqsi);
|
||||
// @merth: client->zoneattempt=0;
|
||||
client_list.Add(client);
|
||||
@@ -569,9 +606,9 @@ int main(int argc, char** argv) {
|
||||
TimeOfDay_Struct tod;
|
||||
zoneserver_list.worldclock.GetCurrentEQTimeOfDay(time(0), &tod);
|
||||
if (!database.SaveTime(tod.minute, tod.hour, tod.day, tod.month, tod.year))
|
||||
Log(Logs::General, Logs::World_Server, "Failed to save eqtime.");
|
||||
LogError("Failed to save eqtime");
|
||||
else
|
||||
Log(Logs::Detail, Logs::World_Server, "EQTime successfully saved.");
|
||||
LogDebug("EQTime successfully saved");
|
||||
}
|
||||
|
||||
zoneserver_list.Process();
|
||||
@@ -590,18 +627,18 @@ int main(int argc, char** argv) {
|
||||
EQ::EventLoop::Get().Process();
|
||||
Sleep(5);
|
||||
}
|
||||
Log(Logs::General, Logs::World_Server, "World main loop completed.");
|
||||
Log(Logs::General, Logs::World_Server, "Shutting down zone connections (if any).");
|
||||
LogInfo("World main loop completed");
|
||||
LogInfo("Shutting down zone connections (if any)");
|
||||
zoneserver_list.KillAll();
|
||||
Log(Logs::General, Logs::World_Server, "Zone (TCP) listener stopped.");
|
||||
Log(Logs::General, Logs::World_Server, "Signaling HTTP service to stop...");
|
||||
LogInfo("Zone (TCP) listener stopped");
|
||||
LogInfo("Signaling HTTP service to stop");
|
||||
LogSys.CloseFileLogs();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CatchSignal(int sig_num) {
|
||||
Log(Logs::General, Logs::World_Server, "Caught signal %d", sig_num);
|
||||
LogInfo("Caught signal [{}]", sig_num);
|
||||
RunLoops = false;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@ void UCSConnection::SetConnection(std::shared_ptr<EQ::Net::ServertalkServerConne
|
||||
{
|
||||
if (Stream && Stream->Handle())
|
||||
{
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Incoming UCS Connection while we were already connected to a UCS.");
|
||||
LogInfo("Incoming UCS Connection while we were already connected to a UCS");
|
||||
Stream->Handle()->Disconnect();
|
||||
}
|
||||
|
||||
@@ -46,12 +46,12 @@ void UCSConnection::ProcessPacket(uint16 opcode, EQ::Net::Packet &p)
|
||||
}
|
||||
case ServerOP_ZAAuth:
|
||||
{
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Got authentication from UCS when they are already authenticated.");
|
||||
LogInfo("Got authentication from UCS when they are already authenticated");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Unknown ServerOPcode from UCS 0x%04x, size %d", opcode, pack->size);
|
||||
LogInfo("Unknown ServerOPcode from UCS {:#04x}, size [{}]", opcode, pack->size);
|
||||
DumpPacket(pack->pBuffer, pack->size);
|
||||
break;
|
||||
}
|
||||
|
||||
+13
-13
@@ -34,7 +34,7 @@ WorldGuildManager guild_mgr;
|
||||
|
||||
|
||||
void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) {
|
||||
Log(Logs::Detail, Logs::Guilds, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation);
|
||||
LogGuilds("Broadcasting guild refresh for [{}], changes: name=[{}], motd=[{}], rank=d, relation=[{}]", guild_id, name, motd, rank, relation);
|
||||
auto pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct));
|
||||
ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer;
|
||||
s->guild_id = guild_id;
|
||||
@@ -47,7 +47,7 @@ void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd,
|
||||
}
|
||||
|
||||
void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) {
|
||||
Log(Logs::Detail, Logs::Guilds, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id);
|
||||
LogGuilds("Broadcasting char refresh for [{}] from guild [{}] to world", charid, guild_id);
|
||||
auto pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct));
|
||||
ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer;
|
||||
s->guild_id = guild_id;
|
||||
@@ -58,7 +58,7 @@ void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, ui
|
||||
}
|
||||
|
||||
void WorldGuildManager::SendGuildDelete(uint32 guild_id) {
|
||||
Log(Logs::Detail, Logs::Guilds, "Broadcasting guild delete for guild %d to world", guild_id);
|
||||
LogGuilds("Broadcasting guild delete for guild [{}] to world", guild_id);
|
||||
auto pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct));
|
||||
ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer;
|
||||
s->guild_id = guild_id;
|
||||
@@ -71,18 +71,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
|
||||
|
||||
case ServerOP_RefreshGuild: {
|
||||
if(pack->size != sizeof(ServerGuildRefresh_Struct)) {
|
||||
Log(Logs::Detail, Logs::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct));
|
||||
LogGuilds("Received ServerOP_RefreshGuild of incorrect size [{}], expected [{}]", pack->size, sizeof(ServerGuildRefresh_Struct));
|
||||
return;
|
||||
}
|
||||
ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer;
|
||||
Log(Logs::Detail, Logs::Guilds, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change);
|
||||
LogGuilds("Received and broadcasting guild refresh for [{}], changes: name=[{}], motd=[{}], rank=d, relation=[{}]", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change);
|
||||
|
||||
//broadcast this packet to all zones.
|
||||
zoneserver_list.SendPacket(pack);
|
||||
|
||||
//preform a local refresh.
|
||||
if(!RefreshGuild(s->guild_id)) {
|
||||
Log(Logs::Detail, Logs::Guilds, "Unable to preform local refresh on guild %d", s->guild_id);
|
||||
LogGuilds("Unable to preform local refresh on guild [{}]", s->guild_id);
|
||||
//can we do anything?
|
||||
}
|
||||
|
||||
@@ -91,11 +91,11 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
|
||||
|
||||
case ServerOP_GuildCharRefresh: {
|
||||
if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) {
|
||||
Log(Logs::Detail, Logs::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct));
|
||||
LogGuilds("Received ServerOP_RefreshGuild of incorrect size [{}], expected [{}]", pack->size, sizeof(ServerGuildCharRefresh_Struct));
|
||||
return;
|
||||
}
|
||||
ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer;
|
||||
Log(Logs::Detail, Logs::Guilds, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id);
|
||||
LogGuilds("Received and broadcasting guild member refresh for char [{}] to all zones with members of guild [{}]", s->char_id, s->guild_id);
|
||||
|
||||
//preform the local update
|
||||
client_list.UpdateClientGuild(s->char_id, s->guild_id);
|
||||
@@ -110,18 +110,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
|
||||
|
||||
case ServerOP_DeleteGuild: {
|
||||
if(pack->size != sizeof(ServerGuildID_Struct)) {
|
||||
Log(Logs::Detail, Logs::Guilds, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct));
|
||||
LogGuilds("Received ServerOP_DeleteGuild of incorrect size [{}], expected [{}]", pack->size, sizeof(ServerGuildID_Struct));
|
||||
return;
|
||||
}
|
||||
ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer;
|
||||
Log(Logs::Detail, Logs::Guilds, "Received and broadcasting guild delete for guild %d", s->guild_id);
|
||||
LogGuilds("Received and broadcasting guild delete for guild [{}]", s->guild_id);
|
||||
|
||||
//broadcast this packet to all zones.
|
||||
zoneserver_list.SendPacket(pack);
|
||||
|
||||
//preform a local refresh.
|
||||
if(!LocalDeleteGuild(s->guild_id)) {
|
||||
Log(Logs::Detail, Logs::Guilds, "Unable to preform local delete on guild %d", s->guild_id);
|
||||
LogGuilds("Unable to preform local delete on guild [{}]", s->guild_id);
|
||||
//can we do anything?
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
|
||||
case ServerOP_GuildMemberUpdate: {
|
||||
if(pack->size != sizeof(ServerGuildMemberUpdate_Struct))
|
||||
{
|
||||
Log(Logs::Detail, Logs::Guilds, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct));
|
||||
LogGuilds("Received ServerOP_GuildMemberUpdate of incorrect size [{}], expected [{}]", pack->size, sizeof(ServerGuildMemberUpdate_Struct));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
|
||||
}
|
||||
|
||||
default:
|
||||
Log(Logs::Detail, Logs::Guilds, "Unknown packet 0x%x received from zone??", pack->opcode);
|
||||
LogGuilds("Unknown packet {:#04x} received from zone??", pack->opcode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -366,14 +366,14 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct*
|
||||
return false;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Status, "SoF Start zone query: %s\n", query.c_str());
|
||||
LogInfo("SoF Start zone query: [{}]\n", query.c_str());
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
printf("No start_zones entry in database, using defaults\n");
|
||||
isTitanium ? SetTitaniumDefaultStartZone(in_pp, in_cc) : SetSoFDefaultStartZone(in_pp, in_cc);
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::Status, "Found starting location in start_zones");
|
||||
LogInfo("Found starting location in start_zones");
|
||||
auto row = results.begin();
|
||||
in_pp->x = atof(row[0]);
|
||||
in_pp->y = atof(row[1]);
|
||||
@@ -512,7 +512,7 @@ void WorldDatabase::GetLauncherList(std::vector<std::string> &rl) {
|
||||
const std::string query = "SELECT name FROM launcher";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::General, Logs::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str());
|
||||
LogError("WorldDatabase::GetLauncherList: {}", results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -526,7 +526,7 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level)
|
||||
std::string query = StringFormat("SELECT level FROM character_data WHERE name = '%s'", name);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::General, Logs::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str());
|
||||
LogError("WorldDatabase::GetCharacterLevel: {}", results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -94,7 +94,7 @@ void ZSList::KillAll() {
|
||||
void ZSList::Process() {
|
||||
|
||||
if (shutdowntimer && shutdowntimer->Check()) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)");
|
||||
LogInfo("Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)");
|
||||
auto pack2 = new ServerPacket;
|
||||
pack2->opcode = ServerOP_ShutdownAll;
|
||||
pack2->size = 0;
|
||||
@@ -432,6 +432,7 @@ void ZSList::SendChannelMessageRaw(const char* from, const char* to, uint8 chan_
|
||||
}
|
||||
|
||||
scm->language = language;
|
||||
scm->lang_skill = 100;
|
||||
scm->chan_num = chan_num;
|
||||
strcpy(&scm->message[0], message);
|
||||
|
||||
@@ -570,7 +571,7 @@ void ZSList::RebootZone(const char* ip1, uint16 port, const char* ip2, uint32 sk
|
||||
s->port = port;
|
||||
s->zoneid = zoneid;
|
||||
if (zoneid != 0)
|
||||
Log(Logs::Detail, Logs::World_Server, "Rebooting static zone with the ID of: %i", zoneid);
|
||||
LogInfo("Rebooting static zone with the ID of: [{}]", zoneid);
|
||||
tmp[z]->SendPacket(pack);
|
||||
delete pack;
|
||||
safe_delete_array(tmp);
|
||||
|
||||
+36
-37
@@ -90,7 +90,7 @@ bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
|
||||
char* longname;
|
||||
|
||||
if (iZoneID)
|
||||
Log(Logs::Detail, Logs::World_Server, "Setting to '%s' (%d:%d)%s", (zn) ? zn : "", iZoneID, iInstanceID,
|
||||
Log(Logs::Detail, Logs::WorldServer, "Setting to '%s' (%d:%d)%s", (zn) ? zn : "", iZoneID, iInstanceID,
|
||||
iStaticZone ? " (Static)" : "");
|
||||
|
||||
zone_server_zone_id = iZoneID;
|
||||
@@ -541,10 +541,10 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
|
||||
RezzPlayer_Struct* sRezz = (RezzPlayer_Struct*)pack->pBuffer;
|
||||
if (zoneserver_list.SendPacket(pack)) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Sent Rez packet for %s", sRezz->rez.your_name);
|
||||
LogInfo("Sent Rez packet for [{}]", sRezz->rez.your_name);
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::World_Server, "Could not send Rez packet for %s", sRezz->rez.your_name);
|
||||
LogInfo("Could not send Rez packet for [{}]", sRezz->rez.your_name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -589,21 +589,21 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
ServerConnectInfo* sci = (ServerConnectInfo*)p.pBuffer;
|
||||
sci->port = client_port;
|
||||
SendPacket(&p);
|
||||
Log(Logs::Detail, Logs::World_Server, "Auto zone port configuration. Telling zone to use port %d", client_port);
|
||||
LogInfo("Auto zone port configuration. Telling zone to use port [{}]", client_port);
|
||||
}
|
||||
else {
|
||||
client_port = sci->port;
|
||||
Log(Logs::Detail, Logs::World_Server, "Zone specified port %d.", client_port);
|
||||
LogInfo("Zone specified port [{}]", client_port);
|
||||
}
|
||||
|
||||
if (sci->address[0]) {
|
||||
strn0cpy(client_address, sci->address, 250);
|
||||
Log(Logs::Detail, Logs::World_Server, "Zone specified address %s.", sci->address);
|
||||
LogInfo("Zone specified address [{}]", sci->address);
|
||||
}
|
||||
|
||||
if (sci->local_address[0]) {
|
||||
strn0cpy(client_local_address, sci->local_address, 250);
|
||||
Log(Logs::Detail, Logs::World_Server, "Zone specified local address %s.", sci->address);
|
||||
LogInfo("Zone specified local address [{}]", sci->address);
|
||||
}
|
||||
|
||||
if (sci->process_id) {
|
||||
@@ -617,7 +617,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
const LaunchName_Struct* ln = (const LaunchName_Struct*)pack->pBuffer;
|
||||
launcher_name = ln->launcher_name;
|
||||
launched_name = ln->zone_name;
|
||||
Log(Logs::Detail, Logs::World_Server, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str());
|
||||
LogInfo("Zone started with name [{}] by launcher [{}]", launched_name.c_str(), launcher_name.c_str());
|
||||
break;
|
||||
}
|
||||
case ServerOP_ShutdownAll: {
|
||||
@@ -700,12 +700,11 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
if (WorldConfig::get()->UpdateStats)
|
||||
client = client_list.FindCharacter(ztz->name);
|
||||
|
||||
Log(Logs::Detail, Logs::World_Server, "ZoneToZone request for %s current zone %d req zone %d\n",
|
||||
ztz->name, ztz->current_zone_id, ztz->requested_zone_id);
|
||||
LogInfo("ZoneToZone request for [{}] current zone [{}] req zone [{}]", ztz->name, ztz->current_zone_id, ztz->requested_zone_id);
|
||||
|
||||
/* This is a request from the egress zone */
|
||||
if (GetZoneID() == ztz->current_zone_id && GetInstanceID() == ztz->current_instance_id) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Processing ZTZ for egress from zone for client %s\n", ztz->name);
|
||||
LogInfo("Processing ZTZ for egress from zone for client [{}]", ztz->name);
|
||||
|
||||
if (ztz->admin < 80 && ztz->ignorerestrictions < 2 && zoneserver_list.IsZoneLocked(ztz->requested_zone_id)) {
|
||||
ztz->response = 0;
|
||||
@@ -723,20 +722,20 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
|
||||
/* Zone was already running*/
|
||||
if (ingress_server) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Found a zone already booted for %s\n", ztz->name);
|
||||
LogInfo("Found a zone already booted for [{}]", ztz->name);
|
||||
ztz->response = 1;
|
||||
}
|
||||
/* Boot the Zone*/
|
||||
else {
|
||||
int server_id;
|
||||
if ((server_id = zoneserver_list.TriggerBootup(ztz->requested_zone_id, ztz->requested_instance_id))) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Successfully booted a zone for %s\n", ztz->name);
|
||||
LogInfo("Successfully booted a zone for [{}]", ztz->name);
|
||||
// bootup successful, ready to rock
|
||||
ztz->response = 1;
|
||||
ingress_server = zoneserver_list.FindByID(server_id);
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::World_Server, "FAILED to boot a zone for %s\n", ztz->name);
|
||||
LogError("failed to boot a zone for [{}]", ztz->name);
|
||||
// bootup failed, send back error code 0
|
||||
ztz->response = 0;
|
||||
}
|
||||
@@ -751,7 +750,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
/* Response from Ingress server, route back to egress */
|
||||
else {
|
||||
|
||||
Log(Logs::Detail, Logs::World_Server, "Processing ZTZ for ingress to zone for client %s\n", ztz->name);
|
||||
LogInfo("Processing ZTZ for ingress to zone for client [{}]", ztz->name);
|
||||
ZoneServer *egress_server = nullptr;
|
||||
if (ztz->current_instance_id > 0) {
|
||||
egress_server = zoneserver_list.FindByInstanceID(ztz->current_instance_id);
|
||||
@@ -769,7 +768,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
}
|
||||
case ServerOP_ClientList: {
|
||||
if (pack->size != sizeof(ServerClientList_Struct)) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Wrong size on ServerOP_ClientList. Got: %d, Expected: %d", pack->size, sizeof(ServerClientList_Struct));
|
||||
LogInfo("Wrong size on ServerOP_ClientList. Got: [{}], Expected: [{}]", pack->size, sizeof(ServerClientList_Struct));
|
||||
break;
|
||||
}
|
||||
client_list.ClientUpdate(this, (ServerClientList_Struct*)pack->pBuffer);
|
||||
@@ -778,7 +777,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
case ServerOP_ClientListKA: {
|
||||
ServerClientListKeepAlive_Struct* sclka = (ServerClientListKeepAlive_Struct*)pack->pBuffer;
|
||||
if (pack->size < 4 || pack->size != 4 + (4 * sclka->numupdates)) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d", pack->size, (4 + (4 * sclka->numupdates)));
|
||||
LogInfo("Wrong size on ServerOP_ClientListKA. Got: [{}], Expected: [{}]", pack->size, (4 + (4 * sclka->numupdates)));
|
||||
break;
|
||||
}
|
||||
client_list.CLEKeepAlive(sclka->numupdates, sclka->wid);
|
||||
@@ -893,7 +892,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
}
|
||||
case ServerOP_GMGoto: {
|
||||
if (pack->size != sizeof(ServerGMGoto_Struct)) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d", pack->size, sizeof(ServerGMGoto_Struct));
|
||||
LogInfo("Wrong size on ServerOP_GMGoto. Got: [{}], Expected: [{}]", pack->size, sizeof(ServerGMGoto_Struct));
|
||||
break;
|
||||
}
|
||||
ServerGMGoto_Struct* gmg = (ServerGMGoto_Struct*)pack->pBuffer;
|
||||
@@ -913,7 +912,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
}
|
||||
case ServerOP_Lock: {
|
||||
if (pack->size != sizeof(ServerLock_Struct)) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Wrong size on ServerOP_Lock. Got: %d, Expected: %d", pack->size, sizeof(ServerLock_Struct));
|
||||
LogInfo("Wrong size on ServerOP_Lock. Got: [{}], Expected: [{}]", pack->size, sizeof(ServerLock_Struct));
|
||||
break;
|
||||
}
|
||||
ServerLock_Struct* slock = (ServerLock_Struct*)pack->pBuffer;
|
||||
@@ -938,7 +937,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
}
|
||||
case ServerOP_Motd: {
|
||||
if (pack->size != sizeof(ServerMotd_Struct)) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Wrong size on ServerOP_Motd. Got: %d, Expected: %d", pack->size, sizeof(ServerMotd_Struct));
|
||||
LogInfo("Wrong size on ServerOP_Motd. Got: [{}], Expected: [{}]", pack->size, sizeof(ServerMotd_Struct));
|
||||
break;
|
||||
}
|
||||
ServerMotd_Struct* smotd = (ServerMotd_Struct*)pack->pBuffer;
|
||||
@@ -949,7 +948,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
}
|
||||
case ServerOP_Uptime: {
|
||||
if (pack->size != sizeof(ServerUptime_Struct)) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Wrong size on ServerOP_Uptime. Got: %d, Expected: %d", pack->size, sizeof(ServerUptime_Struct));
|
||||
LogInfo("Wrong size on ServerOP_Uptime. Got: [{}], Expected: [{}]", pack->size, sizeof(ServerUptime_Struct));
|
||||
break;
|
||||
}
|
||||
ServerUptime_Struct* sus = (ServerUptime_Struct*)pack->pBuffer;
|
||||
@@ -968,7 +967,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
break;
|
||||
}
|
||||
case ServerOP_GetWorldTime: {
|
||||
Log(Logs::Detail, Logs::World_Server, "Broadcasting a world time update");
|
||||
LogInfo("Broadcasting a world time update");
|
||||
auto pack = new ServerPacket;
|
||||
|
||||
pack->opcode = ServerOP_SyncWorldTime;
|
||||
@@ -987,17 +986,17 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
break;
|
||||
}
|
||||
case ServerOP_SetWorldTime: {
|
||||
Log(Logs::Detail, Logs::World_Server, "Received SetWorldTime");
|
||||
LogNetcode("Received SetWorldTime");
|
||||
eqTimeOfDay* newtime = (eqTimeOfDay*)pack->pBuffer;
|
||||
zoneserver_list.worldclock.SetCurrentEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime);
|
||||
Log(Logs::Detail, Logs::World_Server, "New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime);
|
||||
LogInfo("New time = [{}]-[{}]-[{}] [{}]:[{}] ([{}])\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime);
|
||||
database.SaveTime((int)newtime->start_eqtime.minute, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.day, newtime->start_eqtime.month, newtime->start_eqtime.year);
|
||||
zoneserver_list.SendTimeSync();
|
||||
break;
|
||||
}
|
||||
case ServerOP_IPLookup: {
|
||||
if (pack->size < sizeof(ServerGenericWorldQuery_Struct)) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d", pack->size, sizeof(ServerGenericWorldQuery_Struct));
|
||||
LogInfo("Wrong size on ServerOP_IPLookup. Got: [{}], Expected (at least): [{}]", pack->size, sizeof(ServerGenericWorldQuery_Struct));
|
||||
break;
|
||||
}
|
||||
ServerGenericWorldQuery_Struct* sgwq = (ServerGenericWorldQuery_Struct*)pack->pBuffer;
|
||||
@@ -1009,7 +1008,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
}
|
||||
case ServerOP_LockZone: {
|
||||
if (pack->size < sizeof(ServerLockZone_Struct)) {
|
||||
Log(Logs::Detail, Logs::World_Server, "Wrong size on ServerOP_LockZone. Got: %d, Expected: %d", pack->size, sizeof(ServerLockZone_Struct));
|
||||
LogInfo("Wrong size on ServerOP_LockZone. Got: [{}], Expected: [{}]", pack->size, sizeof(ServerLockZone_Struct));
|
||||
break;
|
||||
}
|
||||
ServerLockZone_Struct* s = (ServerLockZone_Struct*)pack->pBuffer;
|
||||
@@ -1087,7 +1086,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
zs->SendPacket(pack);
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id);
|
||||
LogInfo("Unable to locate zone record for instance id [{}] in zoneserver list for ServerOP_Consent_Response operation", s->instance_id);
|
||||
}
|
||||
safe_delete(pack);
|
||||
}
|
||||
@@ -1112,7 +1111,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
zs->SendPacket(pack);
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id);
|
||||
LogInfo("Unable to locate zone record for zone id [{}] in zoneserver list for ServerOP_Consent_Response operation", s->zone_id);
|
||||
}
|
||||
safe_delete(pack);
|
||||
}
|
||||
@@ -1132,7 +1131,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
zs->SendPacket(pack);
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id);
|
||||
LogInfo("Unable to locate zone record for zone id [{}] in zoneserver list for ServerOP_Consent_Response operation", s->zone_id);
|
||||
}
|
||||
safe_delete(pack);
|
||||
}
|
||||
@@ -1151,7 +1150,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
zs->SendPacket(pack);
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id);
|
||||
LogInfo("Unable to locate zone record for instance id [{}] in zoneserver list for ServerOP_Consent_Response operation", s->instance_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1161,7 +1160,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
zs->SendPacket(pack);
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id);
|
||||
LogInfo("Unable to locate zone record for zone id [{}] in zoneserver list for ServerOP_Consent_Response operation", s->zone_id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1263,7 +1262,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
|
||||
case ServerOP_LSAccountUpdate:
|
||||
{
|
||||
Log(Logs::Detail, Logs::World_Server, "Received ServerOP_LSAccountUpdate packet from zone");
|
||||
LogNetcode("Received ServerOP_LSAccountUpdate packet from zone");
|
||||
loginserverlist.SendAccountUpdate(pack);
|
||||
break;
|
||||
}
|
||||
@@ -1326,14 +1325,14 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
case ServerOP_ChangeSharedMem: {
|
||||
std::string hotfix_name = std::string((char*)pack->pBuffer);
|
||||
|
||||
Log(Logs::General, Logs::World_Server, "Loading items...");
|
||||
LogInfo("Loading items");
|
||||
if (!database.LoadItems(hotfix_name)) {
|
||||
Log(Logs::General, Logs::World_Server, "Error: Could not load item data. But ignoring");
|
||||
LogInfo("Error: Could not load item data. But ignoring");
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::World_Server, "Loading skill caps...");
|
||||
LogInfo("Loading skill caps");
|
||||
if (!database.LoadSkillCaps(hotfix_name)) {
|
||||
Log(Logs::General, Logs::World_Server, "Error: Could not load skill cap data. But ignoring");
|
||||
LogInfo("Error: Could not load skill cap data. But ignoring");
|
||||
}
|
||||
|
||||
zoneserver_list.SendPacket(pack);
|
||||
@@ -1352,7 +1351,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
}
|
||||
default:
|
||||
{
|
||||
Log(Logs::Detail, Logs::World_Server, "Unknown ServerOPcode from zone 0x%04x, size %d", pack->opcode, pack->size);
|
||||
LogInfo("Unknown ServerOPcode from zone {:#04x}, size [{}]", pack->opcode, pack->size);
|
||||
DumpPacket(pack->pBuffer, pack->size);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user