From 8ba8fc9f606a1c2a2d78bd59125bb8c2c99ffa59 Mon Sep 17 00:00:00 2001 From: Nuno Date: Fri, 29 Oct 2021 13:55:06 +0200 Subject: [PATCH] Merge branch 'new_features' into main/atys-live --- .../mission_manager/mission_template.cpp | 37 ++++++++++++++++++- .../mission_manager/mission_template.h | 3 ++ .../mission_manager/missions_commands.cpp | 5 ++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/ryzom/server/src/entities_game_service/mission_manager/mission_template.cpp b/ryzom/server/src/entities_game_service/mission_manager/mission_template.cpp index fdd591e17..19116f328 100644 --- a/ryzom/server/src/entities_game_service/mission_manager/mission_template.cpp +++ b/ryzom/server/src/entities_game_service/mission_manager/mission_template.cpp @@ -476,6 +476,8 @@ bool CMissionTemplate::build(const NLLIGO::IPrimitive* prim,CMissionGlobalParsin ret = parseItemList( i+1, ";",script, Prerequisits.Wear , missionData.ChatParams) && ret; else if ( script[0] == "req_item" ) ret = parseItemList( i+1, ";",script, Prerequisits.Own , missionData.ChatParams) && ret; + else if ( script[0] == "req_item_quality" ) + ret = parseQualityList( i+1, ";",script, Prerequisits.OwnQuality , missionData.ChatParams) && ret; else if ( script[0] == "req_guild" ) Prerequisits.Guild = true; else if ( script[0] == "req_title" ) @@ -1886,13 +1888,21 @@ uint32 CMissionTemplate::testPrerequisits( CCharacter * user, CPrerequisitInfos { // if( equip[j] != NULL && equip[j]->getSheetId() == Prerequisits.Own[i] ) if( equip->getItem(j) != NULL && equip->getItem(j)->getSheetId() == Prerequisits.Own[i] ) - break; + { + if (Prerequisits.OwnQuality.size() > i) + { + if (equip->getItem(j)->quality() >= Prerequisits.OwnQuality[i]) + break; + } + else + break; + } } if ( j == equip->getSlotCount() ) { if (logOnFail) MISDBG("%s Require bag item at %uth req_item line", sDebugPrefix.c_str(), i); - + if (returnValue == MISSION_DESC::PreReqSuccess) { if (!fillPrereqInfos) @@ -2690,6 +2700,29 @@ bool CMissionTemplate::parseItemList(uint32 line, const std::string & separator } }// CMissionTemplate parseItemList + +bool CMissionTemplate::parseQualityList(uint32 line, const std::string & separator, const std::vector< std::string > & script, std::vector< float > & ret, std::vector< std::pair< std::string, STRING_MANAGER::TParamType > > & chatParams ) +{ + if ( script.size() != 2 ) + { + MISLOGSYNTAXERROR1("*[%s]", separator.c_str()); + return false; + } + else + { + std::vector< std::string > args; + NLMISC::splitString(script[1],separator,args); + for ( uint j = 0; j < args.size(); j++ ) + { + float value; + NLMISC::fromString(args[j], value); + ret.push_back( value ); + } + return true; + } +}// CMissionTemplate parseQualityList + + bool CMissionTemplate::parseTitlePrereq(uint32 line, const std::vector< std::string > & script ) { if ( script.size() != 2 ) diff --git a/ryzom/server/src/entities_game_service/mission_manager/mission_template.h b/ryzom/server/src/entities_game_service/mission_manager/mission_template.h index 85e109227..7b55e0f7e 100644 --- a/ryzom/server/src/entities_game_service/mission_manager/mission_template.h +++ b/ryzom/server/src/entities_game_service/mission_manager/mission_template.h @@ -234,6 +234,8 @@ public: std::vector< NLMISC::CSheetId > Wear; /// item that must be owned std::vector< NLMISC::CSheetId > Own; + /// item quality that must be owned + std::vector< float > OwnQuality; /// title that must be displayed by the player CHARACTER_TITLE::ECharacterTitle Title; /// fame prerequisits @@ -398,6 +400,7 @@ private: // bool parseChatParamList( const std::string & separator, const std::vector< std::string > & preparsedParams, TVectorParamCheck & ret ); /// parse a list of items bool parseItemList(uint32 line, const std::string & separator, const std::vector< std::string > & preparsedParams, std::vector< NLMISC::CSheetId > & ret, std::vector< std::pair< std::string, STRING_MANAGER::TParamType > > & chatParams ); + bool parseQualityList(uint32 line, const std::string & separator, const std::vector< std::string > & script, std::vector< float > & ret, std::vector< std::pair< std::string, STRING_MANAGER::TParamType > > & chatParams ); /// parse player title prereq bool parseTitlePrereq(uint32 line, const std::vector< std::string > & preparsedParams ); /// parse the minimum fame diff --git a/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp b/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp index f6bdd5795..1d6d86273 100644 --- a/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp +++ b/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp @@ -801,6 +801,7 @@ NLMISC_COMMAND(getItemList, "get list of items of character by filter", " [ inventories.push_back(selectedInv); } } else { + inventories.push_back(INVENTORIES::temporary); inventories.push_back(INVENTORIES::handling); inventories.push_back(INVENTORIES::equipment); inventories.push_back(INVENTORIES::bag); @@ -2962,11 +2963,13 @@ NLMISC_COMMAND(spawnArkMission,"spawn Mission"," " uint8 result = CMissionManager::getInstance()->instanciateMission(c, missionAlias, giverAlias, eventList); if (!result) { - c->processMissionEventList(eventList,true, CAIAliasTranslator::Invalid); + c->processMissionEventList(eventList,true, CAIAliasTranslator::Invalid); log.displayNL("OK"); } else + { log.displayNL("ERR: %d", result); + } return true; }