From f8af0da354c9ed68c5513be3600978158be8d877 Mon Sep 17 00:00:00 2001 From: ulukyn Date: Tue, 28 May 2019 20:40:41 +0200 Subject: [PATCH 01/53] =?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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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/53] 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 ada46dfabcf0b17261fa8b7876778e458d077fb9 Mon Sep 17 00:00:00 2001 From: Riasan Date: Thu, 7 May 2020 18:22:41 +0200 Subject: [PATCH 26/53] Changed: update releasenote url --- code/ryzom/client/src/client_cfg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index d2e3458fb..df1debee2 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -439,8 +439,8 @@ CClientConfig::CClientConfig() CurlMaxConnections = 5; CurlCABundle.clear(); - RingReleaseNotePath = WebIgMainDomain + "/releasenotes_ring/index.php"; - ReleaseNotePath = WebIgMainDomain + "/releasenotes/index.php"; + RingReleaseNotePath = WebIgMainDomain + "/app_releasenotes/index.php"; + ReleaseNotePath = WebIgMainDomain + "/app_releasenotes/index.php"; /////////////// From 4254b6788a4b27d7d4e4501acbac346531dea1fc Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Tue, 12 May 2020 15:44:38 +0200 Subject: [PATCH 27/53] Fixed: Bad dispaly of server custom names --- code/ryzom/client/src/string_manager_client.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/string_manager_client.cpp b/code/ryzom/client/src/string_manager_client.cpp index 06c3523b4..ddc41d0d1 100644 --- a/code/ryzom/client/src/string_manager_client.cpp +++ b/code/ryzom/client/src/string_manager_client.cpp @@ -390,7 +390,7 @@ restartLoop4: else { result = it->second; - if (result.size() > 9 && result.substr(0, 9) == ucstring(" 9 && result.substr(0, 9) == ucstring("::iterator itds = _DynStrings.find(result.substr(9, result.size()-10)); if (itds != _DynStrings.end()) @@ -747,6 +747,12 @@ restartLoop: str = CEntityCL::removeTitleFromName(str); } + // if the string contains a special rename of creature, remove it + if (str.size() > 2 && str[0] == '<' && str[1] == '#') + { + str = str.substr(2); + } + // append this string temp.append(move, src+param.ReplacementPoint); temp += str; @@ -1625,7 +1631,7 @@ const ucchar *CStringManagerClient::getTitleLocalizedName(const ucstring &titleI _TitleWords.push_back(listInfos[0]); return getLocalizedName(_TitleWords.back()); } - + return getLocalizedName(titleId); } From d130a7f8260a5c46e11b783c9810357a96ec8bf9 Mon Sep 17 00:00:00 2001 From: Riasan Date: Wed, 3 Jun 2020 12:38:33 +0200 Subject: [PATCH 28/53] Changed: fix client crash from opengl changes + fix compiling error because of moved client_default.cfg --- code/CMakeLists.txt | 13 ++++++++++--- .../3d/driver/opengl/driver_opengl_extension.cpp | 6 ++++++ .../src/3d/driver/opengl/driver_opengl_window.cpp | 3 +++ code/ryzom/client/CMakeLists.txt | 2 +- code/ryzom/client/src/CMakeLists.txt | 2 +- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 4c962537c..3225dc1b8 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -177,9 +177,16 @@ IF(WITH_STATIC) ENDIF() # under Linux and OS X, recent libxml2 versions are linked against libicu - FIND_PACKAGE(Icu) - IF(ICU_LIBRARIES) - SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICU_LIBRARIES} ${ICU_DATA_LIBRARIES}) + # FIND_PACKAGE(Icu) + FIND_LIBRARY(ICU_LIBRARY icuuc) + IF(ICU_LIBRARY) + FIND_LIBRARY(ICU_DATA_LIBRARY icudata) + IF(ICU_LIBRARY) + MESSAGE(STATUS "ICU UC was found: ${ICU_LIBRARY}") + ELSE() + MESSAGE(STATUS "ICU UC was NOT found") + ENDIF() + SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICU_DATA_LIBRARY} ${ICU_LIBRARY}) ENDIF() ENDIF() diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index c81ab9e1e..f7c0bf496 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -1583,6 +1583,12 @@ static bool setupATIMeminfo(const char *glext) void registerGlExtensions(CGlExtensions &ext) { H_AUTO_OGL(registerGlExtensions); + + CGLContextObj ctx = CGLGetCurrentContext(); + if (ctx == NULL) + { + nlerror("No OpenGL context set"); + } // OpenGL 1.2 ?? const char *nglVersion = (const char *)glGetString (GL_VERSION); diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 293cb28bb..6537c289f 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -1072,6 +1072,9 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re [_ctx flushBuffer]; [_glView display]; + // Set context as thread context + CGLSetCurrentContext((CGLContextObj)[_ctx CGLContextObj]); + _EventEmitter.init(this, _glView, _DestroyWindow); #elif defined(NL_OS_UNIX) diff --git a/code/ryzom/client/CMakeLists.txt b/code/ryzom/client/CMakeLists.txt index 7a6cf7424..2e17c230e 100644 --- a/code/ryzom/client/CMakeLists.txt +++ b/code/ryzom/client/CMakeLists.txt @@ -8,7 +8,7 @@ IF(WITH_RYZOM_CLIENT) ADD_SUBDIRECTORY(unix) ENDIF() - INSTALL(FILES client_default.cfg DESTINATION ${RYZOM_ETC_PREFIX}) + #INSTALL(FILES client_default.cfg DESTINATION ${RYZOM_ETC_PREFIX}) IF(WITH_RYZOM_PATCH) IF(APPLE) diff --git a/code/ryzom/client/src/CMakeLists.txt b/code/ryzom/client/src/CMakeLists.txt index 99b9a6773..7e1f89348 100644 --- a/code/ryzom/client/src/CMakeLists.txt +++ b/code/ryzom/client/src/CMakeLists.txt @@ -82,7 +82,7 @@ IF(WITH_RYZOM_CLIENT) ADD_CUSTOM_COMMAND(TARGET ryzom_client PRE_BUILD COMMAND mkdir -p ${RYZOM_RESOURCES_DIR}) ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${MAC_RESOURCES_DIR}/PkgInfo ${RYZOM_CONTENTS_DIR}) ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${MAC_RESOURCES_DIR}/ryzom.icns ${RYZOM_RESOURCES_DIR}) - ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${CMAKE_SOURCE_DIR}/ryzom/client/client_default.cfg ${RYZOM_RESOURCES_DIR}) + #ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${CMAKE_SOURCE_DIR}/ryzom/client/client_default.cfg ${RYZOM_RESOURCES_DIR}) # remove any present installscript_osx.vdf before signing ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND rm -f ${RYZOM_OUTPUT_DIR}/installscript_osx.vdf) From c2e7807f99524a08885ea4addc89e49adc5d3c4e Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Fri, 12 Jun 2020 00:30:03 +0200 Subject: [PATCH 29/53] Adapt action handler for editing phrases to handle second action bar --- .../interface_v3/action_handler_phrase.cpp | 87 +++++++++++-------- 1 file changed, 53 insertions(+), 34 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp index 0e5ba0c48..efe882b1d 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -1,9 +1,6 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // -// This source file has been modified by the following contributors: -// Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the @@ -136,7 +133,7 @@ public: if (pCSDst->isShortCut()) pPM->CompositionPhraseMemoryLineDest= pPM->getSelectedMemoryLineDB(); else - pPM->CompositionPhraseMemoryLineDest= 0; + pPM->CompositionPhraseMemoryLineDest= pPM->getSelectedMemoryAltLineDB(); pPM->CompositionPhraseMemorySlotDest= pCSDst->getIndexInDB(); } @@ -536,10 +533,8 @@ public: CInterfaceManager *pIM= CInterfaceManager::getInstance(); // Launch the modal to select the faber plan - extern void fillFaberPlanSelection(const std::string &brickDB, uint maxSelection, TOOL_TYPE::TCraftingToolType toolType); - // from sphrase_manager.cpp - extern TOOL_TYPE::TCraftingToolType getRightHandCraftToolType(); - fillFaberPlanSelection(CDBGroupBuildPhrase::BrickSelectionDB, CDBGroupBuildPhrase::MaxSelection, getRightHandCraftToolType()); + extern void fillFaberPlanSelection(const std::string &brickDB, uint maxSelection); + fillFaberPlanSelection(CDBGroupBuildPhrase::BrickSelectionDB, CDBGroupBuildPhrase::MaxSelection); // setup the validation CHandlerPhraseValidateBrick::BuildPhraseGroup= NULL; @@ -750,8 +745,8 @@ class CHandlerMemorizePhraseOrMacro : public IActionHandler { public: virtual void execute (CCtrlBase *pCaller, const string &Params); - void memorizePhraseOrMacro(uint dstMemoryIndex, bool isMacro, sint32 phraseId, sint32 macroId); - void memorizePhraseSheet(uint dstMemoryIndex, uint32 sheetId); + void memorizePhraseOrMacro(sint32 memoryLine, uint dstMemoryIndex, bool isMacro, sint32 phraseId, sint32 macroId); + void memorizePhraseSheet(sint32 memoryLine, uint dstMemoryIndex, uint32 sheetId); }; REGISTER_ACTION_HANDLER( CHandlerMemorizePhraseOrMacro, "memorize_phrase_or_macro"); @@ -771,7 +766,11 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P // The dest must be a memory or a macro memory if (!pCSDst->isSPhraseIdMemory() && !pCSDst->isMacroMemory()) return; // get the memory line and memory index - sint32 dstMemoryLine= pPM->getSelectedMemoryLineDB(); + sint32 dstMemoryLine; + if (pCSDst->isShortCut()) + dstMemoryLine = pPM->getSelectedMemoryLineDB(); + else + dstMemoryLine = pPM->getSelectedMemoryAltLineDB(); uint dstMemoryIndex= pCSDst->getIndexInDB(); bool srcIsMacro; @@ -806,7 +805,7 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P pPM->sendLearnToServer(newPhraseId); // memorize the new phrase - memorizePhraseOrMacro(dstMemoryIndex, srcIsMacro, newPhraseId, srcMacroId); + memorizePhraseOrMacro(dstMemoryLine, dstMemoryIndex, srcIsMacro, newPhraseId, srcMacroId); } } else @@ -833,7 +832,7 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P if(pCSSrc->isSPhrase()) { // learn and memorize this phrase - memorizePhraseSheet(dstMemoryIndex, pCSSrc->getSheetId()); + memorizePhraseSheet(dstMemoryLine, dstMemoryIndex, pCSSrc->getSheetId()); } else { @@ -842,7 +841,7 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P pPM->fullDeletePhraseIfLast(dstMemoryLine, dstMemoryIndex); // memorize the phrase or macro - memorizePhraseOrMacro(dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId); + memorizePhraseOrMacro(dstMemoryLine, dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId); } } // Else the src is a memory too @@ -868,7 +867,7 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P pPM->sendLearnToServer(newPhraseId); // memorize the new phrase - memorizePhraseOrMacro(dstMemoryIndex, srcIsMacro, newPhraseId, srcMacroId); + memorizePhraseOrMacro(dstMemoryLine, dstMemoryIndex, srcIsMacro, newPhraseId, srcMacroId); } else { @@ -876,7 +875,7 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P pPM->fullDeletePhraseIfLast(dstMemoryLine, dstMemoryIndex); // memorize the macro (still a reference) - memorizePhraseOrMacro(dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId); + memorizePhraseOrMacro(dstMemoryLine, dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId); } } // else this is a swap! @@ -887,17 +886,23 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P { // get the memory index for src uint srcMemoryIndex= pCSSrc->getIndexInDB(); - + // get the memory line for src + sint32 srcMemoryLine; + if (pCSSrc->isShortCut()) + srcMemoryLine = pPM->getSelectedMemoryLineDB(); + else + srcMemoryLine = pPM->getSelectedMemoryAltLineDB(); + // memorize dst into src - memorizePhraseOrMacro(srcMemoryIndex, dstIsMacro, dstPhraseId, dstMacroId); + memorizePhraseOrMacro(srcMemoryLine, srcMemoryIndex, dstIsMacro, dstPhraseId, dstMacroId); // memorize src into dst - memorizePhraseOrMacro(dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId); + memorizePhraseOrMacro(dstMemoryLine, dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId); } // else, it's a move else { // copy - memorizePhraseOrMacro(dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId); + memorizePhraseOrMacro(dstMemoryLine, dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId); // forget src (after shorctut change!) CAHManager::getInstance()->runActionHandler("forget_phrase_or_macro", pCSSrc); @@ -909,14 +914,13 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P // memorize a spell -void CHandlerMemorizePhraseOrMacro::memorizePhraseOrMacro(uint memoryIndex, bool isMacro, sint32 phraseId, sint32 macroId) +void CHandlerMemorizePhraseOrMacro::memorizePhraseOrMacro(sint32 memoryLine, uint memoryIndex, bool isMacro, sint32 phraseId, sint32 macroId) { CSPhraseManager *pPM= CSPhraseManager::getInstance(); - sint32 memoryLine= pPM->getSelectedMemoryLineDB(); - if(memoryLine<0) - return; - + if (memoryLine<0) + return; + if(isMacro) { pPM->memorizeMacro(memoryLine, memoryIndex, macroId); @@ -931,11 +935,10 @@ void CHandlerMemorizePhraseOrMacro::memorizePhraseOrMacro(uint memoryIndex, bool } // memorize a default spell -void CHandlerMemorizePhraseOrMacro::memorizePhraseSheet(uint memoryIndex, uint32 sheetId) +void CHandlerMemorizePhraseOrMacro::memorizePhraseSheet(sint32 memoryLine, uint memoryIndex, uint32 sheetId) { CSPhraseManager *pPM= CSPhraseManager::getInstance(); - sint32 memoryLine= pPM->getSelectedMemoryLineDB(); if(memoryLine<0) return; @@ -989,7 +992,11 @@ public: return; // Ok, the user try to forget a phrase slot. - sint32 memoryLine= pPM->getSelectedMemoryLineDB(); + sint32 memoryLine; + if (pCSDst->isShortCut()) + memoryLine = pPM->getSelectedMemoryLineDB(); + else + memoryLine = pPM->getSelectedMemoryAltLineDB(); if(memoryLine<0) return; @@ -1026,6 +1033,9 @@ public: if (!pCSDst->isSPhraseIdMemory() && !pCSDst->isMacroMemory()) return; + // is alternative action bar + bool isMain = pCSDst->isShortCut(); + // get the memory index uint memoryIndex = pCSDst->getIndexInDB(); @@ -1034,7 +1044,9 @@ public: // build params string string sParams; - sParams.append("memoryIndex="); + sParams.append("isMain="); + sParams.append(toString(isMain)); + sParams.append("|memoryIndex="); sParams.append(toString(memoryIndex)); sParams.append("|isMacro="); sParams.append(toString(isMacro)); @@ -1066,11 +1078,10 @@ public: // Ok, the user try to forget a phrase slot CSPhraseManager *pPM = CSPhraseManager::getInstance(); - sint32 memoryLine = pPM->getSelectedMemoryLineDB(); - if (memoryLine<0) - return; - + // get params + bool isMain; + fromString(getParam(Params, "isMain"), isMain); uint memoryIndex; fromString(getParam(Params, "memoryIndex"), memoryIndex); bool isMacro; @@ -1078,6 +1089,14 @@ public: sint32 phraseId; fromString(getParam(Params, "phraseId"),phraseId); + sint32 memoryLine; + if (isMain) + memoryLine = pPM->getSelectedMemoryLineDB(); + else + memoryLine = pPM->getSelectedMemoryAltLineDB(); + if (memoryLine<0) + return; + if (isMacro) { pPM->forgetMacro(memoryLine, memoryIndex); @@ -1513,7 +1532,7 @@ public: if (pCSDst->isShortCut()) memoryLine = pPM->getSelectedMemoryLineDB(); else - memoryLine = 0; + memoryLine = pPM->getSelectedMemoryAltLineDB(); if(memoryLine<0) return; From 59c794f7166a23853c2db969d94d6aa5021d2a19 Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Fri, 12 Jun 2020 02:24:37 +0200 Subject: [PATCH 30/53] Wrongly removed previous change --- .../ryzom/client/src/interface_v3/action_handler_phrase.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp index efe882b1d..f7ea71c33 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -533,8 +533,10 @@ public: CInterfaceManager *pIM= CInterfaceManager::getInstance(); // Launch the modal to select the faber plan - extern void fillFaberPlanSelection(const std::string &brickDB, uint maxSelection); - fillFaberPlanSelection(CDBGroupBuildPhrase::BrickSelectionDB, CDBGroupBuildPhrase::MaxSelection); + extern voidfillFaberPlanSelection(const std::string &brickDB, uint maxSelection, TOOL_TYPE::TCraftingToolType toolType); + // from sphrase_manager.cpp + extern TOOL_TYPE::TCraftingToolType getRightHandCraftToolType(); + fillFaberPlanSelection(CDBGroupBuildPhrase::BrickSelectionDB, CDBGroupBuildPhrase::MaxSelection, getRightHandCraftToolType()); // setup the validation CHandlerPhraseValidateBrick::BuildPhraseGroup= NULL; From 6c8aeb6ae33d1cd2c29d5d5858a56fcf50de6fee Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Fri, 12 Jun 2020 02:31:46 +0200 Subject: [PATCH 31/53] Missed a whitespace --- code/ryzom/client/src/interface_v3/action_handler_phrase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp index f7ea71c33..56e3d4b1b 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -533,7 +533,7 @@ public: CInterfaceManager *pIM= CInterfaceManager::getInstance(); // Launch the modal to select the faber plan - extern voidfillFaberPlanSelection(const std::string &brickDB, uint maxSelection, TOOL_TYPE::TCraftingToolType toolType); + extern void fillFaberPlanSelection(const std::string &brickDB, uint maxSelection, TOOL_TYPE::TCraftingToolType toolType); // from sphrase_manager.cpp extern TOOL_TYPE::TCraftingToolType getRightHandCraftToolType(); fillFaberPlanSelection(CDBGroupBuildPhrase::BrickSelectionDB, CDBGroupBuildPhrase::MaxSelection, getRightHandCraftToolType()); From 421de3fa913c88be5737980b42a50eec3e6b772c Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Fri, 12 Jun 2020 14:07:17 +0200 Subject: [PATCH 32/53] 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 33/53] 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 34/53] 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 35/53] 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 From a87b0f4c973b9c10afa3ebec0a7b94aa86cde759 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Fri, 26 Jun 2020 15:18:54 +0200 Subject: [PATCH 36/53] Changed: When ryzom patch fails try to download lzma file (this last may never fail) --- code/ryzom/client/src/login_patch.cpp | 133 +++++++++++++++++++++----- code/ryzom/client/src/login_patch.h | 2 +- 2 files changed, 108 insertions(+), 27 deletions(-) diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index 926ed61b1..0a6b912dd 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -245,7 +245,7 @@ void CPatchManager::init(const std::vector& patchURIs, const std::s #endif // App name matches Domain on the SQL server - std::string appName = cf->getVarPtr("Application") + std::string appName = cf->getVarPtr("Application") ? cf->getVar("Application").asString(0) : "default"; @@ -1354,7 +1354,7 @@ void CPatchManager::getServerFile (const std::string &name, bool bZipped, const { //nlwarning("EXCEPTION CATCH: getServerFile() failed - try to find an alternative: %i: %s",UsedServer,PatchServers[UsedServer].DisplayedServerPath.c_str()); - nlwarning("EXCEPTION CATCH: getServerFile() failed - try to find an alternative :"); + nlwarning("EXCEPTION CATCH: getServerFile() failed - try to find an alternative : %s", (serverPath+srcName).c_str()); nlwarning("%i", UsedServer); if (UsedServer >= 0 && UsedServer < (int) PatchServers.size()) { @@ -2676,6 +2676,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) string OutFilename; bool usePatchFile = true; + bool haveAllreadyTryiedDownloadingOfFile = false; // compute the total size of patch to download uint32 totalPatchSize = 0; @@ -2743,6 +2744,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) { // can not load the 7zip file, use normal patching usePatchFile = true; + haveAllreadyTryiedDownloadingOfFile = true; break; } @@ -2754,6 +2756,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) { // fallback to standard patch method usePatchFile = true; + haveAllreadyTryiedDownloadingOfFile = true; break; } } @@ -2766,6 +2769,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) nlwarning("Failed to unpack lzma file %s", (pPM->ClientPatchPath+lzmaFile).c_str()); // fallback to standard patch method usePatchFile = true; + haveAllreadyTryiedDownloadingOfFile = true; break; } @@ -2874,32 +2878,108 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) sTranslate = CI18N::get("uiApplyingDelta") + " " + CFile::getFilename(PatchName); pPM->setState(true, sTranslate); - xDeltaPatch(PatchName, SourceNameXD, OutFilename); + bool deltaPatchResult = xDeltaPatch(PatchName, SourceNameXD, OutFilename); - if (rFTP.LocalFileExists) - pPM->deleteFile(SourceName); - pPM->deleteFile(PatchName); - - if (j > 0) + if (!deltaPatchResult && !haveAllreadyTryiedDownloadingOfFile) // Patch failed, try to download and apply lzma { - pPM->deleteFile(SourceNameXD, false, false); // File can exists if bad BNP loading - } - tmpSourceName = OutFilename; - PatchSizeProgress += rFTP.PatcheSizes[j]; - currentPatchedSize += rFTP.PatcheSizes[j]; - } + breakable + { + // compute the seven zip filename + string lzmaFile = rFTP.FileName+".lzma"; - if (tmpSourceName != DestinationName) - { - pPM->deleteFile(SourceName, false, false); // File can exists if bad BNP loading - if (!_CommitPatch) - { - // let the patch in the unpack directory - pPM->renameFile(tmpSourceName, pPM->ClientPatchPath + rFTP.FileName + ".tmp"); + // download the 7zip file + try + { + // first, try in the file version subfolfer + try + { + progress.Scale = 1.f; + progress.Bias = 0.f; + if (!rFTP.Patches.empty()) + { + pPM->getServerFile(toString("%05u/", rFTP.Patches.back())+lzmaFile, false, "", &progress); + } + // else -> file comes from a previous download (with .tmp extension, and is up to date) + // the remaining code will just rename it with good name and exit + } + catch (const NLMISC::EWriteError &) + { + // this is a local error, rethrow ... + throw; + } + catch(...) + { + // failed with version subfolder, try in the root patch directory + pPM->getServerFile(lzmaFile, false, "", &progress); + } + } + catch (const NLMISC::EWriteError &) + { + // this is a local error, rethrow ... + throw; + } + catch (...) + { + break; + } + + OutFilename = pPM->ClientPatchPath + NLMISC::CFile::getFilename(rFTP.FileName); + // try to unpack the file + try + { + if (!unpackLZMA(pPM->ClientPatchPath+lzmaFile, OutFilename+".tmp")) + { + break; + } + } + catch (const NLMISC::EWriteError&) + { + throw; + } + catch (...) + { + nlwarning("Failed to unpack lzma file %s", (pPM->ClientPatchPath+lzmaFile).c_str()); + break; + } + + if (rFTP.LocalFileExists) + pPM->deleteFile(SourceName); + + pPM->deleteFile(pPM->ClientPatchPath+lzmaFile); // delete the archive file + pPM->deleteFile(SourceName, false, false); // File can exists if bad BNP loading + if (_CommitPatch) + { + pPM->renameFile(OutFilename+".tmp", DestinationName); + } + } } else { - pPM->renameFile(tmpSourceName, DestinationName); + if (rFTP.LocalFileExists) + pPM->deleteFile(SourceName); + pPM->deleteFile(PatchName); + + if (j > 0) + { + pPM->deleteFile(SourceNameXD, false, false); // File can exists if bad BNP loading + } + tmpSourceName = OutFilename; + PatchSizeProgress += rFTP.PatcheSizes[j]; + currentPatchedSize += rFTP.PatcheSizes[j]; + } + + if (tmpSourceName != DestinationName) + { + pPM->deleteFile(SourceName, false, false); // File can exists if bad BNP loading + if (!_CommitPatch) + { + // let the patch in the unpack directory + pPM->renameFile(tmpSourceName, pPM->ClientPatchPath + rFTP.FileName + ".tmp"); + } + else + { + pPM->renameFile(tmpSourceName, DestinationName); + } } } } @@ -2915,7 +2995,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) } // **************************************************************************** -void CPatchThread::xDeltaPatch(const string &patch, const string &src, const string &out) +bool CPatchThread::xDeltaPatch(const string &patch, const string &src, const string &out) { // Internal xdelta @@ -2941,12 +3021,13 @@ void CPatchThread::xDeltaPatch(const string &patch, const string &src, const str break; default: { - std::string str = toString("Error applying %s to %s giving %s", patch.c_str(), src.c_str(), out.c_str()); - throw Exception (str); + nlinfo("Error applying %s to %s giving %s", patch.c_str(), src.c_str(), out.c_str()); + return false; } break; } - } + } else + return true; // Launching xdelta diff --git a/code/ryzom/client/src/login_patch.h b/code/ryzom/client/src/login_patch.h index 2b108994d..27ffec901 100644 --- a/code/ryzom/client/src/login_patch.h +++ b/code/ryzom/client/src/login_patch.h @@ -547,7 +547,7 @@ private: void run(); void processFile (CPatchManager::SFileToPatch &rFTP); - void xDeltaPatch(const std::string &patch, const std::string &src, const std::string &out); + bool xDeltaPatch(const std::string &patch, const std::string &src, const std::string &out); }; /** From 107dbc1987b64041aa7532b7f4156f4e897fe954 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Fri, 26 Jun 2020 19:44:54 +0200 Subject: [PATCH 37/53] Changed: Fixed non-Mac compilation --- .../src/3d/driver/opengl/driver_opengl_extension.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index f7c0bf496..4bdd7ca97 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -1275,7 +1275,7 @@ static bool setupNVFragmentProgram2(const char *glext) { H_AUTO_OGL(setupNVFragmentProgram2); CHECK_EXT("GL_NV_fragment_program2"); - + return true; } @@ -1284,7 +1284,7 @@ static bool setupARBFragmentShader(const char *glext) { H_AUTO_OGL(setupNVFragmentProgram2); CHECK_EXT("GL_ARB_fragment_shader"); - + return true; } @@ -1583,12 +1583,14 @@ static bool setupATIMeminfo(const char *glext) void registerGlExtensions(CGlExtensions &ext) { H_AUTO_OGL(registerGlExtensions); - + +#ifdef NL_OS_MAC CGLContextObj ctx = CGLGetCurrentContext(); if (ctx == NULL) { nlerror("No OpenGL context set"); } +#endif // OpenGL 1.2 ?? const char *nglVersion = (const char *)glGetString (GL_VERSION); @@ -1697,12 +1699,12 @@ void registerGlExtensions(CGlExtensions &ext) ext.EXTVertexShader = false; ext.ARBVertexProgram = false; } - + // Check pixel program // Disable feature ??? if (!ext.DisableHardwarePixelProgram) { - ext.ARBFragmentProgram = setupARBFragmentProgram(glext); + ext.ARBFragmentProgram = setupARBFragmentProgram(glext); ext.NVFragmentProgram2 = setupNVFragmentProgram2(glext); ext.ARBFragmentShader = setupARBFragmentShader(glext); } From 2a4b16ab1b9fb66dac18a0353577323322c88b81 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 25 Jun 2020 14:44:45 +0300 Subject: [PATCH 38/53] Changed: Allow to use 2x/4x hi-res texture atlas for GUI elements --- code/nel/include/nel/gui/view_renderer.h | 4 ++++ code/nel/src/gui/view_renderer.cpp | 26 +++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/code/nel/include/nel/gui/view_renderer.h b/code/nel/include/nel/gui/view_renderer.h index aefbb315f..4498a436a 100644 --- a/code/nel/include/nel/gui/view_renderer.h +++ b/code/nel/include/nel/gui/view_renderer.h @@ -444,9 +444,13 @@ namespace NLGUI SGlobalTexture () { FromGlobaleTexture = true; + Scale = 1.f; } uint32 Width, Height; uint32 DefaultWidth, DefaultHeight; + // used by texture atlas to unscale individual texture + // getTextureSizeFromId() calls to return 1x size for GUI. + float Scale; NL3D::UTexture *Texture; std::string Name; bool FromGlobaleTexture; diff --git a/code/nel/src/gui/view_renderer.cpp b/code/nel/src/gui/view_renderer.cpp index 82716de4a..6a7d86eef 100644 --- a/code/nel/src/gui/view_renderer.cpp +++ b/code/nel/src/gui/view_renderer.cpp @@ -621,9 +621,7 @@ namespace NLGUI return; sint32 txw, txh; - SImage &rImage = *getSImage(nTxId); - txw = (sint32)((rImage.UVMax.U - rImage.UVMin.U)*rImage.GlobalTexturePtr->Width+0.5f); - txh = (sint32)((rImage.UVMax.V - rImage.UVMin.V)*rImage.GlobalTexturePtr->Height+0.5f); + getTextureSizeFromId(nTxId, txw, txh); drawRotFlipBitmap (layerId, x, y, txw, txh, rot, flipv, nTxId, col); } @@ -859,6 +857,14 @@ namespace NLGUI CIFile ifTmp; if (ifTmp.open(filename)) CBitmap::loadSize (ifTmp, gt.Width, gt.Height); + + // extract textures scale from filename + // texture_interface_v3_2x.tga / texture_interface_v3_4x.tga + if (textureFileName.find("_2x.") != std::string::npos) + gt.Scale = 2.f; + else if (textureFileName.find("_4x.") != std::string::npos) + gt.Scale = 4.f; + gt.Texture = driver->createTextureFile (filename); // Force to generate the texture now. This way we can extract the mouse bitmaps from it now without having to load it again. // Its why we don't release it at the end, because it is likely to be uploaded soon) @@ -932,6 +938,10 @@ namespace NLGUI CBitmap curs; curs.resize(x1 - x0, y1 - y0); curs.blit(*texDatas, x0, y0, (x1 - x0), (y1 - y0), 0, 0); + // TODO: scaled cursors not supported + if (gt.Scale > 1.f) { + curs.resample((sint)(curs.getWidth() / gt.Scale), (sint)(curs.getHeight() / gt.Scale)); + } driver->addCursor(image.Name, curs); } } @@ -1357,8 +1367,8 @@ namespace NLGUI else { SImage &rImage = *getSImage(id); - width = (sint32)((rImage.UVMax.U - rImage.UVMin.U)*rImage.GlobalTexturePtr->Width+0.5f); - height = (sint32)((rImage.UVMax.V - rImage.UVMin.V)*rImage.GlobalTexturePtr->Height+0.5f); + width = (sint32)(((rImage.UVMax.U - rImage.UVMin.U)*rImage.GlobalTexturePtr->Width / rImage.GlobalTexturePtr->Scale)+0.5f); + height = (sint32)(((rImage.UVMax.V - rImage.UVMin.V)*rImage.GlobalTexturePtr->Height / rImage.GlobalTexturePtr->Scale)+0.5f); } } /* @@ -1373,9 +1383,11 @@ namespace NLGUI SImage &rImage = *getSImage(id); SGlobalTexture &rGT = *rImage.GlobalTexturePtr; + // get (possibly) scaled width/height sint32 width, height; - width = (sint32)((rImage.UVMax.U - rImage.UVMin.U)*rGT.Width+0.5f); - height = (sint32)((rImage.UVMax.V - rImage.UVMin.V)*rGT.Height+0.5f); + getTextureSizeFromId(id, width, height); + if (width == 0 || height == 0) + return CRGBA(255,255,255); float xRatio = ((float)x) / ((float)(width)); float yRatio = ((float)y) / ((float)(height)); UTexture *pTF = rGT.Texture; From f7be62eb3ddc1511df04bc407166c94e87db945d Mon Sep 17 00:00:00 2001 From: Nimetu Date: Mon, 6 Jul 2020 18:36:48 +0300 Subject: [PATCH 39/53] Fixed: Player/guild room buy dialog price --- code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index 4a59163b3..d05ba9d7a 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -588,7 +588,8 @@ void CBotChatPageTrade::updateTradeModal() if ((_BuyMean == MoneyGuildXP) || (_BuyMean == GuildMoney) || (_BuyMean == GuildMoneyGuildXP)) { uint64 totalPrice = (uint64) priceWithoutFame * (uint64) quantity; - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:PRICE")->setValue64(totalPrice); + NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:UNIT_PRICE")->setValue64(totalPrice); + NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:UNIT_PRICE_WITH_FAME")->setValue64(totalPrice); uint64 totalXP = (uint64) getCurrItemXP() * (uint64) quantity; CGuildManager *pGM = CGuildManager::getInstance(); From f31eeff8fc753f6cc0e78c00a0ff23d570da0ade Mon Sep 17 00:00:00 2001 From: Riasan Date: Tue, 7 Jul 2020 14:00:42 +0200 Subject: [PATCH 40/53] Changed: add display current online guildmembers --- code/ryzom/client/src/interface_v3/guild_manager.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/code/ryzom/client/src/interface_v3/guild_manager.cpp b/code/ryzom/client/src/interface_v3/guild_manager.cpp index d00661357..5190404ab 100644 --- a/code/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/code/ryzom/client/src/interface_v3/guild_manager.cpp @@ -67,6 +67,7 @@ NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListAscensor, std::string, "list_sheet #define VIEW_TEXT_GUILD_QUIT "ui:interface:guild:content:tab_guild_info:quit_guild" #define CTRL_SHEET_GUILD_BLASON "ui:interface:guild:content:tab_guild_info:blason" #define VIEW_TEXT_GUILD_MEMBER_COUNT "ui:interface:guild:content:tab_guild_info:member_count" +#define VIEW_TEXT_GUILD_MEMBER_COUNT_ONLINE "ui:interface:guild:content:tab_guild_info:member_count_online" #define LIST_GUILD_MEMBERS "ui:interface:guild:content:tab_guild:list_member:guild_members" @@ -817,6 +818,7 @@ class CAHGuildSheetOpen : public IActionHandler if (pParent == NULL) return; pParent->clearGroups(); pParent->setDynamicDisplaySize(false); + uint member_online = 0; for (uint i = 0; i < rGuildMembers.size(); i++) { // create the member line @@ -855,11 +857,13 @@ class CAHGuildSheetOpen : public IActionHandler switch(rGuildMembers[i].Online) { case ccs_online: + member_online++; onlineView->setTexture("w_online.tga"); if (toolTip) toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOnline")); break; case ccs_online_abroad: + member_online++; onlineView->setTexture("w_online_abroad.tga"); if (toolTip) toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOnlineAbroad")); @@ -895,6 +899,12 @@ class CAHGuildSheetOpen : public IActionHandler pLine->setParent (pParent); pParent->addChild (pLine); } + + // update member online count view + CViewText *pOnlineMember = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(VIEW_TEXT_GUILD_MEMBER_COUNT_ONLINE)); + if (pOnlineMember) + pOnlineMember->setText(toString(member_online)); + } } }; From 6fa74cd5c2dfca0dfb5a7f0b74d77fd893ba12c5 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Thu, 9 Jul 2020 13:15:13 +0200 Subject: [PATCH 41/53] Added: Option to use ryzom_client_patcher as bnp unpacker and xdelta patcher --- code/ryzom/client/src/login_patch.h | 3 +- .../tools/client/client_patcher/main.cpp | 31 +++++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/code/ryzom/client/src/login_patch.h b/code/ryzom/client/src/login_patch.h index 27ffec901..7c0a68b2d 100644 --- a/code/ryzom/client/src/login_patch.h +++ b/code/ryzom/client/src/login_patch.h @@ -269,6 +269,7 @@ public: void setStartRyzomAtEnd(bool startAtEnd){ _StartRyzomAtEnd = startAtEnd; } // Forward message to installation software if needed void fatalError(const std::string& errorId, const std::string& param1, const std::string& param2); + bool bnpUnpack(const std::string &srcBigfile, const std::string &dstPath, std::vector &vFilenames); const std::string & getServerVersion () { return ServerVersion; } private: @@ -320,8 +321,6 @@ private: void getPatchFromDesc(SFileToPatch &ftpOut, const CBNPFile &fIn, bool forceCheckSumTest); - bool bnpUnpack(const std::string &srcBigfile, const std::string &dstPath, std::vector &vFilenames); - // stop the threads (called when knowing the thread ended) void stopCheckThread(); void stopPatchThread(); diff --git a/code/ryzom/tools/client/client_patcher/main.cpp b/code/ryzom/tools/client/client_patcher/main.cpp index e7d57a335..62937dd59 100644 --- a/code/ryzom/tools/client/client_patcher/main.cpp +++ b/code/ryzom/tools/client/client_patcher/main.cpp @@ -200,9 +200,38 @@ int main(int argc, char *argv[]) Args.setVersion(getDisplayVersion()); Args.setDescription("Ryzom client"); + Args.addArg("p", "patch", "patch", "Name of the file to use tp xdelta the source file"); + Args.addArg("s", "source", "source", "Name of source file to xdelta with patch file"); + Args.addArg("d", "destination", "destination", "Name of destination operation (patch or unpack)"); + Args.addArg("u", "unpack", "unpack", "Name of bnp file to unpack"); if (!Args.parse(argc, argv)) return 1; + if (Args.haveArg("p") && Args.haveArg("p") && Args.haveArg("p")) + { + string patchName = Args.getArg("p").front(); + string sourceName = Args.getArg("s").front(); + string destinationName = Args.getArg("d").front(); + + std::string errorMsg; + CXDeltaPatch::TApplyResult ar = CXDeltaPatch::apply(patchName, sourceName, destinationName, errorMsg); + nlinfo("%s", errorMsg.c_str()); + return ar; + } + + // initialize patch manager and set the ryzom full path, before it's used + CPatchManager *pPM = CPatchManager::getInstance(); + + if (Args.haveArg("u") && Args.haveArg("d")) + { + string bnpName = Args.getArg("u").front(); + string destinationName = Args.getArg("d").front(); + vector vFilenames; + if (pPM->bnpUnpack(bnpName, destinationName, vFilenames)) + return 0; + return 1; + } + // create logs in temporary directory createDebug(CPath::getTemporaryDirectory().c_str(), true, true); @@ -244,8 +273,6 @@ int main(int argc, char *argv[]) printf("\n"); printf("Checking %s files to patch...\n", convert(CI18N::get("TheSagaOfRyzom")).c_str()); - // initialize patch manager and set the ryzom full path, before it's used - CPatchManager *pPM = CPatchManager::getInstance(); // use PatchUrl vector patchURLs; From c06469b2a03c4bb919483f5693c949e4dfa42c52 Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Sat, 15 Aug 2020 16:49:14 +0200 Subject: [PATCH 42/53] Fixed second action bar not updating after being changed --- code/ryzom/client/src/interface_v3/sphrase_manager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/sphrase_manager.cpp b/code/ryzom/client/src/interface_v3/sphrase_manager.cpp index 160010f3f..f9dd511d5 100644 --- a/code/ryzom/client/src/interface_v3/sphrase_manager.cpp +++ b/code/ryzom/client/src/interface_v3/sphrase_manager.cpp @@ -411,7 +411,7 @@ void CSPhraseManager::forgetPhrase(uint32 memoryLine, uint32 memorySlot) _Memories[memoryLine].Slot[memorySlot].Id= 0; // must update DB? - if((sint32)memoryLine==_SelectedMemoryDB) + if((sint32)memoryLine==_SelectedMemoryDB || (sint32)memoryLine==_SelectedMemoryDBalt) { // update the db updateMemoryDBSlot(memorySlot); @@ -465,7 +465,7 @@ void CSPhraseManager::memorizePhrase(uint32 memoryLine, uint32 memorySlot, ui _Memories[memoryLine].Slot[memorySlot].Id= slot; // must update DB? - if((sint32)memoryLine==_SelectedMemoryDB) + if((sint32)memoryLine==_SelectedMemoryDB || (sint32)memoryLine==_SelectedMemoryDBalt) { // update the DB updateMemoryDBSlot(memorySlot); @@ -3276,7 +3276,7 @@ void CSPhraseManager::memorizeMacro(uint32 memoryLine, uint32 memorySlot, uint32 _Memories[memoryLine].Slot[memorySlot].Id= macroId; // must update DB? - if((sint32)memoryLine==_SelectedMemoryDB) + if((sint32)memoryLine==_SelectedMemoryDB || (sint32)memoryLine==_SelectedMemoryDBalt) { // update the DB updateMemoryDBSlot(memorySlot); @@ -3302,7 +3302,7 @@ void CSPhraseManager::forgetMacro(uint32 memoryLine, uint32 memorySlot) _Memories[memoryLine].Slot[memorySlot].Id= 0; // must update DB? - if((sint32)memoryLine==_SelectedMemoryDB) + if((sint32)memoryLine==_SelectedMemoryDB || (sint32)memoryLine==_SelectedMemoryDBalt) { // update the db updateMemoryDBSlot(memorySlot); From e5b3b752d5743723f56fc7a457d92288f3396746 Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Sat, 15 Aug 2020 15:01:09 +0000 Subject: [PATCH 43/53] Copyright somehow got lost --- code/ryzom/client/src/interface_v3/action_handler_phrase.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp index 56e3d4b1b..b18e348e5 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the From bccc86bd996b4ceedada6e49dc45b9c860609969 Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Sat, 15 Aug 2020 18:51:20 +0200 Subject: [PATCH 44/53] Added option to show the translation as a tooltip and original by default --- .../src/interface_v3/chat_text_manager.cpp | 17 +++++++++++++-- .../interface_v3/group_in_scene_bubble.cpp | 21 ++++++++++++++++--- 2 files changed, 33 insertions(+), 5 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 b3a673ffe..ec0aee822 100644 --- a/code/ryzom/client/src/interface_v3/chat_text_manager.cpp +++ b/code/ryzom/client/src/interface_v3/chat_text_manager.cpp @@ -425,6 +425,9 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C ucstring::size_type pos = 0; // Manage Translations + CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CHAT:SHOW_TRANSLATION_ONLY_AS_TOOLTIP_CB", false); + bool originalFirst = node->getValueBool(); + string::size_type startTr = msg.find(ucstring("{:")); string::size_type endOfOriginal = msg.find(ucstring("}@{")); @@ -436,12 +439,22 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C string texture = "flag-"+toLower(msg.substr(startTr+2, 2)).toString()+".tga"; ucstring original = msg.substr(startTr+5, endOfOriginal-startTr-5); - pos = endOfOriginal+3; + ucstring translation = msg.substr(endOfOriginal+3); CCtrlButton *ctrlButton = new CCtrlButton(CViewBase::TCtorParam()); ctrlButton->setTexture(texture); ctrlButton->setTextureOver(texture); ctrlButton->setTexturePushed(texture); - ctrlButton->setDefaultContextHelp(original); + if (!originalFirst) + { + ctrlButton->setDefaultContextHelp(original); + pos = endOfOriginal+3; + } + else + { + ctrlButton->setDefaultContextHelp(translation); + pos = startTr+5; + textSize = endOfOriginal; + } ctrlButton->setId("tr"); para->addChild(ctrlButton); } 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 460a095fc..2276eb506 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 @@ -846,11 +846,26 @@ void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText, // Clean bubble from translation system + CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CHAT:SHOW_TRANSLATION_ONLY_AS_TOOLTIP_CB", false); + bool originalFirst = node->getValueBool(); + ucstring::size_type pos = 0; + ucstring::size_type textSize = ucsText.size(); + string::size_type startTr = ucsText.find(ucstring("{:")); string::size_type endOfOriginal = ucsText.find(ucstring("}@{")); if (endOfOriginal != string::npos) - pos = endOfOriginal+4; - + { + if (!originalFirst) + { + pos = endOfOriginal+4; + } + else + { + pos = startTr+5; + textSize = endOfOriginal; + } + } + // Output the message in a bubble bool show = false; @@ -870,7 +885,7 @@ void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText, return; // Get a bubble - CGroupInSceneBubble *bubble = newBubble (ucsText.substr(pos)); + CGroupInSceneBubble *bubble = newBubble (ucsText.substr(pos, textSize-pos)); if (bubble) { // Link the bubble From b8b21914f64413ee58f8dc07f9e89e2e1a3a56ef Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Sun, 16 Aug 2020 02:58:52 +0200 Subject: [PATCH 45/53] Made item groups compatible with Zigs --- .../client/src/interface_v3/inventory_manager.cpp | 15 +++++++++++++++ .../client/src/interface_v3/inventory_manager.h | 9 +++++++++ code/ryzom/client/src/item_group_manager.cpp | 6 ++++++ 3 files changed, 30 insertions(+) diff --git a/code/ryzom/client/src/interface_v3/inventory_manager.cpp b/code/ryzom/client/src/interface_v3/inventory_manager.cpp index 816f676e2..312df9769 100644 --- a/code/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/code/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -3769,6 +3769,21 @@ void CInventoryManager::sortBag() if (pIconList != NULL) pIconList->needToSort(); pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA3_TEXT)); if (pList != NULL) pList->needToSort(); + + pIconList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA4_ICONS)); + if (pIconList != NULL) pIconList->needToSort(); + pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA4_TEXT)); + if (pList != NULL) pList->needToSort(); + + pIconList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA5_ICONS)); + if (pIconList != NULL) pIconList->needToSort(); + pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA5_TEXT)); + if (pList != NULL) pList->needToSort(); + + pIconList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA6_ICONS)); + if (pIconList != NULL) pIconList->needToSort(); + pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA6_TEXT)); + if (pList != NULL) pList->needToSort(); } // *************************************************************************** diff --git a/code/ryzom/client/src/interface_v3/inventory_manager.h b/code/ryzom/client/src/interface_v3/inventory_manager.h index 8c365a0be..160b7c1aa 100644 --- a/code/ryzom/client/src/interface_v3/inventory_manager.h +++ b/code/ryzom/client/src/interface_v3/inventory_manager.h @@ -822,6 +822,15 @@ private: #define LIST_PA3_TEXT "ui:interface:inv_pa3:content:iil:bag_list" #define LIST_PA3_ICONS "ui:interface:inv_pa3:content:iil:bag_icons" +#define LIST_PA4_TEXT "ui:interface:inv_pa4:content:iil:bag_list" +#define LIST_PA4_ICONS "ui:interface:inv_pa4:content:iil:bag_icons" + +#define LIST_PA5_TEXT "ui:interface:inv_pa5:content:iil:bag_list" +#define LIST_PA5_ICONS "ui:interface:inv_pa5:content:iil:bag_icons" + +#define LIST_PA6_TEXT "ui:interface:inv_pa6:content:iil:bag_list" +#define LIST_PA6_ICONS "ui:interface:inv_pa6:content:iil:bag_icons" + // Theorically never used #define LIST_BAG2_TEXT "ui:interface:inv_bag:content:iil:bag_list" #define LIST_BAG2_ICONS "ui:interface:inv_bag:content:iil:bag_icons" diff --git a/code/ryzom/client/src/item_group_manager.cpp b/code/ryzom/client/src/item_group_manager.cpp index fddba873f..82a60f478 100644 --- a/code/ryzom/client/src/item_group_manager.cpp +++ b/code/ryzom/client/src/item_group_manager.cpp @@ -733,6 +733,12 @@ std::string CItemGroupManager::toDbPath(INVENTORIES::TInventory inventory) return LIST_PA2_TEXT; break; case INVENTORIES::pet_animal4: return LIST_PA3_TEXT; break; + case INVENTORIES::pet_animal5: + return LIST_PA4_TEXT; break; + case INVENTORIES::pet_animal6: + return LIST_PA5_TEXT; break; + case INVENTORIES::pet_animal7: + return LIST_PA6_TEXT; break; case INVENTORIES::player_room: return LIST_ROOM_TEXT;break; case INVENTORIES::guild: From 49fcec5759c5b02f918d8ed27fccc71cde1e07c3 Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Thu, 27 Aug 2020 02:30:02 +0200 Subject: [PATCH 46/53] First steps, still work in progress --- .../src/interface_v3/people_interraction.cpp | 56 +++++++++++++++++++ .../client/src/interface_v3/people_list.h | 3 +- 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index 96f27bb6c..91226657e 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/code/ryzom/client/src/interface_v3/people_interraction.cpp @@ -2307,6 +2307,62 @@ public: }; REGISTER_ACTION_HANDLER( CHandlerMoveContact, "move_contact"); +uint lastPeopleIndexChangeGroup; +//================================================================================================================= +class CHandlerChangeContactGroupBegin : public IActionHandler +{ +public: + void execute (CCtrlBase * /* pCaller */, const std::string &sParams) + { + // retrieve the index of the people + CPeopleList *srcList; + if (PeopleInterraction.getPeopleFromCurrentMenu(srcList, lastPeopleIndexChangeGroup)) + { + string groupName= getParam(sParams, "group"); + CInterfaceGroup *gc = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(groupName)); + if (gc) + { + CGroupEditBox *geb = dynamic_cast(gc->getGroup("change_contact_group_eb:eb")); + geb->setInputString(ucstring("")); + } + CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, sParams); + } + } +}; +REGISTER_ACTION_HANDLER( CHandlerMoveContact, "change_contact_group_begin"); + +//================================================================================================================= +// Add a contact to the list +class CHandlerChangeContactGroup : public IActionHandler +{ +public: + void execute (CCtrlBase *pCaller, const std::string &/* sParams */) + { + CInterfaceManager *pIM = CInterfaceManager::getInstance(); + + if (pCaller) + { + // Get the modal edit box + CGroupEditBox *geb = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:change_contact_group_eb:eb")); + if (geb && !geb->getInputString().empty()) + { + // don't add if it is the player name + if (!ClientCfg.Local && (UserEntity->getEntityName() == geb->getInputString())) + { + displayVisibleSystemMsg(CI18N::get("uiCantAddYourSelfInContactList")); + } + else + { + PeopleInterraction.askAddContact(geb->getInputString(), peopleList); + geb->setInputString(ucstring("")); + } + geb->setInputString(ucstring("")); + } + } + CAHManager::getInstance()->runActionHandler("leave_modal", pCaller, ""); + } +}; +REGISTER_ACTION_HANDLER( CHandlerAddContact, "change_contact_group"); //================================================================================================================= class CHandlerSortContacts : public IActionHandler diff --git a/code/ryzom/client/src/interface_v3/people_list.h b/code/ryzom/client/src/interface_v3/people_list.h index 32317b6b8..6845ce73a 100644 --- a/code/ryzom/client/src/interface_v3/people_list.h +++ b/code/ryzom/client/src/interface_v3/people_list.h @@ -151,13 +151,14 @@ public: private: struct CPeople { - CPeople() : Container(NULL), Chat(NULL), Online(ccs_offline), Blocked(false), ContactId(0) {} + CPeople() : Container(NULL), Chat(NULL), Online(ccs_offline), Blocked(false), ContactId(0), Group("") {} NLMISC::CRefPtr Container; // todo : replace this with a CChatWindow one day, for consistency NLMISC::CRefPtr Chat; uint GlobalID; TCharConnectionState Online; bool Blocked; uint32 ContactId; + ucstring Group; bool operator < (const CPeople &other) const { return getName() < other.getName(); } ucstring getName() const { return Container->getUCTitle(); } }; From 5dc85db8b114d5d21993b1c48200cd599688f438 Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Tue, 1 Sep 2020 15:29:02 +0200 Subject: [PATCH 47/53] Added action handlers to change contact group and read/write to file --- .../src/interface_v3/people_interraction.cpp | 517 +++++++++--------- .../client/src/interface_v3/people_list.cpp | 340 +++++++++--- .../client/src/interface_v3/people_list.h | 6 + 3 files changed, 525 insertions(+), 338 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index 91226657e..9164a78ea 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/code/ryzom/client/src/interface_v3/people_interraction.cpp @@ -90,7 +90,7 @@ static const sint PARTY_CHAT_SPAWN_DELTA = 20; // to avoid that all party chat a ////////////////////////////////// /** Display an error msg in the system info window, and also in the last window that triggered the command (so that the user is sure to see it) - */ + */ static void displayVisibleSystemMsg(const ucstring &msg, const string &cat = "CHK"); @@ -289,13 +289,13 @@ void CChatStdInput::registerListeningWindow(CChatWindow *cw) //=========================================================================================================== CPeopleInterraction::CPeopleInterraction() : Region(NULL), - Universe(NULL), - TeamChat(NULL), - GuildChat(NULL), - SystemInfo(NULL), - TellWindow(NULL), - DebugInfo(NULL), - CurrPartyChatID(0) + Universe(NULL), + TeamChat(NULL), + GuildChat(NULL), + SystemInfo(NULL), + TellWindow(NULL), + DebugInfo(NULL), + CurrPartyChatID(0) { for(uint i=0;isetMenu("ui:interface:base_chat_box_menu"); */ + chatDesc.FatherContainer = "ui:interface"; + chatDesc.Title = "uiTellWindow"; + chatDesc.Listener = NULL; + chatDesc.Savable = true; + chatDesc.Localize = true; + chatDesc.Id = "tell"; + chatDesc.ChatTemplate ="chat_no_eb_id"; + chatDesc.AHOnActive = "set"; + chatDesc.AHOnActiveParams = "dblink=UI:SAVE:ISDETACHED:TELL|value=1"; + chatDesc.AHOnDeactive = "set"; + chatDesc.AHOnDeactiveParams = "dblink=UI:SAVE:ISDETACHED:TELL|value=0"; + + TellWindow = getChatWndMgr().createChatWindow(chatDesc); + if (!TellWindow) return; + TellWindow->setMenu("ui:interface:base_chat_box_menu"); */ } //=========================================================================================================== @@ -826,13 +828,13 @@ class CHandlerUserChatActive : public IActionHandler CChatGroup::TGroupType m = PeopleInterraction.TheUserChat.Filter.getTargetGroup(); switch(m) { - default: - case CChatGroup::arround: - case CChatGroup::say: pUserBut->setHardText("uiFilterAround"); break; - case CChatGroup::region: pUserBut->setHardText("uiFilterRegion"); break; - case CChatGroup::universe: pUserBut->setHardText("uiFilterUniverse"); break; - case CChatGroup::team: pUserBut->setHardText("uiFilterTeam"); break; - case CChatGroup::guild: pUserBut->setHardText("uiFilterGuild"); break; + default: + case CChatGroup::arround: + case CChatGroup::say: pUserBut->setHardText("uiFilterAround"); break; + case CChatGroup::region: pUserBut->setHardText("uiFilterRegion"); break; + case CChatGroup::universe: pUserBut->setHardText("uiFilterUniverse"); break; + case CChatGroup::team: pUserBut->setHardText("uiFilterTeam"); break; + case CChatGroup::guild: pUserBut->setHardText("uiFilterGuild"); break; } pUserBut->getParent()->updateCoords(); pUserBut->updateCoords(); @@ -925,29 +927,29 @@ class CHandlerChatGroupFilter : public IActionHandler CChatGroup::TGroupType m = PeopleInterraction.TheUserChat.Filter.getTargetGroup(); switch(m) { - default: - case CChatGroup::arround: - case CChatGroup::say: pUserBut->setHardText("uiFilterAround"); break; - case CChatGroup::region: pUserBut->setHardText("uiFilterRegion"); break; - case CChatGroup::team: pUserBut->setHardText("uiFilterTeam"); break; - case CChatGroup::guild: pUserBut->setHardText("uiFilterGuild"); break; - case CChatGroup::universe: pUserBut->setHardText("uiFilterUniverse"); break; - case CChatGroup::dyn_chat: - uint32 index = PeopleInterraction.TheUserChat.Filter.getTargetDynamicChannelDbIndex(); - uint32 textId = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DYN_CHAT:CHANNEL"+toString(index)+":NAME")->getValue32(); - ucstring title; - STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); - if (title.empty()) - { - // Dyn channel not available yet, so set to around - PeopleInterraction.TheUserChat.Filter.setTargetGroup(CChatGroup::arround); - pUserBut->setHardText("uiFilterAround"); - } - else - { - pUserBut->setHardText(title.toUtf8()); - } - break; + default: + case CChatGroup::arround: + case CChatGroup::say: pUserBut->setHardText("uiFilterAround"); break; + case CChatGroup::region: pUserBut->setHardText("uiFilterRegion"); break; + case CChatGroup::team: pUserBut->setHardText("uiFilterTeam"); break; + case CChatGroup::guild: pUserBut->setHardText("uiFilterGuild"); break; + case CChatGroup::universe: pUserBut->setHardText("uiFilterUniverse"); break; + case CChatGroup::dyn_chat: + uint32 index = PeopleInterraction.TheUserChat.Filter.getTargetDynamicChannelDbIndex(); + uint32 textId = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DYN_CHAT:CHANNEL"+toString(index)+":NAME")->getValue32(); + ucstring title; + STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); + if (title.empty()) + { + // Dyn channel not available yet, so set to around + PeopleInterraction.TheUserChat.Filter.setTargetGroup(CChatGroup::arround); + pUserBut->setHardText("uiFilterAround"); + } + else + { + pUserBut->setHardText(title.toUtf8()); + } + break; } pUserBut->setActive(true); @@ -1252,8 +1254,8 @@ void CPeopleInterraction::askRemoveContact(uint peopleIndex, CPeopleList *pl) //================================================================================================================= void CPeopleInterraction::initContactLists( const std::vector &vFriendListName, - const std::vector &vFriendListOnline, - const std::vector &vIgnoreListName ) + const std::vector &vFriendListOnline, + const std::vector &vIgnoreListName ) { // clear the current lists if any @@ -1266,6 +1268,9 @@ void CPeopleInterraction::initContactLists( const std::vector &vFriendLi addContactInList(contactIdPool++, vFriendListName[i], vFriendListOnline[i], 0); for (uint i = 0; i < vIgnoreListName.size(); ++i) addContactInList(contactIdPool++, vIgnoreListName[i], ccs_offline, 1); + FriendList.readContactGroups(); + CPeopleList::TSortOrder order = (CPeopleList::TSortOrder)(NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CONTACT_LIST:SORT_ORDER")->getValue32()); + FriendList.sortEx(order); updateAllFreeTellerHeaders(); } @@ -1278,6 +1283,8 @@ void CPeopleInterraction::addContactInList(uint32 contactId, const ucstring &nam // remove the shard name if possible ucstring name= CEntityCL::removeShardFromName(nameIn); + + // add the contact to this list sint index = pl.getIndexFromName(name); // try to create if not found @@ -1477,7 +1484,7 @@ bool CPeopleInterraction::testValidPartyChatName(const ucstring &title) index = IgnoreList.getIndexFromName(title); if (index != -1) return false; // TODO_GAMEDEV server test for the name (not only local), & modify callers of this function - // The party chat should NOT have the name of a player + // The party chat should NOT have the name of a player // A player name is NOT valid if it is the same that a party chat name return true; } @@ -1547,14 +1554,14 @@ bool CPeopleInterraction::createNewPartyChat(const ucstring &title) { // popup the container /* - newPartyChat->getContainer()->setup(); - newPartyChat->getContainer()->setOpen(true); - newPartyChat->getContainer()->popupCurrentPos(); - newPartyChat->getContainer()->updateCoords(); - newPartyChat->getContainer()->center(); - newPartyChat->getContainer()->setX(newPartyChat->getContainer()->getX() + (sint32) (rand() % PARTY_CHAT_SPAWN_DELTA)); - newPartyChat->getContainer()->setY(newPartyChat->getContainer()->getY() + (sint32) (rand() % PARTY_CHAT_SPAWN_DELTA)); - newPartyChat->getContainer()->enableBlink(2); + newPartyChat->getContainer()->setup(); + newPartyChat->getContainer()->setOpen(true); + newPartyChat->getContainer()->popupCurrentPos(); + newPartyChat->getContainer()->updateCoords(); + newPartyChat->getContainer()->center(); + newPartyChat->getContainer()->setX(newPartyChat->getContainer()->getX() + (sint32) (rand() % PARTY_CHAT_SPAWN_DELTA)); + newPartyChat->getContainer()->setY(newPartyChat->getContainer()->getY() + (sint32) (rand() % PARTY_CHAT_SPAWN_DELTA)); + newPartyChat->getContainer()->enableBlink(2); */ CPartyChatInfo pci; @@ -1742,15 +1749,15 @@ bool CPeopleInterraction::loadUserChatsInfos(NLMISC::IStream &f) f.serialCheck(NELID("TAHC")); if (ver>=1) { -// CChatGroupWindow *pCGW = PeopleInterraction.getChatGroupWindow(); + // CChatGroupWindow *pCGW = PeopleInterraction.getChatGroupWindow(); sint32 index; f.serial(index); /* Yoyo: decide to always start with the default channel (user) activated - because complex (at this time, the buttons are not all active, must wait guild loading, UI:SAVE loading etc...) - Hence this doesn't work for anything but User and Sysinfo (if it is activated....) - NB: must still load the index for file format reason - //if (pCGW) pCGW->setTabIndex(index); - */ + because complex (at this time, the buttons are not all active, must wait guild loading, UI:SAVE loading etc...) + Hence this doesn't work for anything but User and Sysinfo (if it is activated....) + NB: must still load the index for file format reason + //if (pCGW) pCGW->setTabIndex(index); + */ f.serial(present); if (present) { @@ -2012,17 +2019,17 @@ public: if (list == &PeopleInterraction.TeamList) // check for good list { /* - const string msgName = "TEAM:SET_LEADER"; - CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) - { - uint8 teamMember = (uint8)(peopleIndex); - out.serial(teamMember); - NetMngr.push(out); - //nlinfo("impulseCallBack : %s %d sent", msgName.c_str(), teamMember); - } - else - nlwarning("command 'set_leader': unknown message named '%s'.", msgName.c_str()); + const string msgName = "TEAM:SET_LEADER"; + CBitMemStream out; + if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) + { + uint8 teamMember = (uint8)(peopleIndex); + out.serial(teamMember); + NetMngr.push(out); + //nlinfo("impulseCallBack : %s %d sent", msgName.c_str(), teamMember); + } + else + nlwarning("command 'set_leader': unknown message named '%s'.", msgName.c_str()); */ NLMISC::ICommand::execute("a setTeamLeader " + toString(peopleIndex), g_log); } @@ -2177,8 +2184,8 @@ public: void execute (CCtrlBase *pCaller, const std::string &sParams) { /** This msg may have been triggered from valid button or from the edit box itself, so retrieve - * the edit box from the enclosing group - */ + * the edit box from the enclosing group + */ // Get enclosing container to know in which people list we are if (pCaller) { @@ -2221,8 +2228,8 @@ public: CInterfaceManager *pIM = CInterfaceManager::getInstance(); /** This msg may have been triggered from valid button or from the edit box itself, so retrieve - * the edit box from the enclosing group - */ + * the edit box from the enclosing group + */ // Get enclosing container to know in which people list we are if (!LastFatherAddContactId.empty() && pCaller) { @@ -2292,13 +2299,13 @@ public: } switch(listIndex) { - case 0: - destList = &PeopleInterraction.IgnoreList; + case 0: + destList = &PeopleInterraction.IgnoreList; break; - case 1: - destList = &PeopleInterraction.FriendList; + case 1: + destList = &PeopleInterraction.FriendList; break; - default: nlwarning("Bad list index"); return; + default: nlwarning("Bad list index"); return; } PeopleInterraction.askMoveContact(peopleIndex, srcList, destList); @@ -2312,7 +2319,7 @@ uint lastPeopleIndexChangeGroup; class CHandlerChangeContactGroupBegin : public IActionHandler { public: - void execute (CCtrlBase * /* pCaller */, const std::string &sParams) + void execute (CCtrlBase * pCaller, const std::string &sParams) { // retrieve the index of the people CPeopleList *srcList; @@ -2321,18 +2328,18 @@ public: string groupName= getParam(sParams, "group"); CInterfaceGroup *gc = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(groupName)); if (gc) - { - CGroupEditBox *geb = dynamic_cast(gc->getGroup("change_contact_group_eb:eb")); - geb->setInputString(ucstring("")); - } + { + CGroupEditBox *geb = dynamic_cast(gc->getGroup("change_contact_group_eb:eb")); + geb->setInputString(ucstring("")); + } CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, sParams); } } }; -REGISTER_ACTION_HANDLER( CHandlerMoveContact, "change_contact_group_begin"); +REGISTER_ACTION_HANDLER( CHandlerChangeContactGroupBegin, "change_contact_group_begin"); //================================================================================================================= -// Add a contact to the list +// Change the group of a contact in the list class CHandlerChangeContactGroup : public IActionHandler { public: @@ -2343,26 +2350,20 @@ public: if (pCaller) { // Get the modal edit box - CGroupEditBox *geb = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:change_contact_group_eb:eb")); - if (geb && !geb->getInputString().empty()) + CGroupEditBox *geb = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:change_contact_group:change_contact_group_eb:eb")); + if (geb) { - // don't add if it is the player name - if (!ClientCfg.Local && (UserEntity->getEntityName() == geb->getInputString())) - { - displayVisibleSystemMsg(CI18N::get("uiCantAddYourSelfInContactList")); - } - else - { - PeopleInterraction.askAddContact(geb->getInputString(), peopleList); - geb->setInputString(ucstring("")); - } + + PeopleInterraction.FriendList.changeGroup(lastPeopleIndexChangeGroup, geb->getInputString()); geb->setInputString(ucstring("")); + CPeopleList::TSortOrder order = (CPeopleList::TSortOrder)(NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CONTACT_LIST:SORT_ORDER")->getValue32()); + PeopleInterraction.FriendList.sortEx(order); } } CAHManager::getInstance()->runActionHandler("leave_modal", pCaller, ""); } }; -REGISTER_ACTION_HANDLER( CHandlerAddContact, "change_contact_group"); +REGISTER_ACTION_HANDLER( CHandlerChangeContactGroup, "change_contact_group"); //================================================================================================================= class CHandlerSortContacts : public IActionHandler @@ -2428,7 +2429,7 @@ REGISTER_ACTION_HANDLER( CHandlerContactDirectChat, "contact_direct_chat"); //================================================================================================================= /** Menu to create a new party chat - */ + */ class CHandlerNewPartyChat : public IActionHandler { public: @@ -2462,7 +2463,7 @@ REGISTER_ACTION_HANDLER( CHandlerNewPartyChat, "new_party_chat"); //================================================================================================================= /** The name of a party chat has been validated - */ + */ class CHandlerValidatePartyChatName : public IActionHandler { void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) @@ -2495,12 +2496,12 @@ REGISTER_ACTION_HANDLER(CHandlerValidatePartyChatName, "validate_party_chat_name //================================================================================================================= /** Menu to create a new party chat - */ + */ //================================================================================================================= /** Menu to remove a currenlty created party chat - */ + */ class CHandlerRemovePartyChat : public IActionHandler { void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) @@ -2513,7 +2514,7 @@ REGISTER_ACTION_HANDLER( CHandlerRemovePartyChat, "remove_party_chat"); //================================================================================================================= /** TEMP : just create an 'invite' command in the 'around me' edit box - */ + */ class CHandlerPartyChatInvite : public IActionHandler { void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) @@ -2539,12 +2540,12 @@ REGISTER_ACTION_HANDLER( CHandlerPartyChatInvite, "party_chat_invite" ); //================================================================================================================= /** Add all members of the team to the party chat - */ + */ class CHandlerAddAllTeamMembersToPartyChat : public IActionHandler { void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) { -// CChatWindow *chat = getChatWndMgr().getChatWindowFromCaller(CWidgetManager::getInstance()->getCtrlLaunchingModal()); + // CChatWindow *chat = getChatWndMgr().getChatWindowFromCaller(CWidgetManager::getInstance()->getCtrlLaunchingModal()); // TODO GAMEDEV : add all team members } }; @@ -2552,12 +2553,12 @@ REGISTER_ACTION_HANDLER( CHandlerAddAllTeamMembersToPartyChat, "add_all_team_mem //================================================================================================================= /** Remove all members of the team to the party chat - */ + */ class CHandlerRemoveAllTeamMembersToPartyChat : public IActionHandler { void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) { -// CChatWindow *chat = getChatWndMgr().getChatWindowFromCaller(CWidgetManager::getInstance()->getCtrlLaunchingModal()); + // CChatWindow *chat = getChatWndMgr().getChatWindowFromCaller(CWidgetManager::getInstance()->getCtrlLaunchingModal()); // TODO GAMEDEV : remove all team members } }; @@ -2565,12 +2566,12 @@ REGISTER_ACTION_HANDLER( CHandlerRemoveAllTeamMembersToPartyChat, "remove_all_te //================================================================================================================= /** Add all members of the guild to the party chat - */ + */ class CHandlerAddAllGuildMembersToPartyChat : public IActionHandler { void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) { -// CChatWindow *chat = getChatWndMgr().getChatWindowFromCaller(CWidgetManager::getInstance()->getCtrlLaunchingModal()); + // CChatWindow *chat = getChatWndMgr().getChatWindowFromCaller(CWidgetManager::getInstance()->getCtrlLaunchingModal()); // TODO GAMEDEV : add all guild members } }; @@ -2578,12 +2579,12 @@ REGISTER_ACTION_HANDLER( CHandlerAddAllGuildMembersToPartyChat, "add_all_guild_m //================================================================================================================= /** Remove all members of the team to the party chat - */ + */ class CHandlerRemoveAllGuildMembersToPartyChat : public IActionHandler { void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) { -// CChatWindow *chat = getChatWndMgr().getChatWindowFromCaller(CWidgetManager::getInstance()->getCtrlLaunchingModal()); + // CChatWindow *chat = getChatWndMgr().getChatWindowFromCaller(CWidgetManager::getInstance()->getCtrlLaunchingModal()); // TODO_GAMEDEV : remove all guild members } }; @@ -2595,8 +2596,8 @@ REGISTER_ACTION_HANDLER( CHandlerRemoveAllGuildMembersToPartyChat, "remove_all_g //================================================================================================================= /** Select the target on a filtered chat window - * This create a menu with the standard window (team, around me ...) + the party chat windows - */ + * This create a menu with the standard window (team, around me ...) + the party chat windows + */ class CHandlerSelectChatTarget : public IActionHandler { public: @@ -2659,7 +2660,7 @@ public: { CInterfaceManager *pIM = CInterfaceManager::getInstance(); cw = PeopleInterraction.TheUserChat.Window; -// CChatStdInput &ci = PeopleInterraction.ChatInput; + // CChatStdInput &ci = PeopleInterraction.ChatInput; CGroupMenu *pMenu = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:user_chat_target_menu")); CViewTextMenu *pMenuAround = dynamic_cast(pMenu->getElement("ui:interface:user_chat_target_menu:around")); CViewTextMenu *pMenuRegion = dynamic_cast(pMenu->getElement("ui:interface:user_chat_target_menu:region")); @@ -2715,7 +2716,7 @@ REGISTER_ACTION_HANDLER( CHandlerSelectChatTarget, "select_chat_target"); //================================================================================================================= /** A target has been selected for a filtered chat - */ + */ class CHandlerChatTargetSelected : public IActionHandler { void execute (CCtrlBase * /* pCaller */, const std::string &sParams) @@ -2804,7 +2805,7 @@ REGISTER_ACTION_HANDLER( CHandlerChatTargetSelected, "chat_target_selected"); //================================================================================================================= /** If no more in team, leave team chat mode - */ + */ class CHandlerLeaveTeamChat : public IActionHandler { void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) @@ -2829,7 +2830,7 @@ REGISTER_ACTION_HANDLER( CHandlerLeaveTeamChat, "leave_team_chat"); /** Create checkbox for a menu. - */ + */ static CInterfaceGroup *createMenuCheckBox(const std::string &onclickL, const std::string ¶msL, bool checked) { pair params [2]; @@ -2851,7 +2852,7 @@ static CInterfaceGroup *createMenuCheckBox(const std::string &onclickL, const st //================================================================================================================= /** Display a menu to select the source on a filtered chat - */ + */ class CHandlerSelectChatSource : public IActionHandler { void execute (CCtrlBase *pCaller, const std::string &/* sParams */) @@ -3033,7 +3034,7 @@ REGISTER_ACTION_HANDLER(CHandlerSelectChatSource, "select_chat_source"); //================================================================================================================= /** A new source has been selected / unselected from a filtered chat - */ + */ class CHandlerChatSourceSelected : public IActionHandler { void execute (CCtrlBase * /* pCaller */, const std::string &sParams) @@ -3057,10 +3058,10 @@ class CHandlerChatSourceSelected : public IActionHandler /*CCtrlBaseButton *button = dynamic_cast(pCaller); - if (button) - { - button->setPushed(!button->getPushed()); - }*/ + if (button) + { + button->setPushed(!button->getPushed()); + }*/ // GUILD if (nlstricmp(sParams, "guild") == 0) { @@ -3068,71 +3069,71 @@ class CHandlerChatSourceSelected : public IActionHandler else ci.Guild.addListeningWindow(cw); } else - // TEAM - if (nlstricmp(sParams, "team") == 0) - { - if (ci.Team.isListeningWindow(cw)) ci.Team.removeListeningWindow(cw); - else ci.Team.addListeningWindow(cw); - } - else - // AROUND ME - if (nlstricmp(sParams, "am") == 0) - { - if (ci.AroundMe.isListeningWindow(cw)) ci.AroundMe.removeListeningWindow(cw); - else ci.AroundMe.addListeningWindow(cw); - } - else - // REGION - if (nlstricmp(sParams, "region") == 0) - { - if (ci.Region.isListeningWindow(cw)) ci.Region.removeListeningWindow(cw); - else ci.Region.addListeningWindow(cw); - } - else - // UNIVERSE - if (nlstricmp(sParams, "universe") == 0) - { - if (ci.Universe.isListeningWindow(cw)) ci.Universe.removeListeningWindow(cw); - else ci.Universe.addListeningWindow(cw); - } - else - // TELL - if (nlstricmp(sParams, "tell") == 0) - { - if (ci.Tell.isListeningWindow(cw)) ci.Tell.removeListeningWindow(cw); - else ci.Tell.addListeningWindow(cw); - } - else - // SYSTEM INFOS - if (nlstricmp(sParams, "si") == 0) - { - if (ci.SystemInfo.isListeningWindow(cw)) ci.SystemInfo.removeListeningWindow(cw); - else ci.SystemInfo.addListeningWindow(cw); - } - else - // PARTY CHAT - if (fromString(sParams, partyChatID)) - { - std::vector &partyChats = PeopleInterraction.PartyChats; - for(uint k = 0; k < partyChats.size(); ++k) + // TEAM + if (nlstricmp(sParams, "team") == 0) { - if (partyChats[k].ID == (uint) partyChatID) + if (ci.Team.isListeningWindow(cw)) ci.Team.removeListeningWindow(cw); + else ci.Team.addListeningWindow(cw); + } + else + // AROUND ME + if (nlstricmp(sParams, "am") == 0) { - if (partyChats[k].Filter != NULL) + if (ci.AroundMe.isListeningWindow(cw)) ci.AroundMe.removeListeningWindow(cw); + else ci.AroundMe.addListeningWindow(cw); + } + else + // REGION + if (nlstricmp(sParams, "region") == 0) { - if (partyChats[k].Filter->isListeningWindow(cw)) partyChats[k].Filter->removeListeningWindow(partyChats[k].Window); - else partyChats[k].Filter->addListeningWindow(cw); + if (ci.Region.isListeningWindow(cw)) ci.Region.removeListeningWindow(cw); + else ci.Region.addListeningWindow(cw); } - } - } - } - else if (nlstricmp(sParams.substr(0, 3), "dyn") == 0) - { - uint8 i = 0; - fromString(sParams.substr(3), i); - if (ci.DynamicChat[i].isListeningWindow(cw)) ci.DynamicChat[i].removeListeningWindow(cw); - else ci.DynamicChat[i].addListeningWindow(cw); - } + else + // UNIVERSE + if (nlstricmp(sParams, "universe") == 0) + { + if (ci.Universe.isListeningWindow(cw)) ci.Universe.removeListeningWindow(cw); + else ci.Universe.addListeningWindow(cw); + } + else + // TELL + if (nlstricmp(sParams, "tell") == 0) + { + if (ci.Tell.isListeningWindow(cw)) ci.Tell.removeListeningWindow(cw); + else ci.Tell.addListeningWindow(cw); + } + else + // SYSTEM INFOS + if (nlstricmp(sParams, "si") == 0) + { + if (ci.SystemInfo.isListeningWindow(cw)) ci.SystemInfo.removeListeningWindow(cw); + else ci.SystemInfo.addListeningWindow(cw); + } + else + // PARTY CHAT + if (fromString(sParams, partyChatID)) + { + std::vector &partyChats = PeopleInterraction.PartyChats; + for(uint k = 0; k < partyChats.size(); ++k) + { + if (partyChats[k].ID == (uint) partyChatID) + { + if (partyChats[k].Filter != NULL) + { + if (partyChats[k].Filter->isListeningWindow(cw)) partyChats[k].Filter->removeListeningWindow(partyChats[k].Window); + else partyChats[k].Filter->addListeningWindow(cw); + } + } + } + } + else if (nlstricmp(sParams.substr(0, 3), "dyn") == 0) + { + uint8 i = 0; + fromString(sParams.substr(3), i); + if (ci.DynamicChat[i].isListeningWindow(cw)) ci.DynamicChat[i].removeListeningWindow(cw); + else ci.DynamicChat[i].addListeningWindow(cw); + } } }; REGISTER_ACTION_HANDLER( CHandlerChatSourceSelected, "chat_source_selected"); @@ -3242,80 +3243,80 @@ NLMISC_COMMAND(ignore, "add or remove a player from the ignore list", "") { - if (args.size() != 1) - { - displayVisibleSystemMsg(CI18N::get("uiPartyChatCmd")); - return true; - } - CPeopleInterraction &pi = PeopleInterraction; - ucstring title = args[0]; +if (args.size() != 1) +{ +displayVisibleSystemMsg(CI18N::get("uiPartyChatCmd")); +return true; +} +CPeopleInterraction &pi = PeopleInterraction; +ucstring title = args[0]; - if (!pi.testValidPartyChatName(title)) - { - displayVisibleSystemMsg(CI18N::get("uiInvalidPartyChatName")); - return true; - } +if (!pi.testValidPartyChatName(title)) +{ +displayVisibleSystemMsg(CI18N::get("uiInvalidPartyChatName")); +return true; +} - PeopleInterraction.createNewPartyChat(title); - return true; +PeopleInterraction.createNewPartyChat(title); +return true; } // Remove the party chat with the given name NLMISC_COMMAND(remove_party_chat, "Remove a party chat", "") { - if (args.size() != 1) - { - displayVisibleSystemMsg(CI18N::get("uiRemovePartyChatCmd")); - return true; - } - ucstring title = ucstring(args[0]); - CChatWindow *chat = getChatWndMgr().getChatWindow(title); - if (!chat) - { - displayVisibleSystemMsg(title + ucstring(" : ") + CI18N::get("uiBadPartyChatName")); - return true; - } - if (!PeopleInterraction.removePartyChat(chat)) - { - displayVisibleSystemMsg(title + ucstring(" : ") + CI18N::get("uiCantRemovePartyChat")); - return true; - } - return true; +if (args.size() != 1) +{ +displayVisibleSystemMsg(CI18N::get("uiRemovePartyChatCmd")); +return true; +} +ucstring title = ucstring(args[0]); +CChatWindow *chat = getChatWndMgr().getChatWindow(title); +if (!chat) +{ +displayVisibleSystemMsg(title + ucstring(" : ") + CI18N::get("uiBadPartyChatName")); +return true; +} +if (!PeopleInterraction.removePartyChat(chat)) +{ +displayVisibleSystemMsg(title + ucstring(" : ") + CI18N::get("uiCantRemovePartyChat")); +return true; +} +return true; } // Join a party chat whose name is known NLMISC_COMMAND(add_to_party_chat, "Join the given party chat", "") { - if (args.size() != 1) - { - displayVisibleSystemMsg(CI18N::get("uiAddPartyChatCmd")); - return true; - } - // TODO GAMEDEV : join the party chat - return true; +if (args.size() != 1) +{ +displayVisibleSystemMsg(CI18N::get("uiAddPartyChatCmd")); +return true; +} +// TODO GAMEDEV : join the party chat +return true; } // Invite someone in a party chat NLMISC_COMMAND(invite, "Invite someone to a party chat", " ") { - if (args.size() != 2) - { - displayVisibleSystemMsg(CI18N::get("uiInviteCmd")); - return true; - } - // TODO GAMEDEV : Send invite message to the server - // Check that the inviter has created the chat ? - // The people being invited should receive a popup to announce that he is being invited - return true; +if (args.size() != 2) +{ +displayVisibleSystemMsg(CI18N::get("uiInviteCmd")); +return true; +} +// TODO GAMEDEV : Send invite message to the server +// Check that the inviter has created the chat ? +// The people being invited should receive a popup to announce that he is being invited +return true; } */ diff --git a/code/ryzom/client/src/interface_v3/people_list.cpp b/code/ryzom/client/src/interface_v3/people_list.cpp index 92601ed32..ece5b5cc8 100644 --- a/code/ryzom/client/src/interface_v3/people_list.cpp +++ b/code/ryzom/client/src/interface_v3/people_list.cpp @@ -31,6 +31,7 @@ #include "chat_text_manager.h" #include "people_interraction.h" #include "../user_entity.h" +#include "nel/misc/o_xml.h" using namespace std; using namespace NLMISC; @@ -49,9 +50,9 @@ extern CClientChatManager ChatMngr; //================================================================== CPeopleList::CPeopleList() : _ChatWindow(NULL), - _ContactType(CPeopleListDesc::Unknown), - _CurrPeopleID(0), - _Savable(false) + _ContactType(CPeopleListDesc::Unknown), + _CurrPeopleID(0), + _Savable(false) { // Construct @@ -191,34 +192,41 @@ sint CPeopleList::getIndexFromContainerID(const std::string &id) const //================================================================== bool CPeopleList::sortExByContactId(const CPeople& a, const CPeople& b) { - return (a.ContactId < b.ContactId); + if (a.Group == b.Group) + return (a.ContactId < b.ContactId); + else + return (a.Group < b.Group); } //================================================================== 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); + if (a.Group == b.Group) { + ucstring name_a = toUpper(a.getName()); + ucstring name_b = toUpper(b.getName()); + return (name_a < name_b); + } + else + return (a.Group < b.Group); } //================================================================== bool CPeopleList::sortExByOnline(const CPeople& a, const CPeople& b) { - ucstring name_a = toUpper(a.getName()); - ucstring name_b = toUpper(b.getName()); + if (a.Group == b.Group) { + 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) - { - return (name_a < name_b); - } - else - { - // Compare online status - switch (a.Online) + // We want order: online/alpha, offworld/alpha, offline/alpha + if (a.Online == b.Online) + { + return (name_a < name_b); + } + else { + // Compare online status + switch (a.Online) + { case ccs_online: // a is > if a is online return true; @@ -232,11 +240,11 @@ bool CPeopleList::sortExByOnline(const CPeople& a, const CPeople& b) // b is always > if a is offline return false; break; + } } } - - // Should not get here so just return something - return true; + else + return (a.Group < b.Group); } //================================================================== @@ -245,29 +253,56 @@ void CPeopleList::sortEx(TSortOrder order) // remove all people from the father container if (!_BaseContainer) return; uint k; + for(k = 0; k < _Peoples.size(); ++k) { - _BaseContainer->detachContainer(_Peoples[k].Container); + CGroupContainer *parentContainer = _Peoples[k].Container->getProprietaryContainer(); + parentContainer->detachContainer(_Peoples[k].Container); + } + for (k = 0; k < _GroupContainers.size(); ++k) + { + if (_GroupContainers[k].second->getProprietaryContainer() != NULL) + _BaseContainer->detachContainer(_GroupContainers[k].second); } switch (order) { - default: - case sort_index: - std::sort(_Peoples.begin(), _Peoples.end(), CPeopleList::sortExByContactId); - break; - case sort_name: - std::sort(_Peoples.begin(), _Peoples.end(), CPeopleList::sortExByName); - break; + default: + case sort_index: + std::sort(_Peoples.begin(), _Peoples.end(), CPeopleList::sortExByContactId); + break; + case sort_name: + std::sort(_Peoples.begin(), _Peoples.end(), CPeopleList::sortExByName); + break; - case sort_online: - std::sort(_Peoples.begin(), _Peoples.end(), CPeopleList::sortExByOnline); - break; + case sort_online: + std::sort(_Peoples.begin(), _Peoples.end(), CPeopleList::sortExByOnline); + break; } + CGroupContainer *group = _BaseContainer; + ucstring groupName = ""; + uint groupIndex = 0; + for(k = 0; k < _Peoples.size(); ++k) { - _BaseContainer->attachContainer(_Peoples[k].Container); + bool newGroup = false; + if (k == 0) + { + newGroup = true; + } + while (groupIndex < _GroupContainers.size() && _GroupContainers[groupIndex].first != _Peoples[k].Group.toString()) + { + newGroup = true; + ++groupIndex; + } + if (newGroup && groupIndex < _GroupContainers.size()) + { + group = _GroupContainers[groupIndex].second; + groupName = _GroupContainers[groupIndex].first; + _BaseContainer->attachContainer(group); + } + group->attachContainer(_Peoples[k].Container); } } @@ -299,34 +334,34 @@ bool CPeopleList::isPeopleChatVisible(uint index) const return (_Peoples[index].Chat != NULL); } /* -bool CPeopleList::isPeopleWindowVisible(uint index) const -{ - if (index >= _Peoples.size()) - { - nlwarning("Bad index"); - return false; - } - if (!_Peoples[index].Container) return false; - if (_Peoples[index].Container->isOpen()) - { - CInterfaceGroup *ig = _Peoples[index].Container; - do - { - if (ig->isGroupContainer()) - { - if (!static_cast(ig)->isOpen()) break; - } - if (!ig->getActive()) break; - ig = ig->getParent(); - } - while(ig); - return ig == NULL; // all parent windows must be open & visible - } - else - { - return false; - } -} + bool CPeopleList::isPeopleWindowVisible(uint index) const + { + if (index >= _Peoples.size()) + { + nlwarning("Bad index"); + return false; + } + if (!_Peoples[index].Container) return false; + if (_Peoples[index].Container->isOpen()) + { + CInterfaceGroup *ig = _Peoples[index].Container; + do + { + if (ig->isGroupContainer()) + { + if (!static_cast(ig)->isOpen()) break; + } + if (!ig->getActive()) break; + ig = ig->getParent(); + } + while(ig); + return ig == NULL; // all parent windows must be open & visible + } + else + { + return false; + } + } */ //================================================================== @@ -354,12 +389,12 @@ sint CPeopleList::addPeople(const ucstring &name, uint teamMateIndex /*= 0*/) std::string templateName; switch (_ContactType) { - case CPeopleListDesc::Team: templateName = "mate_id"; break; - case CPeopleListDesc::Contact: templateName = "contact_id_friend"; break; - case CPeopleListDesc::Ignore: templateName = "contact_id_ignore"; break; - default: - nlwarning(" Unknown contact type"); - return -1; + case CPeopleListDesc::Team: templateName = "mate_id"; break; + case CPeopleListDesc::Contact: templateName = "contact_id_friend"; break; + case CPeopleListDesc::Ignore: templateName = "contact_id_ignore"; break; + default: + nlwarning(" Unknown contact type"); + return -1; break; } @@ -379,10 +414,10 @@ sint CPeopleList::addPeople(const ucstring &name, uint teamMateIndex /*= 0*/) gc->setSavable(false); // /*if (_ChatWindow) - { - _ChatWindow->getContainer()->attachContainer(gc); - } - else*/ + { + _ChatWindow->getContainer()->attachContainer(gc); + } + else*/ { _BaseContainer->attachContainer(gc); } @@ -415,8 +450,9 @@ void CPeopleList::removePeople(uint index) } else { - if (_BaseContainer) - _BaseContainer->detachContainer(_Peoples[index].Container); + CGroupContainer *parentContainer = _Peoples[index].Container->getProprietaryContainer(); + if (parentContainer) + parentContainer->detachContainer(_Peoples[index].Container); } CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceGroup *pRoot = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface")); @@ -447,6 +483,150 @@ void CPeopleList::setContactId(uint index, uint32 contactId) _Peoples[index].ContactId = contactId; } +//================================================================== +void CPeopleList::changeGroup(uint index, const ucstring &groupName) +{ + if (index >= _Peoples.size()) + { + nlwarning(" bad index."); + return; + } + ucstring group = groupName; + if (group.toString() == "General") + group = ucstring(""); + _Peoples[index].Group = group; + + for (uint k = 0; k < _GroupContainers.size(); ++k) + { + if (_GroupContainers[k].first == group.toString()) + return; + } + + vector > properties; + properties.push_back(make_pair(string("posparent"), string("parent"))); + properties.push_back(make_pair(string("id"), _ContainerID + "_group_" + toString(_GroupContainers.size()))); + if (group.toString() == "") + properties.push_back(make_pair(string("title"), "General")); + else + properties.push_back(make_pair(string("title"), group.toString())); + CGroupContainer *gc = dynamic_cast(CWidgetManager::getInstance()->getParser()->createGroupInstance("people_list_group_header", "ui:interface", properties, false)); + + if (group.toString() == "") + gc->setUCTitle(ucstring("General")); + else + gc->setUCTitle(group.toString()); + gc->setSavable(false); + + CInterfaceGroup *pRoot = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface")); + pRoot->addGroup (gc); + _BaseContainer->attachContainer(gc); + + _GroupContainers.push_back(make_pair(group.toString(), gc)); + + std::sort(_GroupContainers.begin(), _GroupContainers.end()); +} + +//================================================================== +void CPeopleList::readContactGroups() +{ + _GroupContainers.clear(); + const std::string filename = CInterfaceManager::getInstance()->getSaveFileName("contactgroups", "xml"); + try + { + CIFile fd; + if (fd.open(CPath::lookup(filename))) + { + CIXml stream; + stream.init(fd); + + xmlKeepBlanksDefault(0); + xmlNodePtr root = stream.getRootNode(); + + if (!root) return; + + xmlNodePtr node = root->children; + uint nb = 0; + while (node) + { + CXMLAutoPtr propName = xmlGetProp(node, (xmlChar*)"name"); + CXMLAutoPtr propGroup = xmlGetProp(node, (xmlChar*)"group"); + if (propName && propGroup) + { + sint index = getIndexFromName(propName.str()); + if (index < _Peoples.size()) + { + _Peoples[index].Group = propGroup.str(); + if (_GroupContainers.empty() || _GroupContainers.back().first != propName.str()) { + vector > properties; + properties.push_back(make_pair(string("posparent"), string("parent"))); + properties.push_back(make_pair(string("id"), _ContainerID + "_group_" + toString(_GroupContainers.size()))); + if (propGroup.str() == "") + properties.push_back(make_pair(string("title"), "General")); + else + properties.push_back(make_pair(string("title"), propGroup.str())); + CInterfaceGroup *group = CWidgetManager::getInstance()->getParser()->createGroupInstance("people_list_group_header", "ui:interface", properties, false); + CGroupContainer *gc = dynamic_cast(group); + if (propGroup.str() == "") + gc->setUCTitle(ucstring("General")); + else + gc->setUCTitle(propGroup.str()); + gc->setSavable(false); + + CInterfaceGroup *pRoot = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface")); + pRoot->addGroup (gc); + _BaseContainer->attachContainer(gc); + + _GroupContainers.push_back(make_pair(propGroup.str(), gc)); + } + } + } + node = node->next; + nb++; + } + fd.close(); + } + std::sort(_GroupContainers.begin(), _GroupContainers.end()); + } + catch (const Exception &e) + { + nlwarning("Error while parsing xml file %s : %s", filename.c_str(), e.what()); + } +} + +//================================================================== +void CPeopleList::saveContactGroups() +{ + const std::string filename = CInterfaceManager::getInstance()->getSaveFileName("contactgroups", "xml"); + try + { + COFile fd; + if (fd.open(filename, false, false, true)) + { + COXml stream; + stream.init(&fd); + + xmlDocPtr doc = stream.getDocument(); + xmlNodePtr node = xmlNewDocNode(doc, NULL, (const xmlChar*)"contact_groups", NULL); + xmlDocSetRootElement(doc, node); + + for (uint k = 0; k < _Peoples.size(); ++k) + { + xmlNodePtr newNode = xmlNewChild(node, NULL, (const xmlChar*)"contact", NULL); + + xmlSetProp(newNode, (const xmlChar*)"name", (const xmlChar*)_Peoples[k].getName().toString().c_str()); + xmlSetProp(newNode, (const xmlChar*)"group", (const xmlChar*)_Peoples[k].Group.toString().c_str()); + } + stream.flush(); + fd.close(); + } + nlinfo("save %s", filename.c_str()); + } + catch (const Exception &e) + { + nlwarning("Error while writing the file %s : %s", filename.c_str(), e.what()); + } +} + //================================================================== void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, const ucstring &msg,uint numBlinks /*=0*/) { @@ -617,12 +797,12 @@ void CPeopleList::setPeopleMenu(const std::string &menuName) } void CPeopleList::setPeopleMenuEx(const std::string &offlineUnblockedMenuName, - const std::string &onlineUnblockedMenuName, - const std::string &onlineAbroadUnblockedMenuName, - const std::string &offlineBockedMenuName, - const std::string &onlineBlockedMenuName, - const std::string &onlineAbroadBlockedMenuName - ) + const std::string &onlineUnblockedMenuName, + const std::string &onlineAbroadUnblockedMenuName, + const std::string &offlineBockedMenuName, + const std::string &onlineBlockedMenuName, + const std::string &onlineAbroadBlockedMenuName + ) { _PeopleMenuOfflineUnblocked = offlineUnblockedMenuName; _PeopleMenuOnlineUnblocked = onlineUnblockedMenuName; diff --git a/code/ryzom/client/src/interface_v3/people_list.h b/code/ryzom/client/src/interface_v3/people_list.h index 6845ce73a..682b1a6e5 100644 --- a/code/ryzom/client/src/interface_v3/people_list.h +++ b/code/ryzom/client/src/interface_v3/people_list.h @@ -110,6 +110,11 @@ public: void setContactId(uint index, uint32 contactId); sint getIndexFromContactId(uint32 contactId); + // For Friend Groups management + void changeGroup(uint index, const ucstring &groupName); + void readContactGroups(); + void saveContactGroups(); + /** Display a message for the given people * If the window is closed, it causes it to blink (and also the parent window) */ @@ -165,6 +170,7 @@ private: typedef std::vector TPeopleVect; private: CGroupContainerPtr _BaseContainer; + std::vector > > _GroupContainers; NLMISC::CRefPtr _ChatWindow; TPeopleVect _Peoples; CPeopleListDesc::TContactType _ContactType; From f96f0b41b9de2afcc335478d04463a51e23d4190 Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Tue, 1 Sep 2020 18:41:45 +0200 Subject: [PATCH 48/53] Removed an unused variable and don't show groups anymore when there is only one --- code/ryzom/client/src/interface_v3/people_list.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/people_list.cpp b/code/ryzom/client/src/interface_v3/people_list.cpp index ece5b5cc8..33d1c900e 100644 --- a/code/ryzom/client/src/interface_v3/people_list.cpp +++ b/code/ryzom/client/src/interface_v3/people_list.cpp @@ -281,9 +281,8 @@ void CPeopleList::sortEx(TSortOrder order) } CGroupContainer *group = _BaseContainer; - ucstring groupName = ""; uint groupIndex = 0; - + for(k = 0; k < _Peoples.size(); ++k) { bool newGroup = false; @@ -296,10 +295,9 @@ void CPeopleList::sortEx(TSortOrder order) newGroup = true; ++groupIndex; } - if (newGroup && groupIndex < _GroupContainers.size()) + if (newGroup && groupIndex < _GroupContainers.size() && _GroupContainers.size() > 1) { group = _GroupContainers[groupIndex].second; - groupName = _GroupContainers[groupIndex].first; _BaseContainer->attachContainer(group); } group->attachContainer(_Peoples[k].Container); @@ -556,7 +554,7 @@ void CPeopleList::readContactGroups() if (index < _Peoples.size()) { _Peoples[index].Group = propGroup.str(); - if (_GroupContainers.empty() || _GroupContainers.back().first != propName.str()) { + if (_GroupContainers.empty() || _GroupContainers.back().first != propGroup.str()) { vector > properties; properties.push_back(make_pair(string("posparent"), string("parent"))); properties.push_back(make_pair(string("id"), _ContainerID + "_group_" + toString(_GroupContainers.size()))); From 02732c124141d54a100a000ddb31772a2a93019e Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Thu, 3 Sep 2020 13:14:50 +0200 Subject: [PATCH 49/53] Changes to fix compilation on some setups --- code/ryzom/client/src/interface_v3/people_list.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/people_list.cpp b/code/ryzom/client/src/interface_v3/people_list.cpp index 33d1c900e..47806bf5f 100644 --- a/code/ryzom/client/src/interface_v3/people_list.cpp +++ b/code/ryzom/client/src/interface_v3/people_list.cpp @@ -546,8 +546,10 @@ void CPeopleList::readContactGroups() uint nb = 0; while (node) { - CXMLAutoPtr propName = xmlGetProp(node, (xmlChar*)"name"); - CXMLAutoPtr propGroup = xmlGetProp(node, (xmlChar*)"group"); + CXMLAutoPtr propName; + propName = (char*) xmlGetProp(node, (xmlChar*)"name"); + CXMLAutoPtr propGroup; + propGroup = (char*) xmlGetProp(node, (xmlChar*)"group"); if (propName && propGroup) { sint index = getIndexFromName(propName.str()); From 47bf9ecbc8e2eeb8cc4ce5787cfa3ec8c103f044 Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Thu, 3 Sep 2020 21:12:10 +0200 Subject: [PATCH 50/53] Always create General group, so at first launch groups show directly when changed --- .../client/src/interface_v3/people_list.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/code/ryzom/client/src/interface_v3/people_list.cpp b/code/ryzom/client/src/interface_v3/people_list.cpp index 47806bf5f..c3f2cf4d7 100644 --- a/code/ryzom/client/src/interface_v3/people_list.cpp +++ b/code/ryzom/client/src/interface_v3/people_list.cpp @@ -528,6 +528,23 @@ void CPeopleList::changeGroup(uint index, const ucstring &groupName) void CPeopleList::readContactGroups() { _GroupContainers.clear(); + + // Create default group even if no groups defined + vector > properties; + properties.push_back(make_pair(string("posparent"), string("parent"))); + properties.push_back(make_pair(string("id"), _ContainerID + "_group_0")); + properties.push_back(make_pair(string("title"), "General")); + CInterfaceGroup *group = CWidgetManager::getInstance()->getParser()->createGroupInstance("people_list_group_header", "ui:interface", properties, false); + CGroupContainer *gc = dynamic_cast(group); + gc->setUCTitle(ucstring("General")); + gc->setSavable(false); + + CInterfaceGroup *pRoot = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface")); + pRoot->addGroup (gc); + _BaseContainer->attachContainer(gc); + + _GroupContainers.push_back(make_pair("", gc)); + const std::string filename = CInterfaceManager::getInstance()->getSaveFileName("contactgroups", "xml"); try { From 6b59fc0081699901a75f194b61ee0413fab614bb Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sat, 15 Aug 2020 01:21:16 +0300 Subject: [PATCH 51/53] Fixed: ctrl+3 detected as KeyESCAPE when using keychar event --- code/nel/src/gui/widget_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index 864e4ef5b..a1da03b2e 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -2296,7 +2296,7 @@ namespace NLGUI // Hide menu if the key is pushed // if ((eventDesc.getKeyEventType() == CEventDescriptorKey::keydown) && !_ModalStack.empty() && !eventDesc.getKeyAlt() && !eventDesc.getKeyCtrl() && !eventDesc.getKeyShift()) // Hide menu (or popup menu) is ESCAPE pressed - if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyESCAPE ) + if( eventDesc.getKeyEventType() == CEventDescriptorKey::keydown && eventDesc.getKey() == NLMISC::KeyESCAPE ) { if( hasModal() ) { @@ -2307,7 +2307,7 @@ namespace NLGUI } // Manage "quit window" If the Key is ESCAPE, no captureKeyboard - if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyESCAPE ) + if( eventDesc.getKeyEventType() == CEventDescriptorKey::keydown && eventDesc.getKey() == NLMISC::KeyESCAPE ) { // Get the last escapable active top window. NB: this is ergonomically better. CInterfaceGroup *win= getLastEscapableTopWindow(); From 9532fc3a81ba2bc8f499af3cbcaf8d5e85a98d0b Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 10 Sep 2020 20:16:28 +0300 Subject: [PATCH 52/53] Fixed: mouse free look when using inverted mouse --- code/ryzom/client/src/events_listener.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/code/ryzom/client/src/events_listener.cpp b/code/ryzom/client/src/events_listener.cpp index 879bd5a2a..cfa9d2b3c 100644 --- a/code/ryzom/client/src/events_listener.cpp +++ b/code/ryzom/client/src/events_listener.cpp @@ -172,16 +172,12 @@ void CEventsListener::operator()(const CEvent& event) // Get in pixel space, centered uint32 drW, drH; Driver->getWindowSize(drW, drH); - float fX = mouseEvent->X; // from 0 to 1.0 - float fY = (ClientCfg.FreeLookInverted ? -mouseEvent->Y : mouseEvent->Y); - sint scX = (sint32)(fX * (float)drW) - ((sint32)drW >> 1); // in pixels, centered - sint scY = (sint32)(fY * (float)drH) - ((sint32)drH >> 1); + sint scX = (sint32)(mouseEvent->X * (float)drW) - ((sint32)drW >> 1); // in pixels, centered + sint scY = (sint32)(mouseEvent->Y * (float)drH) - ((sint32)drH >> 1); if (!s_MouseFreeLookReady) { - float pfX = _MouseX; - float pfY = (ClientCfg.FreeLookInverted ? -_MouseY : _MouseY); - sint pscX = (sint32)(pfX * (float)drW) - ((sint32)drW >> 1); // in pixels, centered - sint pscY = (sint32)(pfY * (float)drH) - ((sint32)drH >> 1); + sint pscX = (sint32)(_MouseX * (float)drW) - ((sint32)drW >> 1); // in pixels, centered + sint pscY = (sint32)(_MouseY * (float)drH) - ((sint32)drH >> 1); s_MouseFreeLookReady = true; s_MouseFreeLookLastX = pscX; s_MouseFreeLookLastY = pscY; @@ -199,13 +195,12 @@ void CEventsListener::operator()(const CEvent& event) } // Get delta since last center - sint scXd = scX - s_MouseFreeLookLastX; - sint scYd = scY - s_MouseFreeLookLastY; + s_MouseFreeLookFrameX += (scX - s_MouseFreeLookLastX); + s_MouseFreeLookFrameY += (scY - s_MouseFreeLookLastY) * (ClientCfg.FreeLookInverted ? -1 : 1); + s_MouseFreeLookLastX = scX; s_MouseFreeLookLastY = scY; - s_MouseFreeLookFrameX += scXd; - s_MouseFreeLookFrameY += scYd; // updateFreeLookPos is called in updateMouseSmoothing per frame // Center cursor From b7cbeeb2ae43b85e1d0bae450b03fe19e0b857e9 Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Sun, 13 Sep 2020 02:00:41 +0200 Subject: [PATCH 53/53] Fixed grayed icons on second bar not draggable --- code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 56727f6d4..7b188742c 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -2875,7 +2875,7 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event) } else { - validClic = isDraggable() && !isDragged() && ((!getItemWeared()&&!getGrayed()) || isShortCut()); + validClic = isDraggable() && !isDragged() && ((!getItemWeared()&&!getGrayed()) || isSPhraseId()); } } if (_Type == SheetType_Macro)