diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 4c962537c..af243a412 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -102,6 +102,7 @@ SET(RYZOM_CLIENT_CREATE_ACCOUNT_URL "https://open.ryzom.dev/ams/" CACHE STRING SET(RYZOM_CLIENT_EDIT_ACCOUNT_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Edit Account URL") SET(RYZOM_CLIENT_FORGET_PASSWORD_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Forget Password URL") SET(RYZOM_CLIENT_PATCH_URL "https://cdn.ryzom.dev/open/patch/" CACHE STRING "Ryzom Client Patch URL") +SET(RYZOM_CLIENT_APP_NAME "default") SET(RYZOM_WEBIG_MAIN_URL "https://open.ryzom.dev/" CACHE STRING "Ryzom Client WebIG Main URL") SET(RYZOM_WEBIG_TRUSTED_DOMAIN "open.ryzom.dev" CACHE STRING "Ryzom Client WebIG Trusted Domain") @@ -114,6 +115,7 @@ IF(WITH_RYZOM_LIVE) SET(RYZOM_CLIENT_EDIT_ACCOUNT_URL "https://account.ryzom.com/payment_profile/index.php") SET(RYZOM_CLIENT_FORGET_PASSWORD_URL "https://account.ryzom.com/payment_profile/lost_secure_password.php") SET(RYZOM_CLIENT_PATCH_URL "http://dl.ryzom.com/patch_live") + SET(RYZOM_CLIENT_APP_NAME "ryzom_live") SET(RYZOM_WEBIG_MAIN_URL "https://app.ryzom.com/") SET(RYZOM_WEBIG_TRUSTED_DOMAIN "app.ryzom.com") @@ -177,9 +179,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/config.h.cmake b/code/config.h.cmake index fa4749cb2..fa6c456b9 100644 --- a/code/config.h.cmake +++ b/code/config.h.cmake @@ -37,6 +37,7 @@ #cmakedefine RYZOM_CLIENT_EDIT_ACCOUNT_URL "${RYZOM_CLIENT_EDIT_ACCOUNT_URL}" #cmakedefine RYZOM_CLIENT_FORGET_PASSWORD_URL "${RYZOM_CLIENT_FORGET_PASSWORD_URL}" #cmakedefine RYZOM_CLIENT_PATCH_URL "${RYZOM_CLIENT_PATCH_URL}" +#cmakedefine RYZOM_CLIENT_APP_NAME "${RYZOM_CLIENT_APP_NAME}" #cmakedefine RYZOM_WEBIG_MAIN_URL "${RYZOM_WEBIG_MAIN_URL}" #cmakedefine RYZOM_WEBIG_TRUSTED_DOMAIN "${RYZOM_WEBIG_TRUSTED_DOMAIN}" 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/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index c81ab9e1e..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; } @@ -1584,6 +1584,14 @@ 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); @@ -1691,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); } 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/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 50b381a3c..e88bdfbc5 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -5503,7 +5503,7 @@ namespace NLGUI string suri = elm.getAttribute("href"); if(suri.find("ah:") == 0) { - if (_TrustedDomain) + if (_TrustedDomain || suri.find("ah:script:") == 0) _Link.back() = suri; } else @@ -6360,11 +6360,13 @@ namespace NLGUI void CGroupHTML::htmlOBJECTend(const CHtmlElement &elm) { - if (!_TrustedDomain) - return; + if (_ObjectType=="application/ryzom-data") { + if (!_TrustedDomain) + return; + if (!_ObjectData.empty()) { if (addBnpDownload(_ObjectData, _ObjectAction, _ObjectScript, _ObjectMD5Sum)) @@ -6374,6 +6376,20 @@ namespace NLGUI _ObjectScript.clear(); } } + else if (_ObjectType=="application/ryzom-tutorial") + { + while(strFindReplace(_ObjectScript, "[", "〈")); + while(strFindReplace(_ObjectScript, "]", "〉")); + CLuaManager::getInstance().executeLuaScript("\ngame:executeTutorial([["+_ObjectScript+"]])\n", true); + _ObjectScript.clear(); + } + else if (_ObjectType=="application/ryzom-script") + { + while(strFindReplace(_ObjectScript, "[", "〈")); + while(strFindReplace(_ObjectScript, "]", "〉")); + CLuaManager::getInstance().executeLuaScript("\ngame:executeRyzomScript([["+_ObjectScript+"]])\n", true); + _ObjectScript.clear(); + } _Object = false; } diff --git a/code/nel/src/gui/interface_element.cpp b/code/nel/src/gui/interface_element.cpp index cf5646077..4a736314d 100644 --- a/code/nel/src/gui/interface_element.cpp +++ b/code/nel/src/gui/interface_element.cpp @@ -1168,6 +1168,8 @@ namespace NLGUI { _Active = state; invalidateCoords(); + // force invalidate CViewText/CGroupTable inner elements + invalidateContent(); } } 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; 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(); 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) diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index df1debee2..6758d440a 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -326,8 +326,8 @@ CClientConfig::CClientConfig() Local = false; // Default is Net Mode. FSHost = ""; // Default Host. - TexturesInterface.push_back("texture_interfaces_v3"); - TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc"); + TexturesInterface.push_back("texture_interfaces_v3_2x"); + TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc_2x"); TexturesOutGameInterface.push_back("texture_interfaces_v3_outgame_ui"); @@ -782,8 +782,8 @@ void CClientConfig::setValues() READ_STRINGVECTOR_FV(TexturesOutGameInterfaceDXTC); // interface textures ingame and r2 - READ_STRINGVECTOR_FV(TexturesInterface); - READ_STRINGVECTOR_FV(TexturesInterfaceDXTC); + //READ_STRINGVECTOR_FV(TexturesInterface); + //READ_STRINGVECTOR_FV(TexturesInterfaceDXTC); // interface files login menus READ_STRINGVECTOR_FV(XMLLoginInterfaceFiles); diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index 82564354e..b4d7b5296 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -193,6 +193,7 @@ bool hasPrivilegeG() { return (UserPrivileges.find(":G:") != std::string::npos); bool hasPrivilegeEM() { return (UserPrivileges.find(":EM:") != std::string::npos); } bool hasPrivilegeEG() { return (UserPrivileges.find(":EG:") != std::string::npos); } bool hasPrivilegeOBSERVER() { return (UserPrivileges.find(":OBSERVER:") != std::string::npos); } +bool hasPrivilegeTESTER() { return (UserPrivileges.find(":TESTER:") != std::string::npos); } // Restore the video mode (fullscreen for example) after the connection (done in a window) diff --git a/code/ryzom/client/src/connection.h b/code/ryzom/client/src/connection.h index 79a72fb0e..72a44d31c 100644 --- a/code/ryzom/client/src/connection.h +++ b/code/ryzom/client/src/connection.h @@ -52,6 +52,7 @@ bool hasPrivilegeEM(); bool hasPrivilegeEG(); bool hasPrivilegeVG(); bool hasPrivilegeOBSERVER(); +bool hasPrivilegeTESTER(); // connection with the server. (login, shard list, etc.). 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 diff --git a/code/ryzom/client/src/game_context_menu.cpp b/code/ryzom/client/src/game_context_menu.cpp index 78e58c4b5..1306c0704 100644 --- a/code/ryzom/client/src/game_context_menu.cpp +++ b/code/ryzom/client/src/game_context_menu.cpp @@ -267,7 +267,7 @@ void CGameContextMenu::update() setupContextMenuCantTalk(); // can't talk by default - bool showGMOptions = (hasPrivilegeDEV() || hasPrivilegeSGM() || hasPrivilegeGM() || hasPrivilegeVG() || hasPrivilegeSG() || hasPrivilegeEM() || hasPrivilegeEG() || hasPrivilegeOBSERVER()); + bool showGMOptions = (hasPrivilegeDEV() || hasPrivilegeSGM() || hasPrivilegeGM() || hasPrivilegeVG() || hasPrivilegeSG() || hasPrivilegeEM() || hasPrivilegeEG() || hasPrivilegeOBSERVER() || hasPrivilegeTESTER()); if (_TextInvisible) _TextInvisible->setActive(showGMOptions); 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 3e3ce9b8e..b200205be 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -4686,7 +4686,7 @@ class CHandlerOutgameNaviGetKeys : public IActionHandler id = "sel"; if (event != -1) -- CLuaManager::getInstance().executeLuaScript(toString("outgame:eventChar%sKeyGet(%i)", id.c_str(), event)); + CLuaManager::getInstance().executeLuaScript(toString("outgame:eventChar%sKeyGet(%i)", id.c_str(), event)); } // reset previous input Driver->AsyncListener.reset(); 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..b18e348e5 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -136,7 +136,7 @@ public: if (pCSDst->isShortCut()) pPM->CompositionPhraseMemoryLineDest= pPM->getSelectedMemoryLineDB(); else - pPM->CompositionPhraseMemoryLineDest= 0; + pPM->CompositionPhraseMemoryLineDest= pPM->getSelectedMemoryAltLineDB(); pPM->CompositionPhraseMemorySlotDest= pCSDst->getIndexInDB(); } @@ -536,7 +536,7 @@ 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); + 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()); @@ -750,8 +750,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 +771,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 +810,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 +837,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 +846,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 +872,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 +880,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 +891,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 +919,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 +940,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 +997,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 +1038,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 +1049,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 +1083,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 +1094,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 +1537,7 @@ public: if (pCSDst->isShortCut()) memoryLine = pPM->getSelectedMemoryLineDB(); else - memoryLine = 0; + memoryLine = pPM->getSelectedMemoryAltLineDB(); if(memoryLine<0) return; diff --git a/code/ryzom/client/src/interface_v3/bot_chat_manager.cpp b/code/ryzom/client/src/interface_v3/bot_chat_manager.cpp index d25763bff..839381b91 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_manager.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_manager.cpp @@ -86,6 +86,12 @@ void CBotChatManager::setCurrPage(CBotChatPage *page) UserEntity->trader(CLFECOMMON::INVALID_SLOT); } _CurrPage = page; + + if (page == NULL && !_AHAfterEnd.empty()) + { + CAHManager::getInstance()->runActionHandler(_AHAfterEnd, NULL, ""); + _AHAfterEnd = ""; + } } // ******************************************************************************************** diff --git a/code/ryzom/client/src/interface_v3/bot_chat_manager.h b/code/ryzom/client/src/interface_v3/bot_chat_manager.h index cbd2713f8..9b9f996fc 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_manager.h +++ b/code/ryzom/client/src/interface_v3/bot_chat_manager.h @@ -93,12 +93,15 @@ public: // Called for local client debugging void debugLocalReceiveMissionInfo(); + void setAHAfterEnd(const std::string &ah) { _AHAfterEnd = ah ;} + ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// private: CBotChatPage *_CurrPage; uint16 _SessionID; + std::string _AHAfterEnd; static CBotChatManager *_Instance; //uint _ChosenMissionFlags; diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_mission.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_mission.cpp index ad95a35e5..4830fb096 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_mission.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_mission.cpp @@ -161,6 +161,7 @@ void CBotChatPageMission::acceptMission() /// close the botchat //CBotChatManager::getInstance()->setCurrPage(NULL); _CurrSel = NULL; + CBotChatManager::getInstance()->setAHAfterEnd("context_choose_mission"); } diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_mission.h b/code/ryzom/client/src/interface_v3/bot_chat_page_mission.h index 03cb8d95e..0e458fc7a 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_mission.h +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_mission.h @@ -51,6 +51,7 @@ private: // an observer to update big mission list from littles pages in server database CHugeListObs _MissionPagesObs; CDBCtrlSheet *_CurrSel; + bool _HaveAcceptedMission; MISSION_DESC::TClientMissionType _MType; }; 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(); 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..ec0aee822 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,42 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C return para; } + 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("}@{")); + + // 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); + ucstring translation = msg.substr(endOfOriginal+3); + CCtrlButton *ctrlButton = new CCtrlButton(CViewBase::TCtorParam()); + ctrlButton->setTexture(texture); + ctrlButton->setTextureOver(texture); + ctrlButton->setTexturePushed(texture); + if (!originalFirst) + { + ctrlButton->setDefaultContextHelp(original); + pos = endOfOriginal+3; + } + else + { + ctrlButton->setDefaultContextHelp(translation); + pos = startTr+5; + textSize = endOfOriginal; + } + ctrlButton->setId("tr"); + para->addChild(ctrlButton); + } // quickly check if text has links or not bool hasUrl; @@ -430,8 +466,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/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) diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp index 4a7ef5701..618507ff5 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp @@ -257,7 +257,7 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT case CDBCtrlSheet::Pact: text= CI18N::get("uiBotChatPact") + text; break; case CDBCtrlSheet::Skill: text= CI18N::get("uiBotChatSkill") + text; break; case CDBCtrlSheet::GuildFlag: text= CI18N::get("uiBotChatSkill") + text; break; - case CDBCtrlSheet::Phrase: text= CI18N::get("uiBotChatPhrase") + text; break; + case CDBCtrlSheet::Phrase: text= text; break; default: break; } @@ -536,12 +536,12 @@ bool CDBGroupListSheetTrade::CSheetChildTrade::isSheetValid(CDBGroupListSheetTex nlwarning("Brick %d has type %s", (int) k, BRICK_TYPE::toString(bs->getBrickType()).c_str()); } else - { + { nlwarning("Brick %d : not a brick sheet", (int) k); } } } - */ + */ if (phraseSheet) { @@ -563,7 +563,7 @@ bool CDBGroupListSheetTrade::CSheetChildTrade::isSheetValid(CDBGroupListSheetTex break; } } - + return true; 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..015800173 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 @@ -28,6 +28,7 @@ #include "nel/gui/action_handler.h" #include "../entities.h" #include "nel/gui/group_paragraph.h" // For CCtrlLink +#include "nel/gui/view_bitmap.h" #include "../net_manager.h" #include "../string_manager_client.h" #include "../login.h" @@ -644,14 +645,42 @@ void CGroupInSceneBubbleManager::addMessagePopupCenter (const ucstring &message, "ui:interface", templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size()); if (group) { + ucstring finalMessage = message; + + ucstring::size_type pos = message.find(ucstring("|")); + if (pos != std::string::npos) + { + CViewBitmap *pViewIcon = dynamic_cast(group->getView("iconA")); + if (pViewIcon != NULL) + { + string texture = message.substr(0, pos).toString(); + pViewIcon->setTexture(texture); + } + + ucstring::size_type end = message.find(ucstring("|"), pos+1); + if (end != std::string::npos) + { + CViewBitmap *pViewIcon = dynamic_cast(group->getView("iconZ")); + if (pViewIcon != NULL) + { + string texture = message.substr(end+1).toString(); + pViewIcon->setTexture(texture); + } + finalMessage = message.substr(pos+1, end-pos-1); + } + else + finalMessage = message.substr(pos+1); + } + // Skill name CViewText *pViewName = dynamic_cast(group->getView("name")); if (pViewName != NULL) { - pViewName->setTextFormatTaged(message); + pViewName->setTextFormatTaged(finalMessage); pViewName->setColor (color); } + // Link to the interface CWidgetManager::getInstance()->addWindowToMasterGroup("ui:interface", group); CInterfaceGroup *pRoot = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface")); @@ -843,6 +872,29 @@ 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 + 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) + { + if (!originalFirst) + { + pos = endOfOriginal+4; + } + else + { + pos = startTr+5; + textSize = endOfOriginal; + } + } + // Output the message in a bubble bool show = false; @@ -862,7 +914,7 @@ void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText, return; // Get a bubble - CGroupInSceneBubble *bubble = newBubble (ucsText); + CGroupInSceneBubble *bubble = newBubble (ucsText.substr(pos, textSize-pos)); if (bubble) { // Link the bubble diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp index dd5e5ae20..35a1fc4e6 100644 --- a/code/ryzom/client/src/interface_v3/group_map.cpp +++ b/code/ryzom/client/src/interface_v3/group_map.cpp @@ -2472,7 +2472,8 @@ void CGroupMap::updateMatchedLandmarks() std::vector > params; params.clear(); params.push_back(std::pair("id", toString("lm%d", k))); - params.push_back(std::pair("tooltip", _MatchedLandmarks[k].Title.toUtf8())); + // ctrl base expects utf8 string to start with "u:" + params.push_back(std::pair("tooltip", "u:" + _MatchedLandmarks[k].Title.toUtf8())); params.push_back(std::pair("index", toString(k))); CInterfaceGroup *g = CWidgetManager::getInstance()->getParser()->createGroupInstance("lm_search_result", pL->getId(), params); @@ -2653,7 +2654,7 @@ void CGroupMap::createContinentLandMarks() static void hideTeleportButtonsInPopupMenuIfNotEnoughPriv() { - bool showTeleport = (hasPrivilegeDEV() || hasPrivilegeSGM() || hasPrivilegeGM() || hasPrivilegeVG() || hasPrivilegeSG() || hasPrivilegeEM() || hasPrivilegeEG() || hasPrivilegeOBSERVER()); + bool showTeleport = (hasPrivilegeDEV() || hasPrivilegeSGM() || hasPrivilegeGM() || hasPrivilegeVG() || hasPrivilegeSG() || hasPrivilegeEM() || hasPrivilegeEG() || hasPrivilegeOBSERVER()|| hasPrivilegeTESTER()); CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceElement *ie = CWidgetManager::getInstance()->getElementFromId("ui:interface:map_menu:teleport"); @@ -2680,7 +2681,7 @@ void CGroupMap::setLandmarkFilter(const std::string &s) if (!s.empty()) { ucstring ucs; ucs.fromUtf8(s); - splitUCString(toLower(s), ucstring(" "), _LandmarkFilter); + splitUCString(toLower(ucs), ucstring(" "), _LandmarkFilter); } // recreate landmarks @@ -2754,6 +2755,8 @@ CGroupMap::CLandMarkButton *CGroupMap::createArkPointButton(const CArkPoint &poi lmb->setParamsOnLeftClick(point.LeftClickParam); lmb->setActionOnRightClick(point.RightClickAction); lmb->setParamsOnRightClick(point.RightClickParam); + lmb->setActionOnOver(point.OverClickAction); + lmb->setParamsOnOver(point.OverClickParam); lmb->setColor(point.Color); lmb->setColorOver(point.Color); lmb->setColorPushed(point.Color); diff --git a/code/ryzom/client/src/interface_v3/group_map.h b/code/ryzom/client/src/interface_v3/group_map.h index e138c6b71..9cfc5bae6 100644 --- a/code/ryzom/client/src/interface_v3/group_map.h +++ b/code/ryzom/client/src/interface_v3/group_map.h @@ -95,6 +95,8 @@ public: std::string LeftClickParam; std::string RightClickAction; std::string RightClickParam; + std::string OverClickAction; + std::string OverClickParam; public: CArkPoint() @@ -230,7 +232,7 @@ public: void addUserLandMark(const NLMISC::CVector2f &pos, const ucstring &title, NLMISC::CRGBA color); void addUserRespawnPoint(const NLMISC::CVector2f &pos); void delArkPoints(); - + // set landmarks visibility based text query void setLandmarkFilter(const std::string &s); @@ -602,7 +604,7 @@ private: CLandMarkButton *createLandMarkButton(const CLandMarkOptions &options); // Create a Ark landmark button, but do not add it to this group CLandMarkButton *createArkPointButton(const CArkPoint &point); - + // update a landmark button void updateLandMarkButton(CLandMarkButton *lmb, const CLandMarkOptions &options); diff --git a/code/ryzom/client/src/interface_v3/group_quick_help.cpp b/code/ryzom/client/src/interface_v3/group_quick_help.cpp index 0b789fccf..e89967193 100644 --- a/code/ryzom/client/src/interface_v3/group_quick_help.cpp +++ b/code/ryzom/client/src/interface_v3/group_quick_help.cpp @@ -74,6 +74,8 @@ bool CGroupQuickHelp::submitEvent (const char *event) // Update the text updateParagraph (); + + CLuaManager::getInstance().executeLuaScript(toString("\ngame:processTutorialEvent(\"%s\")\n", event), true); } } return false; 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)); + } } }; diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index e81785ea8..5231dc19a 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -2523,6 +2523,17 @@ void CInterfaceManager::displaySystemInfo(const ucstring &str, const string &cat CClientConfig::SSysInfoParam::TMode mode = CClientConfig::SSysInfoParam::Normal; CRGBA color = CRGBA::White; + ucstring cleanStr = str; + ucstring::size_type pos = str.find(ucstring("|")); + if (pos != std::string::npos) + { + ucstring::size_type end = str.find(ucstring("|"), pos+1); + if (end != std::string::npos) + cleanStr = str.substr(pos+1, end-pos-1); + else + cleanStr = str.substr(pos+1); + } + // If broadcast, parse lua code if (toLower(cat) == "bc" && str.size() > 3 && str[0]=='@' && str[1]=='L' && str[2]=='U' && str[3]=='A') { @@ -2542,11 +2553,11 @@ void CInterfaceManager::displaySystemInfo(const ucstring &str, const string &cat if (mode != CClientConfig::SSysInfoParam::OverOnly && mode != CClientConfig::SSysInfoParam::Around) { if (PeopleInterraction.SystemInfo) - PeopleInterraction.ChatInput.SystemInfo.displayMessage(str, color, 2); + PeopleInterraction.ChatInput.SystemInfo.displayMessage(cleanStr, color, 2); else { CPeopleInterraction::CSysMsg sysMsg; - sysMsg.Str = str; + sysMsg.Str = cleanStr; sysMsg.Cat = cat; PeopleInterraction.SystemMessageBuffer.push_back( sysMsg ); } @@ -2557,10 +2568,10 @@ void CInterfaceManager::displaySystemInfo(const ucstring &str, const string &cat // If over popup a string at the bottom of the screen if ((mode == CClientConfig::SSysInfoParam::Over) || (mode == CClientConfig::SSysInfoParam::OverOnly)) - InSceneBubbleManager.addMessagePopup(str, color); + InSceneBubbleManager.addMessagePopup(cleanStr, color); else if ( (mode == CClientConfig::SSysInfoParam::Around || mode == CClientConfig::SSysInfoParam::CenterAround) && PeopleInterraction.AroundMe.Window) - PeopleInterraction.ChatInput.AroundMe.displayMessage(str, color, 2); + PeopleInterraction.ChatInput.AroundMe.displayMessage(cleanStr, color, 2); } 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/interface_v3/lua_ihm_ryzom.cpp b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 8aa7af585..ca5de98c8 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -184,6 +184,21 @@ private: REGISTER_ACTION_HANDLER(CHandlerLUA, "lua"); std::deque > CHandlerLUA::_UICallerStack; +// *************************************************************************** +class CHandlerSCRIPT : public IActionHandler +{ +public: + void execute(CCtrlBase *pCaller, const std::string &sParams) + { + string script = sParams; + while(strFindReplace(script, "[", "〈")); + while(strFindReplace(script, "]", "〉")); + strFindReplace(script, "|", "\n"); + CLuaManager::getInstance().executeLuaScript("\ngame:executeRyzomScript([["+script+"]])\n", true); + } +}; +REGISTER_ACTION_HANDLER(CHandlerSCRIPT, "script"); + // *************************************************************************** // Allow also to call script from expression static DECLARE_INTERFACE_USER_FCT(lua) @@ -565,6 +580,8 @@ void CLuaIHMRyzom::RegisterRyzomFunctions(NLGUI::CLuaState &ls) LUABIND_FUNC(isDynStringAvailable), LUABIND_FUNC(isFullyPatched), LUABIND_FUNC(getSheetType), + LUABIND_FUNC(getSheetShape), + LUABIND_FUNC(getCharacterSheetScale), LUABIND_FUNC(getSheetFamily), LUABIND_FUNC(getSheetName), LUABIND_FUNC(getFameIndex), @@ -1245,7 +1262,7 @@ int CLuaIHMRyzom::getMousePos(CLuaState &ls) CTool::getMousePos(x, y); ls.push(x); ls.push(y); - + return 2; } @@ -1257,7 +1274,7 @@ int CLuaIHMRyzom::getMouseDown(CLuaState &ls) ls.push(down); ls.push(x); ls.push(y); - + return 3; } @@ -1266,11 +1283,11 @@ int CLuaIHMRyzom::getMouseMiddleDown(CLuaState &ls) sint32 x, y; bool down; CTool::getMouseMiddleDown(down, x, y); - + ls.push(down); ls.push(x); ls.push(y); - + return 3; } @@ -1279,11 +1296,11 @@ int CLuaIHMRyzom::getMouseRightDown(CLuaState &ls) sint32 x, y; bool down; CTool::getMouseRightDown(down, x, y); - + ls.push(down); ls.push(x); ls.push(y); - + return 3; } @@ -1294,10 +1311,10 @@ int CLuaIHMRyzom::getShapeIdAt(CLuaState &ls) CLuaIHM::checkArgCount(ls, funcName, 2); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER); - + uint32 x = (uint32)ls.toInteger(1); - uint32 y = (uint32)ls.toInteger(2); - + uint32 y = (uint32)ls.toInteger(2); + uint32 w, h; CViewRenderer &viewRender = *CViewRenderer::getInstance(); viewRender.getScreenSize(w, h); @@ -1308,11 +1325,11 @@ int CLuaIHMRyzom::getShapeIdAt(CLuaState &ls) float cursX = (float)x/(float)w; float cursY = (float)y/(float)h; - + sint32 instance_idx; EntitiesMngr.getShapeInstanceUnderPos(cursX, cursY, instance_idx); ls.push(instance_idx); - + return 1; } @@ -1339,7 +1356,7 @@ int CLuaIHMRyzom::getGroundAtMouse(CLuaState &ls) worldViewRay.Up = camMatrix.getK().normed(); CVector sceneInter; CTool::TRayIntersectionType rayInterType = CTool::computeLandscapeRayIntersection(worldViewRay, sceneInter); - + ls.push(sceneInter.x); ls.push(sceneInter.y); ls.push(sceneInter.z); @@ -1367,7 +1384,7 @@ int CLuaIHMRyzom::moveCam(CLuaState &ls) float z = (float)ls.toNumber(3); CVector moves(x, y, z); UserEntity->setCameraMoves(moves); - + return 0; } @@ -1541,7 +1558,7 @@ int CLuaIHMRyzom::moveToTarget(CLuaState &ls) const std::string &url = ls.toString(1); CEntityCL *target = getTargetEntity(); if (!target) return 0; - + CLuaManager::getInstance().executeLuaScript("ArkTargetUrl = [["+url+"]]", 0); UserEntity->moveTo(UserEntity->selection(), 1.0, CUserEntity::OpenArkUrl); return 0; @@ -2180,7 +2197,7 @@ int CLuaIHMRyzom::addShape(CLuaState &ls) CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); sint32 idx = -1; - + if (!Scene) { nlwarning("No scene available"); @@ -2189,7 +2206,7 @@ int CLuaIHMRyzom::addShape(CLuaState &ls) } string shape = ls.toString(1); - + float x = 0.0f, y = 0.0f, z = 0.0f; float scale = 1.0f; string context, url, skeleton, texture; @@ -2197,7 +2214,7 @@ int CLuaIHMRyzom::addShape(CLuaState &ls) bool transparency = false; bool collision = true; bool inIgZone = false; - + if (ls.getTop() >= 2) { CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER); @@ -2223,14 +2240,14 @@ int CLuaIHMRyzom::addShape(CLuaState &ls) y = UserEntity->pos().y; z = UserEntity->pos().z; } - + CVector userDir = UserEntity->dir(); - + if (ls.getTop() >= 5) { CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING); string angle = ls.toString(5); - + if (angle != "user") { float a; @@ -2238,7 +2255,7 @@ int CLuaIHMRyzom::addShape(CLuaState &ls) userDir = CVector(sin(a), cos(a), 0.f); } } - + if (ls.getTop() >= 6) { CLuaIHM::checkArgType(ls, funcName, 6, LUA_TNUMBER); @@ -2250,19 +2267,19 @@ int CLuaIHMRyzom::addShape(CLuaState &ls) CLuaIHM::checkArgType(ls, funcName, 7, LUA_TBOOLEAN); collision = ls.toBoolean(7); } - + if (ls.getTop() >= 8) { CLuaIHM::checkArgType(ls, funcName, 8, LUA_TSTRING); context = ls.toString(8); } - + if (ls.getTop() >= 9) { CLuaIHM::checkArgType(ls, funcName, 9, LUA_TSTRING); url = ls.toString(9); } - + if (ls.getTop() >= 10) { CLuaIHM::checkArgType(ls, funcName, 10, LUA_TBOOLEAN); @@ -2274,25 +2291,25 @@ int CLuaIHMRyzom::addShape(CLuaState &ls) CLuaIHM::checkArgType(ls, funcName, 11, LUA_TBOOLEAN); transparency = ls.toBoolean(11); } - + if (ls.getTop() >= 12) { CLuaIHM::checkArgType(ls, funcName, 12, LUA_TSTRING); texture = ls.toString(12); } - + if (ls.getTop() >= 13) { CLuaIHM::checkArgType(ls, funcName, 13, LUA_TSTRING); skeleton = ls.toString(13); } - + if (ls.getTop() >= 14) { CLuaIHM::checkArgType(ls, funcName, 14, LUA_TBOOLEAN); inIgZone = ls.toBoolean(14); } - + CShapeInstanceReference instref = EntitiesMngr.createInstance(shape, CVector(x, y, z), context, url, collision, inIgZone, idx); UInstance instance = instref.Instance; @@ -2373,9 +2390,9 @@ int CLuaIHMRyzom::addShape(CLuaState &ls) instance.setPos(CVector(x, y, z)); instance.setRotQuat(dir.getRot()); } - + instance.setTransformMode(UTransformable::RotEuler); - + // if the shape is a particle system, additionnal parameters are user params UParticleSystemInstance psi; psi.cast (instance); @@ -2398,7 +2415,7 @@ int CLuaIHMRyzom::addShape(CLuaState &ls) } } }*/ - + UMovePrimitive *primitive = instref.Primitive; if (primitive) { @@ -2408,7 +2425,7 @@ int CLuaIHMRyzom::addShape(CLuaState &ls) primitive->setReactionType(UMovePrimitive::Slide); primitive->setTriggerType(UMovePrimitive::NotATrigger); primitive->setAbsorbtion(0); - + primitive->setPrimitiveType(UMovePrimitive::_2DOrientedBox); primitive->setSize((bbox.getMax().x - bbox.getMin().x)*scale, (bbox.getMax().y - bbox.getMin().y)*scale); primitive->setHeight((bbox.getMax().z - bbox.getMin().z)*scale); @@ -2416,10 +2433,10 @@ int CLuaIHMRyzom::addShape(CLuaState &ls) primitive->setCollisionMask(MaskColPlayer | MaskColNpc | MaskColDoor); primitive->setOcclusionMask(MaskColPlayer | MaskColNpc | MaskColDoor); primitive->setObstacle(true); - - + + primitive->setGlobalPosition(instance.getPos(), dynamicWI); - + primitive->insertInWorldImage(dynamicWI); } } @@ -2434,9 +2451,9 @@ int CLuaIHMRyzom::setupShape(CLuaState &ls) CLuaIHM::checkArgCount(ls, funcName, 2); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); CLuaIHM::checkArgType(ls, funcName, 2, LUA_TTABLE); - + uint32 idx = (uint32)ls.toInteger(1); - + std::vector keys; std::vector values; CLuaObject params; @@ -2459,12 +2476,12 @@ int CLuaIHMRyzom::setupShape(CLuaState &ls) values.push_back(it.nextValue().toString()); keys.push_back(it.nextKey().toString()); } - + if (EntitiesMngr.setupInstance(idx, keys, values)) ls.push(1); else ls.pushNil(); - + return 1; } @@ -2476,15 +2493,15 @@ int CLuaIHMRyzom::moveShape(CLuaState &ls) CLuaIHM::checkArgType(ls, funcName, 2, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 3, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 4, LUA_TSTRING); - + uint32 idx = (uint32)ls.toInteger(1); - + CVector pos = EntitiesMngr.getInstancePos(idx); string x = ls.toString(2); string y = ls.toString(3); string z = ls.toString(4); - + float move_x = 0; float move_y = 0; float move_z = 0; @@ -2502,7 +2519,7 @@ int CLuaIHMRyzom::moveShape(CLuaState &ls) pos.x = move_x; } } - + if (!y.empty()) { if (y[0] == '+') @@ -2516,7 +2533,7 @@ int CLuaIHMRyzom::moveShape(CLuaState &ls) pos.y = move_y; } } - + if (!z.empty()) { if (z[0] == '+') @@ -2530,12 +2547,12 @@ int CLuaIHMRyzom::moveShape(CLuaState &ls) pos.z = move_z; } } - + if (EntitiesMngr.setInstancePos(idx, pos)) ls.push(1); else ls.pushNil(); - + return 1; } @@ -2547,9 +2564,9 @@ int CLuaIHMRyzom::rotateShape(CLuaState &ls) CLuaIHM::checkArgType(ls, funcName, 2, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 3, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 4, LUA_TSTRING); - + uint32 idx = (uint32)ls.toInteger(1); - + CVector rot = EntitiesMngr.getInstanceRot(idx); string x = ls.toString(2); @@ -2573,7 +2590,7 @@ int CLuaIHMRyzom::rotateShape(CLuaState &ls) rot.x = rot_x; } } - + if (!y.empty()) { if (y[0] == '+') @@ -2587,7 +2604,7 @@ int CLuaIHMRyzom::rotateShape(CLuaState &ls) rot.y = rot_y; } } - + if (!z.empty()) { if (z[0] == '+') @@ -2601,12 +2618,12 @@ int CLuaIHMRyzom::rotateShape(CLuaState &ls) rot.z = rot_z; } } - + if (EntitiesMngr.setInstanceRot(idx, rot)) ls.push(1); else ls.pushNil(); - + return 1; } @@ -2615,7 +2632,7 @@ int CLuaIHMRyzom::deleteShape(CLuaState &ls) const char* funcName = "deleteShape"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - + if (EntitiesMngr.deleteInstance((uint32)ls.toInteger(1))) ls.push(1); else @@ -2629,9 +2646,9 @@ int CLuaIHMRyzom::getShapePos(CLuaState &ls) const char* funcName = "getShapePos"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - + uint32 idx = (uint32)ls.toInteger(1); - + CVector pos = EntitiesMngr.getInstancePos(idx); ls.push(pos.x); @@ -2645,9 +2662,9 @@ int CLuaIHMRyzom::getShapeRot(CLuaState &ls) const char* funcName = "getShapeRot"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - + uint32 idx = (uint32)ls.toInteger(1); - + CVector rot = EntitiesMngr.getInstanceRot(idx); ls.push(rot.x); @@ -2661,11 +2678,11 @@ int CLuaIHMRyzom::getShapeScale(CLuaState &ls) const char* funcName = "getShapeScale"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - + uint32 idx = (uint32)ls.toInteger(1); - + CVector scale = EntitiesMngr.getInstanceScale(idx); - + ls.push(scale.x); ls.push(scale.y); ls.push(scale.z); @@ -2677,11 +2694,11 @@ int CLuaIHMRyzom::getShapeColPos(CLuaState &ls) const char* funcName = "getShapeColPos"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - + uint32 idx = (uint32)ls.toInteger(1); - + CVector pos = EntitiesMngr.getInstanceColPos(idx); - + ls.push(pos.x); ls.push(pos.y); ls.push(pos.z); @@ -2693,11 +2710,11 @@ int CLuaIHMRyzom::getShapeColScale(CLuaState &ls) const char* funcName = "getShapeColScale"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - + uint32 idx = (uint32)ls.toInteger(1); - + CVector scale = EntitiesMngr.getInstanceColScale(idx); - + ls.push(scale.x); ls.push(scale.y); ls.push(scale.z); @@ -2709,11 +2726,11 @@ int CLuaIHMRyzom::getShapeColOrient(CLuaState &ls) const char* funcName = "getShapeColOrient"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - + uint32 idx = (uint32)ls.toInteger(1); - + double orient = EntitiesMngr.getInstanceColOrient(idx); - + ls.push(orient); return 1; } @@ -3469,6 +3486,38 @@ std::string CLuaIHMRyzom::getSheetType(const std::string &sheet) return CEntitySheet::typeToString(sheetPtr->Type); } +// *************************************************************************** +std::string CLuaIHMRyzom::getSheetShape(const std::string &sheet) +{ + //H_AUTO(Lua_CLuaIHM_getSheetType) + const CEntitySheet *sheetPtr = SheetMngr.get(CSheetId(sheet)); + + if (!sheetPtr) + return ""; + + if (sheetPtr->type() == CEntitySheet::ITEM) + { + CItemSheet *sheet = (CItemSheet*)sheetPtr; + return sheet->getShape(); + } + else if (sheetPtr->type() == CEntitySheet::FAUNA) + { + CCharacterSheet *sheet = (CCharacterSheet*)(sheetPtr); + return sheet->Body.getItem(); + } + + return ""; +} + +// *************************************************************************** +float CLuaIHMRyzom::getCharacterSheetScale(const std::string &sheet) +{ + const CEntitySheet *sheetPtr = SheetMngr.get(CSheetId(sheet)); + const CCharacterSheet *charSheet = dynamic_cast(sheetPtr); + + if (charSheet) return charSheet->Scale; + return 1; +} // *************************************************************************** std::string CLuaIHMRyzom::getSheetFamily(const std::string &sheet) @@ -3481,7 +3530,7 @@ std::string CLuaIHMRyzom::getSheetFamily(const std::string &sheet) if (pIS) return ITEMFAMILY::toString(pIS->Family); } - + return ""; } @@ -3712,7 +3761,7 @@ float CLuaIHMRyzom::setChar3dDBfromVPX(const std::string &branch, const std::str cs.People = EGSPD::CPeople::fromString(people); SCharacter3DSetup::setupDBFromCharacterSummary(branch, cs); - + return cs.VisualPropC.PropertySubData.CharacterHeight; } @@ -3880,41 +3929,41 @@ sint32 CLuaIHMRyzom::getPlayerLevel() std::string CLuaIHMRyzom::getPlayerVpaHex() { sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E0:P" + toString("%d", CLFECOMMON::PROPERTY_VPA))->getValue64(); - return NLMISC::toString("%X", prop); + return NLMISC::toString("%" NL_I64 "X", prop); } // *************************************************************************** std::string CLuaIHMRyzom::getPlayerVpbHex() { sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E0:P" + toString("%d", CLFECOMMON::PROPERTY_VPB))->getValue64(); - return NLMISC::toString("%X", prop); + return NLMISC::toString("%" NL_I64 "X", prop); } // *************************************************************************** std::string CLuaIHMRyzom::getPlayerVpcHex() { - sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E0:P" + toString("%d", CLFECOMMON::PROPERTY_VPB))->getValue64(); - return NLMISC::toString("%X", prop); + sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E0:P" + toString("%d", CLFECOMMON::PROPERTY_VPC))->getValue64(); + return NLMISC::toString("%" NL_I64 "X", prop); } // *************************************************************************** -sint64 CLuaIHMRyzom::getPlayerVpa() +uint64 CLuaIHMRyzom::getPlayerVpa() { - sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E0:P" + toString("%d", CLFECOMMON::PROPERTY_VPA))->getValue64(); + uint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E0:P" + toString("%d", CLFECOMMON::PROPERTY_VPA))->getValue64(); return prop; } // *************************************************************************** -sint64 CLuaIHMRyzom::getPlayerVpb() +uint64 CLuaIHMRyzom::getPlayerVpb() { - sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E0:P" + toString("%d", CLFECOMMON::PROPERTY_VPB))->getValue64(); + uint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E0:P" + toString("%d", CLFECOMMON::PROPERTY_VPB))->getValue64(); return prop; } // *************************************************************************** -sint64 CLuaIHMRyzom::getPlayerVpc() +uint64 CLuaIHMRyzom::getPlayerVpc() { - sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E0:P" + toString("%d", CLFECOMMON::PROPERTY_VPB))->getValue64(); + uint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E0:P" + toString("%d", CLFECOMMON::PROPERTY_VPC))->getValue64(); return prop; } @@ -3965,7 +4014,7 @@ std::string CLuaIHMRyzom::getTargetVpaHex() if (!target) return 0; sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E" + toString("%d", getTargetSlotNr()) + ":P" + toString("%d", CLFECOMMON::PROPERTY_VPA))->getValue64(); - return NLMISC::toString("%X", prop); + return NLMISC::toString("%" NL_I64 "X", prop); } // *************************************************************************** @@ -3975,7 +4024,7 @@ std::string CLuaIHMRyzom::getTargetVpbHex() if (!target) return 0; sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E" + toString("%d", getTargetSlotNr()) + ":P" + toString("%d", CLFECOMMON::PROPERTY_VPB))->getValue64(); - return NLMISC::toString("%X", prop); + return NLMISC::toString("%" NL_I64 "X", prop); } // *************************************************************************** @@ -3984,40 +4033,37 @@ std::string CLuaIHMRyzom::getTargetVpcHex() CEntityCL *target = getTargetEntity(); if (!target) return 0; - sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E" + toString("%d", getTargetSlotNr()) + ":P" + toString("%d", CLFECOMMON::PROPERTY_VPB))->getValue64(); - return NLMISC::toString("%X", prop); + sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E" + toString("%d", getTargetSlotNr()) + ":P" + toString("%d", CLFECOMMON::PROPERTY_VPC))->getValue64(); + return NLMISC::toString("%" NL_I64 "X", prop); } // *************************************************************************** -sint64 CLuaIHMRyzom::getTargetVpa() +uint64 CLuaIHMRyzom::getTargetVpa() { CEntityCL *target = getTargetEntity(); if (!target) return 0; - sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E" + toString("%d", getTargetSlotNr()) + ":P" + toString("%d", CLFECOMMON::PROPERTY_VPA))->getValue64(); - + uint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E" + toString("%d", getTargetSlotNr()) + ":P" + toString("%d", CLFECOMMON::PROPERTY_VPA))->getValue64(); return prop; } // *************************************************************************** -sint64 CLuaIHMRyzom::getTargetVpb() +uint64 CLuaIHMRyzom::getTargetVpb() { CEntityCL *target = getTargetEntity(); if (!target) return 0; - sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E" + toString("%d", getTargetSlotNr()) + ":P" + toString("%d", CLFECOMMON::PROPERTY_VPB))->getValue64(); - + uint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E" + toString("%d", getTargetSlotNr()) + ":P" + toString("%d", CLFECOMMON::PROPERTY_VPB))->getValue64(); return prop; } // *************************************************************************** -sint64 CLuaIHMRyzom::getTargetVpc() +uint64 CLuaIHMRyzom::getTargetVpc() { CEntityCL *target = getTargetEntity(); if (!target) return 0; - sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E" + toString("%d", getTargetSlotNr()) + ":P" + toString("%d", CLFECOMMON::PROPERTY_VPB))->getValue64(); - + uint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E" + toString("%d", getTargetSlotNr()) + ":P" + toString("%d", CLFECOMMON::PROPERTY_VPC))->getValue64(); return prop; } @@ -4153,7 +4199,7 @@ int CLuaIHMRyzom::addLandMark(CLuaState &ls) { const char* funcName = "addLandMark"; CLuaIHM::checkArgMin(ls, funcName, 4); - CLuaIHM::checkArgMax(ls, funcName, 9); + CLuaIHM::checkArgMax(ls, funcName, 11); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); // x CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER); // y CLuaIHM::checkArgType(ls, funcName, 3, LUA_TSTRING); // title @@ -4162,6 +4208,9 @@ int CLuaIHMRyzom::addLandMark(CLuaState &ls) CLuaIHM::checkArgType(ls, funcName, 6, LUA_TSTRING); // left click param CLuaIHM::checkArgType(ls, funcName, 7, LUA_TSTRING); // right click action CLuaIHM::checkArgType(ls, funcName, 8, LUA_TSTRING); // right click params + CLuaIHM::checkArgType(ls, funcName, 9, LUA_TSTRING); // over click action + CLuaIHM::checkArgType(ls, funcName, 10, LUA_TSTRING); // over click params + // 11 : Color CArkPoint point; point.x = (sint32)(ls.toNumber(1)*1000.f); @@ -4172,12 +4221,14 @@ int CLuaIHMRyzom::addLandMark(CLuaState &ls) point.LeftClickParam = ls.toString(6); point.RightClickAction = ls.toString(7); point.RightClickParam = ls.toString(8); - + point.OverClickAction = ls.toString(9); + point.OverClickParam = ls.toString(10); + point.Color = CRGBA(255,255,255,255); - if (ls.getTop() >= 9) + if (ls.getTop() >= 11) CLuaIHM::pop(ls, point.Color); - + CGroupMap *pMap = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:actual_map")); if (pMap != NULL) pMap->addArkPoint(point); diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h index 78b5a2a00..d574efb68 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h @@ -15,7 +15,7 @@ private: static int luaClientCfgIndex(CLuaState &ls); static int luaClientCfgNewIndex(CLuaState &ls); - + // CInterfaceElement management on stack, stored by a CRefPtr. public: @@ -204,6 +204,8 @@ private: static bool isDynStringAvailable(sint32 dynStringId); static bool isFullyPatched(); static std::string getSheetType(const std::string &sheet); + static std::string getSheetShape(const std::string &sheet); + static float getCharacterSheetScale(const std::string &sheet); static std::string getSheetFamily(const std::string &sheet); static std::string getSheetName(uint32 sheetId); static sint32 getFameIndex(const std::string &factionName); @@ -251,7 +253,7 @@ private: static int addRespawnPoint(CLuaState &ls); static int delArkPoints(CLuaState &ls); static int setArkPowoOptions(CLuaState &ls); - + // open the window to do a tell to 'player', if 'msg' is not empty, then the message will be sent immediatly // else, current command of the chat window will be replaced with tell 'player' @@ -260,7 +262,7 @@ private: static void updateTooltipCoords(); // test if the ctrl key is down (NB nico : I didn't add other key, // because it would be too easy to write a key recorder ...) - static bool isCtrlKeyDown(); + static bool isCtrlKeyDown(); static std::string encodeURLUnicodeParam(const ucstring &text); static std::string encodeURLParam(const std::string &text); @@ -271,9 +273,9 @@ private: static std::string getPlayerVpaHex(); static std::string getPlayerVpbHex(); static std::string getPlayerVpcHex(); - static sint64 getPlayerVpa(); - static sint64 getPlayerVpb(); - static sint64 getPlayerVpc(); + static uint64 getPlayerVpa(); + static uint64 getPlayerVpb(); + static uint64 getPlayerVpc(); static sint32 getTargetLevel(); // get current, precise level of the selected target, or -1 if there's no such selected target static sint32 getTargetForceRegion(); // get 'force region' for current target, or -1 if there's no selected target static sint32 getTargetLevelForce(); // get 'level force' for current target, or -1 if there's no selected target @@ -281,9 +283,9 @@ private: static std::string getTargetVpaHex(); static std::string getTargetVpbHex(); static std::string getTargetVpcHex(); - static sint64 getTargetVpa(); - static sint64 getTargetVpb(); - static sint64 getTargetVpc(); + static uint64 getTargetVpa(); + static uint64 getTargetVpb(); + static uint64 getTargetVpc(); static bool isTargetNPC(); // return 'true' if the target is an npc static bool isTargetPlayer(); // return 'true' if the target is a player static bool isTargetUser(); // return 'true' if the target is the user diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index 96f27bb6c..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); @@ -2307,6 +2314,56 @@ 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( CHandlerChangeContactGroupBegin, "change_contact_group_begin"); + +//================================================================================================================= +// Change the group of a contact in 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:change_contact_group_eb:eb")); + if (geb) + { + + 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( CHandlerChangeContactGroup, "change_contact_group"); //================================================================================================================= class CHandlerSortContacts : public IActionHandler @@ -2372,7 +2429,7 @@ REGISTER_ACTION_HANDLER( CHandlerContactDirectChat, "contact_direct_chat"); //================================================================================================================= /** Menu to create a new party chat - */ + */ class CHandlerNewPartyChat : public IActionHandler { public: @@ -2406,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 */) @@ -2439,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 */) @@ -2457,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 */) @@ -2483,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 } }; @@ -2496,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 } }; @@ -2509,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 } }; @@ -2522,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 } }; @@ -2539,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: @@ -2603,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")); @@ -2659,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) @@ -2748,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 */) @@ -2773,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]; @@ -2795,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 */) @@ -2977,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) @@ -3001,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) { @@ -3012,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"); @@ -3186,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..8728c0e77 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,54 @@ 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; + 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() && _GroupContainers.size() > 1) + { + group = _GroupContainers[groupIndex].second; + _BaseContainer->attachContainer(group); + } + group->attachContainer(_Peoples[k].Container); } } @@ -299,34 +332,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 +387,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 +412,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 +448,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 +481,169 @@ 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(); + + // 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 + { + 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; + propName = (char*) xmlGetProp(node, (xmlChar*)"name"); + CXMLAutoPtr propGroup; + propGroup = (char*) 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 != 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()))); + 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*/) { @@ -607,7 +804,12 @@ void CPeopleList::removeAllPeoples() { _BaseContainer->removeAllContainers(); } + for (uint k = 0; k < _GroupContainers.size(); ++k) + { + _GroupContainers[k].second->removeAllContainers(); + } NLMISC::contReset(_Peoples); + NLMISC::contReset(_GroupContainers); } //================================================================== @@ -617,12 +819,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 32317b6b8..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) */ @@ -151,19 +156,21 @@ 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(); } }; typedef std::vector TPeopleVect; private: CGroupContainerPtr _BaseContainer; + std::vector > > _GroupContainers; NLMISC::CRefPtr _ChatWindow; TPeopleVect _Peoples; CPeopleListDesc::TContactType _ContactType; 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); 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: diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index 926ed61b1..f21d84bb7 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"; @@ -1280,6 +1280,19 @@ void CPatchManager::readDescFile(sint32 nVersion) CBNPFileSet &bnpFS = const_cast(DescFile.getFiles()); + // TODO: .ref files are expected to follow platform category naming (they are in 'main' category) + std::set::const_iterator it; + for(it = forceRemovePatchCategories.begin(); it != forceRemovePatchCategories.end(); ++it) + { + std::string name = *it; + std::string::size_type pos = name.find("_"); + if (pos != std::string::npos) + { + name = name.substr(pos+1) + "_.ref"; + bnpFS.removeFile(name); + } + } + for (cat = 0; cat < DescFile.getCategories().categoryCount();) { const CBNPCategory &bnpCat = DescFile.getCategories().getCategory(cat); @@ -1354,7 +1367,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 +2689,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 +2757,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) { // can not load the 7zip file, use normal patching usePatchFile = true; + haveAllreadyTryiedDownloadingOfFile = true; break; } @@ -2754,6 +2769,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) { // fallback to standard patch method usePatchFile = true; + haveAllreadyTryiedDownloadingOfFile = true; break; } } @@ -2766,6 +2782,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,34 +2891,109 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) sTranslate = CI18N::get("uiApplyingDelta") + " " + CFile::getFilename(PatchName); pPM->setState(true, sTranslate); - xDeltaPatch(PatchName, SourceNameXD, OutFilename); - - if (rFTP.LocalFileExists) - pPM->deleteFile(SourceName); - pPM->deleteFile(PatchName); + bool deltaPatchResult = xDeltaPatch(PatchName, SourceNameXD, OutFilename); - 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); + } + } } else { @@ -2915,7 +3007,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 +3033,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..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(); @@ -547,7 +546,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); }; /** 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) { 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 diff --git a/code/ryzom/common/src/game_share/fame.cpp b/code/ryzom/common/src/game_share/fame.cpp index cd9e2b850..19c3cbb80 100644 --- a/code/ryzom/common/src/game_share/fame.cpp +++ b/code/ryzom/common/src/game_share/fame.cpp @@ -534,7 +534,7 @@ void CStaticFames::loadTribeThreshold( const string& filename ) // check table structure uint nbTribe = ws.size()-2; nlassert(nbTribe<=_FameTableSize); - nlassert(ws.ColCount == 16); // 5 ( 4 people + neutral ) * 3 cult + 1 for tribe name + nlassert(ws.ColCount == 17); // 5 ( 4 people + neutral ) * 3 cult + 1 for tribe name + marauder _TribeCultThresholdPerCiv.resize(nbTribe); @@ -548,7 +548,7 @@ void CStaticFames::loadTribeThreshold( const string& filename ) _TribeCultThresholdPerCiv[i-2].FameIndex = index; - for( uint c=1; csetMarauder(thresholdMarauder*6000); } } } diff --git a/code/ryzom/common/src/game_share/fame.h b/code/ryzom/common/src/game_share/fame.h index fde8611b8..c0cc856bb 100644 --- a/code/ryzom/common/src/game_share/fame.h +++ b/code/ryzom/common/src/game_share/fame.h @@ -52,26 +52,30 @@ public: Kami = 0; Karavan = 0; Neutral = 0; + Marauder = 0; } void setKami(sint32 t) { Kami = t; } void setKaravan(sint32 t) { Karavan = t; } void setNeutral(sint32 t) { Neutral = t; } + void setMarauder(sint32 t) { Marauder = t; } sint32 getKami() const { return Kami; } sint32 getKaravan() const { return Karavan; } sint32 getNeutral() const { return Neutral; } + sint32 getMarauder() const { return Marauder; } private: sint32 Kami; sint32 Karavan; sint32 Neutral; + sint32 Marauder; }; class CTribeCultThresholdPerCiv { public: - bool getCultThresholdForCiv( PVP_CLAN::TPVPClan civ, sint32& kami, sint32& karavan, sint32& neutral) const + bool getCultThresholdForCiv( PVP_CLAN::TPVPClan civ, sint32& kami, sint32& karavan, sint32& neutral, sint32& marauder) const { const CTribeCultThreshold * tc = 0; switch( civ ) @@ -88,12 +92,16 @@ public: case PVP_CLAN::Neutral: tc = &Neutral; break; + case PVP_CLAN::Marauder: + tc = &Marauder; + break; default: return false; } kami = tc->getKami(); karavan = tc->getKaravan(); neutral = tc->getNeutral(); + marauder = tc->getMarauder(); return true; } @@ -103,6 +111,7 @@ public: CTribeCultThreshold Tryker; CTribeCultThreshold Zorai; CTribeCultThreshold Neutral; + CTribeCultThreshold Marauder; }; // declare scoped constant value diff --git a/code/ryzom/common/src/game_share/magic_fx.h b/code/ryzom/common/src/game_share/magic_fx.h index 2a46475e8..414a6586a 100644 --- a/code/ryzom/common/src/game_share/magic_fx.h +++ b/code/ryzom/common/src/game_share/magic_fx.h @@ -136,6 +136,7 @@ namespace MAGICFX OtherFireWall = 14, TeleportKami = 15, // No effect aura TeleportKara = 16, // No effect aura + TeleportMarauder = 17, // No effect aura }; } diff --git a/code/ryzom/tools/client/client_patcher/main.cpp b/code/ryzom/tools/client/client_patcher/main.cpp index e7d57a335..21fc58959 100644 --- a/code/ryzom/tools/client/client_patcher/main.cpp +++ b/code/ryzom/tools/client/client_patcher/main.cpp @@ -191,7 +191,8 @@ struct CClientPatcherTranslations : public NLMISC::CI18N::ILoadProxy }; // hardcoded URL to not depend on external files -static const std::string PatchUrl = RYZOM_CLIENT_PATCH_URL; // "https://cdn.ryzom.dev/open/patch"; +static const std::string DefaultPatchUrl = RYZOM_CLIENT_PATCH_URL; // "https://cdn.ryzom.dev/open/patch"; +static const std::string DefaultAppName = RYZOM_CLIENT_APP_NAME; // "default" int main(int argc, char *argv[]) { @@ -200,9 +201,40 @@ 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"); + Args.addArg("", "url", "PatchUrl", "Patch server url, ie 'https://dl.ryzom.com/patch_live'"); + Args.addArg("", "app", "Application", "Patch application name for version file, ie 'ryzom_live' requests ryzom_live.version from PatchUrl"); if (!Args.parse(argc, argv)) return 1; + if (Args.haveArg("p") && Args.haveArg("s") && Args.haveArg("d")) + { + 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); @@ -240,16 +272,32 @@ int main(int argc, char *argv[]) // now translations are read, we don't need it anymore delete trans; + // create minimal client.cfg file in memory for patcher + { + CConfigFile::CVar patchUrl; + patchUrl.forceAsString(DefaultPatchUrl); + if (Args.haveLongArg("url") && !Args.getLongArg("url").empty()) + patchUrl.forceAsString(Args.getLongArg("url").front()); + + CConfigFile::CVar appName; + appName.forceAsString(DefaultAppName); + if (Args.haveLongArg("app") && !Args.getLongArg("app").empty()) + appName.forceAsString(Args.getLongArg("app").front()); + + ClientCfg.ConfigFile.insertVar("PatchUrl", patchUrl); + ClientCfg.ConfigFile.insertVar("Application", appName); + } + + // Args.displayVersion(); 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(); + printf("Using '%s/%s.version'\n", ClientCfg.ConfigFile.getVar("PatchUrl").asString().c_str(), + ClientCfg.ConfigFile.getVar("Application").asString().c_str()); // use PatchUrl vector patchURLs; - pPM->init(patchURLs, PatchUrl, ""); + pPM->init(patchURLs, ClientCfg.ConfigFile.getVar("PatchUrl").asString(), ""); pPM->startCheckThread(true /* include background patchs */); ucstring state;