From 02f688326716e1f9a193f6f139021242241ad014 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 14 Dec 2014 23:21:39 +0300 Subject: Add chat command for warp to location at same map. New chat command: /warp X Y --- src/actions/commands.cpp | 14 ++++++++++++++ src/actions/commands.h | 1 + src/input/inputaction.h | 1 + src/input/inputactionmap.h | 9 +++++++++ 4 files changed, 25 insertions(+) diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 07cd0c64e..b90a801d1 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -23,6 +23,7 @@ #include "actormanager.h" #include "configuration.h" #include "flooritem.h" +#include "game.h" #include "inventory.h" #include "item.h" #include "party.h" @@ -821,4 +822,17 @@ impHandler0(leaveParty) return true; } +impHandler(warp) +{ + int x = 0; + int y = 0; + + if (Game::instance() && parse2Int(event.args, x, y)) + { + adminHandler->warp(Game::instance()->getCurrentMapName(), + x, y); + } + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 3b69535a3..245b514a2 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -81,6 +81,7 @@ namespace Actions decHandler(setHomunculusName); decHandler(fireHomunculus); decHandler(leaveParty); + decHandler(warp); } // namespace Actions #undef decHandler diff --git a/src/input/inputaction.h b/src/input/inputaction.h index e4f96d06a..4de3c7cb4 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -514,6 +514,7 @@ namespace InputAction ADD_TEXT, KICK, LEAVE_PARTY, + WARP, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index e93d6029c..ac54eaedb 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -4369,6 +4369,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputCondition::INGAME, "leaveparty|partyleave", true}, + {"keyWarp", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::warp, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "warp", + true}, }; #endif // INPUT_INPUTACTIONMAP_H -- cgit v1.2.3-70-g09d2