set timers when you join and change areas
This commit is contained in:
parent
6cf135a975
commit
18efacb886
@ -130,6 +130,16 @@ void AOClient::changeArea(int new_area)
|
||||
server->areas[current_area]->characters_taken[current_char] = true;
|
||||
server->updateCharsTaken(server->areas[current_area]);
|
||||
}
|
||||
for (QTimer* timer : server->areas[current_area]->timers) {
|
||||
int timer_id = server->areas[current_area]->timers.indexOf(timer) + 1;
|
||||
if (timer->isActive()) {
|
||||
sendPacket("TI", {QString::number(timer_id), QString::number(2)});
|
||||
sendPacket("TI", {QString::number(timer_id), QString::number(0), QString::number(QTime(0,0).msecsTo(QTime(0,0).addMSecs(timer->remainingTime())))});
|
||||
}
|
||||
else {
|
||||
sendPacket("TI", {QString::number(timer_id), QString::number(3)});
|
||||
}
|
||||
}
|
||||
sendServerMessage("You moved to area " + server->area_names[current_area]);
|
||||
if (server->areas[current_area]->locked == AreaData::LockStatus::SPECTATABLE)
|
||||
sendServerMessage("Area " + server->area_names[current_area] + " is spectate-only; to chat IC you will need to be invited by the CM.");
|
||||
|
@ -563,7 +563,7 @@ void AOClient::cmdTimer(int argc, QStringList argv)
|
||||
timers.append("Currently active timers:");
|
||||
QTimer* global_timer = server->timer;
|
||||
if (global_timer->isActive()) {
|
||||
QTime current_time(0, 0, 0, global_timer->remainingTime());
|
||||
QTime current_time = QTime(0,0).addMSecs(global_timer->remainingTime());
|
||||
timers.append("Global timer is at " + current_time.toString("hh:mm:ss.zzz"));
|
||||
}
|
||||
for (QTimer* timer : area->timers) {
|
||||
|
@ -143,6 +143,23 @@ void AOClient::pktSelectChar(AreaData* area, int argc, QStringList argv, AOPacke
|
||||
server->updateCharsTaken(area);
|
||||
sendPacket("PV", {QString::number(id), "CID", argv[1]});
|
||||
fullArup();
|
||||
if (server->timer->isActive()) {
|
||||
sendPacket("TI", {QString::number(0), QString::number(2)});
|
||||
sendPacket("TI", {QString::number(0), QString::number(0), QString::number(QTime(0,0).msecsTo(QTime(0,0).addMSecs(server->timer->remainingTime())))});
|
||||
}
|
||||
else {
|
||||
sendPacket("TI", {QString::number(0), QString::number(3)});
|
||||
}
|
||||
for (QTimer* timer : area->timers) {
|
||||
int timer_id = area->timers.indexOf(timer) + 1;
|
||||
if (timer->isActive()) {
|
||||
sendPacket("TI", {QString::number(timer_id), QString::number(2)});
|
||||
sendPacket("TI", {QString::number(timer_id), QString::number(0), QString::number(QTime(0,0).msecsTo(QTime(0,0).addMSecs(timer->remainingTime())))});
|
||||
}
|
||||
else {
|
||||
sendPacket("TI", {QString::number(timer_id), QString::number(3)});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AOClient::pktIcChat(AreaData* area, int argc, QStringList argv, AOPacket packet)
|
||||
|
Loading…
Reference in New Issue
Block a user