summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-25 20:13:04 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-25 20:13:04 +0300
commit704b5b31fea63483c81f0744d88e46a856573424 (patch)
tree37a3530e9be27f0aca4283ec90944174aae542fa
parent25bf3308cf490313b4a86b78643226f078ce4f7e (diff)
downloadplus-704b5b31fea63483c81f0744d88e46a856573424.tar.gz
plus-704b5b31fea63483c81f0744d88e46a856573424.tar.bz2
plus-704b5b31fea63483c81f0744d88e46a856573424.tar.xz
plus-704b5b31fea63483c81f0744d88e46a856573424.zip
Add chat command /killer. Also add it to player context menu.
-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.cpp3
-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, 33 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 13bb0b622..6c7cb1d8f 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -1396,4 +1396,10 @@ impHandler(commandGotoNpc)
return true;
}
+impHandler(commandKiller)
+{
+ adminHandler->killer(event.args);
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index f1dc28356..9328f1d2c 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -120,6 +120,7 @@ namespace Actions
decHandler(commandLoadPosition);
decHandler(commandRandomWarp);
decHandler(commandGotoNpc);
+ decHandler(commandKiller);
} // namespace Actions
#undef decHandler
diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp
index 79c03a746..a87b76c5e 100644
--- a/src/dyetool/actions/commands.cpp
+++ b/src/dyetool/actions/commands.cpp
@@ -120,5 +120,6 @@ impHandlerVoid(commandSavePosition)
impHandlerVoid(commandLoadPosition)
impHandlerVoid(commandRandomWarp)
impHandlerVoid(commandGotoNpc)
+impHandlerVoid(commandKiller)
} // namespace Actions
diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h
index 29d8b9362..edfc88f34 100644
--- a/src/enums/input/inputaction.h
+++ b/src/enums/input/inputaction.h
@@ -649,6 +649,7 @@ enumStart(InputAction)
COMMAND_LOAD_POSITION,
COMMAND_RANDOM_WARP,
COMMAND_GOTO_NPC,
+ COMMAND_KILLER,
TOTAL
}
enumEnd(InputAction);
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index cb46084d2..f5bc3d32d 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -2746,6 +2746,9 @@ void PopupMenu::showPlayerGMCommands()
if (!legacy)
{
// TRANSLATORS: popup menu item
+ // TRANSLATORS: set player as killer
+ mBrowserBox->addRow("/killer 'NAME'", _("Killer"));
+ // TRANSLATORS: popup menu item
// TRANSLATORS: set player save position
mBrowserBox->addRow("/savepos 'NAME'", _("Set save"));
// TRANSLATORS: popup menu item
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 3a90e4a5d..93f1e73bb 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -5383,6 +5383,12 @@ static const InputActionData inputActionData
"gotonpc|warptonpc",
UseArgs_true,
Protected_true},
+ {"keyCommandKiller",
+ defaultAction(&Actions::commandKiller),
+ InputCondition::INGAME,
+ "setkiller|killer",
+ UseArgs_true,
+ Protected_true},
};
#undef defaultAction
diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h
index 94acc54f5..ae8a55e73 100644
--- a/src/net/adminhandler.h
+++ b/src/net/adminhandler.h
@@ -142,6 +142,8 @@ class AdminHandler notfinal
virtual void randomWarp(const std::string &name) const = 0;
virtual void gotoNpc(const std::string &name) const = 0;
+
+ virtual void killer(const std::string &name) const = 0;
};
} // namespace Net
diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp
index f1742315b..25104c076 100644
--- a/src/net/eathena/adminhandler.cpp
+++ b/src/net/eathena/adminhandler.cpp
@@ -270,4 +270,9 @@ void AdminHandler::gotoNpc(const std::string &name) const
Gm::runCommand("tonpc", name);
}
+void AdminHandler::killer(const std::string &name) const
+{
+ Gm::runCharCommand("killer", name);
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h
index 0ddc8b348..24dbf9b8a 100644
--- a/src/net/eathena/adminhandler.h
+++ b/src/net/eathena/adminhandler.h
@@ -116,6 +116,8 @@ class AdminHandler final : public Ea::AdminHandler
void gotoNpc(const std::string &name) const override final;
+ void killer(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 76bec8fc5..1b2d2919a 100644
--- a/src/net/tmwa/adminhandler.cpp
+++ b/src/net/tmwa/adminhandler.cpp
@@ -211,4 +211,8 @@ void AdminHandler::gotoNpc(const std::string &name A_UNUSED) const
{
}
+void AdminHandler::killer(const std::string &name A_UNUSED) const
+{
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h
index bdb7e1037..22deeeb08 100644
--- a/src/net/tmwa/adminhandler.h
+++ b/src/net/tmwa/adminhandler.h
@@ -128,6 +128,8 @@ class AdminHandler final : public Ea::AdminHandler
void randomWarp(const std::string &name) const override final A_CONST;
void gotoNpc(const std::string &name) const override final A_CONST;
+
+ void killer(const std::string &name) const override final A_CONST;
};
} // namespace TmwAthena