summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-25 22:29:43 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-25 22:29:43 +0300
commit66c33ea3f5e82ae09b935f65d7183b4ffc8bb9b1 (patch)
tree6ab4c5a48bc54f7e0156f3ef64851f51c76ba95a /src
parent46f4e5fb5c77d01de334e059b88837f8c7fe1f3e (diff)
downloadmanaplus-66c33ea3f5e82ae09b935f65d7183b4ffc8bb9b1.tar.gz
manaplus-66c33ea3f5e82ae09b935f65d7183b4ffc8bb9b1.tar.bz2
manaplus-66c33ea3f5e82ae09b935f65d7183b4ffc8bb9b1.tar.xz
manaplus-66c33ea3f5e82ae09b935f65d7183b4ffc8bb9b1.zip
Add chat command /hide. Also add it to player context menu.
Diffstat (limited to 'src')
-rw-r--r--src/actions/commands.cpp6
-rw-r--r--src/actions/commands.h1
-rw-r--r--src/dyetool/actions/commands.cpp1
-rw-r--r--src/enums/input/inputaction.h1
-rw-r--r--src/gui/popups/popupmenu.cpp15
-rw-r--r--src/input/inputactionmap.h6
-rw-r--r--src/net/adminhandler.h2
-rw-r--r--src/net/eathena/adminhandler.cpp5
-rw-r--r--src/net/eathena/adminhandler.h2
-rw-r--r--src/net/tmwa/adminhandler.cpp5
-rw-r--r--src/net/tmwa/adminhandler.h2
11 files changed, 45 insertions, 1 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 969807577..f0dd84500 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -1435,4 +1435,10 @@ impHandler(commandImmortal)
return true;
}
+impHandler(commandHide)
+{
+ adminHandler->hide(event.args);
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index 1e642ec9e..74fedcf8c 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -126,6 +126,7 @@ namespace Actions
decHandler(commandAlive);
decHandler(commandDisguise);
decHandler(commandImmortal);
+ decHandler(commandHide);
} // namespace Actions
#undef decHandler
diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp
index c885e7c48..5debac3d0 100644
--- a/src/dyetool/actions/commands.cpp
+++ b/src/dyetool/actions/commands.cpp
@@ -126,5 +126,6 @@ impHandlerVoid(commandHeal)
impHandlerVoid(commandAlive)
impHandlerVoid(commandDisguise)
impHandlerVoid(commandImmortal)
+impHandlerVoid(commandHide)
} // namespace Actions
diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h
index 6d68d55fb..4c6a351bb 100644
--- a/src/enums/input/inputaction.h
+++ b/src/enums/input/inputaction.h
@@ -655,6 +655,7 @@ enumStart(InputAction)
COMMAND_ALIVE,
COMMAND_DISGUISE,
COMMAND_IMMORTAL,
+ COMMAND_HIDE,
TOTAL
}
enumEnd(InputAction);
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 20ee37264..1caf50adb 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -2739,7 +2739,17 @@ void PopupMenu::showPlayerGMCommands()
// TRANSLATORS: mute menu
mBrowserBox->addRow("mute", _("Mute..."));
}
- if (!legacy)
+ if (legacy)
+ {
+ if (localPlayer->getName() == mNick)
+ {
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: hide player
+ mBrowserBox->addRow("/hide", _("Hide"));
+ mBrowserBox->addRow("##3---");
+ }
+ }
+ else
{
// TRANSLATORS: popup menu item
// TRANSLATORS: heal player
@@ -2747,6 +2757,9 @@ void PopupMenu::showPlayerGMCommands()
// TRANSLATORS: popup menu item
// TRANSLATORS: enable immortal mode for player
mBrowserBox->addRow("/immortal 'NAME'", _("Immortal"));
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: hide player
+ mBrowserBox->addRow("/hide 'NAME'", _("Hide"));
mBrowserBox->addRow("##3---");
// TRANSLATORS: popup menu item
// TRANSLATORS: set player as killer
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index d42fda40d..625b7dd88 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -5419,6 +5419,12 @@ static const InputActionData inputActionData
"immortal",
UseArgs_true,
Protected_true},
+ {"keyCommandHide",
+ defaultAction(&Actions::commandHide),
+ InputCondition::INGAME,
+ "hide",
+ UseArgs_true,
+ Protected_true},
};
#undef defaultAction
diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h
index ab38cdb1a..2a35036c6 100644
--- a/src/net/adminhandler.h
+++ b/src/net/adminhandler.h
@@ -152,6 +152,8 @@ class AdminHandler notfinal
virtual void disguise(const std::string &name) const = 0;
virtual void immortal(const std::string &name) const = 0;
+
+ virtual void hide(const std::string &name) const = 0;
};
} // namespace Net
diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp
index 8912750f4..1b7a7a8d5 100644
--- a/src/net/eathena/adminhandler.cpp
+++ b/src/net/eathena/adminhandler.cpp
@@ -300,4 +300,9 @@ void AdminHandler::immortal(const std::string &name) const
Gm::runCharCommand("monsterignore", name);
}
+void AdminHandler::hide(const std::string &name) const
+{
+ Gm::runCharCommand("hide", name);
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h
index 79ad2143e..a86e68f4e 100644
--- a/src/net/eathena/adminhandler.h
+++ b/src/net/eathena/adminhandler.h
@@ -128,6 +128,8 @@ class AdminHandler final : public Ea::AdminHandler
void immortal(const std::string &name) const override final;
+ void hide(const std::string &name) const override final;
+
protected:
static std::string mStatsName;
};
diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp
index 6bcfcc66f..47ee1edcb 100644
--- a/src/net/tmwa/adminhandler.cpp
+++ b/src/net/tmwa/adminhandler.cpp
@@ -236,4 +236,9 @@ void AdminHandler::immortal(const std::string &name A_UNUSED) const
{
}
+void AdminHandler::hide(const std::string &name A_UNUSED) const
+{
+ Gm::runCommand("hide");
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h
index 56511f7a8..4239bde8e 100644
--- a/src/net/tmwa/adminhandler.h
+++ b/src/net/tmwa/adminhandler.h
@@ -140,6 +140,8 @@ class AdminHandler final : public Ea::AdminHandler
void disguise(const std::string &name) const override final;
void immortal(const std::string &name) const override final;
+
+ void hide(const std::string &name) const override final;
};
} // namespace TmwAthena