From 1db03005155a512723d698be8b5189f625da1b18 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Thu, 27 Feb 2020 17:52:55 +0100 Subject: [PATCH 1/2] Added: moveToTarget lua command and OpenArkUrl move action --- .../ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp | 13 +++++++++++++ code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h | 1 + code/ryzom/client/src/user_entity.cpp | 6 +++++- code/ryzom/client/src/user_entity.h | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 006d45663..034a914b2 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -464,6 +464,7 @@ void CLuaIHMRyzom::RegisterRyzomFunctions(NLGUI::CLuaState &ls) ls.registerFunc("getTargetName", getTargetName); ls.registerFunc("getTargetTitleRaw", getTargetTitleRaw); ls.registerFunc("getTargetTitle", getTargetTitle); + ls.registerFunc("moveToTarget", moveToTarget); ls.registerFunc("addSearchPathUser", addSearchPathUser); ls.registerFunc("displaySystemInfo", displaySystemInfo); ls.registerFunc("displayChatMessage", displayChatMessage); @@ -1527,6 +1528,18 @@ int CLuaIHMRyzom::getTargetTitle(CLuaState &ls) return 1; } +// *************************************************************************** +int CLuaIHMRyzom::moveToTarget(CLuaState &ls) +{ + CLuaIHM::checkArgCount(ls, "moveToTarget", 0); + CEntityCL *target = getTargetEntity(); + if (!target) return 0; + + UserEntity->moveTo(UserEntity->selection(), 1.0, CUserEntity::OpenArkUrl); + return 0; +} + + // *************************************************************************** int CLuaIHMRyzom::addSearchPathUser(CLuaState &ls) { diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h index 529ef8724..78b5a2a00 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h @@ -92,6 +92,7 @@ private: static int getTargetName(CLuaState &ls); static int getTargetTitleRaw(CLuaState &ls); static int getTargetTitle(CLuaState &ls); + static int moveToTarget(CLuaState &ls); static int addSearchPathUser(CLuaState &ls); static int getClientCfgVar(CLuaState &ls); static int isPlayerFreeTrial(CLuaState &ls); diff --git a/code/ryzom/client/src/user_entity.cpp b/code/ryzom/client/src/user_entity.cpp index fd1670da0..652568255 100644 --- a/code/ryzom/client/src/user_entity.cpp +++ b/code/ryzom/client/src/user_entity.cpp @@ -1682,10 +1682,14 @@ void CUserEntity::moveToAction(CEntityCL *ent) case CUserEntity::Outpost: CLuaManager::getInstance().executeLuaScript("game:outpostBCOpenStateWindow()", 0); break; - // BuildTotem + // BuildTotem case CUserEntity::BuildTotem: buildTotem(); break; + // openArkUrl + case CUserEntity::OpenArkUrl: + CLuaManager::getInstance().executeLuaScript("game:openTargetArkUrl()", 0); + break; default: break; } diff --git a/code/ryzom/client/src/user_entity.h b/code/ryzom/client/src/user_entity.h index e240622c9..194ba931f 100644 --- a/code/ryzom/client/src/user_entity.h +++ b/code/ryzom/client/src/user_entity.h @@ -95,6 +95,7 @@ public: Outpost, BuildTotem, MissionRing, + OpenArkUrl, }; public: From 4df2489f5996afbca76bbd9cd0fe2af7f5b42b45 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Thu, 27 Feb 2020 22:33:09 +0100 Subject: [PATCH 2/2] Changed: updated way to moveToTarget --- code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp | 8 ++++++-- code/ryzom/client/src/user_entity.cpp | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 034a914b2..f83bd7dea 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -1531,10 +1531,14 @@ int CLuaIHMRyzom::getTargetTitle(CLuaState &ls) // *************************************************************************** int CLuaIHMRyzom::moveToTarget(CLuaState &ls) { - CLuaIHM::checkArgCount(ls, "moveToTarget", 0); + CLuaIHM::checkArgCount(ls, "moveToTarget", 1); + CLuaIHM::checkArgType(ls, "url", 1, LUA_TSTRING); + + const std::string &url = ls.toString(1); CEntityCL *target = getTargetEntity(); if (!target) return 0; - + + CLuaManager::getInstance().executeLuaScript("ArkTargetUrl = [["+url+"]]", 0); UserEntity->moveTo(UserEntity->selection(), 1.0, CUserEntity::OpenArkUrl); return 0; } diff --git a/code/ryzom/client/src/user_entity.cpp b/code/ryzom/client/src/user_entity.cpp index 652568255..67a31770f 100644 --- a/code/ryzom/client/src/user_entity.cpp +++ b/code/ryzom/client/src/user_entity.cpp @@ -1688,7 +1688,7 @@ void CUserEntity::moveToAction(CEntityCL *ent) break; // openArkUrl case CUserEntity::OpenArkUrl: - CLuaManager::getInstance().executeLuaScript("game:openTargetArkUrl()", 0); + CLuaManager::getInstance().executeLuaScript("getUI('ui:interface:web_transactions'):find('html'):browse(ArkTargetUrl)", 0); break; default: break;