summaryrefslogtreecommitdiff
path: root/src/listeners
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-05-20 06:11:17 +0300
committerAndrei Karas <akaras@inbox.ru>2018-05-20 06:11:17 +0300
commit3363acba6f1e8e51937ae2e354a8086c5c56b8cd (patch)
treecc2429241a3e7cba7a90ba1ae1b76e0abf8e5345 /src/listeners
parent1f5ca54b8f60e112c2043160700055290c8ce912 (diff)
downloadmanaplus-3363acba6f1e8e51937ae2e354a8086c5c56b8cd.tar.gz
manaplus-3363acba6f1e8e51937ae2e354a8086c5c56b8cd.tar.bz2
manaplus-3363acba6f1e8e51937ae2e354a8086c5c56b8cd.tar.xz
manaplus-3363acba6f1e8e51937ae2e354a8086c5c56b8cd.zip
Show gm revive button in death dialog if player have rights for @alive command.
Diffstat (limited to 'src/listeners')
-rw-r--r--src/listeners/playerpostdeathlistener.h31
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());
+ }
}
};