diff --git a/modules/gamelib/ui/uiminimap.lua b/modules/gamelib/ui/uiminimap.lua index 7bf48d2499..a69b254dd5 100644 --- a/modules/gamelib/ui/uiminimap.lua +++ b/modules/gamelib/ui/uiminimap.lua @@ -282,6 +282,9 @@ function UIMinimap:onMouseRelease(pos, button) if button == MouseLeftButton then local player = g_game.getLocalPlayer() + if g_game.getClientVersion() > 1288 and g_keyboard.isCtrlPressed() and g_keyboard.isShiftPressed() then + return g_game.sendGmTeleport(mapPos) + end if Position.distance(player:getPosition(), mapPos) > 250 then modules.game_textmessage.displayStatusMessage(tr('Destination is out of range.')) return false diff --git a/src/client/game.cpp b/src/client/game.cpp index b8c81531a9..c9afad73ab 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1848,6 +1848,14 @@ void Game::openContainerQuickLoot(const uint8_t action, const uint8_t category, disableBotCall(); } +void Game::sendGmTeleport(const Position& pos) +{ + if (!canPerformGameAction()) + return; + + m_protocolGame->sendGmTeleport(pos); +} + void Game::inspectionNormalObject(const Position& position) { if (!canPerformGameAction()) diff --git a/src/client/game.h b/src/client/game.h index baf7f10d16..ff0c9055d1 100644 --- a/src/client/game.h +++ b/src/client/game.h @@ -771,6 +771,7 @@ class Game void requestBless(); void requestQuickLootBlackWhiteList(const uint8_t filter, const uint16_t size, const std::vector& listedItems); void openContainerQuickLoot(const uint8_t action, const uint8_t category, const Position& pos, const uint16_t itemId, const uint8_t stackpos, const bool useMainAsFallback); + void sendGmTeleport(const Position& pos); // cyclopedia related void inspectionNormalObject(const Position& position); diff --git a/src/client/luafunctions.cpp b/src/client/luafunctions.cpp index be6004327b..58676788aa 100644 --- a/src/client/luafunctions.cpp +++ b/src/client/luafunctions.cpp @@ -365,6 +365,7 @@ void Client::registerLuaFunctions() g_lua.bindSingletonFunction("g_game", "requestBless", &Game::requestBless, &g_game); g_lua.bindSingletonFunction("g_game", "requestQuickLootBlackWhiteList", &Game::requestQuickLootBlackWhiteList, &g_game); g_lua.bindSingletonFunction("g_game", "openContainerQuickLoot", &Game::openContainerQuickLoot, &g_game); + g_lua.bindSingletonFunction("g_game", "sendGmTeleport", &Game::sendGmTeleport, &g_game); g_lua.bindSingletonFunction("g_game", "inspectionNormalObject", &Game::inspectionNormalObject, &g_game); g_lua.bindSingletonFunction("g_game", "inspectionObject", &Game::inspectionObject, &g_game); g_lua.bindSingletonFunction("g_game", "requestBestiary", &Game::requestBestiary, &g_game); diff --git a/src/client/protocolcodes.h b/src/client/protocolcodes.h index 83d989324f..880fef2029 100644 --- a/src/client/protocolcodes.h +++ b/src/client/protocolcodes.h @@ -256,6 +256,7 @@ namespace Proto ClientTurnEast = 112, ClientTurnSouth = 113, ClientTurnWest = 114, + ClientGmTeleport = 115, ClientEquipItem = 119, ClientMove = 120, ClientInspectNpcTrade = 121, diff --git a/src/client/protocolgame.h b/src/client/protocolgame.h index 9f95cf734a..ce69901a79 100644 --- a/src/client/protocolgame.h +++ b/src/client/protocolgame.h @@ -53,6 +53,7 @@ class ProtocolGame : public Protocol void sendTurnEast(); void sendTurnSouth(); void sendTurnWest(); + void sendGmTeleport(const Position& pos); void sendEquipItem(const uint16_t itemId, const uint16_t countOrSubType); void sendMove(const Position& fromPos, const uint16_t thingId, const uint8_t stackpos, const Position& toPos, const uint16_t count); void sendInspectNpcTrade(const uint16_t itemId, const uint16_t count); diff --git a/src/client/protocolgamesend.cpp b/src/client/protocolgamesend.cpp index aa1b25b1e5..a030fca237 100644 --- a/src/client/protocolgamesend.cpp +++ b/src/client/protocolgamesend.cpp @@ -295,6 +295,14 @@ void ProtocolGame::sendTurnWest() send(msg); } +void ProtocolGame::sendGmTeleport(const Position& pos) +{ + const auto& msg = std::make_shared(); + msg->addU8(Proto::ClientGmTeleport); + addPosition(msg, pos); + send(msg); +} + void ProtocolGame::sendEquipItem(const uint16_t itemId, const uint16_t countOrSubType) { const auto& msg = std::make_shared();