summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-24 20:15:18 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-24 20:15:18 +0300
commite0b4a2665505279e58f2a618272db5245f275518 (patch)
treee973687cba28b78f27e9527743e0c57d6f9619f5 /src
parent61de258859b600011284a49d54bca1f31ecb6d3d (diff)
downloadmanaverse-e0b4a2665505279e58f2a618272db5245f275518.tar.gz
manaverse-e0b4a2665505279e58f2a618272db5245f275518.tar.bz2
manaverse-e0b4a2665505279e58f2a618272db5245f275518.tar.xz
manaverse-e0b4a2665505279e58f2a618272db5245f275518.zip
Add chat command /spawn. Also add it to monster 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.cpp1
-rw-r--r--src/input/inputactionmap.h6
-rw-r--r--src/net/adminhandler.h2
-rw-r--r--src/net/ea/adminhandler.cpp5
-rw-r--r--src/net/ea/adminhandler.h2
9 files changed, 28 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index e6721e4f0..7c451c861 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -1323,4 +1323,13 @@ impHandler(commandShowAccountInfo)
return true;
}
+impHandler(commandSpawn)
+{
+ const std::string args = event.args;
+ if (args.empty())
+ return false;
+ adminHandler->spawn(args);
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index 45f4364b1..6ee3e13e4 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -111,6 +111,7 @@ namespace Actions
decHandler(commandShowInventory);
decHandler(locatePlayer);
decHandler(commandShowAccountInfo);
+ decHandler(commandSpawn);
} // namespace Actions
#undef decHandler
diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp
index 83695c88b..d810e497e 100644
--- a/src/dyetool/actions/commands.cpp
+++ b/src/dyetool/actions/commands.cpp
@@ -111,5 +111,6 @@ impHandlerVoid(commandShowCart)
impHandlerVoid(commandShowInventory)
impHandlerVoid(locatePlayer)
impHandlerVoid(commandShowAccountInfo)
+impHandlerVoid(commandSpawn)
} // namespace Actions
diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h
index b59873d35..e7ed5a9d6 100644
--- a/src/enums/input/inputaction.h
+++ b/src/enums/input/inputaction.h
@@ -640,6 +640,7 @@ enumStart(InputAction)
COMMAND_SHOW_INVENTORY,
LOCATE_PLAYER,
COMMAND_SHOW_ACCOUNT_INFO,
+ COMMAND_SPAWN,
TOTAL
}
enumEnd(InputAction);
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 46d35d0d9..9d7577cf4 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -2769,6 +2769,7 @@ void PopupMenu::showMonsterGMCommands()
// TRANSLATORS: popup menu item
// TRANSLATORS: kick monster
mBrowserBox->addRow("/kick :'BEINGID'", _("Kick"));
+ mBrowserBox->addRow("/spawn 'BEINGSUBTYPEID'", _("Spawn same"));
mBrowserBox->addRow("##3---");
// TRANSLATORS: popup menu item
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index e1541690e..a4f648205 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -5329,6 +5329,12 @@ static const InputActionData inputActionData
"showaccountinfo|showaccinfo|accinfo",
UseArgs_true,
Protected_true},
+ {"keyCommandSpawn",
+ defaultAction(&Actions::commandSpawn),
+ InputCondition::INGAME,
+ "spawn|monster",
+ UseArgs_true,
+ Protected_true},
};
#undef defaultAction
diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h
index 0fe07136a..2d0dc72f4 100644
--- a/src/net/adminhandler.h
+++ b/src/net/adminhandler.h
@@ -124,6 +124,8 @@ class AdminHandler notfinal
virtual void locatePlayer(const std::string &name) const = 0;
virtual void showAccountInfo(const std::string &name) const = 0;
+
+ virtual void spawn(const std::string &name) const = 0;
};
} // namespace Net
diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp
index 8aa0fc041..d209cc47f 100644
--- a/src/net/ea/adminhandler.cpp
+++ b/src/net/ea/adminhandler.cpp
@@ -92,4 +92,9 @@ void AdminHandler::slide(const int x, const int y) const
}
}
+void AdminHandler::spawn(const std::string &name) const
+{
+ chatHandler->talk("@spawn " + name, GENERAL_CHANNEL);
+}
+
} // namespace Ea
diff --git a/src/net/ea/adminhandler.h b/src/net/ea/adminhandler.h
index 9acb1c8f3..3d6adf433 100644
--- a/src/net/ea/adminhandler.h
+++ b/src/net/ea/adminhandler.h
@@ -60,6 +60,8 @@ class AdminHandler notfinal : public Net::AdminHandler
void createItems(const int id,
const ItemColor color,
const int amount) const override final;
+
+ void spawn(const std::string &name) const override final;
};
} // namespace Ea