uint32 IMissionStepTemplate::sendRpStepText(CCharacter * user,const std::vector<uint32>& stepStates,const NLMISC::CEntityId & giver) { TVectorParamCheck params; string buffer; uint nbSteps = 0; const std::string* textPtr = NULL; _User = user; if ( !_RoleplayText.empty() ) { // build the param list getTextParams(nbSteps,(const std::string *&)textPtr,params,stepStates); params.reserve(params.size() + _AdditionalParams.size()); params.insert(params.end(), _AdditionalParams.begin(), _AdditionalParams.end()); if ( textPtr && !textPtr->empty() && (*textPtr)[textPtr->size()-1] == '_' ) { buffer = _RoleplayText + "_"; textPtr = &buffer; } else textPtr = &_RoleplayText; } if( !textPtr ) return 0; // solve dynamic names CMissionParser::solveEntitiesNames(params,user->getEntityRowId(),giver); // if the text was generated, compute its suffix if ( !textPtr->empty() && (*textPtr)[textPtr->size()-1] == '_' ) { std::string text = NLMISC::toString( "%s%u", textPtr->c_str(),nbSteps ); return STRING_MANAGER::sendStringToClient( user->getEntityRowId(),text,params); } else return STRING_MANAGER::sendStringToClient( user->getEntityRowId(),*textPtr,params); }// IMissionStepTemplate::sendRpStepText
uint32 IMissionStepTemplate::sendStepText(CCharacter * user,const std::vector<uint32>& stepStates,const NLMISC::CEntityId & giver) { TVectorParamCheck params; string buffer; uint nbSteps = 0; const std::string* textPtr = NULL; _User = user; // build the param list getTextParams(nbSteps,(const std::string *&)textPtr,params,stepStates); // If the text is overriden, add the overide parameters if ( !_OverridenText.empty() ) { if ( _AddDefaultParams ) { params.reserve(params.size() + _AdditionalParams.size()); params.insert(params.end(), _AdditionalParams.begin(), _AdditionalParams.end()); if ( textPtr && !textPtr->empty() && (*textPtr)[textPtr->size()-1] == '_' ) { buffer = _OverridenText + "_"; textPtr = &buffer; } else textPtr = &_OverridenText; } else { params = _AdditionalParams; textPtr = &_OverridenText; } } if( !textPtr ) return 0; // solve dynamic names CMissionParser::solveEntitiesNames(params,user->getEntityRowId(),giver); // if the text was generated, compute its suffix if ( !textPtr->empty() && (*textPtr)[textPtr->size()-1] == '_' ) { // if( !isAny() ) { std::string text = NLMISC::toString( "%s%u", textPtr->c_str(),nbSteps ); return STRING_MANAGER::sendStringToClient( user->getEntityRowId(),text,params); } // else // { // std::string text = NLMISC::toString( "%s%u", textPtr->c_str(),nbSteps ); // SM_STATIC_PARAMS_1(paramsAnyOr, STRING_MANAGER::dyn_string_id); // paramsAnyOr[0].StringId = STRING_MANAGER::sendStringToClient( user->getEntityRowId(),text,params); // return STRING_MANAGER::sendStringToClient( user->getEntityRowId(),"MISSION_GOAL_STEP_ANY_OR",paramsAnyOr); // } } else { // if( !isAny() ) { return STRING_MANAGER::sendStringToClient( user->getEntityRowId(),*textPtr,params); } // else // { // SM_STATIC_PARAMS_1(paramsAnyOr, STRING_MANAGER::dyn_string_id); // paramsAnyOr[0].StringId = STRING_MANAGER::sendStringToClient( user->getEntityRowId(),*textPtr,params); // return STRING_MANAGER::sendStringToClient( user->getEntityRowId(),"MISSION_GOAL_STEP_ANY_OR",paramsAnyOr); // } } }// IMissionStepTemplate::sendStepText