From de8c9dddcbd6ec6b824bef7ccb9dc1c799e98c18 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Thu, 30 Jan 2020 23:00:23 +0100 Subject: [PATCH] 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;