Headless client work

This commit is contained in:
KimLS
2016-11-15 21:30:43 -08:00
parent 84367e1f77
commit c86d4be1ae
15 changed files with 7798 additions and 64 deletions
+27 -8
View File
@@ -2,10 +2,10 @@
#include "../common/eqemu_logsys.h"
#include "../common/crash.h"
#include "../common/platform.h"
#include "../common/json_config.h"
#include <thread>
#include "login.h"
#include "world.h"
#include "eq.h"
EQEmuLogSys Log;
@@ -16,12 +16,31 @@ int main() {
Log.OutF(Logs::General, Logs::Headless_Client, "Starting EQEmu Headless Client.");
std::unique_ptr<LoginConnection> login_connection(new LoginConnection("testuser", "testpass", "127.0.0.1", 5999, "KLS Test"));
std::unique_ptr<WorldConnection> world_connection;
login_connection->OnCanLoginToWorld([&](const WorldServer &ws, const std::string &key, uint32_t dbid) {
Log.OutF(Logs::General, Logs::Headless_Client, "Connect to world server {1} - {0}:9000", ws.address, ws.long_name);
world_connection.reset(new WorldConnection(key, dbid, ws.address));
});
auto config = EQ::JsonConfigFile::Load("hc.json");
auto config_handle = config.RawHandle();
std::vector<std::unique_ptr<EverQuest>> eq_list;
try {
for (int i = 0; i < config_handle.size(); ++i) {
auto c = config_handle[i];
auto host = c["host"].asString();
auto port = c["port"].asInt();
auto user = c["user"].asString();
auto pass = c["pass"].asString();
auto server = c["server"].asString();
auto character = c["character"].asString();
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting to {0}:{1} as Account '{2}' to Server '{3}' under Character '{4}'", host, port, user, server, character);
eq_list.push_back(std::unique_ptr<EverQuest>(new EverQuest(host, port, user, pass, server, character)));
}
}
catch (std::exception &ex) {
Log.OutF(Logs::General, Logs::Headless_Client, "Error parsing config file: {0}", ex.what());
return 0;
}
for (;;) {
EQ::EventLoop::Get().Process();