Merge fixes

This commit is contained in:
Akkadius 2019-07-03 01:40:36 -05:00
parent 4e7bcd86ff
commit ea02042ace
5 changed files with 268 additions and 71 deletions

View File

@ -27,7 +27,7 @@ extern bool run_server;
ClientManager::ClientManager() ClientManager::ClientManager()
{ {
int titanium_port = server.config.GetVariableInt("Titanium", "port", 5998); int titanium_port = server.config.GetVariableInt("Titanium", "port", 5998);
EQ::Net::EQStreamManagerOptions titanium_opts(titanium_port, false, false); EQStreamManagerInterfaceOptions titanium_opts(titanium_port, false, false);
titanium_stream = new EQ::Net::EQStreamManager(titanium_opts); titanium_stream = new EQ::Net::EQStreamManager(titanium_opts);
titanium_ops = new RegularOpcodeManager; titanium_ops = new RegularOpcodeManager;
if (!titanium_ops->LoadOpcodes(server.config.GetVariableString("Titanium", "opcodes", "login_opcodes.conf").c_str())) if (!titanium_ops->LoadOpcodes(server.config.GetVariableString("Titanium", "opcodes", "login_opcodes.conf").c_str()))
@ -45,7 +45,7 @@ ClientManager::ClientManager()
}); });
int sod_port = server.config.GetVariableInt("SoD", "port", 5999); int sod_port = server.config.GetVariableInt("SoD", "port", 5999);
EQ::Net::EQStreamManagerOptions sod_opts(sod_port, false, false); EQStreamManagerInterfaceOptions sod_opts(sod_port, false, false);
sod_stream = new EQ::Net::EQStreamManager(sod_opts); sod_stream = new EQ::Net::EQStreamManager(sod_opts);
sod_ops = new RegularOpcodeManager; sod_ops = new RegularOpcodeManager;
if (!sod_ops->LoadOpcodes(server.config.GetVariableString("SoD", "opcodes", "login_opcodes.conf").c_str())) if (!sod_ops->LoadOpcodes(server.config.GetVariableString("SoD", "opcodes", "login_opcodes.conf").c_str()))

View File

