mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-01 19:56:38 +00:00
Headless client work
This commit is contained in:
+27
-8
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user