cherrypick additional functionality from Salanto:Rolling-Rocks
This commit is contained in:
parent
7f615df8c5
commit
080e215fb3
@ -90,6 +90,8 @@ class AOClient : public QObject {
|
||||
void arup(ARUPType type, bool broadcast);
|
||||
void fullArup();
|
||||
void sendServerMessage(QString message);
|
||||
void sendServerMessageArea(QString message);
|
||||
void sendServerBroadcast(QString message);
|
||||
bool checkAuth(unsigned long long acl_mask);
|
||||
|
||||
// Packet headers
|
||||
|
@ -50,6 +50,7 @@ class Server : public QObject {
|
||||
void updateCharsTaken(AreaData* area);
|
||||
void broadcast(AOPacket packet, int area_index);
|
||||
void broadcast(AOPacket packet);
|
||||
QString getServerName();
|
||||
|
||||
QVector<AOClient*> clients;
|
||||
|
||||
@ -60,6 +61,7 @@ class Server : public QObject {
|
||||
QStringList music_list;
|
||||
QStringList backgrounds;
|
||||
DBManager* db_manager;
|
||||
QString server_name;
|
||||
|
||||
signals:
|
||||
|
||||
|
@ -248,7 +248,17 @@ void AOClient::setHwid(QString p_hwid)
|
||||
|
||||
void AOClient::sendServerMessage(QString message)
|
||||
{
|
||||
sendPacket("CT", {"Server", message, "1"});
|
||||
sendPacket("CT", {server->getServerName(), message, "1"});
|
||||
}
|
||||
|
||||
void AOClient::sendServerMessageArea(QString message)
|
||||
{
|
||||
server->broadcast(AOPacket("CT", {server->getServerName(), message, "1"}), current_area);
|
||||
}
|
||||
|
||||
void AOClient::sendServerBroadcast(QString message)
|
||||
{
|
||||
server->broadcast(AOPacket("CT", {server->getServerName(), message, "1"}));
|
||||
}
|
||||
|
||||
bool AOClient::checkAuth(unsigned long long acl_mask)
|
||||
|
@ -399,7 +399,7 @@ void AOClient::cmdDoc(int argc, QStringList argv)
|
||||
}
|
||||
else {
|
||||
area->document = argv.join(" ");
|
||||
sendServerMessage(sender_name + " changed the document."); // broadcast this!
|
||||
sendServerMessageArea(sender_name + " changed the document.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -408,7 +408,7 @@ void AOClient::cmdClearDoc(int argc, QStringList argv)
|
||||
QString sender_name = ooc_name;
|
||||
AreaData* area = server->areas[current_area];
|
||||
area->document = "No document.";
|
||||
sendServerMessage(sender_name + " cleared the document."); // broadcast this!
|
||||
sendServerMessageArea(sender_name + " cleared the document.");
|
||||
}
|
||||
|
||||
void AOClient::cmdCM(int argc, QStringList argv)
|
||||
@ -418,7 +418,7 @@ void AOClient::cmdCM(int argc, QStringList argv)
|
||||
if (area->owners.isEmpty()) {
|
||||
area->owners.append(id);
|
||||
area->invited.append(id);
|
||||
sendServerMessage(sender_name + " is now CM in this area."); // broadcast this!
|
||||
sendServerMessageArea(sender_name + " is now CM in this area.");
|
||||
arup(ARUPType::CM, true);
|
||||
}
|
||||
else if (!area->owners.contains(id)) {
|
||||
@ -436,7 +436,7 @@ void AOClient::cmdCM(int argc, QStringList argv)
|
||||
return;
|
||||
}
|
||||
area->owners.append(owner_candidate->id);
|
||||
sendServerMessage(owner_candidate->ooc_name + " is now CM in this area."); // broadcast this!
|
||||
sendServerMessageArea(owner_candidate->ooc_name + " is now CM in this area.");
|
||||
arup(ARUPType::CM, true);
|
||||
}
|
||||
else {
|
||||
@ -512,7 +512,7 @@ void AOClient::cmdLock(int argc, QStringList argv)
|
||||
sendServerMessage("This area is already locked.");
|
||||
return;
|
||||
}
|
||||
sendServerMessage("This area is now locked."); // broadcast me!
|
||||
sendServerMessageArea("This area is now locked.");
|
||||
area->locked = AreaData::LockStatus::LOCKED;
|
||||
for (AOClient* client : server->clients) {
|
||||
if (client->current_area == current_area && client->joined) {
|
||||
@ -532,7 +532,7 @@ void AOClient::cmdSpectatable(int argc, QStringList argv)
|
||||
sendServerMessage("This area is already in spectate mode.");
|
||||
return;
|
||||
}
|
||||
sendServerMessage("This area is now spectatable."); // broadcast me!
|
||||
sendServerMessageArea("This area is now spectatable.");
|
||||
area->locked = AreaData::LockStatus::SPECTATABLE;
|
||||
for (AOClient* client : server->clients) {
|
||||
if (client->current_area == current_area && client->joined) {
|
||||
@ -552,7 +552,7 @@ void AOClient::cmdUnLock(int argc, QStringList argv)
|
||||
sendServerMessage("This area is not locked.");
|
||||
return;
|
||||
}
|
||||
sendServerMessage("This area is now unlocked."); // broadcast me!
|
||||
sendServerMessageArea("This area is now unlocked.");
|
||||
area->locked = AreaData::LockStatus::FREE;
|
||||
arup(ARUPType::LOCKED, true);
|
||||
}
|
||||
|
@ -158,6 +158,14 @@ void Server::broadcast(AOPacket packet)
|
||||
}
|
||||
}
|
||||
|
||||
QString Server::getServerName()
|
||||
{
|
||||
QSettings settings("config/config.ini", QSettings::IniFormat);
|
||||
settings.beginGroup("Options");
|
||||
QString server_name = settings.value("server_name", "Akashi").toString();
|
||||
return server_name;
|
||||
}
|
||||
|
||||
AOClient* Server::getClient(QString ipid)
|
||||
{
|
||||
for (AOClient* client : clients) {
|
||||
|
Loading…
Reference in New Issue
Block a user