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 arup(ARUPType type, bool broadcast);
|
||||||
void fullArup();
|
void fullArup();
|
||||||
void sendServerMessage(QString message);
|
void sendServerMessage(QString message);
|
||||||
|
void sendServerMessageArea(QString message);
|
||||||
|
void sendServerBroadcast(QString message);
|
||||||
bool checkAuth(unsigned long long acl_mask);
|
bool checkAuth(unsigned long long acl_mask);
|
||||||
|
|
||||||
// Packet headers
|
// Packet headers
|
||||||
|
@ -50,6 +50,7 @@ class Server : public QObject {
|
|||||||
void updateCharsTaken(AreaData* area);
|
void updateCharsTaken(AreaData* area);
|
||||||
void broadcast(AOPacket packet, int area_index);
|
void broadcast(AOPacket packet, int area_index);
|
||||||
void broadcast(AOPacket packet);
|
void broadcast(AOPacket packet);
|
||||||
|
QString getServerName();
|
||||||
|
|
||||||
QVector<AOClient*> clients;
|
QVector<AOClient*> clients;
|
||||||
|
|
||||||
@ -60,6 +61,7 @@ class Server : public QObject {
|
|||||||
QStringList music_list;
|
QStringList music_list;
|
||||||
QStringList backgrounds;
|
QStringList backgrounds;
|
||||||
DBManager* db_manager;
|
DBManager* db_manager;
|
||||||
|
QString server_name;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
@ -248,7 +248,17 @@ void AOClient::setHwid(QString p_hwid)
|
|||||||
|
|
||||||
void AOClient::sendServerMessage(QString message)
|
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)
|
bool AOClient::checkAuth(unsigned long long acl_mask)
|
||||||
|
@ -399,7 +399,7 @@ void AOClient::cmdDoc(int argc, QStringList argv)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
area->document = argv.join(" ");
|
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;
|
QString sender_name = ooc_name;
|
||||||
AreaData* area = server->areas[current_area];
|
AreaData* area = server->areas[current_area];
|
||||||
area->document = "No document.";
|
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)
|
void AOClient::cmdCM(int argc, QStringList argv)
|
||||||
@ -418,7 +418,7 @@ void AOClient::cmdCM(int argc, QStringList argv)
|
|||||||
if (area->owners.isEmpty()) {
|
if (area->owners.isEmpty()) {
|
||||||
area->owners.append(id);
|
area->owners.append(id);
|
||||||
area->invited.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);
|
arup(ARUPType::CM, true);
|
||||||
}
|
}
|
||||||
else if (!area->owners.contains(id)) {
|
else if (!area->owners.contains(id)) {
|
||||||
@ -436,7 +436,7 @@ void AOClient::cmdCM(int argc, QStringList argv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
area->owners.append(owner_candidate->id);
|
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);
|
arup(ARUPType::CM, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -512,7 +512,7 @@ void AOClient::cmdLock(int argc, QStringList argv)
|
|||||||
sendServerMessage("This area is already locked.");
|
sendServerMessage("This area is already locked.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sendServerMessage("This area is now locked."); // broadcast me!
|
sendServerMessageArea("This area is now locked.");
|
||||||
area->locked = AreaData::LockStatus::LOCKED;
|
area->locked = AreaData::LockStatus::LOCKED;
|
||||||
for (AOClient* client : server->clients) {
|
for (AOClient* client : server->clients) {
|
||||||
if (client->current_area == current_area && client->joined) {
|
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.");
|
sendServerMessage("This area is already in spectate mode.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sendServerMessage("This area is now spectatable."); // broadcast me!
|
sendServerMessageArea("This area is now spectatable.");
|
||||||
area->locked = AreaData::LockStatus::SPECTATABLE;
|
area->locked = AreaData::LockStatus::SPECTATABLE;
|
||||||
for (AOClient* client : server->clients) {
|
for (AOClient* client : server->clients) {
|
||||||
if (client->current_area == current_area && client->joined) {
|
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.");
|
sendServerMessage("This area is not locked.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sendServerMessage("This area is now unlocked."); // broadcast me!
|
sendServerMessageArea("This area is now unlocked.");
|
||||||
area->locked = AreaData::LockStatus::FREE;
|
area->locked = AreaData::LockStatus::FREE;
|
||||||
arup(ARUPType::LOCKED, true);
|
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)
|
AOClient* Server::getClient(QString ipid)
|
||||||
{
|
{
|
||||||
for (AOClient* client : clients) {
|
for (AOClient* client : clients) {
|
||||||
|
Loading…
Reference in New Issue
Block a user