Add sendServerMessageArea and sendServerBroadcast
+ Update some prior created commands to use them + Change style of global messages + Change style of need messages + Pretend to fix some formatting since I don't understand indentation
This commit is contained in:
parent
f43e360c86
commit
2422287753
@ -88,6 +88,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
|
||||||
|
@ -216,7 +216,26 @@ void AOClient::setHwid(QString p_hwid)
|
|||||||
|
|
||||||
void AOClient::sendServerMessage(QString message)
|
void AOClient::sendServerMessage(QString message)
|
||||||
{
|
{
|
||||||
sendPacket("CT", {"Server", message, "1"});
|
QSettings config("config/config.ini", QSettings::IniFormat);
|
||||||
|
config.beginGroup("Options");
|
||||||
|
QString hostname = config.value("hostname", "Server").toString();
|
||||||
|
sendPacket("CT", {hostname, message, "1"});
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOClient::sendServerMessageArea(QString message)
|
||||||
|
{
|
||||||
|
QSettings config("config/config.ini", QSettings::IniFormat);
|
||||||
|
config.beginGroup("Options");
|
||||||
|
QString hostname = config.value("hostname", "Server").toString();
|
||||||
|
server->broadcast(AOPacket("CT", {hostname, message, "1"}), current_area);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOClient::sendServerBroadcast(QString message)
|
||||||
|
{
|
||||||
|
QSettings config("config/config.ini", QSettings::IniFormat);
|
||||||
|
config.beginGroup("Options");
|
||||||
|
QString hostname = config.value("hostname", "Server").toString();
|
||||||
|
server->broadcast(AOPacket("CT", {hostname, message, "1"}));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AOClient::checkAuth(unsigned long long acl_mask)
|
bool AOClient::checkAuth(unsigned long long acl_mask)
|
||||||
|
@ -374,8 +374,9 @@ void AOClient::cmdPos(int argc, QStringList argv)
|
|||||||
void AOClient::cmdG(int argc, QStringList argv)
|
void AOClient::cmdG(int argc, QStringList argv)
|
||||||
{
|
{
|
||||||
QString sender_name = ooc_name;
|
QString sender_name = ooc_name;
|
||||||
|
QString sender_area = server->area_names.value(current_area);
|
||||||
QString sender_message = argv.join(" ");
|
QString sender_message = argv.join(" ");
|
||||||
server->broadcast(AOPacket("CT", {"[G]" + sender_name, sender_message+ "."}));
|
server->broadcast(AOPacket("CT", {"[" + sender_area + "]" + sender_name, sender_message}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,7 +384,7 @@ void AOClient::cmdNeed(int argc, QStringList argv)
|
|||||||
{
|
{
|
||||||
QString sender_area = server->area_names.value(current_area);
|
QString sender_area = server->area_names.value(current_area);
|
||||||
QString sender_message = argv.join(" ");
|
QString sender_message = argv.join(" ");
|
||||||
server->broadcast(AOPacket("CT", {"=== Advert ===","[" + sender_area + "] needs " + sender_message+ "."}));
|
sendServerBroadcast({"=== Advert ===\n[" + sender_area + "] needs " + sender_message+ "."});
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOClient::cmdFlip(int argc, QStringList argv)
|
void AOClient::cmdFlip(int argc, QStringList argv)
|
||||||
@ -403,7 +404,7 @@ void AOClient::cmdRoll(int argc, QStringList argv)
|
|||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
{
|
{
|
||||||
QString dice_result = QString::number(AOClient::genRand(1, 6));
|
QString dice_result = QString::number(AOClient::genRand(1, 6));
|
||||||
server->broadcast(AOPacket("CT",{"Roll",sender_name + " rolled " + dice_result + " out of 6"}), current_area);
|
sendServerMessageArea(sender_name + " rolled " + dice_result + " out of 6");
|
||||||
}
|
}
|
||||||
else if (argc == 1)
|
else if (argc == 1)
|
||||||
{
|
{
|
||||||
@ -411,7 +412,7 @@ void AOClient::cmdRoll(int argc, QStringList argv)
|
|||||||
if (1 <= amount_faces and amount_faces <= max_roll_faces)
|
if (1 <= amount_faces and amount_faces <= max_roll_faces)
|
||||||
{
|
{
|
||||||
QString dice_result = QString::number(AOClient::genRand(1, amount_faces));
|
QString dice_result = QString::number(AOClient::genRand(1, amount_faces));
|
||||||
server->broadcast(AOPacket("CT",{"Roll",sender_name + " rolled " + dice_result + " out of " + argv[0]}), current_area);
|
sendServerMessageArea(sender_name + " rolled " + dice_result + " out of " + argv[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -437,7 +438,7 @@ void AOClient::cmdRoll(int argc, QStringList argv)
|
|||||||
dice_results = dice_results.append(dice_result + ",");
|
dice_results = dice_results.append(dice_result + ",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
server->broadcast(AOPacket("CT",{"Roll",sender_name + " rolled (" + dice_results + ") out of " + argv[0]}), current_area);
|
sendServerMessageArea(sender_name + " rolled (" + dice_results + ") out of " + argv[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -456,7 +457,7 @@ void AOClient::cmdRollP(int argc, QStringList argv)
|
|||||||
{
|
{
|
||||||
QString dice_result = QString::number(AOClient::genRand(1, 6));
|
QString dice_result = QString::number(AOClient::genRand(1, 6));
|
||||||
sendServerMessage(sender_name + " rolled " + dice_result + " out of 6");
|
sendServerMessage(sender_name + " rolled " + dice_result + " out of 6");
|
||||||
server->broadcast(AOPacket("CT",{"Roll",sender_name + " rolled in secret."}), current_area);
|
sendServerMessageArea((sender_name + " rolled in secret."));
|
||||||
}
|
}
|
||||||
else if (argc == 1)
|
else if (argc == 1)
|
||||||
{
|
{
|
||||||
@ -465,7 +466,7 @@ void AOClient::cmdRollP(int argc, QStringList argv)
|
|||||||
{
|
{
|
||||||
QString dice_result = QString::number(AOClient::genRand(1, amount_faces));
|
QString dice_result = QString::number(AOClient::genRand(1, amount_faces));
|
||||||
sendServerMessage(sender_name + " rolled " + dice_result + " out of " + argv[0]);
|
sendServerMessage(sender_name + " rolled " + dice_result + " out of " + argv[0]);
|
||||||
server->broadcast(AOPacket("CT",{"Roll",sender_name + " rolled in secret."}), current_area);
|
sendServerMessageArea((sender_name + " rolled in secret."));;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -492,7 +493,7 @@ void AOClient::cmdRollP(int argc, QStringList argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sendServerMessage(sender_name + " rolled " + dice_results + " out of " + argv[0]);
|
sendServerMessage(sender_name + " rolled " + dice_results + " out of " + argv[0]);
|
||||||
server->broadcast(AOPacket("CT",{"Roll",sender_name + " rolled in secret."}), current_area);
|
sendServerMessageArea((sender_name + " rolled in secret."));;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user