Make MODT editable - Part 1
This commit is contained in:
parent
3e1f9825ca
commit
06864e115a
@ -9,7 +9,7 @@ ms_port=27016
|
||||
port=27016
|
||||
server_description=This is a placeholder server description. Tell the world of AO who you are here!
|
||||
server_name=An Unnamed Server
|
||||
motd=Sample MOTD.
|
||||
motd=MOTD is not set.
|
||||
webao_enable=true
|
||||
webao_port=27017
|
||||
auth=simple
|
||||
|
@ -76,6 +76,7 @@ class AOClient : public QObject {
|
||||
{"CM", 1ULL << 4},
|
||||
{"GLOBAL_TIMER", 1ULL << 5},
|
||||
{"CHANGE_EVI_MOD", 1ULL << 6},
|
||||
{"CHANGE_MOTD", 1ULL << 7},
|
||||
{"SUPER", ~0ULL}
|
||||
};
|
||||
|
||||
|
@ -66,6 +66,7 @@ class Server : public QObject {
|
||||
QStringList backgrounds;
|
||||
DBManager* db_manager;
|
||||
QString server_name;
|
||||
QString MOTD;
|
||||
|
||||
QTimer* timer;
|
||||
|
||||
|
@ -859,8 +859,19 @@ void AOClient::cmdPM(int arc, QStringList argv)
|
||||
|
||||
void AOClient::cmdMOTD(int argc, QStringList argv)
|
||||
{
|
||||
QString MOTD = server->getMOTD();
|
||||
sendServerMessage(MOTD);
|
||||
if (argc == 0) {
|
||||
sendServerMessage("=== MOTD ===\r\n" + server->MOTD + "\r\n=============");
|
||||
}
|
||||
else if (argc == 1) {
|
||||
unsigned long long user_acl = server->db_manager->getACL(moderator_name);
|
||||
if ((user_acl & ACLFlags.value("MODIFY_USERS")) == 0) {
|
||||
sendServerMessage("You do not have permission to change the MOTD");
|
||||
}
|
||||
else {
|
||||
server->MOTD = argv[0];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
QStringList AOClient::buildAreaList(int area_idx)
|
||||
|
@ -112,7 +112,7 @@ void AOClient::pktLoadingDone(AreaData* area, int argc, QStringList argv, AOPack
|
||||
sendPacket("BN", {area->background});
|
||||
sendPacket("OPPASS", {"DEADBEEF"});
|
||||
sendPacket("DONE");
|
||||
sendServerMessage(server->getMOTD());
|
||||
sendServerMessage("=== MOTD ===\r\n" + server->MOTD + "\r\n=============");
|
||||
}
|
||||
|
||||
void AOClient::pktCharPassword(AreaData* area, int argc, QStringList argv, AOPacket packet)
|
||||
|
@ -51,6 +51,8 @@ void Server::start()
|
||||
qDebug() << "Server listening on" << port;
|
||||
}
|
||||
|
||||
MOTD = config.value("motd","MOTD is not set.").toString();
|
||||
|
||||
proxy = new WSProxy(port, ws_port, this);
|
||||
if(ws_port != -1)
|
||||
proxy->start();
|
||||
@ -182,15 +184,6 @@ int Server::getDiceValue(QString value_type)
|
||||
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)
|
||||
{
|
||||
for (AOClient* client : clients) {
|
||||
|
Loading…
Reference in New Issue
Block a user