summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-25 19:05:31 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-25 19:05:31 +0300
commit77392dfa39913e4d6c51934deab51088da878e7a (patch)
treea6f56d693f5847a22e1514d17f7752798b84597b /src
parent4eb67aee829ba4f7b59d5a8f885a472d843e679a (diff)
downloadplus-77392dfa39913e4d6c51934deab51088da878e7a.tar.gz
plus-77392dfa39913e4d6c51934deab51088da878e7a.tar.bz2
plus-77392dfa39913e4d6c51934deab51088da878e7a.tar.xz
plus-77392dfa39913e4d6c51934deab51088da878e7a.zip
Add chat command /randomwarp. 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.cpp7
-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.cpp4
-rw-r--r--src/net/tmwa/adminhandler.h2
11 files changed, 35 insertions, 2 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 771bf0ed5..c317af86a 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -1381,4 +1381,10 @@ impHandler(commandLoadPosition)
return true;
}
+impHandler(commandRandomWarp)
+{
+ adminHandler->randomWarp(event.args);
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index c7b1b60cb..bf7ebe03c 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -118,6 +118,7 @@ namespace Actions
decHandler(commandSpawnEvilClone);
decHandler(commandSavePosition);
decHandler(commandLoadPosition);
+ decHandler(commandRandomWarp);
} // namespace Actions
#undef decHandler
diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp
index 3f6254053..2b09fc90a 100644
--- a/src/dyetool/actions/commands.cpp
+++ b/src/dyetool/actions/commands.cpp
@@ -118,5 +118,6 @@ impHandlerVoid(commandSpawnSlaveClone)
impHandlerVoid(commandSpawnEvilClone)
impHandlerVoid(commandSavePosition)
impHandlerVoid(commandLoadPosition)
+impHandlerVoid(commandRandomWarp)
} // namespace Actions
diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h
index c3e04d935..261e7319c 100644
--- a/src/enums/input/inputaction.h
+++ b/src/enums/input/inputaction.h
@@ -647,6 +647,7 @@ enumStart(InputAction)
COMMAND_SPAWN_EVIL_CLONE,
COMMAND_SAVE_POSITION,
COMMAND_LOAD_POSITION,
+ COMMAND_RANDOM_WARP,
TOTAL
}
enumEnd(InputAction);
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index f691e4ea5..903720de4 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -2747,10 +2747,13 @@ void PopupMenu::showPlayerGMCommands()
{
// TRANSLATORS: popup menu item
// TRANSLATORS: set player save position
- mBrowserBox->addRow("/savepos 'NAME'", _("Set save position"));
+ mBrowserBox->addRow("/savepos 'NAME'", _("Set save"));
// TRANSLATORS: popup menu item
// TRANSLATORS: warp player to save position
- mBrowserBox->addRow("/loadpos 'NAME'", _("Warp to save position"));
+ mBrowserBox->addRow("/loadpos 'NAME'", _("Warp to save"));
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: warp player to random position on same map
+ mBrowserBox->addRow("/randomwarp 'NAME'", _("Warp to random"));
mBrowserBox->addRow("##3---");
// TRANSLATORS: popup menu item
// TRANSLATORS: spawn player clone
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 1289a9ecd..38768dbe1 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -5371,6 +5371,12 @@ static const InputActionData inputActionData
"loadpos|loadposition",
UseArgs_true,
Protected_true},
+ {"keyCommandRandomWarp",
+ defaultAction(&Actions::commandRandomWarp),
+ InputCondition::INGAME,
+ "randomwarp|jump",
+ UseArgs_true,
+ Protected_true},
};
#undef defaultAction
diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h
index f34a47306..2ac37ffed 100644
--- a/src/net/adminhandler.h
+++ b/src/net/adminhandler.h
@@ -138,6 +138,8 @@ class AdminHandler notfinal
virtual void savePosition(const std::string &name) const = 0;
virtual void loadPosition(const std::string &name) const = 0;
+
+ virtual void randomWarp(const std::string &name) const = 0;
};
} // namespace Net
diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp
index 80a1df983..b647f92b0 100644
--- a/src/net/eathena/adminhandler.cpp
+++ b/src/net/eathena/adminhandler.cpp
@@ -260,4 +260,9 @@ void AdminHandler::loadPosition(const std::string &name) const
Gm::runCharCommand("load", name);
}
+void AdminHandler::randomWarp(const std::string &name) const
+{
+ Gm::runCharCommand("jump", name);
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h
index e5b5e511a..c7f997590 100644
--- a/src/net/eathena/adminhandler.h
+++ b/src/net/eathena/adminhandler.h
@@ -112,6 +112,8 @@ class AdminHandler final : public Ea::AdminHandler
void loadPosition(const std::string &name) const override final;
+ void randomWarp(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 69bdf27b8..363cd2552 100644
--- a/src/net/tmwa/adminhandler.cpp
+++ b/src/net/tmwa/adminhandler.cpp
@@ -203,4 +203,8 @@ void AdminHandler::loadPosition(const std::string &name A_UNUSED) const
{
}
+void AdminHandler::randomWarp(const std::string &name A_UNUSED) const
+{
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h
index 9d0471b8c..88bd007f8 100644
--- a/src/net/tmwa/adminhandler.h
+++ b/src/net/tmwa/adminhandler.h
@@ -124,6 +124,8 @@ class AdminHandler final : public Ea::AdminHandler
void loadPosition(const std::string &name) const override final
A_CONST;
+
+ void randomWarp(const std::string &name) const override final A_CONST;
};
} // namespace TmwAthena