From f8af0da354c9ed68c5513be3600978158be8d877 Mon Sep 17 00:00:00 2001 From: ulukyn Date: Tue, 28 May 2019 20:40:41 +0200 Subject: [PATCH 01/29] =?UTF-8?q?=C3=89tiquette=20Live-746=20ajout=C3=A9e?= =?UTF-8?q?=20=C3=A0=20la=20r=C3=A9vision=202102fb276eb6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : yubo --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 0e4513b68..09f29bcc8 100644 --- a/.hgtags +++ b/.hgtags @@ -24,3 +24,4 @@ fc4be8ebec5ca754ef4453bc6a9faef90837c674 ryzom-patch-3.4.0 3941482843f9cd130cfc16634efc08d34a98ed35 ryzom-patch-3.4.0 Atysmas ecae9feb4cceb78103e5d7236caccaf450796cdb ryzom-patch-3.5.0 95783afa226f241062134eb62f4323295d29ac84 ryzom-patch-3.5.0.9637 +2102fb276eb69d49ed4923042215312a63c47c08 Live-746 From 21dfa80b735831eaed315066047e0265bac16697 Mon Sep 17 00:00:00 2001 From: Inky Date: Wed, 12 Jun 2019 22:37:36 +0300 Subject: [PATCH 02/29] Changed: display version at login --HG-- branch : compatibility-develop --- code/ryzom/client/src/login.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp index d45ac7e26..1eb6ec867 100644 --- a/code/ryzom/client/src/login.cpp +++ b/code/ryzom/client/src/login.cpp @@ -61,6 +61,7 @@ #include "game_share/bg_downloader_msg.h" #include "misc.h" +#include "user_agent.h" void ConnectToShard(); @@ -783,6 +784,15 @@ void initLoginScreen() ClientApp = ClientCfg.ConfigFile.getVar("Application").asString(0); + // version + std::string ext; + if (ClientApp.find("ryzom_") != ucstring::npos) + ext = " (" + ClientApp.substr(6) + ")"; + + CViewText *pV = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:checkpass:content:ver_value")); + if (pV) + pV->setHardText(getDisplayVersion() + (ext.empty() ? "" : ext)); + // give priority to login specified as argument string l = !LoginLogin.empty() ? LoginLogin:ClientCfg.LastLogin; From bfab92082bb5ea037e247b0cc3be6e6d96f2483f Mon Sep 17 00:00:00 2001 From: Inky Date: Thu, 13 Jun 2019 15:41:44 +0300 Subject: [PATCH 03/29] Changed: char selection keyboard navigation handler --HG-- branch : compatibility-develop --- .../src/interface_v3/action_handler_game.cpp | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 9ccdf1b11..813bda15d 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -4609,3 +4609,38 @@ public: }; REGISTER_ACTION_HANDLER( CHandlerSortTribeFame, "sort_tribefame"); +// *************************************************************************** +// navigate_charsel +// Arg : current slot selected +// *************************************************************************** +class CHandlerCharselNaviGetKeys : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const string &Params) + { + sint32 slot = 0; + if (!getParam(Params, "cs").empty()) + fromString(getParam(Params, "cs"), slot); + + if (Driver->AsyncListener.isKeyPushed(KeyESCAPE)) + CAHManager::getInstance()->runActionHandler("proc", NULL, "proc_quit"); + + if (Driver->AsyncListener.isKeyPushed(KeyRETURN)) + CAHManager::getInstance()->runActionHandler("proc", NULL, "proc_charsel_enterkeyslot"); + + const sint32 index = slot; + if (Driver->AsyncListener.isKeyPushed(KeyUP)) + { + slot--; + if (slot < 0) slot = 4; + } + else if (Driver->AsyncListener.isKeyPushed(KeyDOWN)) + { + slot++; + if (slot > 4) slot = 0; + } + // now select + if (index != slot) + CAHManager::getInstance()->runActionHandler("proc", NULL, toString("proc_charsel_clickslot|%i", slot)); + } +}; +REGISTER_ACTION_HANDLER( CHandlerCharselNaviGetKeys, "navigate_charsel" ); From 90e508032c71d4e62bd06ab75e09119b4307a664 Mon Sep 17 00:00:00 2001 From: Inky Date: Fri, 21 Jun 2019 02:03:36 +0300 Subject: [PATCH 05/29] Changed: character selection handler --HG-- branch : menu_navi --- .../src/interface_v3/action_handler_game.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 9ccdf1b11..6548ce412 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -4609,3 +4609,30 @@ public: }; REGISTER_ACTION_HANDLER( CHandlerSortTribeFame, "sort_tribefame"); +// *************************************************************************** +class CHandlerCharselNaviGetKeys : public IActionHandler +{ + virtual void execute (CCtrlBase *pCaller, const string &Params) + { + const std::string ui = pCaller->getParent()->getId(); + if (ui != "ui:outgame") + return; + + if (Params.empty()) + { + sint32 event = -1; + + if (Driver->AsyncListener.isKeyPushed(KeyESCAPE)) event = 0; + if (Driver->AsyncListener.isKeyPushed(KeyDELETE)) event = 1; + if (Driver->AsyncListener.isKeyPushed(KeyRETURN)) event = 2; + if (Driver->AsyncListener.isKeyPushed(KeyDOWN)) event = 3; + if (Driver->AsyncListener.isKeyPushed(KeyUP)) event = 4; + + if (event != -1) + CLuaManager::getInstance().executeLuaScript(toString("outgame:eventCharselKeyGet(%i)", event)); + } + // reset previous input + Driver->AsyncListener.reset(); + } +}; +REGISTER_ACTION_HANDLER( CHandlerCharselNaviGetKeys, "navigate_charsel" ); From 331b0d8718e72c4caa0794d3fdf76e970c0c9554 Mon Sep 17 00:00:00 2001 From: Inky Date: Sat, 22 Jun 2019 00:51:12 +0300 Subject: [PATCH 06/29] Fixed: bad condition to verify parent id --HG-- branch : menu_navi --- code/ryzom/client/src/interface_v3/action_handler_game.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 6548ce412..a9dcb54ea 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -4614,8 +4614,10 @@ class CHandlerCharselNaviGetKeys : public IActionHandler { virtual void execute (CCtrlBase *pCaller, const string &Params) { - const std::string ui = pCaller->getParent()->getId(); - if (ui != "ui:outgame") + if (!pCaller->getParent()) + return; + + if (pCaller->getParent()->getId() != "ui:outgame") return; if (Params.empty()) From f5e9b7703c710fc67dd421d4169a4f40b23cf278 Mon Sep 17 00:00:00 2001 From: Inky Date: Sun, 23 Jun 2019 02:13:39 +0300 Subject: [PATCH 07/29] Changed: added keyboard events to CCtrlScroll elements --HG-- branch : menu_navi --- code/nel/include/nel/gui/ctrl_scroll.h | 1 + code/nel/src/gui/ctrl_scroll.cpp | 42 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/code/nel/include/nel/gui/ctrl_scroll.h b/code/nel/include/nel/gui/ctrl_scroll.h index a22da2cbd..8a47691a5 100644 --- a/code/nel/include/nel/gui/ctrl_scroll.h +++ b/code/nel/include/nel/gui/ctrl_scroll.h @@ -174,6 +174,7 @@ namespace NLGUI bool _MouseDown : 1; bool _CallingAH : 1; bool _Cancelable : 1; // true if the slider may be cancelled when pressed on the mouse right button + bool _Keyboard : 1; bool _Frozen : 1; bool _Scale : 1; diff --git a/code/nel/src/gui/ctrl_scroll.cpp b/code/nel/src/gui/ctrl_scroll.cpp index e97bd8cd4..ba38b32c2 100644 --- a/code/nel/src/gui/ctrl_scroll.cpp +++ b/code/nel/src/gui/ctrl_scroll.cpp @@ -53,6 +53,7 @@ namespace NLGUI _MouseDown = false; _CallingAH = false; _Cancelable = false; + _Keyboard = false; _Target = NULL; _Inverted = false; _IsDBLink = false; @@ -221,6 +222,11 @@ namespace NLGUI return toString( _Cancelable ); } else + if( name == "keyboard" ) + { + return toString( _Keyboard ); + } + else if( name == "frozen" ) { return toString( _Frozen ); @@ -401,6 +407,14 @@ namespace NLGUI return; } else + if( name == "keyboard" ) + { + bool b; + if( fromString( value, b ) ) + _Keyboard = b; + return; + } + else if( name == "frozen" ) { bool b; @@ -470,6 +484,7 @@ namespace NLGUI xmlSetProp( node, BAD_CAST "target_stepy", BAD_CAST toString( _TargetStepY ).c_str() ); xmlSetProp( node, BAD_CAST "step_value", BAD_CAST toString( _StepValue ).c_str() ); xmlSetProp( node, BAD_CAST "cancelable", BAD_CAST toString( _Cancelable ).c_str() ); + xmlSetProp( node, BAD_CAST "keyboard", BAD_CAST toString( _Keyboard ).c_str() ); xmlSetProp( node, BAD_CAST "frozen", BAD_CAST toString( _Frozen ).c_str() ); return node; @@ -585,6 +600,9 @@ namespace NLGUI prop = (char*) xmlGetProp( node, (xmlChar*)"cancelable" ); if (prop) _Cancelable = convertBool(prop); + prop = (char*) xmlGetProp( node, (xmlChar*)"keyboard" ); + if (prop) _Keyboard = convertBool(prop); + prop= (char*) xmlGetProp (node, (xmlChar*)"frozen"); _Frozen = false; if (prop) @@ -850,6 +868,7 @@ namespace NLGUI if (CCtrlBase::handleEvent(event)) return true; if (!_Active || _Frozen) return false; + if (event.getType() == NLGUI::CEventDescriptor::mouse) { const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event; @@ -908,6 +927,28 @@ namespace NLGUI return true; } } + else if (event.getType() == NLGUI::CEventDescriptor::key) + { + const NLGUI::CEventDescriptorKey &eventDesc = (const NLGUI::CEventDescriptorKey &)event; + + if (eventDesc.getKeyEventType() == NLGUI::CEventDescriptorKey::keydown) + { + if (_Keyboard) + { + sint32 i = 0; + // direction + if (eventDesc.getKey() == KeyNEXT) i++; + if (eventDesc.getKey() == KeyPRIOR) i--; + + if (_Vertical) + moveTrackY(-(i * _TargetStepY)); + else + moveTrackX(-(i * _TargetStepX)); + + return true; + } + } + } return false; } @@ -1209,6 +1250,7 @@ namespace NLGUI if(wReal <= maxWReal) return; + // compute the new ofsX. sint32 ofsX= _Target->getOfsX(); ofsX+= dx; From 5d1233e8050aa301900dafc0b260d8ec2f5a1fcf Mon Sep 17 00:00:00 2001 From: Inky Date: Mon, 24 Jun 2019 02:15:04 +0300 Subject: [PATCH 08/29] Changed: update button selection handler mainland_select --HG-- branch : menu_navi --- code/ryzom/client/src/connection.cpp | 62 +++++++++++++++++++--------- 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index 045822370..df557dd45 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -2110,7 +2110,7 @@ public: virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); + //CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceGroup *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND)); if (pList == NULL) @@ -2189,7 +2189,7 @@ public: virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); + //CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceGroup *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND)); pList->clearGroups(); } @@ -2200,32 +2200,56 @@ REGISTER_ACTION_HANDLER (CAHResetMainlandList, "reset_mainland_list"); // *************************************************************************** class CAHMainlandSelect : public IActionHandler { - virtual void execute (CCtrlBase *pCaller, const string &/* Params */) + virtual void execute (CCtrlBase *pCaller, const std::string &Params) { - nlinfo("CAHMainlandSelect called"); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); + //nlinfo("CAHMainlandSelect called"); + struct CUnpush : public CInterfaceElementVisitor + { + CCtrlBase *Ref; + virtual void visitCtrl(CCtrlBase *ctrl) + { + if (ctrl == Ref) return; + CCtrlBaseButton *but = dynamic_cast(ctrl); + if (but) + { + but->setPushed(false); + } + } + }; + CInterfaceGroup *list = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND)); + if (!list) + return; - CCtrlButton *pCB = NULL; - // Unselect - if (MainlandSelected.asInt() != 0) + // unselect + if (Params.empty()) { - pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND ":"+toString(MainlandSelected)+":but")); - if (pCB != NULL) - pCB->setPushed(false); + CUnpush unpusher; + unpusher.Ref = pCaller; + list->visit(&unpusher); } - pCB = dynamic_cast(pCaller); - if (pCB != NULL) + // now select + uint32 mainland; + if (Params.empty()) { - string name = pCB->getId(); - name = name.substr(0,name.rfind(':')); - uint32 mainland; - fromString(name.substr(name.rfind(':')+1,name.size()), mainland); - MainlandSelected = (TSessionId)mainland; + CCtrlButton *pCB = dynamic_cast(pCaller); + if (!pCB) + return; + + std::string name = pCB->getId(); + name = name.substr(0, name.rfind(':')); + + if (!fromString(name.substr(name.rfind(':')+1, name.size()), mainland)) + return; pCB->setPushed(true); } + else + if (!fromString(Params, mainland)) + return; + + // and store + MainlandSelected = (TSessionId)mainland; } }; REGISTER_ACTION_HANDLER (CAHMainlandSelect, "mainland_select"); From c8927c9c4bdbf18f2521a7a682356c74dcaaf505 Mon Sep 17 00:00:00 2001 From: Inky Date: Mon, 24 Jun 2019 20:34:01 +0300 Subject: [PATCH 09/29] Changed: update button selection handler keyset_select --HG-- branch : menu_navi --- code/ryzom/client/src/connection.cpp | 73 +++++++++++++++------------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index df557dd45..17a042efd 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -2454,7 +2454,7 @@ public: virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); + //CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceGroup *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_KEYSET)); pList->clearGroups(); } @@ -2465,59 +2465,66 @@ REGISTER_ACTION_HANDLER (CAHResetKeysetList, "reset_keyset_list"); // *************************************************************************** class CAHResetKeysetSelect : public IActionHandler { -public: std::string getIdPostFix(const std::string fullId) { std::string::size_type pos = fullId.find_last_of(":"); if (pos != std::string::npos) - { return fullId.substr(pos + 1); - } + return ""; } - virtual void execute (CCtrlBase *pCaller, const string &/* Params */) + + virtual void execute(CCtrlBase *pCaller, const std::string &Params) { - if (!pCaller) return; // 'unpush' all groups but the caller - // struct CUnpush : public CInterfaceElementVisitor { CCtrlBase *Ref; virtual void visitCtrl(CCtrlBase *ctrl) { if (ctrl == Ref) return; - CCtrlBaseButton *but = dynamic_cast(ctrl); + CCtrlBaseButton *but = dynamic_cast(ctrl); if (but) { but->setPushed(false); } } }; - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInterfaceGroup * list = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_KEYSET)); - if (list) - { - CUnpush unpusher; - unpusher.Ref = pCaller; - list->visit(&unpusher); - } - CCtrlBaseButton *but = dynamic_cast(pCaller); + CInterfaceGroup *list = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_KEYSET)); + if (!list) + return; + + // unselect + CUnpush unpusher; + unpusher.Ref = pCaller; + list->visit(&unpusher); + + // now select + CCtrlBaseButton *but = dynamic_cast(pCaller); if (but) - { but->setPushed(true); + + std::string id; + if (Params.empty()) + { + if (!pCaller) return; + if (!pCaller->getParent()) return; + + id = getIdPostFix(pCaller->getParent()->getId()); } - // + else + id = getIdPostFix(Params); + GameKeySet = "keys.xml"; RingEditorKeySet = "keys_r2ed.xml"; - if (!pCaller->getParent()) return; - // compute the 2 filenames from the id - // if id is in the built-in keysets : + + // compute the two filenames from the id + // if id is in the built-in keysets CConfigFile::CVar *keySetVar = ClientCfg.ConfigFile.getVarPtr(KeySetVarName); - if (keySetVar && keySetVar->size() != 0) + if (keySetVar && keySetVar->size() > 0) { for (uint k = 0; k < keySetVar->size(); ++k) { - std::string id = getIdPostFix(pCaller->getParent()->getId()); if (keySetVar->asString(k) == id) { GameKeySet = "keys" + string(id.empty() ? "" : "_") + id + ".xml"; @@ -2526,17 +2533,15 @@ public: } } } - // ... else maybe from a previous character ? - if (CFile::isExists("save/keys_" + getIdPostFix(pCaller->getParent()->getId()) + ".xml") ) - { - GameKeySet = "keys_" + getIdPostFix(pCaller->getParent()->getId()) + ".xml"; - } - if (CFile::isExists("save/keys_r2ed_" + getIdPostFix(pCaller->getParent()->getId()) + ".xml") ) - { - RingEditorKeySet = "keys_r2ed_" + getIdPostFix(pCaller->getParent()->getId()) + ".xml"; - } - // NB : key file will be copied for real when the new 'character summary' is + // else maybe from a previous character? + if (CFile::isExists("save/keys_" + id + ".xml")) + GameKeySet = "keys_" + id + ".xml"; + + if (CFile::isExists("save/keys_r2ed_" + id + ".xml")) + RingEditorKeySet = "keys_r2ed_" + id + ".xml"; + + // NB: key file will be copied for real when the new character summary is } }; REGISTER_ACTION_HANDLER (CAHResetKeysetSelect, "keyset_select"); From 0f3f64cdc231ee71cef004353551a478f04824d4 Mon Sep 17 00:00:00 2001 From: Inky Date: Tue, 25 Jun 2019 15:52:28 +0300 Subject: [PATCH 10/29] Changed: character creation handler Todo: fusion both handler --HG-- branch : menu_navi --- .../src/interface_v3/action_handler_game.cpp | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index a9dcb54ea..c35493475 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -4638,3 +4638,35 @@ class CHandlerCharselNaviGetKeys : public IActionHandler } }; REGISTER_ACTION_HANDLER( CHandlerCharselNaviGetKeys, "navigate_charsel" ); + +// *************************************************************************** +class CHandlerCharcreateGetKeys : public IActionHandler +{ + virtual void execute (CCtrlBase *pCaller, const string &Params) + { + if (!pCaller->getParent()) + return; + + if (pCaller->getParent()->getId() != "ui:outgame") + return; + + if (Params.empty()) + { + sint32 event = -1; + + if (Driver->AsyncListener.isKeyPushed(KeyESCAPE)) event = 0; + //if (Driver->AsyncListener.isKeyPushed(KeyDELETE)) event = 1; + if (Driver->AsyncListener.isKeyPushed(KeyRETURN)) event = 2; + if (Driver->AsyncListener.isKeyPushed(KeyDOWN)) event = 3; + if (Driver->AsyncListener.isKeyPushed(KeyUP)) event = 4; + if (Driver->AsyncListener.isKeyPushed(KeyI)) event = 5; + if (Driver->AsyncListener.isKeyPushed(KeyP)) event = 6; + + if (event != -1) + CLuaManager::getInstance().executeLuaScript(toString("outgame:eventCharcreateKeyGet(%i)", event)); + } + // reset previous input + Driver->AsyncListener.reset(); + } +}; +REGISTER_ACTION_HANDLER( CHandlerCharcreateGetKeys, "navigate_charcreate" ); \ No newline at end of file From b2b16e3ccecc73b3818b4818b604bcaf3cdeb7e0 Mon Sep 17 00:00:00 2001 From: Inky Date: Tue, 25 Jun 2019 22:55:22 +0300 Subject: [PATCH 11/29] Changed: fusion selection and creation handler --HG-- branch : menu_navi --- .../src/interface_v3/action_handler_game.cpp | 42 ++++--------------- 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index c35493475..706099741 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -4610,9 +4610,9 @@ public: REGISTER_ACTION_HANDLER( CHandlerSortTribeFame, "sort_tribefame"); // *************************************************************************** -class CHandlerCharselNaviGetKeys : public IActionHandler +class CHandlerOutgameNaviGetKeys : public IActionHandler { - virtual void execute (CCtrlBase *pCaller, const string &Params) + virtual void execute (CCtrlBase *pCaller, const std::string &Params) { if (!pCaller->getParent()) return; @@ -4629,44 +4629,18 @@ class CHandlerCharselNaviGetKeys : public IActionHandler if (Driver->AsyncListener.isKeyPushed(KeyRETURN)) event = 2; if (Driver->AsyncListener.isKeyPushed(KeyDOWN)) event = 3; if (Driver->AsyncListener.isKeyPushed(KeyUP)) event = 4; - - if (event != -1) - CLuaManager::getInstance().executeLuaScript(toString("outgame:eventCharselKeyGet(%i)", event)); - } - // reset previous input - Driver->AsyncListener.reset(); - } -}; -REGISTER_ACTION_HANDLER( CHandlerCharselNaviGetKeys, "navigate_charsel" ); - -// *************************************************************************** -class CHandlerCharcreateGetKeys : public IActionHandler -{ - virtual void execute (CCtrlBase *pCaller, const string &Params) - { - if (!pCaller->getParent()) - return; - - if (pCaller->getParent()->getId() != "ui:outgame") - return; - - if (Params.empty()) - { - sint32 event = -1; - - if (Driver->AsyncListener.isKeyPushed(KeyESCAPE)) event = 0; - //if (Driver->AsyncListener.isKeyPushed(KeyDELETE)) event = 1; - if (Driver->AsyncListener.isKeyPushed(KeyRETURN)) event = 2; - if (Driver->AsyncListener.isKeyPushed(KeyDOWN)) event = 3; - if (Driver->AsyncListener.isKeyPushed(KeyUP)) event = 4; if (Driver->AsyncListener.isKeyPushed(KeyI)) event = 5; if (Driver->AsyncListener.isKeyPushed(KeyP)) event = 6; + std::string id = "create"; + if (pCaller->getId() == "ui:outgame:charsel") + id = "sel"; + if (event != -1) - CLuaManager::getInstance().executeLuaScript(toString("outgame:eventCharcreateKeyGet(%i)", event)); + CLuaManager::getInstance().executeLuaScript(toString("outgame:eventChar%sKeyGet(%i)", id.c_str(), event)); } // reset previous input Driver->AsyncListener.reset(); } }; -REGISTER_ACTION_HANDLER( CHandlerCharcreateGetKeys, "navigate_charcreate" ); \ No newline at end of file +REGISTER_ACTION_HANDLER( CHandlerOutgameNaviGetKeys, "navigate_outgame" ); From 20fe11c53fed389908159f191591c376e159237d Mon Sep 17 00:00:00 2001 From: Inky Date: Sat, 29 Jun 2019 03:43:29 +0300 Subject: [PATCH 12/29] Changed: add character importation handler --HG-- branch : menu_navi --- code/ryzom/client/src/connection.cpp | 182 ++++++++++++++++++++++++++- 1 file changed, 181 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index 17a042efd..59b30cf57 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -155,7 +155,7 @@ string ScenarioFileName; static const char *KeySetVarName = "BuiltInKeySets"; - +#define GROUP_LIST_CHARACTER "ui:outgame:charsel_import:import_list" #define GROUP_LIST_MAINLAND "ui:outgame:appear_mainland:mainland_list" #define GROUP_LIST_KEYSET "ui:outgame:appear_keyset:keyset_list" vector Mainlands; @@ -3436,3 +3436,183 @@ class CAHOpenRingSessions : public IActionHandler } }; REGISTER_ACTION_HANDLER (CAHOpenRingSessions, "open_ring_sessions"); + +// *************************************************************************** +class CAHInitImportCharacter : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) + { + CInterfaceGroup *list = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CHARACTER)); + if (!list) + { + nlwarning("element " GROUP_LIST_CHARACTER " not found probably bad outgame.xml"); + return; + } + + // retrieve saved files + std::vector savedCharacters; + CPath::getPathContent("save/", false, false, true, savedCharacters); + + CInterfaceGroup *newLine; + CInterfaceGroup *prevLine; + + for (uint i = 0; i < savedCharacters.size(); ++i) + { + // search saved characters only + if (testWildCard(CFile::getFilename(savedCharacters[i]), "character_*.save")) + { + const std::string id = CFile::getFilenameWithoutExtension(savedCharacters[i]).substr(strlen("character_")); + if (id.empty()) + continue; + + std::vector> params; + params.clear(); + params.push_back(std::pair("id", id)); + // adjust ref + if (list->getNumGroup() > 0) + params.push_back(std::pair("posref", "BL TL")); + + newLine = CWidgetManager::getInstance()->getParser()->createGroupInstance("t_import", GROUP_LIST_CHARACTER, params); + if (newLine) + { + CViewText *text = dynamic_cast(newLine->getView("name")); + if (text) + text->setText(ucstring(savedCharacters[i])); + + // add to the list now + newLine->setParent(list); + newLine->setParentSize(list); + newLine->setParentPos(prevLine); + + list->addGroup(newLine); + + prevLine = newLine; + } + } + } + // none case + if (list->getNumGroup() == 0) + CLuaManager::getInstance().executeLuaScript("outgame:procCharselNotifaction(3)"); + + list->invalidateCoords(); + } +}; +REGISTER_ACTION_HANDLER( CAHInitImportCharacter, "import_char_init" ); + +// *************************************************************************** +class CAHResetImportCharacter : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) + { + CInterfaceGroup *list = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CHARACTER)); + if (list) + list->clearGroups(); + + if (!ImportCharacter.empty()) + ImportCharacter = ""; + } +}; +REGISTER_ACTION_HANDLER( CAHResetImportCharacter, "import_char_reset" ); + +// *************************************************************************** +class CAHSelectImportCharacter : public IActionHandler +{ + virtual void execute (CCtrlBase *pCaller, const std::string &Params) + { + struct CUnpush : public CInterfaceElementVisitor + { + CCtrlBase *Ref; + virtual void visitCtrl(CCtrlBase *ctrl) + { + if (ctrl == Ref) return; + CCtrlBaseButton *but = dynamic_cast(ctrl); + if (but) + { + but->setPushed(false); + } + } + }; + CInterfaceGroup *list = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CHARACTER)); + if (!list) + return; + + // unselect + if (Params.empty()) + { + CUnpush unpusher; + unpusher.Ref = pCaller; + list->visit(&unpusher); + } + + // now select + std::string name; + if (Params.empty()) + { + CCtrlButton *pCB = dynamic_cast(pCaller); + if (!pCB) + return; + + std::string id = pCB->getId(); + id = id.substr(0, id.rfind(':')); + + if (!fromString(id.substr(id.rfind(':')+1, id.size()), name)) + return; + + pCB->setPushed(true); + } + else + if (!fromString(Params, name)) + return; + + ImportCharacter = ""; + // check filename and store + if (CFile::fileExists(toString("save/character_%s.save", name.c_str()))) + ImportCharacter = name; + } +}; +REGISTER_ACTION_HANDLER( CAHSelectImportCharacter, "import_char_select" ); + +// *************************************************************************** +class CAHImportCharacter : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) + { + if (ImportCharacter.empty()) + return; + + if (!CFile::fileExists(toString("save/character_%s.save", ImportCharacter.c_str()))) + return; + + bool success = false; + + CIFile fd; + CCharacterSummary CS; + // use temporary file until close() + if (fd.open(toString("save/character_%s.save", ImportCharacter.c_str()))) + { + try + { + CS.serial(fd); + SCharacter3DSetup::setupDBFromCharacterSummary("UI:TEMP:CHAR3D", CS); + + // validate import + CDBManager::getInstance()->getDbProp("UI:TEMP:IMPORT")->setValue32(1); + success = true; + } + catch (const EStream &e) + { + nlwarning(e.what()); + } + fd.close(); + } + else + nlwarning("Failed to open file: save/character_%s.save", ImportCharacter.c_str()); + + // user notification + if (!success) + CLuaManager::getInstance().executeLuaScript("outgame:procCharselNotifaction(2)"); + else + CAHManager::getInstance()->runActionHandler("proc", NULL, "proc_charsel_create_new"); + } +}; +REGISTER_ACTION_HANDLER( CAHImportCharacter, "import_char" ); From c1e76fcbb2ba22682ae74443219a41d91fb35be5 Mon Sep 17 00:00:00 2001 From: Inky Date: Sat, 29 Jun 2019 03:47:02 +0300 Subject: [PATCH 13/29] Changed: add character exportation handler --HG-- branch : menu_navi --- code/ryzom/client/src/connection.cpp | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index 59b30cf57..581b7de95 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -3616,3 +3616,54 @@ class CAHImportCharacter : public IActionHandler } }; REGISTER_ACTION_HANDLER( CAHImportCharacter, "import_char" ); + +// *************************************************************************** +class CAHExportCharacter : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params) + { + if (Params.empty()) + return; + + sint32 slot = -1; + if (!fromString(getParam(Params, "slot"), slot)) + return; + + if (slot >= CharacterSummaries.size() || slot < 0) + return; + + // retrieve infos + CCharacterSummary &CS = CharacterSummaries[slot]; + if (CS.Name.empty()) + return; + + // extract name + const std::string name = buildPlayerNameForSaveFile(CS.Name.toString()); + + COFile fd; + bool success = false; + // use temporary file until close() + if (fd.open(toString("save/character_%s.save", name.c_str()), false, false, true)) + { + try + { + fd.serial(CS); + fd.flush(); + // validate + success = true; + } + catch (const EStream &e) + { + nlwarning(e.what()); + } + fd.close(); + } + else + nlwarning("Failed to open file: save/character_%s.save", name.c_str()); + + const uint8 val = (success == true) ? 0 : 1; + // user notification + CLuaManager::getInstance().executeLuaScript(toString("outgame:procCharselNotifaction(%i)", val)); + } +}; +REGISTER_ACTION_HANDLER( CAHExportCharacter, "export_char" ); From c545629a10d3593b71954dc9cdddac104f38a1a4 Mon Sep 17 00:00:00 2001 From: Inky Date: Sat, 29 Jun 2019 16:22:39 +0300 Subject: [PATCH 14/29] Changed: import modal auto select first occurence --HG-- branch : menu_navi --- code/ryzom/client/src/connection.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index 581b7de95..fbbac50c2 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -3479,6 +3479,11 @@ class CAHInitImportCharacter : public IActionHandler if (text) text->setText(ucstring(savedCharacters[i])); + // first button is pushed + CCtrlButton *button = dynamic_cast(newLine->getCtrl("but")); + if (button && list->getNumGroup() == 0) + button->setPushed(true); + // add to the list now newLine->setParent(list); newLine->setParentSize(list); From 77496daef4869d52e2343b1a84bdc5135112f262 Mon Sep 17 00:00:00 2001 From: Inky Date: Sun, 30 Jun 2019 18:10:01 +0300 Subject: [PATCH 15/29] Changed: new key pushed event to export --HG-- branch : menu_navi --- code/ryzom/client/src/interface_v3/action_handler_game.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 706099741..9a042767a 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -4631,6 +4631,7 @@ class CHandlerOutgameNaviGetKeys : public IActionHandler if (Driver->AsyncListener.isKeyPushed(KeyUP)) event = 4; if (Driver->AsyncListener.isKeyPushed(KeyI)) event = 5; if (Driver->AsyncListener.isKeyPushed(KeyP)) event = 6; + if (Driver->AsyncListener.isKeyPushed(KeyE)) event = 7; std::string id = "create"; if (pCaller->getId() == "ui:outgame:charsel") From f75e41399415a16a5f286c2a46115baa50e883ef Mon Sep 17 00:00:00 2001 From: Inky Date: Wed, 3 Jul 2019 18:30:09 +0300 Subject: [PATCH 16/29] Changed: new key pushed event: left-right-tabulation --HG-- branch : menu_navi --- code/ryzom/client/src/interface_v3/action_handler_game.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 9a042767a..9ca94649b 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -4632,6 +4632,9 @@ class CHandlerOutgameNaviGetKeys : public IActionHandler if (Driver->AsyncListener.isKeyPushed(KeyI)) event = 5; if (Driver->AsyncListener.isKeyPushed(KeyP)) event = 6; if (Driver->AsyncListener.isKeyPushed(KeyE)) event = 7; + if (Driver->AsyncListener.isKeyPushed(KeyLEFT)) event = 8; + if (Driver->AsyncListener.isKeyPushed(KeyRIGHT)) event = 9; + if (Driver->AsyncListener.isKeyPushed(KeyTAB)) event = 10; std::string id = "create"; if (pCaller->getId() == "ui:outgame:charsel") From 6fdbdc9ed1325a979ca6c98591c838935cf4e537 Mon Sep 17 00:00:00 2001 From: Inky Date: Wed, 3 Jul 2019 18:34:40 +0300 Subject: [PATCH 17/29] Fixed: record only key next/prior event on CCtrlScroll element --HG-- branch : menu_navi --- code/nel/src/gui/ctrl_scroll.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/nel/src/gui/ctrl_scroll.cpp b/code/nel/src/gui/ctrl_scroll.cpp index ba38b32c2..06d3afe33 100644 --- a/code/nel/src/gui/ctrl_scroll.cpp +++ b/code/nel/src/gui/ctrl_scroll.cpp @@ -938,7 +938,9 @@ namespace NLGUI sint32 i = 0; // direction if (eventDesc.getKey() == KeyNEXT) i++; - if (eventDesc.getKey() == KeyPRIOR) i--; + else if (eventDesc.getKey() == KeyPRIOR) i--; + else + return false; if (_Vertical) moveTrackY(-(i * _TargetStepY)); From 8006dbeabebeb5ebf76b6060d08dd81645278303 Mon Sep 17 00:00:00 2001 From: Inky Date: Wed, 3 Jul 2019 18:45:39 +0300 Subject: [PATCH 18/29] Changed: export reflect texture(pushed, over) on CCtrlTextButton element --HG-- branch : menu_navi --- code/nel/include/nel/gui/ctrl_text_button.h | 13 +++++ code/nel/src/gui/ctrl_text_button.cpp | 63 +++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/code/nel/include/nel/gui/ctrl_text_button.h b/code/nel/include/nel/gui/ctrl_text_button.h index e88ec81e1..713c5ad1c 100644 --- a/code/nel/include/nel/gui/ctrl_text_button.h +++ b/code/nel/include/nel/gui/ctrl_text_button.h @@ -124,6 +124,16 @@ namespace NLGUI void setTexturePushed(const std::string &l, const std::string &m, const std::string &r); void setTextureOver(const std::string &l, const std::string &m, const std::string &r); + // lua + void setTextureLua (const std::string &name); + void setTexturePushedLua (const std::string &name); + void setTextureOverLua (const std::string &name); + + // return texture _l.tga + std::string getTexture () const; + std::string getTexturePushed () const; + std::string getTextureOver() const; + int luaGetViewText(CLuaState &ls); REFLECT_EXPORT_START(CCtrlTextButton, CCtrlBaseButton) @@ -134,6 +144,9 @@ namespace NLGUI REFLECT_SINT32("wmin", getWMin, setWMin) REFLECT_SINT32("hmin", getHMin, setHMin) REFLECT_LUA_METHOD("getViewText", luaGetViewText) + REFLECT_STRING("texture", getTexture, setTextureLua); + REFLECT_STRING("texture_pushed", getTexturePushed, setTexturePushedLua); + REFLECT_STRING("texture_over", getTextureOver, setTextureOverLua); REFLECT_EXPORT_END void onRemoved(); diff --git a/code/nel/src/gui/ctrl_text_button.cpp b/code/nel/src/gui/ctrl_text_button.cpp index d10dfa0c9..0cea8c8b3 100644 --- a/code/nel/src/gui/ctrl_text_button.cpp +++ b/code/nel/src/gui/ctrl_text_button.cpp @@ -1074,6 +1074,69 @@ namespace NLGUI // *************************************************************************** + void CCtrlTextButton::setTextureLua(const std::string &name) + { + _TextureIdNormal[0].setTexture(std::string(name + "_l.tga").c_str()); + _TextureIdNormal[1].setTexture(std::string(name + "_m.tga").c_str()); + _TextureIdNormal[2].setTexture(std::string(name + "_r.tga").c_str()); + } + + // *************************************************************************** + + void CCtrlTextButton::setTexturePushedLua(const std::string &name) + { + _TextureIdPushed[0].setTexture(std::string(name + "_l.tga").c_str()); + _TextureIdPushed[1].setTexture(std::string(name + "_m.tga").c_str()); + _TextureIdPushed[2].setTexture(std::string(name + "_r.tga").c_str()); + } + + // *************************************************************************** + + void CCtrlTextButton::setTextureOverLua(const std::string &name) + { + _TextureIdOver[0].setTexture(std::string(name + "_l.tga").c_str()); + _TextureIdOver[1].setTexture(std::string(name + "_m.tga").c_str()); + _TextureIdOver[2].setTexture(std::string(name + "_r.tga").c_str()); + } + + // *************************************************************************** + + std::string CCtrlTextButton::getTexture() const + { + std::string tx = CViewRenderer::getInstance()->getTextureNameFromId(_TextureIdNormal[0]); + std::string::size_type i = tx.rfind("_l.tga"); + if (i != std::string::npos) + tx = tx.substr(0, i); + + return tx; + } + + // *************************************************************************** + + std::string CCtrlTextButton::getTexturePushed() const + { + std::string tx = CViewRenderer::getInstance()->getTextureNameFromId(_TextureIdOver[0]); + std::string::size_type i = tx.rfind("_l.tga"); + if (i != std::string::npos) + tx = tx.substr(0, i); + + return tx; + } + + // *************************************************************************** + + std::string CCtrlTextButton::getTextureOver() const + { + std::string tx = CViewRenderer::getInstance()->getTextureNameFromId(_TextureIdPushed[0]); + std::string::size_type i = tx.rfind("_l.tga"); + if (i != std::string::npos) + tx = tx.substr(0, i); + + return tx; + } + + // *************************************************************************** + int CCtrlTextButton::luaGetViewText(CLuaState &ls) { const char *funcName = "getViewText"; From c752619f134af6f5d020b2651077155ad9d879e7 Mon Sep 17 00:00:00 2001 From: Inky Date: Wed, 3 Jul 2019 19:40:02 +0300 Subject: [PATCH 19/29] Fixed: missing stream.h and import select var --HG-- branch : menu_navi --- code/ryzom/client/src/connection.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index fbbac50c2..92c68de48 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -28,6 +28,7 @@ #include "nel/misc/time_nl.h" #include "nel/misc/algo.h" #include "nel/misc/system_utils.h" +#include "nel/misc/stream.h" // 3D Interface. #include "nel/3d/u_driver.h" #include "nel/3d/u_text_context.h" @@ -152,6 +153,7 @@ std::string RingEditorKeySet = "keys_r2ed.xml"; string ScenarioFileName; +std::string ImportCharacter; static const char *KeySetVarName = "BuiltInKeySets"; From 045a80b59e9378da2174dba9e1c775815cfc2b56 Mon Sep 17 00:00:00 2001 From: Inky Date: Thu, 4 Jul 2019 03:58:31 +0300 Subject: [PATCH 20/29] Changed: removed tabulation event since not used --HG-- branch : menu_navi --- code/ryzom/client/src/interface_v3/action_handler_game.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 9ca94649b..cb0d03313 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -4634,7 +4634,6 @@ class CHandlerOutgameNaviGetKeys : public IActionHandler if (Driver->AsyncListener.isKeyPushed(KeyE)) event = 7; if (Driver->AsyncListener.isKeyPushed(KeyLEFT)) event = 8; if (Driver->AsyncListener.isKeyPushed(KeyRIGHT)) event = 9; - if (Driver->AsyncListener.isKeyPushed(KeyTAB)) event = 10; std::string id = "create"; if (pCaller->getId() == "ui:outgame:charsel") From c9a5fbacd9c05fd9f67d17cda0e34b6e749bd84b Mon Sep 17 00:00:00 2001 From: Nimetu Date: Wed, 24 Jul 2019 08:14:18 +0300 Subject: [PATCH 21/29] Changed: Disable r2_islands_textures, ai_build_wmap, build_world_packed_col because no server code in yubo/atys branch. --HG-- branch : yubo --- code/ryzom/server/CMakeLists.txt | 2 +- code/ryzom/tools/client/CMakeLists.txt | 3 ++- code/ryzom/tools/server/CMakeLists.txt | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/code/ryzom/server/CMakeLists.txt b/code/ryzom/server/CMakeLists.txt index 4b7537b55..0d2f4ffc4 100644 --- a/code/ryzom/server/CMakeLists.txt +++ b/code/ryzom/server/CMakeLists.txt @@ -1 +1 @@ -ADD_SUBDIRECTORY(src) +#ADD_SUBDIRECTORY(src) diff --git a/code/ryzom/tools/client/CMakeLists.txt b/code/ryzom/tools/client/CMakeLists.txt index d4f136b3c..2a9cfc59e 100644 --- a/code/ryzom/tools/client/CMakeLists.txt +++ b/code/ryzom/tools/client/CMakeLists.txt @@ -15,5 +15,6 @@ IF(WITH_QT5 AND WITH_RYZOM_INSTALLER) ENDIF() IF(WITH_RYZOM_TOOLS AND MYSQL_FOUND) - ADD_SUBDIRECTORY(r2_islands_textures) + # requires which is missing from yubo/atys branch + #ADD_SUBDIRECTORY(r2_islands_textures) ENDIF() diff --git a/code/ryzom/tools/server/CMakeLists.txt b/code/ryzom/tools/server/CMakeLists.txt index 1e8a6edb9..310fd7583 100644 --- a/code/ryzom/tools/server/CMakeLists.txt +++ b/code/ryzom/tools/server/CMakeLists.txt @@ -1,10 +1,12 @@ IF(WITH_RYZOM_TOOLS) IF(WITH_LIGO) - ADD_SUBDIRECTORY(ai_build_wmap) + # Disabled because no server code in atys/yubo branch + #ADD_SUBDIRECTORY(ai_build_wmap) ENDIF() IF(WITH_3D) - ADD_SUBDIRECTORY(build_world_packed_col) + # Disabled because no server code in atys/yubo branch + #ADD_SUBDIRECTORY(build_world_packed_col) ENDIF() ENDIF() From 99ededcfcb020cc4d08be375f3d14dc1941819db Mon Sep 17 00:00:00 2001 From: Herrah Date: Sat, 5 Oct 2019 12:56:19 -0700 Subject: [PATCH 22/29] fix for error "cannot convert argument 1 from 'std::wstring' to 'LPCWSTR'" --HG-- branch : fix-WinVS2017_debug --- code/nel/src/misc/app_context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/nel/src/misc/app_context.cpp b/code/nel/src/misc/app_context.cpp index a7381d026..c912cf7a4 100644 --- a/code/nel/src/misc/app_context.cpp +++ b/code/nel/src/misc/app_context.cpp @@ -135,7 +135,7 @@ CApplicationContext::~CApplicationContext() std::string message = toString("Instance '%s' still allocated at %p", it->first.c_str(), it->second); #ifdef NL_OS_WINDOWS - OutputDebugStringW(utf8ToWide(message)); + OutputDebugStringW(utf8ToWide(message).c_str()); #else printf("%s\n", message.c_str()); #endif From 99caf036ff4cefa670a963d26263e13f021e8a98 Mon Sep 17 00:00:00 2001 From: Ulu Kyn Date: Mon, 7 Oct 2019 12:45:26 +0200 Subject: [PATCH 23/29] Fixed: Revert Bad commit --HG-- branch : yubo --- .../src/interface_v3/action_handler_game.cpp | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 10b1474bb..2d974c1cc 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -4650,7 +4650,45 @@ public: } }; REGISTER_ACTION_HANDLER( CHandlerSortTribeFame, "sort_tribefame"); -(??) + +// *************************************************************************** +class CHandlerOutgameNaviGetKeys : public IActionHandler +{ + virtual void execute (CCtrlBase *pCaller, const std::string &Params) + { + if (!pCaller->getParent()) + return; + + if (pCaller->getParent()->getId() != "ui:outgame") + return; + + if (Params.empty()) + { + sint32 event = -1; + + if (Driver->AsyncListener.isKeyPushed(KeyESCAPE)) event = 0; + if (Driver->AsyncListener.isKeyPushed(KeyDELETE)) event = 1; + if (Driver->AsyncListener.isKeyPushed(KeyRETURN)) event = 2; + if (Driver->AsyncListener.isKeyPushed(KeyDOWN)) event = 3; + if (Driver->AsyncListener.isKeyPushed(KeyUP)) event = 4; + if (Driver->AsyncListener.isKeyPushed(KeyI)) event = 5; + if (Driver->AsyncListener.isKeyPushed(KeyP)) event = 6; + if (Driver->AsyncListener.isKeyPushed(KeyE)) event = 7; + if (Driver->AsyncListener.isKeyPushed(KeyLEFT)) event = 8; + if (Driver->AsyncListener.isKeyPushed(KeyRIGHT)) event = 9; + + std::string id = "create"; + if (pCaller->getId() == "ui:outgame:charsel") + id = "sel"; + + if (event != -1) +- CLuaManager::getInstance().executeLuaScript(toString("outgame:eventChar%sKeyGet(%i)", id.c_str(), event)); + } + // reset previous input + Driver->AsyncListener.reset(); + } +}; +REGISTER_ACTION_HANDLER( CHandlerOutgameNaviGetKeys, "navigate_outgame" ); // *************************************************************************** class CHandlerTriggerIconBuffs : public IActionHandler From 3b08d50b8377f5a54d45c8af14671eacc3026854 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Fri, 6 Mar 2020 15:28:58 +0200 Subject: [PATCH 24/29] Fixed: Scroll bar losing position when group window is minimized --- code/nel/src/gui/ctrl_scroll.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/nel/src/gui/ctrl_scroll.cpp b/code/nel/src/gui/ctrl_scroll.cpp index 06d3afe33..efa467acb 100644 --- a/code/nel/src/gui/ctrl_scroll.cpp +++ b/code/nel/src/gui/ctrl_scroll.cpp @@ -45,7 +45,7 @@ namespace NLGUI _Aligned = 1; _TrackPos = 0; _TrackDispPos = 0; - _TrackSize = _TrackSizeMin = 16; + _TrackSize = _TrackSizeMin = 8; _Min = 0; _Max = 100; _Value = 0; From 3220a2aa4746107325a094893392d0ac93c907cd Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Tue, 10 Mar 2020 16:08:55 +0100 Subject: [PATCH 25/29] Changed: new name of Enclyclopedia window --- .../client/src/interface_v3/encyclopedia_manager.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/encyclopedia_manager.h b/code/ryzom/client/src/interface_v3/encyclopedia_manager.h index dc5e97651..b1b589b16 100644 --- a/code/ryzom/client/src/interface_v3/encyclopedia_manager.h +++ b/code/ryzom/client/src/interface_v3/encyclopedia_manager.h @@ -77,11 +77,11 @@ private: bool _Initializing; }; -#define CONT_ENCY "ui:interface:encyclopedia" -#define LIST_ENCY_ALBUM "ui:interface:encyclopedia:content:sbtree:tree_list" -#define PAGE_ENCY_ALBUM "ui:interface:encyclopedia:content:album" -#define PAGE_ENCY_THEMA "ui:interface:encyclopedia:content:theme" -#define PAGE_ENCY_HELP "ui:interface:encyclopedia:content:help" +#define CONT_ENCY "ui:interface:legacy_encyclopedia" +#define LIST_ENCY_ALBUM "ui:interface:legacy_encyclopedia:content:sbtree:tree_list" +#define PAGE_ENCY_ALBUM "ui:interface:legacy_encyclopedia:content:album" +#define PAGE_ENCY_THEMA "ui:interface:legacy_encyclopedia:content:theme" +#define PAGE_ENCY_HELP "ui:interface:legacy_encyclopedia:content:help" #endif // RY_ENCYCLOPEDIA_MANAGER_H From 421de3fa913c88be5737980b42a50eec3e6b772c Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Fri, 12 Jun 2020 14:07:17 +0200 Subject: [PATCH 26/29] Changed: fixed issue with rumors --- code/ryzom/client/src/game_context_menu.cpp | 7 +- .../client/src/interface_v3/chat_window.cpp | 107 ++++++++++-------- .../client/src/interface_v3/people_list.cpp | 37 +++--- 3 files changed, 87 insertions(+), 64 deletions(-) diff --git a/code/ryzom/client/src/game_context_menu.cpp b/code/ryzom/client/src/game_context_menu.cpp index c19ea62ac..78e58c4b5 100644 --- a/code/ryzom/client/src/game_context_menu.cpp +++ b/code/ryzom/client/src/game_context_menu.cpp @@ -451,18 +451,19 @@ void CGameContextMenu::update() else if (continent == "lepaysmalade.continent") fameIndex = CStaticFames::getInstance().getFactionIndex("zorai"); - + if (fameIndex != CStaticFames::INVALID_FACTION_INDEX) { CCDBNodeLeaf *pLeafFame = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:FAME:PLAYER%d:VALUE", fameIndex), false); if (pLeafFame != NULL) fameValue = pLeafFame->getValue8(); } + if (_TextNews) - _TextNews->setActive(selection && !canAttack() && selection->isNPC() && fameValue >= -30); + _TextNews->setActive(!UserEntity->isFighting() && !UserEntity->isRiding() && selection && !canAttack() && selection->isNPC() && fameValue >= -30); if (_TextNewsAgressive) - _TextNewsAgressive->setActive(selection && !canAttack() && selection->isNPC() && fameValue < -30); + _TextNewsAgressive->setActive(!UserEntity->isFighting() && !UserEntity->isRiding() && selection && !canAttack() && selection->isNPC() && fameValue < -30); if (_TextDuel && _TextUnDuel) diff --git a/code/ryzom/client/src/interface_v3/chat_window.cpp b/code/ryzom/client/src/interface_v3/chat_window.cpp index 1537e7b8b..13f7bc66d 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.cpp +++ b/code/ryzom/client/src/interface_v3/chat_window.cpp @@ -215,29 +215,34 @@ void CChatWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGr CChatTextManager &ctm = getChatTextMngr(); gl = dynamic_cast(_Chat->getGroup("cb:text_list")); - if (gl) gl->addChild(ctm.createMsgText(msg, col)); - // if the group is closed, make it blink - if (!_Chat->isOpen()) + CViewBase *child = ctm.createMsgText(msg, col); + if (child) { - if (numBlinks) _Chat->enableBlink(numBlinks); - } - if (_ParentBlink) - { - CGroupContainer *father = dynamic_cast(_Chat->getParent()); - if (father && !father->isOpen()) + if (gl) gl->addChild(child); + + // if the group is closed, make it blink + if (!_Chat->isOpen()) { - father->enableBlink(numBlinks); + if (numBlinks) _Chat->enableBlink(numBlinks); } + if (_ParentBlink) + { + CGroupContainer *father = dynamic_cast(_Chat->getParent()); + if (father && !father->isOpen()) + { + father->enableBlink(numBlinks); + } + } + if (windowVisible != NULL) + { + *windowVisible = isVisible(); + } + /*for(std::vector::iterator it = _Observers.begin(); it != _Observers.end(); ++it) + { + (*it)->displayMessage(this, msg, col, numBlinks); + }*/ } - if (windowVisible != NULL) - { - *windowVisible = isVisible(); - } - /*for(std::vector::iterator it = _Observers.begin(); it != _Observers.end(); ++it) - { - (*it)->displayMessage(this, msg, col, numBlinks); - }*/ } //================================================================================= @@ -563,12 +568,17 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC ucstring newmsg = msg; ucstring prefix; + CViewBase *child = NULL; if (gl != NULL) { - gl->addChild(ctm.createMsgText(newmsg, col)); - if (!gl->getParent()->getActive()) - if (tab != NULL) - tab->setTextColorNormal(newMsgColor); + child = ctm.createMsgText(newmsg, col); + if (child) + { + gl->addChild(child); + if (!gl->getParent()->getActive()) + if (tab != NULL) + tab->setTextColorNormal(newMsgColor); + } } // *** Display the message in the UserChat (special case) @@ -590,7 +600,7 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC case CChatGroup::guild: if (ci.Guild.isListeningWindow(cw)) gl = gl2; break; case CChatGroup::system: if (ci.SystemInfo.isListeningWindow(cw)) gl = gl2; break; case CChatGroup::universe: if (ci.Universe.isListeningWindow(cw)) gl = gl2; break; - case CChatGroup::dyn_chat: + case CChatGroup::dyn_chat: if (ci.DynamicChat[dynamicChatDbIndex].isListeningWindow(cw)) { gl = gl2; @@ -608,7 +618,7 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC pos = newmsg.find(ucstring("}")); prefix += " "; } - + if (pos == ucstring::npos) newmsg = prefix + newmsg; else @@ -635,31 +645,37 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC if (gl != NULL) { - gl->addChild(ctm.createMsgText(newmsg, col)); - if (!gl->getParent()->getActive()) - if (tab != NULL) - tab->setTextColorNormal(newMsgColor); + child = ctm.createMsgText(newmsg, col); + if (child) + { + gl->addChild(child); + if (!gl->getParent()->getActive()) + if (tab != NULL) + tab->setTextColorNormal(newMsgColor); + } } } - - // *** Blink and visibility event - // if the group is closed, make it blink - if (!_Chat->isOpen()) - { - if (numBlinks) _Chat->enableBlink(numBlinks); - } - if (_ParentBlink) + if (child) { - CGroupContainer *father = dynamic_cast(_Chat->getParent()); - if (father && !father->isOpen()) + // *** Blink and visibility event + // if the group is closed, make it blink + if (!_Chat->isOpen()) { - father->enableBlink(numBlinks); + if (numBlinks) _Chat->enableBlink(numBlinks); + } + if (_ParentBlink) + { + CGroupContainer *father = dynamic_cast(_Chat->getParent()); + if (father && !father->isOpen()) + { + father->enableBlink(numBlinks); + } + } + if (windowVisible != NULL) + { + *windowVisible = isVisible(); } - } - if (windowVisible != NULL) - { - *windowVisible = isVisible(); } } @@ -685,8 +701,9 @@ void CChatGroupWindow::displayTellMessage(const ucstring &msg, NLMISC::CRGBA col nlwarning(" can't get text_list."); return; } - - gl->addChild(getChatTextMngr().createMsgText(msg, col)); + CViewBase *child = getChatTextMngr().createMsgText(msg, col); + if (child) + gl->addChild(child); } //================================================================================= diff --git a/code/ryzom/client/src/interface_v3/people_list.cpp b/code/ryzom/client/src/interface_v3/people_list.cpp index 6be310d94..92601ed32 100644 --- a/code/ryzom/client/src/interface_v3/people_list.cpp +++ b/code/ryzom/client/src/interface_v3/people_list.cpp @@ -199,7 +199,7 @@ bool CPeopleList::sortExByName(const CPeople& a, const CPeople& b) { ucstring name_a = toUpper(a.getName()); ucstring name_b = toUpper(b.getName()); - + return (name_a < name_b); } @@ -208,7 +208,7 @@ bool CPeopleList::sortExByOnline(const CPeople& a, const CPeople& b) { ucstring name_a = toUpper(a.getName()); ucstring name_b = toUpper(b.getName()); - + // We want order: online/alpha, offworld/alpha, offline/alpha if (a.Online == b.Online) { @@ -249,7 +249,7 @@ void CPeopleList::sortEx(TSortOrder order) { _BaseContainer->detachContainer(_Peoples[k].Container); } - + switch (order) { default: @@ -480,17 +480,21 @@ void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, c ucstring s = CI18N::get("youTellPlayer"); strFindReplace(s, "%name", receiver); strFindReplace(finalMsg, CI18N::get("youTell"), s); - gl->addChild(getChatTextMngr().createMsgText(finalMsg, prop.getRGBA())); - CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); - - // if the group is closed, make it blink - if (!gc->isOpen()) + CViewBase *child = getChatTextMngr().createMsgText(finalMsg, prop.getRGBA()); + if (child) { - if (numBlinks) gc->enableBlink(numBlinks); - } - if (_BaseContainer && !_BaseContainer->isOpen()) - { - _BaseContainer->enableBlink(numBlinks); + gl->addChild(child); + CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); + + // if the group is closed, make it blink + if (!gc->isOpen()) + { + if (numBlinks) gc->enableBlink(numBlinks); + } + if (_BaseContainer && !_BaseContainer->isOpen()) + { + _BaseContainer->enableBlink(numBlinks); + } } } @@ -539,8 +543,9 @@ void CPeopleList::displayMessage(uint index, const ucstring &msg, NLMISC::CRGBA nlwarning(" can't get text_list."); return; } - - gl->addChild(getChatTextMngr().createMsgText(msg, col)); + CViewBase *child = getChatTextMngr().createMsgText(msg, col); + if (child) + gl->addChild(child); } @@ -777,7 +782,7 @@ void CPeopleList::setOnline(uint index, TCharConnectionState online) CCtrlBase *chatButton = hc->getCtrl("chat_button"); if (chatButton != NULL) chatButton->setActive(online != ccs_offline); - + CCtrlBase *inviteButton = hc->getCtrl("invite_button"); if (inviteButton != NULL) inviteButton->setActive(online != ccs_offline); From 9e2872d15ec7f93040a62ba473d24785a532659c Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Fri, 12 Jun 2020 14:09:29 +0200 Subject: [PATCH 27/29] Added: Add a language icon when client receive a translated message --- .../src/interface_v3/chat_text_manager.cpp | 26 +++++++++++++++++-- .../interface_v3/group_in_scene_bubble.cpp | 10 ++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/chat_text_manager.cpp b/code/ryzom/client/src/interface_v3/chat_text_manager.cpp index 3b11d17a5..b3a673ffe 100644 --- a/code/ryzom/client/src/interface_v3/chat_text_manager.cpp +++ b/code/ryzom/client/src/interface_v3/chat_text_manager.cpp @@ -422,6 +422,29 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C return para; } + ucstring::size_type pos = 0; + + // Manage Translations + string::size_type startTr = msg.find(ucstring("{:")); + string::size_type endOfOriginal = msg.find(ucstring("}@{")); + + // Original/Translated case, example: {:enHello the world!}@{ Bonjour le monde ! + if (startTr != string::npos && endOfOriginal != string::npos) + { + CViewBase *vt = createMsgTextSimple(msg.substr(0, startTr), col, justified, NULL); + para->addChild(vt); + + string texture = "flag-"+toLower(msg.substr(startTr+2, 2)).toString()+".tga"; + ucstring original = msg.substr(startTr+5, endOfOriginal-startTr-5); + pos = endOfOriginal+3; + CCtrlButton *ctrlButton = new CCtrlButton(CViewBase::TCtorParam()); + ctrlButton->setTexture(texture); + ctrlButton->setTextureOver(texture); + ctrlButton->setTexturePushed(texture); + ctrlButton->setDefaultContextHelp(original); + ctrlButton->setId("tr"); + para->addChild(ctrlButton); + } // quickly check if text has links or not bool hasUrl; @@ -430,8 +453,7 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C hasUrl = (s.find(ucstring("http://")) || s.find(ucstring("https://"))); } - ucstring::size_type pos = 0; - for (ucstring::size_type i = 0; i< textSize;) + for (ucstring::size_type i = pos; i< textSize;) { if (hasUrl && isUrlTag(msg, i, textSize)) { diff --git a/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp b/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp index d79861b58..460a095fc 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -843,6 +843,14 @@ void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText, if (pChar == NULL || nUID==CLFECOMMON::INVALID_CLIENT_DATASET_INDEX) return; if (bubbleTimer == 0) bubbleTimer = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutBubbles).getValSInt32(); + + + // Clean bubble from translation system + ucstring::size_type pos = 0; + string::size_type endOfOriginal = ucsText.find(ucstring("}@{")); + if (endOfOriginal != string::npos) + pos = endOfOriginal+4; + // Output the message in a bubble bool show = false; @@ -862,7 +870,7 @@ void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText, return; // Get a bubble - CGroupInSceneBubble *bubble = newBubble (ucsText); + CGroupInSceneBubble *bubble = newBubble (ucsText.substr(pos)); if (bubble) { // Link the bubble From 17e539132bcecd1dbfc430c0b5d28faacade9352 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Fri, 12 Jun 2020 14:11:01 +0200 Subject: [PATCH 28/29] Added: very basic anti-spam system (prevent duplication of same message) --- code/ryzom/client/src/net_manager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index 7ce27c4d5..60a996954 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -147,6 +147,7 @@ extern bool CharNameValidArrived; extern bool CharNameValid; bool IsInRingSession = false; TSessionId HighestMainlandSessionId; // highest in the position stack +ucstring lastUniversMessage; extern const char *CDBBankNames[INVALID_CDB_BANK+1]; @@ -770,7 +771,11 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c } else if (mode == CChatGroup::universe) { - PeopleInterraction.ChatInput.Universe.displayMessage(finalString, col, 2, &windowVisible); + if (lastUniversMessage != finalString) + { + PeopleInterraction.ChatInput.Universe.displayMessage(finalString, col, 2, &windowVisible); + lastUniversMessage = finalString; + } } else if (mode == CChatGroup::dyn_chat) { From 80a6bf72a9e4e2a477864e4cc3a49a5c6e32879e Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Fri, 12 Jun 2020 14:11:26 +0200 Subject: [PATCH 29/29] Changed: renamed creatures are now name in ucfirst --- code/ryzom/client/src/string_manager_client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/client/src/string_manager_client.cpp b/code/ryzom/client/src/string_manager_client.cpp index ddc41d0d1..a10be8114 100644 --- a/code/ryzom/client/src/string_manager_client.cpp +++ b/code/ryzom/client/src/string_manager_client.cpp @@ -750,7 +750,7 @@ restartLoop: // if the string contains a special rename of creature, remove it if (str.size() > 2 && str[0] == '<' && str[1] == '#') { - str = str.substr(2); + str = toUpper(str[2])+str.substr(3); } // append this string