From 188c3494fa533e0201837d8313802426aadd99e3 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Thu, 2 Jan 2020 23:19:11 +0100 Subject: [PATCH 01/12] Added: New way to add icons in Contextual Menus --- code/nel/include/nel/gui/group_menu.h | 6 ++- code/nel/src/gui/group_menu.cpp | 63 ++++++++++++++++++++++----- 2 files changed, 56 insertions(+), 13 deletions(-) diff --git a/code/nel/include/nel/gui/group_menu.h b/code/nel/include/nel/gui/group_menu.h index 9c5b37589..70761d650 100644 --- a/code/nel/include/nel/gui/group_menu.h +++ b/code/nel/include/nel/gui/group_menu.h @@ -31,7 +31,7 @@ namespace NLGUI class CViewBitmap; class CGroupList; class CGroupMenu; - + class CGroupSubMenu; /** * CViewTextMenu is an element of a sub menu @@ -50,6 +50,7 @@ namespace NLGUI _Checked = false; _Checkable = false; _CheckBox = NULL; + _ParentMenu = NULL; Over = false; } @@ -60,6 +61,8 @@ namespace NLGUI bool getCheckable() const { return _Checkable; } void setCheckable(bool c); void setCheckBox(CViewBitmap *checkBox) { _CheckBox = checkBox; } + void setParentMenu(CGroupSubMenu *parentMenu) { _ParentMenu = parentMenu; }; + void setActive (bool g); CViewBitmap * getCheckBox() const { return _CheckBox; } bool getFormatted () const { return getMultiLine (); } @@ -86,6 +89,7 @@ namespace NLGUI bool _Grayed; bool _Checked; bool _Checkable; + CGroupSubMenu *_ParentMenu; }; /** diff --git a/code/nel/src/gui/group_menu.cpp b/code/nel/src/gui/group_menu.cpp index c7db05e4f..90416571c 100644 --- a/code/nel/src/gui/group_menu.cpp +++ b/code/nel/src/gui/group_menu.cpp @@ -114,6 +114,19 @@ namespace NLGUI OldShadowColorGrayed.A = OldColorGrayed.A = (uint8)a; } + // ------------------------------------------------------------------------------------------------ + void CViewTextMenu::setActive (bool state) + { + if (_ParentMenu) + _ParentMenu->setActive(state); + + if (_Active != state) + { + _Active = state; + invalidateCoords(); + } + } + // ------------------------------------------------------------------------------------------------ // CGroupSubMenu // ------------------------------------------------------------------------------------------------ @@ -290,6 +303,9 @@ namespace NLGUI if (cond) strCond = (const char*)cond; CXMLAutoPtr params((const char*) xmlGetProp (cur, (xmlChar*)"params")); if (params) strParams = (const char*)params; + CXMLAutoPtr icon((const char*) xmlGetProp (cur, (xmlChar*)"icon")); + if (icon) + strTexture = (const char*)icon; CXMLAutoPtr strCheckable((const char*) xmlGetProp (cur, (xmlChar*)"checkable")); bool bCheckable = false; if (strCheckable) bCheckable = convertBool (strCheckable); @@ -393,11 +409,11 @@ namespace NLGUI pVB->setSerializable( false ); pVB->setParent (this); pVB->setParentPos (parentPos); - pVB->setParentPosRef (Hotspot_ML); - pVB->setPosRef (Hotspot_MR); + pVB->setParentPosRef (Hotspot_BL); + pVB->setPosRef (Hotspot_BR); pVB->setTexture(texture); pVB->setModulateGlobalColor(false); - pVB->setX (-2); + pVB->setX (MENU_WIDGET_X); addView (pVB); return pVB; } @@ -639,12 +655,14 @@ namespace NLGUI // *** Update Text Positions // sint32 currX = 0; + sint32 maxTextW = 0; for(k = 0; k < _Lines.size(); ++k) { if (_Lines[k].ViewText) { // Setup Y _Lines[k].ViewText->setY(_Lines[k].TextDY); + maxTextW = max(maxTextW, _Lines[k].ViewText->getW()); } } @@ -658,10 +676,12 @@ namespace NLGUI // *** Setup SubMenus and CheckBoxes Positions sint32 maxViewW = 0; + for (i = 1; i < _Views.size(); ++i) { CViewBitmap *pVB = dynamic_cast(_Views[i]); if (pVB == NULL) continue; + if (pVB->getId() == ID_MENU_SUBMENU) { // Look for the next line of the menu that contains a sub menu @@ -1250,6 +1270,7 @@ namespace NLGUI _GroupList->addChild (pV); CViewBitmap *checkBox = NULL; + CViewBitmap *icon = NULL; if (checkable) { @@ -1258,15 +1279,6 @@ namespace NLGUI pV->setCheckBox(checkBox); } - CViewBitmap *icon = NULL; - if (!texture.empty()) - { - if (_GroupList->getNumChildren() == 1) - pV->setX(20); - icon = createIcon(pV, texture); - } - - tmp.ViewText = pV; tmp.Separator = NULL; tmp.AHName = ah; @@ -1280,12 +1292,39 @@ namespace NLGUI tmp.Id = id; pV->setId(_GroupMenu->getId()+":"+tmp.Id); + + { + typedef std::pair TTmplParams; + std::vector vparams; + uint lineIndex = _Lines.size()-1; + vparams.push_back(TTmplParams("id", toString("icon%d", lineIndex))); + vparams.push_back(TTmplParams("sizeref", "")); + vparams.push_back(TTmplParams("icon_texture", texture.c_str())); + //vparams.push_back(TTmplParams("icon_color", options.ColorNormal.toString())); + string lineId = toString("%s:icon%d", _GroupMenu->getId().c_str(), lineIndex); + + CInterfaceGroup *pUGLeft = CWidgetManager::getInstance()->getParser()->createGroupInstance("menu_row_icon", lineId, vparams); + if (pUGLeft) + { + tmp.UserGroupLeft = pUGLeft; + tmp.UserGroupLeftOwnership = true; + addGroup(pUGLeft); + pUGLeft->setParent(this); + pUGLeft->setParentPos(this); + pUGLeft->setParentPosRef (Hotspot_BL); + pUGLeft->setPosRef (Hotspot_BL); + pUGLeft->setX(LEFT_MENU_WIDGET_X); + } + } + _Lines.push_back (tmp); + // Add an empty sub menu by default _SubMenus.push_back (NULL); + _GroupMenu->invalidateCoords(); return pV; From 30fabcbd0a6b90099546e74bbabcfb87722e63b4 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Fri, 3 Jan 2020 01:18:29 +0100 Subject: [PATCH 02/12] Changed: Improvements in game context menu --- code/ryzom/client/src/game_context_menu.cpp | 38 +++++++++++++++++---- code/ryzom/client/src/game_context_menu.h | 3 ++ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/code/ryzom/client/src/game_context_menu.cpp b/code/ryzom/client/src/game_context_menu.cpp index a8c1d9322..13e3484d7 100644 --- a/code/ryzom/client/src/game_context_menu.cpp +++ b/code/ryzom/client/src/game_context_menu.cpp @@ -34,6 +34,7 @@ #include "interface_v3/inventory_manager.h" #include "motion/user_controls.h" #include "sheet_manager.h" +#include "connection.h" // GAME SHARE #include "game_share/constants.h" #include "game_share/properties.h" @@ -141,6 +142,9 @@ void CGameContextMenu::init(const std::string &srcMenuId) _TextQuitTeam = "ui:interface:" + menuId + ":quit_team"; _TextAddToFriendList = "ui:interface:" + menuId + ":add_to_friend_list"; _TextTalk = "ui:interface:" + menuId + ":talk"; + _TextInvisible = "ui:interface:" + menuId + ":invisible"; + _TextInvulnerable = "ui:interface:" + menuId + ":invulnerable"; + _TextGod = "ui:interface:" + menuId + ":god"; // Mission DB and Text link @@ -257,6 +261,18 @@ void CGameContextMenu::update() setupContextMenuCantTalk(); // can't talk by default + bool showGMOptions = (hasPrivilegeDEV() || hasPrivilegeSGM() || hasPrivilegeGM() || hasPrivilegeVG() || hasPrivilegeSG() || hasPrivilegeEM() || hasPrivilegeEG() || hasPrivilegeOBSERVER()); + + if (_TextInvisible) + _TextInvisible->setActive(showGMOptions); + + if (_TextInvulnerable) + _TextInvulnerable->setActive(showGMOptions); + + if (_TextGod) + _TextGod->setActive(showGMOptions); + + // If mode Combat (no talk, no give, no mount, no extract_rm) if(UserEntity->isFighting()) { @@ -391,7 +407,7 @@ void CGameContextMenu::update() if(_TextExchange) { // Action possible only if the client is not already busy and the selection is able to do this with you.. - if(selection && selection->properties().canExchangeItem()) + if(selection && selection->isPlayer() && selection->properties().canExchangeItem()) _TextExchange->setActive(!UserEntity->isBusy()); else _TextExchange->setActive(false); @@ -415,6 +431,9 @@ void CGameContextMenu::update() if (_TextAttack) _TextAttack->setActive(canAttack()); + if (_TextNews) + _TextNews->setActive(!canAttack()); + if (_TextDuel && _TextUnDuel) { if ((!UserEntity->isRiding()) && (_ServerInDuel->getValue8() != 0)) @@ -494,7 +513,7 @@ void CGameContextMenu::update() { bool invitable = false; // User should not be flagged as invitable by himself, so no need to check that selection is not the user - if(selection && selection->properties().invitable() && propValidation.invitable() ) + if(selection && selection->isPlayer() && selection->properties().invitable() && propValidation.invitable() ) { invitable = true; } @@ -605,6 +624,7 @@ void CGameContextMenu::update() // Apply real activation of Talk Texts. applyTextTalk(); + } // *************************************************************************** @@ -715,8 +735,15 @@ void CGameContextMenu::updateContextMenuMissionsOptions( bool forceHide ) { result = NLMISC::CI18N::get("uiMissionOptionNotReceived"); } - pVTM->setText(result); - pVTM->setActive(true); + if (result == ucstring("Qui etes-vous ?")) + { + pVTM->setActive(false); + } + else + { + pVTM->setText(result); + pVTM->setActive(true); + } } else { @@ -856,7 +883,7 @@ void CGameContextMenu::updateContextMenuTalkEntries(uint options) options = std::numeric_limits::max(); // in local mode, force all options to be shown (for debug) } // news - _OkTextNews= ((options & (1 << BOTCHATTYPE::NewsFlag))); + _OkTextNews= true; //((options & (1 << BOTCHATTYPE::NewsFlag))); // trade _OkTextTradeItem= ((options & (1 << BOTCHATTYPE::TradeItemFlag)) != 0); _OkTextTradeTeleport= ((options & (1 << BOTCHATTYPE::TradeTeleportFlag)) != 0); @@ -907,7 +934,6 @@ void CGameContextMenu::setupContextMenuTalkWithPlayer() // *************************************************************************** void CGameContextMenu::applyTextTalk() { - if (_TextNews) _TextNews->setActive(_OkTextNews); if (_TextTradeItem) _TextTradeItem->setActive(_OkTextTradeItem); if (_TextTradeTeleport) _TextTradeTeleport->setActive(_OkTextTradeTeleport); if (_TextTradeFaction) _TextTradeFaction->setActive(_OkTextTradeFaction); diff --git a/code/ryzom/client/src/game_context_menu.h b/code/ryzom/client/src/game_context_menu.h index 0f628b6bf..315326417 100644 --- a/code/ryzom/client/src/game_context_menu.h +++ b/code/ryzom/client/src/game_context_menu.h @@ -155,6 +155,9 @@ private: CViewTextMenuPtr _TextOutpostBanishPlayer; CViewTextMenuPtr _TextOutpostBanishGuild; CViewTextMenuPtr _TextWebPage; + CViewTextMenuPtr _TextInvisible; + CViewTextMenuPtr _TextInvulnerable; + CViewTextMenuPtr _TextGod; CViewTextMenuPtr _TextMissionRing[BOTCHATTYPE::MaxR2MissionEntryDatabase]; // Forage source From 6a7fc98a5264bc3d6174cdb7e68c4f99c4ec0024 Mon Sep 17 00:00:00 2001 From: karu Date: Mon, 6 Jan 2020 19:55:08 +0200 Subject: [PATCH 03/12] Added: Show disabled until timer on icon --- .../client/src/interface_v3/dbctrl_sheet.cpp | 39 +++++++++++++++++++ .../client/src/interface_v3/dbctrl_sheet.h | 3 ++ 2 files changed, 42 insertions(+) diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 8a3064a12..a5a07420f 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -535,6 +535,9 @@ CCtrlDraggable(param) _SapBuffIcon = "ico_sap.tga"; _StaBuffIcon = "ico_stamina.tga"; _FocusBuffIcon = "ico_focus.tga"; + + _RegenText = NULL; + _RegenTextValue = 0; } // ---------------------------------------------------------------------------- @@ -2040,6 +2043,12 @@ void CDBCtrlSheet::draw() if (!_LastSheetId) { _RegenTickRange = CTickRange(); + if (_RegenText) + { + delete _RegenText; + _RegenText = NULL; + _RegenTextValue = 0; + } } else { @@ -2066,6 +2075,36 @@ void CDBCtrlSheet::draw() { rVR.drawQuad(_RenderLayer + 1, regenTris[tri], backTex, CRGBA::White, false); } + + if (!_RegenText) { + _RegenText = new CViewText(CViewBase::TCtorParam()); + _RegenText->setId(getId() + ":regen"); + _RegenText->setParent(_Parent); + _RegenText->setOverflowText(ucstring("")); + _RegenText->setModulateGlobalColor(false); + _RegenText->setMultiLine(false); + _RegenText->setTextMode(CViewText::ClipWord); + _RegenText->setFontSizing("0", "0"); + // TODO: font size / color hardcoded. + _RegenText->setFontSize(8); + _RegenText->setColor(CRGBA::White); + _RegenText->setShadow(true); + _RegenText->setActive(true); + _RegenText->updateTextContext(); + } + + // TODO: ticks in second hardcoded + uint32 nextValue = _RegenTickRange.EndTick > LastGameCycle ? (_RegenTickRange.EndTick - LastGameCycle) / 10 : 0; + if (_RegenTextValue != nextValue) + { + _RegenTextValue = nextValue; + _RegenText->setText(toString("%d", _RegenTextValue)); + _RegenText->updateTextContext(); + } + _RegenText->setXReal(_XReal+1); + _RegenText->setYReal(_YReal+2); + _RegenText->setRenderLayer(_RenderLayer+2); + _RegenText->draw(); } } diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.h b/code/ryzom/client/src/interface_v3/dbctrl_sheet.h index 28d7a1ddf..4abc16f4b 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.h +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.h @@ -51,6 +51,7 @@ class COutpostBuildingSheet; namespace NLGUI { class CViewRenderer; + class CViewText; } class CDBCtrlSheet; @@ -731,6 +732,8 @@ protected: sint8 _ArmourColorIndex; CTickRange _RegenTickRange; + NLGUI::CViewText *_RegenText; + uint32 _RegenTextValue; /// D'n'd sint32 _DragX, _DragY; From 10f864b234ad41f17802ad2c27ac943298bf6019 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Mon, 13 Jan 2020 12:24:28 +0100 Subject: [PATCH 04/12] Fixed: Remove blank space when an item menu are inactive --- code/nel/src/gui/group_menu.cpp | 42 ++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/code/nel/src/gui/group_menu.cpp b/code/nel/src/gui/group_menu.cpp index 90416571c..d09eec039 100644 --- a/code/nel/src/gui/group_menu.cpp +++ b/code/nel/src/gui/group_menu.cpp @@ -592,11 +592,14 @@ namespace NLGUI { // compute max height of widgets on the left of text sint32 widgetMaxH = 0; - if (_Lines[k].UserGroupRight) widgetMaxH = _Lines[k].UserGroupRight->getHReal(); - if (_Lines[k].UserGroupLeft) widgetMaxH = std::max(widgetMaxH, _Lines[k].UserGroupLeft->getHReal()); - if (_Lines[k].CheckBox) widgetMaxH = std::max(widgetMaxH, _Lines[k].CheckBox->getHReal()); - if (_Lines[k].RightArrow) widgetMaxH = std::max(widgetMaxH, _Lines[k].RightArrow->getHReal()); - widgetMaxH = std::max(widgetMaxH, _Lines[k].ViewText->getHReal()); + if (_Lines[k].ViewText->getActive()) + { + if (_Lines[k].UserGroupRight) widgetMaxH = _Lines[k].UserGroupRight->getHReal(); + if (_Lines[k].UserGroupLeft) widgetMaxH = std::max(widgetMaxH, _Lines[k].UserGroupLeft->getHReal()); + if (_Lines[k].CheckBox) widgetMaxH = std::max(widgetMaxH, _Lines[k].CheckBox->getHReal()); + if (_Lines[k].RightArrow) widgetMaxH = std::max(widgetMaxH, _Lines[k].RightArrow->getHReal()); + widgetMaxH = std::max(widgetMaxH, _Lines[k].ViewText->getHReal()); + } _GroupList->setMaxH(widgetMaxH*_MaxVisibleLine+_GroupList->getSpace()*(_MaxVisibleLine-1)); if (_ScrollBar == NULL) { @@ -639,16 +642,21 @@ namespace NLGUI { // compute max height of widgets on the left of text sint32 widgetMaxH = 0; - if (_Lines[k].UserGroupRight) widgetMaxH = _Lines[k].UserGroupRight->getHReal(); - if (_Lines[k].UserGroupLeft) widgetMaxH = std::max(widgetMaxH, _Lines[k].UserGroupLeft->getHReal()); - if (_Lines[k].CheckBox) widgetMaxH = std::max(widgetMaxH, _Lines[k].CheckBox->getHReal()); - if (_Lines[k].RightArrow) widgetMaxH = std::max(widgetMaxH, _Lines[k].RightArrow->getHReal()); - - sint32 textHReal= _Lines[k].ViewText->getHReal(); - _Lines[k].HReal= max(widgetMaxH, textHReal); - _Lines[k].TextDY= textDYPos; + sint32 textHReal = 0; + if (_Lines[k].ViewText->getActive()) + { + if (_Lines[k].UserGroupRight) widgetMaxH = _Lines[k].UserGroupRight->getHReal(); + if (_Lines[k].UserGroupLeft) widgetMaxH = std::max(widgetMaxH, _Lines[k].UserGroupLeft->getHReal()); + if (_Lines[k].CheckBox) widgetMaxH = std::max(widgetMaxH, _Lines[k].CheckBox->getHReal()); + if (_Lines[k].RightArrow) widgetMaxH = std::max(widgetMaxH, _Lines[k].RightArrow->getHReal()); + + textHReal = _Lines[k].ViewText->getHReal(); + } + + _Lines[k].HReal = max(widgetMaxH, textHReal); + _Lines[k].TextDY = textDYPos; if(widgetMaxH>textHReal) - _Lines[k].TextDY+= (widgetMaxH-textHReal) / 2; + _Lines[k].TextDY += (widgetMaxH-textHReal) / 2; } } @@ -1244,7 +1252,7 @@ namespace NLGUI pV->setCaseMode(_GroupMenu->getCaseMode()); if (formatted) { - pV->setMultiLine (true); + pV->setMultiLine (true); pV->setMultiLineMaxWOnly (true); pV->setTextFormatTaged (name); } @@ -1299,9 +1307,9 @@ namespace NLGUI uint lineIndex = _Lines.size()-1; vparams.push_back(TTmplParams("id", toString("icon%d", lineIndex))); vparams.push_back(TTmplParams("sizeref", "")); - vparams.push_back(TTmplParams("icon_texture", texture.c_str())); + vparams.push_back(TTmplParams("icon_texture", texture)); //vparams.push_back(TTmplParams("icon_color", options.ColorNormal.toString())); - string lineId = toString("%s:icon%d", _GroupMenu->getId().c_str(), lineIndex); + string lineId = toString("%s:icon", pV->getId().c_str()); CInterfaceGroup *pUGLeft = CWidgetManager::getInstance()->getParser()->createGroupInstance("menu_row_icon", lineId, vparams); if (pUGLeft) From 9e5f20a67945cee3218f7372a6cd7ae510b58bc1 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Mon, 13 Jan 2020 12:54:50 +0100 Subject: [PATCH 05/12] Fixed: missing check --- code/ryzom/client/src/game_context_menu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/game_context_menu.cpp b/code/ryzom/client/src/game_context_menu.cpp index 13e3484d7..cc6ccffc8 100644 --- a/code/ryzom/client/src/game_context_menu.cpp +++ b/code/ryzom/client/src/game_context_menu.cpp @@ -432,8 +432,8 @@ void CGameContextMenu::update() _TextAttack->setActive(canAttack()); if (_TextNews) - _TextNews->setActive(!canAttack()); - + _TextNews->setActive(selection && !canAttack()); + if (_TextDuel && _TextUnDuel) { if ((!UserEntity->isRiding()) && (_ServerInDuel->getValue8() != 0)) From f5c0cbcdf39a519b8e8bef4d5075e0e23613d5e9 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Wed, 15 Jan 2020 19:21:28 +0200 Subject: [PATCH 06/12] Changed: Also show item parts quantity on craft sbrick info window --- code/ryzom/client/src/interface_v3/action_handler_help.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_help.cpp b/code/ryzom/client/src/interface_v3/action_handler_help.cpp index 43797b960..ac1480e0c 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -3053,7 +3053,7 @@ void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText) // Display the part this slot build. mpInfo+= "@{T4}"; - mpInfo+= RM_FABER_TYPE::toLocalString(mpSlot.FaberTypeFilter); + mpInfo+= toString("%dx ", mpSlot.Quantity) + RM_FABER_TYPE::toLocalString(mpSlot.FaberTypeFilter); mpInfo+= "\n"; } // replace in brickText @@ -3074,7 +3074,7 @@ void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText) // Display the required item mpInfo+= "@{T4}"; - mpInfo+= STRING_MANAGER::CStringManagerClient::getItemLocalizedName(mpSlot.ItemRequired); + mpInfo+= toString("%dx ", mpSlot.Quantity) + STRING_MANAGER::CStringManagerClient::getItemLocalizedName(mpSlot.ItemRequired); mpInfo+= "\n"; } // replace in brickText From 45b1bab23fdd0e103cde08f8b0496a91eaf243f5 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Tue, 21 Jan 2020 15:01:42 +0100 Subject: [PATCH 07/12] Changed: Updated PrintfCommands for next Season --- code/ryzom/client/client_default.cfg | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/code/ryzom/client/client_default.cfg b/code/ryzom/client/client_default.cfg index 7431807cf..66c260273 100644 --- a/code/ryzom/client/client_default.cfg +++ b/code/ryzom/client/client_default.cfg @@ -416,23 +416,15 @@ SystemInfoColors = }; PrintfCommands = { - "52", "15", "55 55 0 255", "28", "uiChapterV", "624", - "428", "0 0 0 255", "18", "", "624", "378", - "0 0 0 255", "14", "", "644", "278", "0 0 0 255", - "18", "", "52", "17", "255 255 255 255", "28", - "uiChapterV", "622", "430", "255 255 255 255", "18", "", - "622", "380", "255 255 255 255", "14", "", "642", - "280", "255 255 255 255", "18", "" + "0", "132", "30 144 255 255", "18", "uiS2", + "0", "105", "255 188 0 255", "14", "uiS2E0", + "0", "65", "255 255 255 255", "12", "NEWS" }; PrintfCommandsFreeTrial = { - "52", "15", "55 55 0 255", "28", "uiChapterV", "624", - "428", "0 0 0 255", "18", "", "624", "378", - "0 0 0 255", "14", "", "644", "278", "0 0 0 255", - "18", "", "52", "17", "255 255 255 255", "28", - "uiChapterV", "622", "430", "255 255 255 255", "18", "", - "622", "380", "255 255 255 255", "14", "", "642", - "280", "255 255 255 255", "18", "" + "0", "132", "30 144 255 255", "18", "uiS2", + "0", "105", "255 188 0 255", "14", "uiS2E0", + "0", "65", "255 255 255 255", "12", "NEWS" }; DisplayMissingAnimFile = 0; From 954151ca7328fd9d19550a327f4f5433ee4dbd4b Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Tue, 21 Jan 2020 15:04:43 +0100 Subject: [PATCH 08/12] Added: new way to manage news at loading screen --- code/ryzom/client/src/global.cpp | 1 + code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp | 11 +++++++++++ code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h | 1 + code/ryzom/client/src/progress.cpp | 10 ++++++++-- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/global.cpp b/code/ryzom/client/src/global.cpp index 4b8e1aad7..d5113e0a9 100644 --- a/code/ryzom/client/src/global.cpp +++ b/code/ryzom/client/src/global.cpp @@ -78,6 +78,7 @@ std::vector LogoBitmaps; extern uint TipsOfTheDayIndex; extern ucstring TipsOfTheDay; +extern string NewsAtProgress; extern bool UseEscapeDuringLoading; CProgress::CProgress () @@ -379,10 +380,15 @@ void CProgress::internalProgress (float value) float x = 0.5f;//((*itpc).X / 1024.f); float y = ((*itpc).Y / 768.f); TextContext->setColor( (*itpc).Color ); - TextContext->setFontSize( (uint)(16.f * fontFactor)); + TextContext->setFontSize( (uint)((*itpc).FontSize * fontFactor)); // build the ucstr(s) - ucstring ucstr = CI18N::get((*itpc).Text); + string text = (*itpc).Text; + ucstring ucstr; + if (text == "NEWS") + ucstr.fromUtf8(NewsAtProgress); + else + ucstr = CI18N::get(text); vector vucstr; ucstring sep("\n"); splitUCString(ucstr,sep,vucstr); From 4675b8b8b95cbaddd03767872cebf7b6d4db7160 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Tue, 21 Jan 2020 15:04:43 +0100 Subject: [PATCH 09/12] Added: new way to manage news at loading screen --- code/ryzom/client/src/global.cpp | 1 + code/ryzom/client/src/global.h | 1 + code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp | 11 +++++++++++ code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h | 1 + code/ryzom/client/src/progress.cpp | 10 ++++++++-- 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/global.cpp b/code/ryzom/client/src/global.cpp index 4b8e1aad7..d5113e0a9 100644 --- a/code/ryzom/client/src/global.cpp +++ b/code/ryzom/client/src/global.cpp @@ -78,6 +78,7 @@ std::vector LogoBitmaps; extern uint TipsOfTheDayIndex; extern ucstring TipsOfTheDay; +extern string NewsAtProgress; extern bool UseEscapeDuringLoading; CProgress::CProgress () @@ -379,10 +380,15 @@ void CProgress::internalProgress (float value) float x = 0.5f;//((*itpc).X / 1024.f); float y = ((*itpc).Y / 768.f); TextContext->setColor( (*itpc).Color ); - TextContext->setFontSize( (uint)(16.f * fontFactor)); + TextContext->setFontSize( (uint)((*itpc).FontSize * fontFactor)); // build the ucstr(s) - ucstring ucstr = CI18N::get((*itpc).Text); + string text = (*itpc).Text; + ucstring ucstr; + if (text == "NEWS") + ucstr.fromUtf8(NewsAtProgress); + else + ucstr = CI18N::get(text); vector vucstr; ucstring sep("\n"); splitUCString(ucstr,sep,vucstr); From f9738713a7848c4db5568def0d74e4bcf0f965e2 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Thu, 30 Jan 2020 22:59:02 +0100 Subject: [PATCH 10/12] Changed: replace PrintfCommands by loadingTexts in cff to prevent overwrite of default values in user client.cfg --- code/ryzom/client/client_default.cfg | 8 +----- code/ryzom/client/src/client_cfg.cpp | 42 +++++++++++----------------- code/ryzom/client/src/client_cfg.h | 4 +-- code/ryzom/client/src/progress.cpp | 7 ++--- 4 files changed, 22 insertions(+), 39 deletions(-) diff --git a/code/ryzom/client/client_default.cfg b/code/ryzom/client/client_default.cfg index 66c260273..444f8d20a 100644 --- a/code/ryzom/client/client_default.cfg +++ b/code/ryzom/client/client_default.cfg @@ -415,13 +415,7 @@ SystemInfoColors = "R2_INVITE","0 255 0 255 around", // Ring invitation }; -PrintfCommands = { - "0", "132", "30 144 255 255", "18", "uiS2", - "0", "105", "255 188 0 255", "14", "uiS2E0", - "0", "65", "255 255 255 255", "12", "NEWS" -}; - -PrintfCommandsFreeTrial = { +loadingTexts = { "0", "132", "30 144 255 255", "18", "uiS2", "0", "105", "255 188 0 255", "14", "uiS2E0", "0", "65", "255 255 255 255", "12", "NEWS" diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index 7f0222088..bcb6384de 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -1413,36 +1413,28 @@ void CClientConfig::setValues() #ifndef RZ_NO_CLIENT // printf commands in loading screens - ClientCfg.PrintfCommands.clear(); - ClientCfg.PrintfCommandsFreeTrial.clear(); - std::vector< std::string > printfCommands(2); - printfCommands[0] = "PrintfCommands"; - printfCommands[1] = "PrintfCommandsFreeTrial"; - for(uint p=0; p<2; p++) + ClientCfg.loadingTexts.clear(); + CConfigFile::CVar *pc = ClientCfg.ConfigFile.getVarPtr("loadingTexts"); + if (pc) { - CConfigFile::CVar *pc = ClientCfg.ConfigFile.getVarPtr(printfCommands[p].c_str()); - if (pc) + if( pc->size()%5 == 0 && pc->size() >= 5) { - if( pc->size()%5 == 0 && pc->size() >= 5) + for (uint i = 0; i < pc->size(); i+=5) { - for (uint i = 0; i < pc->size(); i+=5) - { - SPrintfCommand pcom; - pcom.X = pc->asInt(i); - pcom.Y = pc->asInt(i+1); - pcom.Color = CRGBA::stringToRGBA( pc->asString(i+2).c_str() ); - pcom.FontSize = pc->asInt(i+3); - pcom.Text = pc->asString(i+4); - - if(p==0) ClientCfg.PrintfCommands.push_back( pcom ); - else ClientCfg.PrintfCommandsFreeTrial.push_back( pcom ); - } - } - else - { - cfgWarning(("Missing or too many parameters in " + printfCommands[p]).c_str()); + SPrintfCommand pcom; + pcom.X = pc->asInt(i); + pcom.Y = pc->asInt(i+1); + pcom.Color = CRGBA::stringToRGBA( pc->asString(i+2).c_str() ); + pcom.FontSize = pc->asInt(i+3); + pcom.Text = pc->asString(i+4); + + ClientCfg.loadingTexts.push_back( pcom ); } } + else + { + cfgWarning("Missing or too many parameters in loadingTexts"); + } } #endif diff --git a/code/ryzom/client/src/client_cfg.h b/code/ryzom/client/src/client_cfg.h index 7c1fa2ad6..896d0bffd 100644 --- a/code/ryzom/client/src/client_cfg.h +++ b/code/ryzom/client/src/client_cfg.h @@ -699,9 +699,7 @@ struct CClientConfig uint FontSize; std::string Text; }; - std::vector PrintfCommands; - - std::vector PrintfCommandsFreeTrial; + std::vector loadingTexts; // funny loading messages count uint16 LoadingStringCount; diff --git a/code/ryzom/client/src/progress.cpp b/code/ryzom/client/src/progress.cpp index fd46c8183..8847a87a9 100644 --- a/code/ryzom/client/src/progress.cpp +++ b/code/ryzom/client/src/progress.cpp @@ -367,15 +367,14 @@ void CProgress::internalProgress (float value) // apply text commands if( ApplyTextCommands ) { - std::vector printfCommands = ClientCfg.PrintfCommands; - if(FreeTrial) printfCommands = ClientCfg.PrintfCommandsFreeTrial; + std::vector loadingTexts = ClientCfg.loadingTexts; - if( !printfCommands.empty() ) + if( !loadingTexts.empty() ) { TextContext->setHotSpot(UTextContext::MiddleBottom); vector::iterator itpc; - for( itpc = printfCommands.begin(); itpc != printfCommands.end(); ++itpc ) + for( itpc = loadingTexts.begin(); itpc != loadingTexts.end(); ++itpc ) { float x = 0.5f;//((*itpc).X / 1024.f); float y = ((*itpc).Y / 768.f); From 15ce2cd39c1cd0ac446654c41d253901c0955b36 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Thu, 30 Jan 2020 23:00:23 +0100 Subject: [PATCH 11/12] Added: new option to chat with npc when fame are < -30. Finish fast and temporary hack for who_am_i hide --- code/ryzom/client/src/game_context_menu.cpp | 39 +++++++++++++++++++-- code/ryzom/client/src/game_context_menu.h | 1 + 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/code/ryzom/client/src/game_context_menu.cpp b/code/ryzom/client/src/game_context_menu.cpp index cc6ccffc8..e685f9638 100644 --- a/code/ryzom/client/src/game_context_menu.cpp +++ b/code/ryzom/client/src/game_context_menu.cpp @@ -30,6 +30,7 @@ #include "interface_v3/bot_chat_manager.h" #include "interface_v3/guild_manager.h" #include "interface_v3/people_interraction.h" +#include "continent_manager.h" #include "main_loop.h" #include "interface_v3/inventory_manager.h" #include "motion/user_controls.h" @@ -48,6 +49,7 @@ using namespace NLMISC; using namespace std; +extern CContinentManager ContinentMngr; // filter available programs depending on R2 mode static uint32 filterAvailablePrograms(uint32 src) @@ -165,6 +167,7 @@ void CGameContextMenu::init(const std::string &srcMenuId) // BotChat menus _TextNews = "ui:interface:" + menuId + ":news"; + _TextNewsAgressive = "ui:interface:" + menuId + ":news_aggressive"; _TextTradeItem = "ui:interface:" + menuId + ":trade_item"; _TextTradeTeleport = "ui:interface:" + menuId + ":trade_teleport"; _TextTradeFaction = "ui:interface:" + menuId + ":trade_faction"; @@ -431,9 +434,35 @@ void CGameContextMenu::update() if (_TextAttack) _TextAttack->setActive(canAttack()); + + // get current continent to check fame + string continent = ContinentMngr.cur()->SheetName; + sint8 fameValue = 0; + uint fameIndex; + nlinfo("continent = %s", continent.c_str()); + if (continent == "matis.continent") + fameIndex = CStaticFames::getInstance().getFactionIndex("matis"); + else if (continent == "fyros.continent") + fameIndex = CStaticFames::getInstance().getFactionIndex("fyros"); + else if (continent == "tryker.continent") + fameIndex = CStaticFames::getInstance().getFactionIndex("tryker"); + else if (continent == "zorai.continent") + fameIndex = CStaticFames::getInstance().getFactionIndex("zorai"); + + if (fameIndex != CStaticFames::INVALID_FACTION_INDEX) + { + CCDBNodeLeaf *pLeafFame = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:FAME:PLAYER%d:VALUE", fameIndex), false); + if (pLeafFame != NULL) + fameValue = pLeafFame->getValue8(); + } + nlinfo("fame = %d", fameValue); if (_TextNews) - _TextNews->setActive(selection && !canAttack()); - + _TextNews->setActive(selection && !canAttack() && !selection->isForageSource() && fameValue >= -30); + + if (_TextNewsAgressive) + _TextNewsAgressive->setActive(selection && !canAttack() && !selection->isForageSource() && fameValue < -30); + + if (_TextDuel && _TextUnDuel) { if ((!UserEntity->isRiding()) && (_ServerInDuel->getValue8() != 0)) @@ -735,7 +764,11 @@ void CGameContextMenu::updateContextMenuMissionsOptions( bool forceHide ) { result = NLMISC::CI18N::get("uiMissionOptionNotReceived"); } - if (result == ucstring("Qui etes-vous ?")) + if (result == ucstring("Qui etes-vous ?") + || result == ucstring("Wer bist Du?") + || result == ucstring("Who are you?") + || result == ucstring("Quién eres tú?") + || result == ucstring("Кто ты?")) { pVTM->setActive(false); } diff --git a/code/ryzom/client/src/game_context_menu.h b/code/ryzom/client/src/game_context_menu.h index 315326417..6ddc2200d 100644 --- a/code/ryzom/client/src/game_context_menu.h +++ b/code/ryzom/client/src/game_context_menu.h @@ -132,6 +132,7 @@ private: // BotChat and player talk CViewTextMenuPtr _TextNews; + CViewTextMenuPtr _TextNewsAgressive; CViewTextMenuPtr _TextTradeItem; CViewTextMenuPtr _TextTradeTeleport; CViewTextMenuPtr _TextTradeFaction; From de8c9dddcbd6ec6b824bef7ccb9dc1c799e98c18 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Thu, 30 Jan 2020 23:00:23 +0100 Subject: [PATCH 12/12] Added: new option to chat with npc when fame are < -30. Finish fast and temporary hack for who_am_i hide --- code/ryzom/client/src/game_context_menu.cpp | 38 +++++++++++++++++++-- code/ryzom/client/src/game_context_menu.h | 1 + 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/code/ryzom/client/src/game_context_menu.cpp b/code/ryzom/client/src/game_context_menu.cpp index cc6ccffc8..3b42ccea8 100644 --- a/code/ryzom/client/src/game_context_menu.cpp +++ b/code/ryzom/client/src/game_context_menu.cpp @@ -30,6 +30,7 @@ #include "interface_v3/bot_chat_manager.h" #include "interface_v3/guild_manager.h" #include "interface_v3/people_interraction.h" +#include "continent_manager.h" #include "main_loop.h" #include "interface_v3/inventory_manager.h" #include "motion/user_controls.h" @@ -48,6 +49,7 @@ using namespace NLMISC; using namespace std; +extern CContinentManager ContinentMngr; // filter available programs depending on R2 mode static uint32 filterAvailablePrograms(uint32 src) @@ -165,6 +167,7 @@ void CGameContextMenu::init(const std::string &srcMenuId) // BotChat menus _TextNews = "ui:interface:" + menuId + ":news"; + _TextNewsAgressive = "ui:interface:" + menuId + ":news_aggressive"; _TextTradeItem = "ui:interface:" + menuId + ":trade_item"; _TextTradeTeleport = "ui:interface:" + menuId + ":trade_teleport"; _TextTradeFaction = "ui:interface:" + menuId + ":trade_faction"; @@ -431,9 +434,34 @@ void CGameContextMenu::update() if (_TextAttack) _TextAttack->setActive(canAttack()); + + // get current continent to check fame + string continent = ContinentMngr.cur()->SheetName; + sint8 fameValue = 0; + uint fameIndex; + if (continent == "matis.continent") + fameIndex = CStaticFames::getInstance().getFactionIndex("matis"); + else if (continent == "fyros.continent") + fameIndex = CStaticFames::getInstance().getFactionIndex("fyros"); + else if (continent == "tryker.continent") + fameIndex = CStaticFames::getInstance().getFactionIndex("tryker"); + else if (continent == "zorai.continent") + fameIndex = CStaticFames::getInstance().getFactionIndex("zorai"); + + if (fameIndex != CStaticFames::INVALID_FACTION_INDEX) + { + CCDBNodeLeaf *pLeafFame = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:FAME:PLAYER%d:VALUE", fameIndex), false); + if (pLeafFame != NULL) + fameValue = pLeafFame->getValue8(); + } + if (_TextNews) - _TextNews->setActive(selection && !canAttack()); - + _TextNews->setActive(selection && !canAttack() && !selection->isForageSource() && fameValue >= -30); + + if (_TextNewsAgressive) + _TextNewsAgressive->setActive(selection && !canAttack() && !selection->isForageSource() && fameValue < -30); + + if (_TextDuel && _TextUnDuel) { if ((!UserEntity->isRiding()) && (_ServerInDuel->getValue8() != 0)) @@ -735,7 +763,11 @@ void CGameContextMenu::updateContextMenuMissionsOptions( bool forceHide ) { result = NLMISC::CI18N::get("uiMissionOptionNotReceived"); } - if (result == ucstring("Qui etes-vous ?")) + if (result == ucstring("Qui etes-vous ?") + || result == ucstring("Wer bist Du?") + || result == ucstring("Who are you?") + || result == ucstring("Quién eres tú?") + || result == ucstring("Кто ты?")) { pVTM->setActive(false); } diff --git a/code/ryzom/client/src/game_context_menu.h b/code/ryzom/client/src/game_context_menu.h index 315326417..6ddc2200d 100644 --- a/code/ryzom/client/src/game_context_menu.h +++ b/code/ryzom/client/src/game_context_menu.h @@ -132,6 +132,7 @@ private: // BotChat and player talk CViewTextMenuPtr _TextNews; + CViewTextMenuPtr _TextNewsAgressive; CViewTextMenuPtr _TextTradeItem; CViewTextMenuPtr _TextTradeTeleport; CViewTextMenuPtr _TextTradeFaction;