summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-25 21:54:31 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-25 21:54:31 +0300
commitf8423bd2d31ac4da409cabdc84fa2e3962336103 (patch)
treedf71e84fae1ba7bdabea1c2de1f69db7881f4771 /src
parent0b448599f2a1422630e80fbd12f7c6fd9792460e (diff)
downloadmv-f8423bd2d31ac4da409cabdc84fa2e3962336103.tar.gz
mv-f8423bd2d31ac4da409cabdc84fa2e3962336103.tar.bz2
mv-f8423bd2d31ac4da409cabdc84fa2e3962336103.tar.xz
mv-f8423bd2d31ac4da409cabdc84fa2e3962336103.zip
Add chat command /disguise. Also add it to player context menu.
Diffstat (limited to 'src')
-rw-r--r--src/actions/commands.cpp9
-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.cpp6
-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.cpp3
-rw-r--r--src/net/tmwa/adminhandler.h2
11 files changed, 38 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 3f12c0ed2..8cc076fba 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -1420,4 +1420,13 @@ impHandler(commandAlive)
return true;
}
+impHandler(commandDisguise)
+{
+ const std::string args = event.args;
+ if (args.empty())
+ return false;
+ adminHandler->disguise(args);
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index af8a9d64d..fa21e942c 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -124,6 +124,7 @@ namespace Actions
decHandler(commandKillable);
decHandler(commandHeal);
decHandler(commandAlive);
+ decHandler(commandDisguise);
} // namespace Actions
#undef decHandler
diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp
index 9908193f4..9069ee00a 100644
--- a/src/dyetool/actions/commands.cpp
+++ b/src/dyetool/actions/commands.cpp
@@ -124,5 +124,6 @@ impHandlerVoid(commandKiller)
impHandlerVoid(commandKillable)
impHandlerVoid(commandHeal)
impHandlerVoid(commandAlive)
+impHandlerVoid(commandDisguise)
} // namespace Actions
diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h
index 8deb60cfc..15ae2db45 100644
--- a/src/enums/input/inputaction.h
+++ b/src/enums/input/inputaction.h
@@ -653,6 +653,7 @@ enumStart(InputAction)
COMMAND_KILLABLE,
COMMAND_HEAL,
COMMAND_ALIVE,
+ COMMAND_DISGUISE,
TOTAL
}
enumEnd(InputAction);
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index d442c0d99..e287313d7 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -2854,6 +2854,9 @@ void PopupMenu::showNpcGMCommands()
// TRANSLATORS: popup menu item
// TRANSLATORS: warp to npc
mBrowserBox->addRow("/gotonpc 'NAME'", _("Goto"));
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: disguise to npc
+ mBrowserBox->addRow("/disguise 'BEINGSUBTYPEID'", _("Disguise"));
}
}
}
@@ -2875,6 +2878,9 @@ void PopupMenu::showMonsterGMCommands()
// TRANSLATORS: popup menu item
// TRANSLATORS: spawn slave monster
_("Spawn slave"));
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: disguise to monster
+ mBrowserBox->addRow("/disguise 'BEINGSUBTYPEID'", _("Disguise"));
mBrowserBox->addRow("##3---");
// TRANSLATORS: popup menu item
// TRANSLATORS: show monster information
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 8f839e716..cf2e882fc 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -5407,6 +5407,12 @@ static const InputActionData inputActionData
"alive|revive",
UseArgs_true,
Protected_true},
+ {"keyCommandDisguise",
+ defaultAction(&Actions::commandDisguise),
+ InputCondition::INGAME,
+ "disguise",
+ UseArgs_true,
+ Protected_true},
};
#undef defaultAction
diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h
index 04ec9bb6f..72b5157da 100644
--- a/src/net/adminhandler.h
+++ b/src/net/adminhandler.h
@@ -148,6 +148,8 @@ class AdminHandler notfinal
virtual void killable(const std::string &name) const = 0;
virtual void heal(const std::string &name) const = 0;
+
+ virtual void disguise(const std::string &name) const = 0;
};
} // namespace Net
diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp
index 1965cee9d..bf97226b3 100644
--- a/src/net/eathena/adminhandler.cpp
+++ b/src/net/eathena/adminhandler.cpp
@@ -290,4 +290,9 @@ void AdminHandler::alive(const std::string &name) const
Gm::runCharCommand("alive", name);
}
+void AdminHandler::disguise(const std::string &name) const
+{
+ Gm::runCommand("disguise", name);
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h
index dcb7fd7b8..d495f2aad 100644
--- a/src/net/eathena/adminhandler.h
+++ b/src/net/eathena/adminhandler.h
@@ -124,6 +124,8 @@ class AdminHandler final : public Ea::AdminHandler
void alive(const std::string &name) const override final;
+ void disguise(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 6fcc1bd6e..8d1276f6e 100644
--- a/src/net/tmwa/adminhandler.cpp
+++ b/src/net/tmwa/adminhandler.cpp
@@ -228,5 +228,8 @@ void AdminHandler::alive(const std::string &name) const
Gm::runCommand("revive", name);
}
+void AdminHandler::disguise(const std::string &name A_UNUSED) const
+{
+}
} // namespace TmwAthena
diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h
index 99a141517..0a5e034f7 100644
--- a/src/net/tmwa/adminhandler.h
+++ b/src/net/tmwa/adminhandler.h
@@ -136,6 +136,8 @@ class AdminHandler final : public Ea::AdminHandler
void heal(const std::string &name) const override final A_CONST;
void alive(const std::string &name) const override final;
+
+ void disguise(const std::string &name) const override final;
};
} // namespace TmwAthena