From aad1a6edd04816d70e6e0177f0d18d86b8d77abc Mon Sep 17 00:00:00 2001 From: Nuno Date: Mon, 17 May 2021 12:41:48 +0200 Subject: [PATCH] Merge branch 'ark' --- .../mission_manager/missions_commands.cpp | 3 + .../player_manager/character.cpp | 78 +++++++++++-------- 2 files changed, 50 insertions(+), 31 deletions(-) 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 78e361739..aa89247fe 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 @@ -2891,6 +2891,9 @@ NLMISC_COMMAND(spawnArkMission,"spawn Mission"," " return false; } + c->removeMission(missionAlias, 0, true); + c->removeMissionFromHistories(missionAlias); + c->endBotChat(); std::list< CMissionEvent* > eventList; diff --git a/ryzom/server/src/entities_game_service/player_manager/character.cpp b/ryzom/server/src/entities_game_service/player_manager/character.cpp index df301233c..7af9dd286 100644 --- a/ryzom/server/src/entities_game_service/player_manager/character.cpp +++ b/ryzom/server/src/entities_game_service/player_manager/character.cpp @@ -13774,11 +13774,11 @@ void CCharacter::abandonMission(uint8 indexClient) CCharacter::sendDynamicSystemMessage(_EntityRowId, "ABANDON_MISSION"); } - vector params = getCustomMissionParams(toUpper(templ->getMissionName())+"_CALLBACK"); + vector params = getCustomMissionParams(toUpper(templ->getMissionName())+"_CALLBACK"); if (params.size() >= 1) { if (mission->getFinished() && mission->getMissionSuccess()) - validateDynamicMissionStep(params[0]+"&result=SUCCESS"); + validateDynamicMissionStep(params[0]+"&result=FINABD"); else validateDynamicMissionStep(params[0]+"&result=ABD"); setCustomMissionParams(toUpper(templ->getMissionName())+"_CALLBACK", ""); @@ -14687,6 +14687,21 @@ void CCharacter::updateSavedMissions() mission->setClientIndex(idx); mission->putInGame(); mission->updateUsersJournalEntry(); + + sint32 x = 0; + sint32 y = 0; + string msg; + getPositionCheck(toUpper(templ->getMissionName()), x, y, msg); + + if (x != 0 && y != 0) + { + SM_STATIC_PARAMS_1(textParams, STRING_MANAGER::literal); + textParams[0].Literal.fromUtf8(msg); + uint32 txt = STRING_MANAGER::sendStringToClient(getEntityRowId(), "LITERAL", textParams ); + (*it).second->addCompassTarget((TAIAlias)txt,true,true); + } + + list eventList; for (map::iterator itStep = mission->getStepsBegin(); @@ -14725,16 +14740,31 @@ void CCharacter::updateSavedMissions() mission->setTaker(_EntityRowId); mission->putInGame(); + sint32 x = 0; + sint32 y = 0; + string msg; + getPositionCheck(toUpper(templ->getMissionName()), x, y, msg); + for (map::iterator itCompass = (*it).second->getCompassBegin(); itCompass != (*it).second->getCompassEnd(); ++itCompass) { TVectorParamCheck params(1); - sint32 x = 0; - sint32 y = 0; - string msg; - CCreature* c = CreatureManager.getCreature( - CAIAliasTranslator::getInstance()->getEntityId((*itCompass).second.getBotId())); + x = 0; + y = 0; + msg = ""; + + getPositionCheck(toUpper(templ->getMissionName()), x, y, msg); + if (x != 0 && y != 0) + { + SM_STATIC_PARAMS_1(textParams, STRING_MANAGER::literal); + textParams[0].Literal.fromUtf8(msg); + uint32 txt = STRING_MANAGER::sendStringToClient(getEntityRowId(), "LITERAL", textParams ); + PlayerManager.sendImpulseToClient(_Id, "JOURNAL:ADD_COMPASS", x, y, txt); + ++it; + continue; + } + CCreature* c = CreatureManager.getCreature(CAIAliasTranslator::getInstance()->getEntityId((*itCompass).second.getBotId())); if (c) { x = c->getState().X(); @@ -14746,36 +14776,22 @@ void CCharacter::updateSavedMissions() params[0].setEIdAIAlias(c->getId(), CAIAliasTranslator::getInstance()->getAIAlias(c->getId())); msg = "COMPASS_BOT"; uint32 txt = STRING_MANAGER::sendStringToClient(_EntityRowId, msg, params); - PlayerManager.sendImpulseToClient( - _Id, "JOURNAL:ADD_COMPASS_BOT", x, y, txt, c->getEntityRowId().getCompressedIndex()); + PlayerManager.sendImpulseToClient(_Id, "JOURNAL:ADD_COMPASS_BOT", x, y, txt, c->getEntityRowId().getCompressedIndex()); } else { - CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate((*it).second->getTemplateId()); - string textName; - getPositionCheck(toUpper(templ->getMissionName()), x, y, textName); - if (x != 0 && y != 0) + + CPlace* place = CZoneManager::getInstance().getPlaceFromId((uint16)(*itCompass).second.getPlace()); + if (place) { - SM_STATIC_PARAMS_1(textParams, STRING_MANAGER::literal); - textParams[0].Literal.fromUtf8(textName); - uint32 txt = STRING_MANAGER::sendStringToClient( c->getEntityRowId(), "LITERAL", textParams ); + x = place->getCenterX(); + y = place->getCenterY(); + params[0].Identifier = place->getName(); + params[0].Type = STRING_MANAGER::place; + msg = "COMPASS_PLACE"; + uint32 txt = STRING_MANAGER::sendStringToClient(_EntityRowId, msg, params); PlayerManager.sendImpulseToClient(_Id, "JOURNAL:ADD_COMPASS", x, y, txt); } - else - { - CPlace* place = CZoneManager::getInstance().getPlaceFromId((uint16)(*itCompass).second.getPlace()); - - if (place) - { - x = place->getCenterX(); - y = place->getCenterY(); - params[0].Identifier = place->getName(); - params[0].Type = STRING_MANAGER::place; - msg = "COMPASS_PLACE"; - uint32 txt = STRING_MANAGER::sendStringToClient(_EntityRowId, msg, params); - PlayerManager.sendImpulseToClient(_Id, "JOURNAL:ADD_COMPASS", x, y, txt); - } - } } }