fix status in area list, replace number() with str literal

This commit is contained in:
in1tiate 2021-03-11 02:00:33 -06:00
parent ae338b1ac0
commit 953426fea1
2 changed files with 13 additions and 13 deletions

View File

@ -175,20 +175,20 @@ void AOClient::changeCharacter(int char_id)
sendPacket("PV", {QString::number(id), "CID", QString::number(char_id)}); sendPacket("PV", {QString::number(id), "CID", QString::number(char_id)});
fullArup(); fullArup();
if (server->timer->isActive()) { if (server->timer->isActive()) {
sendPacket("TI", {QString::number(0), QString::number(2)}); sendPacket("TI", {"0", "2"});
sendPacket("TI", {QString::number(0), QString::number(0), QString::number(QTime(0,0).msecsTo(QTime(0,0).addMSecs(server->timer->remainingTime())))}); sendPacket("TI", {"0", "0", QString::number(QTime(0,0).msecsTo(QTime(0,0).addMSecs(server->timer->remainingTime())))});
} }
else { else {
sendPacket("TI", {QString::number(0), QString::number(3)}); sendPacket("TI", {"0", "3"});
} }
for (QTimer* timer : area->timers) { for (QTimer* timer : area->timers) {
int timer_id = area->timers.indexOf(timer) + 1; int timer_id = area->timers.indexOf(timer) + 1;
if (timer->isActive()) { if (timer->isActive()) {
sendPacket("TI", {QString::number(timer_id), QString::number(2)}); sendPacket("TI", {QString::number(timer_id), "2"});
sendPacket("TI", {QString::number(timer_id), QString::number(0), QString::number(QTime(0,0).msecsTo(QTime(0,0).addMSecs(timer->remainingTime())))}); sendPacket("TI", {QString::number(timer_id), "0", QString::number(QTime(0,0).msecsTo(QTime(0,0).addMSecs(timer->remainingTime())))});
} }
else { else {
sendPacket("TI", {QString::number(timer_id), QString::number(3)}); sendPacket("TI", {QString::number(timer_id), "3"});
} }
} }
} }

View File

@ -656,28 +656,28 @@ void AOClient::cmdTimer(int argc, QStringList argv)
requested_timer->setInterval(QTime(0,0).msecsTo(requested_time)); requested_timer->setInterval(QTime(0,0).msecsTo(requested_time));
requested_timer->start(); requested_timer->start();
sendServerMessage("Set timer " + QString::number(timer_id) + " to " + argv[1] + "."); sendServerMessage("Set timer " + QString::number(timer_id) + " to " + argv[1] + ".");
sendPacket("TI", {QString::number(timer_id), QString::number(2)}); sendPacket("TI", {QString::number(timer_id), "2"}); // Show the timer
sendPacket("TI", {QString::number(timer_id), QString::number(0), QString::number(QTime(0,0).msecsTo(requested_time))}); sendPacket("TI", {QString::number(timer_id), "0", QString::number(QTime(0,0).msecsTo(requested_time))});
return; return;
} }
else { else {
if (argv[1] == "start") { if (argv[1] == "start") {
requested_timer->start(); requested_timer->start();
sendServerMessage("Started timer " + QString::number(timer_id) + "."); sendServerMessage("Started timer " + QString::number(timer_id) + ".");
sendPacket("TI", {QString::number(timer_id), QString::number(2)}); sendPacket("TI", {QString::number(timer_id), "2"}); // Show the timer
sendPacket("TI", {QString::number(timer_id), QString::number(0), QString::number(QTime(0,0).msecsTo(QTime(0,0).addMSecs(requested_timer->remainingTime())))}); sendPacket("TI", {QString::number(timer_id), "0", QString::number(QTime(0,0).msecsTo(QTime(0,0).addMSecs(requested_timer->remainingTime())))});
} }
else if (argv[1] == "pause" || argv[1] == "stop") { else if (argv[1] == "pause" || argv[1] == "stop") {
requested_timer->setInterval(requested_timer->remainingTime()); requested_timer->setInterval(requested_timer->remainingTime());
requested_timer->stop(); requested_timer->stop();
sendServerMessage("Stopped timer " + QString::number(timer_id) + "."); sendServerMessage("Stopped timer " + QString::number(timer_id) + ".");
sendPacket("TI", {QString::number(timer_id), QString::number(1), QString::number(QTime(0,0).msecsTo(QTime(0,0).addMSecs(requested_timer->interval())))}); sendPacket("TI", {QString::number(timer_id), "1", QString::number(QTime(0,0).msecsTo(QTime(0,0).addMSecs(requested_timer->interval())))});
} }
else if (argv[1] == "hide" || argv[1] == "unset") { else if (argv[1] == "hide" || argv[1] == "unset") {
requested_timer->setInterval(0); requested_timer->setInterval(0);
requested_timer->stop(); requested_timer->stop();
sendServerMessage("Hid timer " + QString::number(timer_id) + "."); sendServerMessage("Hid timer " + QString::number(timer_id) + ".");
sendPacket("TI", {QString::number(timer_id), QString::number(3)}); sendPacket("TI", {QString::number(timer_id), "3"}); // Hide the timer
} }
} }
} }
@ -846,7 +846,7 @@ QStringList AOClient::buildAreaList(int area_idx)
default: default:
break; break;
} }
entries.append("[" + QString::number(area->player_count) + " users][" + area->status + "]"); entries.append("[" + QString::number(area->player_count) + " users][" + QVariant::fromValue(area->status).toString().replace("_", "-") + "]");
for (AOClient* client : server->clients) { for (AOClient* client : server->clients) {
if (client->current_area == area_idx && client->joined) { if (client->current_area == area_idx && client->joined) {
QString char_entry = "[" + QString::number(client->id) + "] " + client->current_char; QString char_entry = "[" + QString::number(client->id) + "] " + client->current_char;