diff --git a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml
index 7faaf1fcf..5426361fa 100644
--- a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml
+++ b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml
@@ -707,6 +707,7 @@
+
diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild.cpp b/code/ryzom/server/src/entities_game_service/guild_manager/guild.cpp
index 2460eb530..a93bdaeb1 100644
--- a/code/ryzom/server/src/entities_game_service/guild_manager/guild.cpp
+++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild.cpp
@@ -795,7 +795,7 @@ bool CGuild::processGuildMissionStepEvent(std::list< CMissionEvent*> & eventList
return false;
}
// I don't know if i should pass _EId to this function
- CMissionEvent::TResult result = mission->processEvent( TheDataset.getDataSetRow( _EId) ,eventList,stepIndex );
+ CMissionEvent::TResult result = mission->processEvent(TheDataset.getDataSetRow(getHighestGradeOnlineUser()) /*TheDataset.getDataSetRow( _EId)*/ ,eventList,stepIndex );
if ( result == CMissionEvent::Nothing )
return false;
else if ( result == CMissionEvent::MissionFailed )
diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp
index bfb7c8d5a..31cf1ff0f 100644
--- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp
+++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp
@@ -4053,15 +4053,16 @@ protected:
TAIAlias Mission;
TAIAlias NPCOwner; // NPC giver the mission have to be attached at spawn time
+ bool Guild;
protected:
bool buildAction ( uint32 line, const std::vector< std::string > & script, CMissionGlobalParsingData & globalData, CMissionSpecificParsingData & missionData)
{
_SourceLine = line;
- if ( script.size() != 3 )
+ if ( script.size() != 3 && script.size() != 4)
{
- MISLOGSYNTAXERROR(" : ");
+ MISLOGSYNTAXERROR(" : [: guild]");
return false;
}
string name = CMissionParser::getNoBlankString( script[1] );
@@ -4094,6 +4095,17 @@ protected:
if (vRet.size() > 0)
NPCOwner = vRet[0];
+ // We check for the guild option
+ Guild = false;
+ for (std::vector< std::string >::const_iterator it = script.begin(); it != script.end(); ++it)
+ {
+ if (CMissionParser::getNoBlankString(*it) == "guild")
+ {
+ Guild = true;
+ break;
+ }
+ }
+
return true;
}
@@ -4104,13 +4116,13 @@ protected:
{
CAIAliasTranslator::getInstance()->getNPCNameFromAlias(instance->getGiver(), sDebugBotName);
nlassert(instance);
- CMissionEventAddMission * event = new CMissionEventAddMission( instance->getGiver(), Mission, mainMission );
+ CMissionEventAddMission * event = new CMissionEventAddMission( instance->getGiver(), Mission, mainMission, Guild );
eventList.push_back( event );
}
else
{
CAIAliasTranslator::getInstance()->getNPCNameFromAlias(NPCOwner, sDebugBotName);
- CMissionEventAddMission * event = new CMissionEventAddMission( NPCOwner, Mission, mainMission );
+ CMissionEventAddMission * event = new CMissionEventAddMission( NPCOwner, Mission, mainMission, Guild );
eventList.push_back( event );
}
LOGMISSIONACTION("spawn_mission bot:" + sDebugBotName + " newmiss:" + CPrimitivesParser::aliasToString(Mission)
diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_event.h b/code/ryzom/server/src/entities_game_service/mission_manager/mission_event.h
index f4aa2ffea..b32599a8a 100644
--- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_event.h
+++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_event.h
@@ -416,11 +416,12 @@ protected:
class CMissionEventAddMission: public CMissionEvent
{
public:
- CMissionEventAddMission( TAIAlias giver, TAIAlias mission, TAIAlias mainMission )
- :CMissionEvent(AddMission, TDataSetRow()) ,Giver(giver),Mission(mission),MainMission(mainMission) {}
+ CMissionEventAddMission( TAIAlias giver, TAIAlias mission, TAIAlias mainMission, bool guild )
+ :CMissionEvent(AddMission, TDataSetRow()) ,Giver(giver),Mission(mission),MainMission(mainMission), Guild(guild) {}
TAIAlias Mission;
TAIAlias Giver;
TAIAlias MainMission;
+ bool Guild;
protected:
friend class CMissionEvent;
bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log){return false;}
diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_guild.h b/code/ryzom/server/src/entities_game_service/mission_manager/mission_guild.h
index 76cd0cb6a..b8635d1d4 100644
--- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_guild.h
+++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_guild.h
@@ -32,7 +32,7 @@ public:
CMissionGuild() : _Chained(false) { }
- inline void setGuild( uint16 guildId );
+ inline void setGuild( uint32 guildId );
/// override
void updateUsersJournalEntry();
/// override
@@ -59,7 +59,7 @@ private:
bool _Chained;
};
-void CMissionGuild::setGuild( uint16 guildId )
+void CMissionGuild::setGuild( uint32 guildId )
{
_GuildId = guildId;
}
diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_misc.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_misc.cpp
index dc0be33d5..03ad33b28 100644
--- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_misc.cpp
+++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_misc.cpp
@@ -1165,7 +1165,17 @@ class CMissionStepDoMissions : public IMissionStepTemplate
for ( uint i = 0; i < subs.size(); i++ )
{
std::vector< std::string > params;
- NLMISC::splitString( subs[i]," \t", params );
+ //NLMISC::splitString( subs[i]," \t", params );
+ subs[i] = CMissionParser::getNoBlankString(subs[i]);
+ std::size_t pos = subs[i].find_first_of(" \t");
+ std::string str = subs[i].substr(0, pos);
+ params.push_back(str);
+ if (pos != std::string::npos)
+ str = subs[i].substr(pos + 1);
+ else
+ str = "";
+ params.push_back(str);
+ //std::size_t pos = _Missions[i].find_first_of(" \t");
_Missions[i].Mission = CMissionParser::getNoBlankString( params[0] );
if (params.size() > 1)
NLMISC::fromString(params[1], _Missions[i].NbNeedCompletion);
diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp
index b70eb3b88..2c0e38f80 100644
--- a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp
+++ b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp
@@ -11641,11 +11641,33 @@ bool CCharacter::processMissionEventList( std::list< CMissionEvent* > & eventLis
TAIAlias mission = eventSpe.Mission;
TAIAlias giver = eventSpe.Giver;
TAIAlias mainMission = eventSpe.MainMission;
+ bool missionForGuild = eventSpe.Guild;
// add mission event are always allocated on heap
delete ( CMissionEvent *) ( eventList.front() );
eventList.pop_front();
- CMissionManager::getInstance()->instanciateMission(this, mission, giver ,eventList, mainMission);
+
+ // If the mission is not for guild members we just instanciate it
+ if (!missionForGuild)
+ CMissionManager::getInstance()->instanciateMission(this, mission, giver ,eventList, mainMission);
+ else
+ {
+ // We find the guild and each guild members and we instanciate the mission for them
+ if (guild)
+ {
+ for ( std::map::iterator it = guild->getMembersBegin();
+ it != guild->getMembersEnd();++it )
+ {
+ CCharacter * guildUser = PlayerManager.getChar( it->first );
+ if ( !guildUser )
+ {
+ nlwarning( "cant find user %s", it->first.toString().c_str() );
+ continue;
+ }
+ CMissionManager::getInstance()->instanciateMission(guildUser, mission, giver ,eventList, mainMission);
+ }
+ }
+ }
}
// event may have been processed during instanciateMission
if ( eventList.empty() )
@@ -11667,7 +11689,7 @@ bool CCharacter::processMissionEventList( std::list< CMissionEvent* > & eventLis
}
// THIRD - Check with guild missions (if event not already processed and char belongs to a guild)
- if (!eventProcessed && (event.Restriction != CMissionEvent::NoGroup))
+ if (!eventProcessed)// && (event.Restriction != CMissionEvent::NoGroup))
{
if (guild != NULL)
eventProcessed = guild->processGuildMissionEvent(eventList, alias);
diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp
index dcd8bb9b3..4b8bce784 100644
--- a/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp
+++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp
@@ -254,6 +254,7 @@ class CActionSpawnMission : public IStepContent
protected:
string _MissionName;
string _GiverName;
+ bool _Guild;
private:
void getPredefParam(uint32 &numEntry, CPhrase::TPredefParams &predef)
{
@@ -268,17 +269,29 @@ public:
if (_GiverName.empty())
{
throw EParseException(prim, "giver_name is empty !");
- }
+ }
+
+ _Guild = md.getProperty(prim, "guild", false, true) == "true";
+ // Check: if _Guild is true then check if we are in a guild mission
+ if (_Guild && !md.isGuildMission())
+ {
+ string err = toString("primitive(%s): 'guild' option true 1 for non guild mission.", prim->getName().c_str());
+ throw EParseException(prim, err.c_str());
+ }
}
string genCode(CMissionData &md)
{
+ string ret = "";
if (!_MissionName.empty())
- return "spawn_mission : " + _MissionName + " : " + _GiverName + NL;
- else
- return string();
+ {
+ ret = "spawn_mission : " + _MissionName + " : " + _GiverName;
+ if (_Guild)
+ ret += " : guild";
+ ret += NL;
+ }
+ return ret;
}
-
};
REGISTER_STEP_CONTENT(CActionSpawnMission, "spawn_mission");