@ -44,7 +44,8 @@ extern LoginServerList loginserverlist;
struct EQ::Net::ConsoleLoginStatus CheckLogin(const std::string &username, const std::string &password) struct EQ::Net::ConsoleLoginStatus CheckLogin(const std::string &username, const std::string &password)
{ {
struct EQ::Net::ConsoleLoginStatus ret; struct EQ::Net::ConsoleLoginStatus ret;
std::string prefix = "eqemu";
std::string prefix = "eqemu";
std::string raw_user = ""; std::string raw_user = "";
ParseAccountString(username, raw_user, prefix); ParseAccountString(username, raw_user, prefix);
@ -717,25 +718,17 @@ void ConsoleSetPass(
connection->SendLine("Format: setpass accountname password"); connection->SendLine("Format: setpass accountname password");
} }
else { else {
std::string prefix = "eqemu"; std::string prefix = "eqemu";
std::string raw_user = ""; std::string raw_user = "";
ParseAccountString(args[0], raw_user, prefix); ParseAccountString(args[0], raw_user, prefix);
int16 tmpstatus = 0; int16 tmpstatus = 0;
uint32 tmpid = database.GetAccountIDByName(raw_user.c_str(), prefix.c_str(), &tmpstatus); uint32 tmpid = database.GetAccountIDByName(raw_user.c_str(), prefix.c_str(), &tmpstatus);
if (!tmpid)
if (!tmpid) {
connection->SendLine("Error: Account not found"); 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.");
}
} }
} }
@ -879,37 +872,242 @@ void ConsoleQuit(
/** /**
* @param console * @param console
*/ */
void RegisterConsoleFunctions(std::unique_ptr<EQ::Net::ConsoleServer>& console) void RegisterConsoleFunctions(std::unique_ptr<EQ::Net::ConsoleServer> &console)
{ {
console->RegisterLogin(std::bind(CheckLogin, std::placeholders::_1, std::placeholders::_2)); console->RegisterLogin(std::bind(CheckLogin, std::placeholders::_1, std::placeholders::_2));
console->RegisterCall("acceptmessages", 50, "acceptmessages [on/off]", std::bind(ConsoleAcceptMessages, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); console->RegisterCall(
console->RegisterCall("api", 200, "api", std::bind(ConsoleApi, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); "acceptmessages",
console->RegisterCall("auction", 50, "auction [message]", std::bind(ConsoleAuction, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); 50,
console->RegisterCall("broadcast", 50, "broadcast [message]", std::bind(ConsoleBroadcast, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); "acceptmessages [on/off]",
console->RegisterCall("echo", 50, "echo [on/off]", std::bind(ConsoleNull, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); std::bind(
console->RegisterCall("emote", 50, "emote [zonename or charname or world] [type] [message]", std::bind(ConsoleEmote, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); ConsoleAcceptMessages,
console->RegisterCall("flag", 200, "flag [status] [accountname]", std::bind(ConsoleFlag, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); std::placeholders::_1,
console->RegisterCall("gmsay", 50, "gmsay [message]", std::bind(ConsoleGMSay, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); std::placeholders::_2,
console->RegisterCall("iplookup", 50, "IPLookup [name]", std::bind(ConsoleIpLookup, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); std::placeholders::_3
console->RegisterCall("kick", 150, "kick [charname]", std::bind(ConsoleKick, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); ));
console->RegisterCall("lock", 150, "lock", std::bind(ConsoleLock, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); console->RegisterCall(
console->RegisterCall("lsreconnect", 50, "LSReconnect", std::bind(ConsoleNull, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); "api",
console->RegisterCall("md5", 50, "md5", std::bind(ConsoleMd5, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); 200,
console->RegisterCall("ooc", 50, "ooc [message]", std::bind(ConsoleOOC, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); "api",
console->RegisterCall("reloadworld", 200, "reloadworld", std::bind(ConsoleReloadWorld, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); std::bind(ConsoleApi, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall("setpass", 200, "setpass [accountname] [newpass]", std::bind(ConsoleSetPass, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); console->RegisterCall(
console->RegisterCall("signalcharbyname", 50, "signalcharbyname charname ID", std::bind(ConsoleSignalCharByName, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); "auction",
console->RegisterCall("tell", 50, "tell [name] [message]", std::bind(ConsoleTell, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); 50,
console->RegisterCall("unlock", 150, "unlock", std::bind(ConsoleUnlock, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); "auction [message]",
console->RegisterCall("uptime", 50, "uptime [zoneID#]", std::bind(ConsoleUptime, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); std::bind(
console->RegisterCall("version", 50, "version", std::bind(ConsoleVersion, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); ConsoleAuction,
console->RegisterCall("who", 50, "who", std::bind(ConsoleWho, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); std::placeholders::_1,
console->RegisterCall("whoami", 50, "whoami", std::bind(ConsoleWhoami, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); std::placeholders::_2,
console->RegisterCall("worldshutdown", 200, "worldshutdown", std::bind(ConsoleWorldShutdown, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); std::placeholders::_3
console->RegisterCall("zonebootup", 150, "zonebootup [ZoneServerID] [zonename]", std::bind(ConsoleZoneBootup, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); ));
console->RegisterCall("zonelock", 150, "zonelock [list|lock|unlock] [zonename]", std::bind(ConsoleZoneLock, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); console->RegisterCall(
console->RegisterCall("zoneshutdown", 150, "zoneshutdown [zonename or ZoneServerID]", std::bind(ConsoleZoneShutdown, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); "broadcast",
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)); 50,
console->RegisterCall("quit", 50, "quit", std::bind(ConsoleQuit, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); "broadcast [message]",
console->RegisterCall("exit", 50, "exit", std::bind(ConsoleQuit, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); std::bind(
ConsoleBroadcast,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
console->RegisterCall(
"echo",
50,
"echo [on/off]",
std::bind(ConsoleNull, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall(
"emote",
50,
"emote [zonename or charname or world] [type] [message]",
std::bind(ConsoleEmote, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall(
"flag",
200,
"flag [status] [accountname]",
std::bind(ConsoleFlag, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall(
"gmsay",
50,
"gmsay [message]",
std::bind(ConsoleGMSay, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall(
"iplookup",
50,
"IPLookup [name]",
std::bind(
ConsoleIpLookup,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
console->RegisterCall(
"kick",
150,
"kick [charname]",
std::bind(ConsoleKick, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall(
"lock",
150,
"lock",
std::bind(ConsoleLock, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall(
"lsreconnect",
50,
"LSReconnect",
std::bind(ConsoleNull, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall(
"md5",
50,
"md5",
std::bind(ConsoleMd5, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall(
"ooc",
50,
"ooc [message]",
std::bind(ConsoleOOC, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall(
"reloadworld",
200,
"reloadworld",
std::bind(
ConsoleReloadWorld,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
console->RegisterCall(
"setpass",
200,
"setpass [accountname] [newpass]",
std::bind(
ConsoleSetPass,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
console->RegisterCall(
"signalcharbyname",
50,
"signalcharbyname charname ID",
std::bind(
ConsoleSignalCharByName,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
console->RegisterCall(
"tell",
50,
"tell [name] [message]",
std::bind(ConsoleTell, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall(
"unlock",
150,
"unlock",
std::bind(
ConsoleUnlock,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
console->RegisterCall(
"uptime",
50,
"uptime [zoneID#]",
std::bind(
ConsoleUptime,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
console->RegisterCall(
"version",
50,
"version",
std::bind(
ConsoleVersion,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
console->RegisterCall(
"who",
50,
"who",
std::bind(ConsoleWho, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall(
"whoami",
50,
"whoami",
std::bind(
ConsoleWhoami,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
console->RegisterCall(
"worldshutdown",
200,
"worldshutdown",
std::bind(
ConsoleWorldShutdown,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
console->RegisterCall(
"zonebootup",
150,
"zonebootup [ZoneServerID] [zonename]",
std::bind(
ConsoleZoneBootup,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
console->RegisterCall(
"zonelock",
150,
"zonelock [list|lock|unlock] [zonename]",
std::bind(
ConsoleZoneLock,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
console->RegisterCall(
"zoneshutdown",
150,
"zoneshutdown [zonename or ZoneServerID]",
std::bind(
ConsoleZoneShutdown,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
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));
} }

View File

@ -361,19 +361,3 @@ void LoginServer::SendAccountUpdate(ServerPacket* pack) {
SendPacket(pack); SendPacket(pack);
} }
} }
bool LoginServer::Connected()
{
if (IsLegacy) {
if (legacy_client) {
return legacy_client->Connected();
}
}
else {
if (client) {
return client->Connected();
}
}
return false;
}

View File

@ -35,14 +35,12 @@ public:
~LoginServer(); ~LoginServer();
bool Connect(); bool Connect();
void SendInfo(); void SendInfo();
void SendStatus(); void SendStatus();
void SendPacket(ServerPacket* pack); void SendPacket(ServerPacket* pack);
void SendAccountUpdate(ServerPacket* pack); void SendAccountUpdate(ServerPacket* pack);
bool Connected() { return IsLegacy ? legacy_client->Connected() : client->Connected(); } bool Connected() { return IsLegacy ? legacy_client->Connected() : client->Connected(); }
bool MiniLogin() { return minilogin; }
bool CanUpdate() { return CanAccountUpdate; } bool CanUpdate() { return CanAccountUpdate; }
private: private:

View File

@ -34,13 +34,25 @@
extern Zone *zone; extern Zone *zone;
EQ::Net::WebsocketLoginStatus /**
CheckLogin(EQ::Net::WebsocketServerConnection *connection, const std::string &username, const std::string &password) * @param connection
* @param username
* @param password
* @return
*/
EQ::Net::WebsocketLoginStatus CheckLogin(
EQ::Net::WebsocketServerConnection *connection,
const std::string &username,
const std::string &password
)
{ {
EQ::Net::WebsocketLoginStatus ret; EQ::Net::WebsocketLoginStatus ret;
ret.logged_in = false; ret.logged_in = false;
ret.account_id = database.CheckLogin(username.c_str(), password.c_str());
std::string prefix = "eqemu";
ret.account_id = database.CheckLogin(username.c_str(), password.c_str(), prefix.c_str());
if (ret.account_id == 0) { if (ret.account_id == 0) {
return ret; return ret;
@ -54,6 +66,11 @@ CheckLogin(EQ::Net::WebsocketServerConnection *connection, const std::string &us
return ret; return ret;
} }
/**
* @param connection
* @param params
* @return
*/
Json::Value ApiGetPacketStatistics(EQ::Net::WebsocketServerConnection *connection, Json::Value params) Json::Value ApiGetPacketStatistics(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
{ {
if (zone->GetZoneID() == 0) { if (zone->GetZoneID() == 0) {