diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-05-20 06:11:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-05-20 06:11:17 +0300 |
commit | 3363acba6f1e8e51937ae2e354a8086c5c56b8cd (patch) | |
tree | cc2429241a3e7cba7a90ba1ae1b76e0abf8e5345 /src/listeners/playerpostdeathlistener.h | |
parent | 1f5ca54b8f60e112c2043160700055290c8ce912 (diff) | |
download | mv-3363acba6f1e8e51937ae2e354a8086c5c56b8cd.tar.gz mv-3363acba6f1e8e51937ae2e354a8086c5c56b8cd.tar.bz2 mv-3363acba6f1e8e51937ae2e354a8086c5c56b8cd.tar.xz mv-3363acba6f1e8e51937ae2e354a8086c5c56b8cd.zip |
Show gm revive button in death dialog if player have rights for @alive command.
Diffstat (limited to 'src/listeners/playerpostdeathlistener.h')
-rw-r--r-- | src/listeners/playerpostdeathlistener.h | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/listeners/playerpostdeathlistener.h b/src/listeners/playerpostdeathlistener.h index c5c6c47fb..58ceee324 100644 --- a/src/listeners/playerpostdeathlistener.h +++ b/src/listeners/playerpostdeathlistener.h @@ -30,11 +30,12 @@ #include "gui/windows/npcdialog.h" +#include "net/adminhandler.h" #include "net/playerhandler.h" #include "localconsts.h" -extern OkDialog *deathNotice; +extern Window *deathNotice; /** * Listener used for handling death message. @@ -47,18 +48,30 @@ struct PlayerPostDeathListener final : public ActionListener A_DELETE_COPY(PlayerPostDeathListener) - void action(const ActionEvent &event A_UNUSED) override final + void action(const ActionEvent &event) override final { - if (playerHandler != nullptr) - playerHandler->respawn(); + const bool respawn = !(event.getId() == "no"); deathNotice = nullptr; + if (respawn) + { + if (playerHandler != nullptr) + playerHandler->respawn(); - DialogsManager::closeDialogs(); - PopupManager::closePopupMenu(); + DialogsManager::closeDialogs(); + PopupManager::closePopupMenu(); + NpcDialog::clearDialogs(); - NpcDialog::clearDialogs(); - if (localPlayer != nullptr) - localPlayer->respawn(); + if (localPlayer != nullptr) + localPlayer->respawn(); + } + else + { + DialogsManager::closeDialogs(); + PopupManager::closePopupMenu(); + NpcDialog::clearDialogs(); + if (localPlayer != nullptr) + adminHandler->alive(localPlayer->getName()); + } } }; |