From a4ee70af007aca5a59a923454ed340cdb6d1e080 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 14 Oct 2015 15:51:23 +0300 Subject: Add option for show why player disappeared. Can be usefull for GM's. Located in settings / players / Log players actions (for GM) --- src/defaults.cpp | 1 + src/enums/resources/notifytypes.h | 5 +++++ src/gui/widgets/tabs/setup_players.cpp | 4 ++++ src/net/ea/beingrecv.cpp | 38 ++++++++++++++++++++++++++++++++++ src/resources/notifications.h | 20 ++++++++++++++++++ 5 files changed, 68 insertions(+) (limited to 'src') diff --git a/src/defaults.cpp b/src/defaults.cpp index 3bf640f78..4c243a19c 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -383,6 +383,7 @@ DefaultsData* getConfigDefaults() AddDEF("showBadges", 1); AddDEF("tradescreenshot", false); AddDEF("skillAutotarget", true); + AddDEF("logPlayerActions", false); return configData; } diff --git a/src/enums/resources/notifytypes.h b/src/enums/resources/notifytypes.h index 6772a172a..242219fd0 100644 --- a/src/enums/resources/notifytypes.h +++ b/src/enums/resources/notifytypes.h @@ -214,6 +214,11 @@ namespace NotifyTypes DELETE_ITEM_ANALYSIS, DELETE_ITEM_UNKNOWN, DELETE_ITEM_DROPPED, + BEING_REMOVE_DIED, + BEING_REMOVE_LOGGED_OUT, + BEING_REMOVE_WARPED, + BEING_REMOVE_TRICK_DEAD, + BEING_REMOVE_UNKNOWN, TYPE_END }; diff --git a/src/gui/widgets/tabs/setup_players.cpp b/src/gui/widgets/tabs/setup_players.cpp index 2f8039b6a..a2be4cb71 100644 --- a/src/gui/widgets/tabs/setup_players.cpp +++ b/src/gui/widgets/tabs/setup_players.cpp @@ -124,6 +124,10 @@ Setup_Players::Setup_Players(const Widget2 *const widget) : new SetupItemCheckBox(_("Use special diagonal speed in players moving"), "", "useDiagonalSpeed", this, "useDiagonalSpeedEvent"); + // TRANSLATORS: settings option + new SetupItemCheckBox(_("Log players actions (for GM)"), + "", "logPlayerActions", this, "logPlayerActionsEvent"); + // TRANSLATORS: settings option new SetupItemCheckBox(_("Create screenshots for each complete trades"), "", "tradescreenshot", this, "tradescreenshotEvent"); diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp index f09979e58..cfae77247 100644 --- a/src/net/ea/beingrecv.cpp +++ b/src/net/ea/beingrecv.cpp @@ -23,13 +23,17 @@ #include "net/ea/beingrecv.h" #include "actormanager.h" +#include "configuration.h" #include "game.h" +#include "notifymanager.h" #include "party.h" #include "being/localplayer.h" #include "being/playerrelation.h" #include "being/playerrelations.h" +#include "enums/resources/notifytypes.h" + #include "enums/resources/map/mapitemtype.h" #include "gui/viewport.h" @@ -100,6 +104,40 @@ void BeingRecv::processBeingRemove(Net::MessageIn &msg) { if (socialWindow) socialWindow->updateActiveList(); + const std::string name = dstBeing->getName(); + if (!name.empty() && config.getBoolValue("logPlayerActions")) + { + switch (type) + { + case 0: + break; + case 1: + NotifyManager::notify( + NotifyTypes::BEING_REMOVE_DIED, + name); + break; + case 2: + NotifyManager::notify( + NotifyTypes::BEING_REMOVE_LOGGED_OUT, + name); + break; + case 3: + NotifyManager::notify( + NotifyTypes::BEING_REMOVE_WARPED, + name); + break; + case 4: + NotifyManager::notify( + NotifyTypes::BEING_REMOVE_TRICK_DEAD, + name); + break; + default: + NotifyManager::notify( + NotifyTypes::BEING_REMOVE_UNKNOWN, + name); + break; + } + } } actorManager->destroy(dstBeing); } diff --git a/src/resources/notifications.h b/src/resources/notifications.h index ab37a5232..250f42813 100644 --- a/src/resources/notifications.h +++ b/src/resources/notifications.h @@ -771,6 +771,26 @@ namespace NotifyManager {"delete item dropped", "", NotifyFlags::STRING}, + {"being remove died", + // TRANSLATORS: notification message + N_("Player %s died."), + NotifyFlags::STRING}, + {"being remove logged out", + // TRANSLATORS: notification message + N_("Player %s logged out."), + NotifyFlags::STRING}, + {"being remove warped", + // TRANSLATORS: notification message + N_("Player %s warped."), + NotifyFlags::STRING}, + {"being remove trick dead", + // TRANSLATORS: notification message + N_("Player %s trick dead."), + NotifyFlags::STRING}, + {"being remove unknown", + // TRANSLATORS: notification message + N_("Player %s unknown remove."), + NotifyFlags::STRING}, }; } // namespace NotifyManager #endif // RESOURCES_NOTIFICATIONS_H -- cgit v1.2.3-60-g2f50