Add server tag support (#372)

This commit is contained in:
Salanto 2024-08-02 21:08:37 +02:00 committed by GitHub
parent db50c81ceb
commit 13a49bafb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 6 deletions

View File

@ -434,18 +434,18 @@ void AOClient::calculateIpid()
void AOClient::sendServerMessage(QString message)
{
sendPacket("CT", {ConfigManager::serverName(), message, "1"});
sendPacket("CT", {ConfigManager::serverTag(), message, "1"});
}
void AOClient::sendServerMessageArea(QString message)
{
server->broadcast(PacketFactory::createPacket("CT", {ConfigManager::serverName(), message, "1"}),
server->broadcast(PacketFactory::createPacket("CT", {ConfigManager::serverTag(), message, "1"}),
areaId());
}
void AOClient::sendServerBroadcast(QString message)
{
server->broadcast(PacketFactory::createPacket("CT", {ConfigManager::serverName(), message, "1"}));
server->broadcast(PacketFactory::createPacket("CT", {ConfigManager::serverTag(), message, "1"}));
}
bool AOClient::checkPermission(ACLRole::Permission f_permission) const

View File

@ -349,7 +349,7 @@ void AOClient::cmdBgLock(int argc, QStringList argv)
l_area->toggleBgLock();
};
server->broadcast(PacketFactory::createPacket("CT", {ConfigManager::serverName(), character() + " locked the background.", "1"}), areaId());
server->broadcast(PacketFactory::createPacket("CT", {ConfigManager::serverTag(), character() + " locked the background.", "1"}), areaId());
}
void AOClient::cmdBgUnlock(int argc, QStringList argv)
@ -363,7 +363,7 @@ void AOClient::cmdBgUnlock(int argc, QStringList argv)
l_area->toggleBgLock();
};
server->broadcast(PacketFactory::createPacket("CT", {ConfigManager::serverName(), character() + " unlocked the background.", "1"}), areaId());
server->broadcast(PacketFactory::createPacket("CT", {ConfigManager::serverTag(), character() + " unlocked the background.", "1"}), areaId());
}
void AOClient::cmdStatus(int argc, QStringList argv)
@ -375,7 +375,7 @@ void AOClient::cmdStatus(int argc, QStringList argv)
if (l_area->changeStatus(l_arg)) {
arup(ARUPType::STATUS, true);
server->broadcast(PacketFactory::createPacket("CT", {ConfigManager::serverName(), character() + " changed status to " + l_arg.toUpper(), "1"}), areaId());
server->broadcast(PacketFactory::createPacket("CT", {ConfigManager::serverTag(), character() + " changed status to " + l_arg.toUpper(), "1"}), areaId());
}
else {
const QStringList keys = AreaData::map_statuses.keys();

View File

@ -340,6 +340,11 @@ QString ConfigManager::serverName()
return m_settings->value("Options/server_name", "An Unnamed Server").toString();
}
QString ConfigManager::serverTag()
{
return m_settings->value("Options/server_tag", serverName()).toString();
}
QString ConfigManager::motd()
{
return m_settings->value("Options/motd", "MOTD not set").toString();

View File

@ -157,6 +157,13 @@ class ConfigManager
*/
static QString serverName();
/**
* @brief Returns the short "tag" version of the server.
*
* @return See short description.
*/
static QString serverTag();
/**
* @brief Returns the server's Message of the Day.
*