motd. Can't get simpler than that.
This commit is contained in:
parent
eba21d9108
commit
3e1f9825ca
@ -9,6 +9,7 @@ ms_port=27016
|
|||||||
port=27016
|
port=27016
|
||||||
server_description=This is a placeholder server description. Tell the world of AO who you are here!
|
server_description=This is a placeholder server description. Tell the world of AO who you are here!
|
||||||
server_name=An Unnamed Server
|
server_name=An Unnamed Server
|
||||||
|
motd=Sample MOTD.
|
||||||
webao_enable=true
|
webao_enable=true
|
||||||
webao_port=27017
|
webao_port=27017
|
||||||
auth=simple
|
auth=simple
|
||||||
|
@ -183,6 +183,7 @@ class AOClient : public QObject {
|
|||||||
//// Commands
|
//// Commands
|
||||||
void cmdDefault(int argc, QStringList argv);
|
void cmdDefault(int argc, QStringList argv);
|
||||||
void cmdHelp(int argc, QStringList argv);
|
void cmdHelp(int argc, QStringList argv);
|
||||||
|
void cmdMOTD(int argc, QStringList argv);
|
||||||
// Authentication
|
// Authentication
|
||||||
void cmdLogin(int argc, QStringList argv);
|
void cmdLogin(int argc, QStringList argv);
|
||||||
void cmdChangeAuth(int argc, QStringList argv);
|
void cmdChangeAuth(int argc, QStringList argv);
|
||||||
@ -298,7 +299,8 @@ class AOClient : public QObject {
|
|||||||
{"forcepos", {ACLFlags.value("CM"), 2, &AOClient::cmdForcePos}},
|
{"forcepos", {ACLFlags.value("CM"), 2, &AOClient::cmdForcePos}},
|
||||||
{"currentmusic", {ACLFlags.value("NONE"), 0, &AOClient::cmdCurrentMusic}},
|
{"currentmusic", {ACLFlags.value("NONE"), 0, &AOClient::cmdCurrentMusic}},
|
||||||
{"pm", {ACLFlags.value("NONE"), 2, &AOClient::cmdPM}},
|
{"pm", {ACLFlags.value("NONE"), 2, &AOClient::cmdPM}},
|
||||||
{"evidence_mod", {ACLFlags.value("CHANGE_EVI_MOD"), 1, &AOClient::cmdEvidenceMod}}
|
{"evidence_mod", {ACLFlags.value("CHANGE_EVI_MOD"), 1, &AOClient::cmdEvidenceMod}},
|
||||||
|
{"motd", {ACLFlags.value("NONE"), 0, &AOClient::cmdMOTD}}
|
||||||
};
|
};
|
||||||
|
|
||||||
QString partial_packet;
|
QString partial_packet;
|
||||||
|
@ -52,6 +52,7 @@ class Server : public QObject {
|
|||||||
void broadcast(AOPacket packet, int area_index);
|
void broadcast(AOPacket packet, int area_index);
|
||||||
void broadcast(AOPacket packet);
|
void broadcast(AOPacket packet);
|
||||||
QString getServerName();
|
QString getServerName();
|
||||||
|
QString getMOTD();
|
||||||
int getDiceValue(QString value_type);
|
int getDiceValue(QString value_type);
|
||||||
int getCharID(QString char_name);
|
int getCharID(QString char_name);
|
||||||
|
|
||||||
|
@ -857,6 +857,12 @@ void AOClient::cmdPM(int arc, QStringList argv)
|
|||||||
target_client->sendServerMessage("Message from " + ooc_name + " (" + QString::number(id) + "): " + message);
|
target_client->sendServerMessage("Message from " + ooc_name + " (" + QString::number(id) + "): " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AOClient::cmdMOTD(int argc, QStringList argv)
|
||||||
|
{
|
||||||
|
QString MOTD = server->getMOTD();
|
||||||
|
sendServerMessage(MOTD);
|
||||||
|
}
|
||||||
|
|
||||||
QStringList AOClient::buildAreaList(int area_idx)
|
QStringList AOClient::buildAreaList(int area_idx)
|
||||||
{
|
{
|
||||||
QStringList entries;
|
QStringList entries;
|
||||||
|
@ -112,6 +112,7 @@ void AOClient::pktLoadingDone(AreaData* area, int argc, QStringList argv, AOPack
|
|||||||
sendPacket("BN", {area->background});
|
sendPacket("BN", {area->background});
|
||||||
sendPacket("OPPASS", {"DEADBEEF"});
|
sendPacket("OPPASS", {"DEADBEEF"});
|
||||||
sendPacket("DONE");
|
sendPacket("DONE");
|
||||||
|
sendServerMessage(server->getMOTD());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOClient::pktCharPassword(AreaData* area, int argc, QStringList argv, AOPacket packet)
|
void AOClient::pktCharPassword(AreaData* area, int argc, QStringList argv, AOPacket packet)
|
||||||
|
@ -182,6 +182,15 @@ int Server::getDiceValue(QString value_type)
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Server::getMOTD()
|
||||||
|
{
|
||||||
|
QSettings settings("config/config.ini", QSettings::IniFormat);
|
||||||
|
settings.beginGroup("Options");
|
||||||
|
QString MOTD = settings.value("motd", "No MOTD has been set.").toString();
|
||||||
|
QString f_MOTD = "=== MOTD ===\r\n" + MOTD + "\r\n============='";
|
||||||
|
return f_MOTD;
|
||||||
|
}
|
||||||
|
|
||||||
AOClient* Server::getClient(QString ipid)
|
AOClient* Server::getClient(QString ipid)
|
||||||
{
|
{
|
||||||
for (AOClient* client : clients) {
|
for (AOClient* client : clients) {
|
||||||
|
Loading…
Reference in New Issue
Block a user