summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-25 22:09:53 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-25 22:09:53 +0300
commit46f4e5fb5c77d01de334e059b88837f8c7fe1f3e (patch)
tree3d20a6b2902e70caeedde5afcb65d0cb5913e69a
parentf8423bd2d31ac4da409cabdc84fa2e3962336103 (diff)
downloadmv-46f4e5fb5c77d01de334e059b88837f8c7fe1f3e.tar.gz
mv-46f4e5fb5c77d01de334e059b88837f8c7fe1f3e.tar.bz2
mv-46f4e5fb5c77d01de334e059b88837f8c7fe1f3e.tar.xz
mv-46f4e5fb5c77d01de334e059b88837f8c7fe1f3e.zip
Add chat command /immortal. 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.cpp4
-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, 34 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 8cc076fba..969807577 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -1429,4 +1429,10 @@ impHandler(commandDisguise)
return true;
}
+impHandler(commandImmortal)
+{
+ adminHandler->immortal(event.args);
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index fa21e942c..1e642ec9e 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -125,6 +125,7 @@ namespace Actions
decHandler(commandHeal);
decHandler(commandAlive);
decHandler(commandDisguise);
+ decHandler(commandImmortal);
} // namespace Actions
#undef decHandler
diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp
index 9069ee00a..c885e7c48 100644
--- a/src/dyetool/actions/commands.cpp
+++ b/src/dyetool/actions/commands.cpp
@@ -125,5 +125,6 @@ impHandlerVoid(commandKillable)
impHandlerVoid(commandHeal)
impHandlerVoid(commandAlive)
impHandlerVoid(commandDisguise)
+impHandlerVoid(commandImmortal)
} // namespace Actions
diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h
index 15ae2db45..6d68d55fb 100644
--- a/src/enums/input/inputaction.h
+++ b/src/enums/input/inputaction.h
@@ -654,6 +654,7 @@ enumStart(InputAction)
COMMAND_HEAL,
COMMAND_ALIVE,
COMMAND_DISGUISE,
+ COMMAND_IMMORTAL,
TOTAL
}
enumEnd(InputAction);
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index e287313d7..20ee37264 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -2745,6 +2745,10 @@ void PopupMenu::showPlayerGMCommands()
// TRANSLATORS: heal player
mBrowserBox->addRow("/gmheal 'NAME'", _("Heal"));
// TRANSLATORS: popup menu item
+ // TRANSLATORS: enable immortal mode for player
+ mBrowserBox->addRow("/immortal 'NAME'", _("Immortal"));
+ mBrowserBox->addRow("##3---");
+ // TRANSLATORS: popup menu item
// TRANSLATORS: set player as killer
mBrowserBox->addRow("/killer 'NAME'", _("Killer"));
// TRANSLATORS: popup menu item
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index cf2e882fc..d42fda40d 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -5413,6 +5413,12 @@ static const InputActionData inputActionData
"disguise",
UseArgs_true,
Protected_true},
+ {"keyCommandImmortal",
+ defaultAction(&Actions::commandImmortal),
+ InputCondition::INGAME,
+ "immortal",
+ UseArgs_true,
+ Protected_true},
};
#undef defaultAction
diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h
index 72b5157da..ab38cdb1a 100644
--- a/src/net/adminhandler.h
+++ b/src/net/adminhandler.h
@@ -150,6 +150,8 @@ class AdminHandler notfinal
virtual void heal(const std::string &name) const = 0;
virtual void disguise(const std::string &name) const = 0;
+
+ virtual void immortal(const std::string &name) const = 0;
};
} // namespace Net
diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp
index bf97226b3..8912750f4 100644
--- a/src/net/eathena/adminhandler.cpp
+++ b/src/net/eathena/adminhandler.cpp
@@ -295,4 +295,9 @@ void AdminHandler::disguise(const std::string &name) const
Gm::runCommand("disguise", name);
}
+void AdminHandler::immortal(const std::string &name) const
+{
+ Gm::runCharCommand("monsterignore", name);
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h
index d495f2aad..79ad2143e 100644
--- a/src/net/eathena/adminhandler.h
+++ b/src/net/eathena/adminhandler.h
@@ -126,6 +126,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;
+
protected:
static std::string mStatsName;
};
diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp
index 8d1276f6e..6bcfcc66f 100644
--- a/src/net/tmwa/adminhandler.cpp
+++ b/src/net/tmwa/adminhandler.cpp
@@ -232,4 +232,8 @@ void AdminHandler::disguise(const std::string &name A_UNUSED) const
{
}
+void AdminHandler::immortal(const std::string &name A_UNUSED) const
+{
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h
index 0a5e034f7..56511f7a8 100644
--- a/src/net/tmwa/adminhandler.h
+++ b/src/net/tmwa/adminhandler.h
@@ -138,6 +138,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;
+
+ void immortal(const std::string &name) const override final;
};
} // namespace TmwAthena