Beispiel #1
0
// Génération d'un item spécial
void GenerateSpecialItem( int numMP, const CSString& nomMP, const MPCraftStats& craftStats, 
						  const CSString& loc,CSString& itemData, int variation )
{
	CSString info, code, name;
	info = itemData.splitTo( "/", true ).toLower();

	if ( loc.left(1) == "I" )
		code = "ixx";
	else if ( loc.left(1) == "D" )
		code = "dxa";
	else
		code = "cxx";

	CreateSheet( numMP, nomMP, code, info.c_str()[0], info.c_str()[1]-'a', craftStats, true, variation );

	name = toString( "m%04d%s%s%02d\t", numMP, code.c_str(), info.c_str(), variation ); 
	name += itemData.splitTo( "/", true ); // singulier
	name += "\t";
	name += itemData.splitTo( "/", true ); // article indéfini
	name += "\t";
	name += itemData.splitTo( "/", true ); // article défini
	name += "\t";
	name += itemData.splitTo( "/", true ); // pluriel
	name += "\t\t";
	name += itemData.splitTo( "/", true ); // article pluriel

	itemNames.insert( name );
}
Beispiel #2
0
// Pour une MP se trouvant dans des déposits, génération de ses items
void GenerateDepositItems( int numMP, const CSString& nomMP, const MPCraftStats& craftStats, const CSString& loc )
{
	CSString code;

	if ( loc.left(1) == "I" )
		code = "ixx";
	else if ( loc.left(1) == "D" )
		code = "dxa";
	else
		code = "cxx";

	// pas de craft = items de mission
	if ( craftStats.Craft == "" )
	{
		if ( loc != "G" )
			CreateSheet( numMP, nomMP, code, 'c', 0, craftStats );
		
		for ( int i=1; i<6; i++ )
		{
			CreateSheet( numMP, nomMP, code, 'c', i, craftStats );
		}
	}
	else
	{
		// 2 items dans common
		CreateSheet( numMP, nomMP, code, 'c', 1, craftStats );
		CreateSheet( numMP, nomMP, code, 'c', 2, craftStats );

		// 3 items par zone
		for ( int i=0; i<3; i++ )
		{
			CreateSheet( numMP, nomMP, code, 'd', 3+i, craftStats );
			CreateSheet( numMP, nomMP, code, 'f', 3+i, craftStats );
			CreateSheet( numMP, nomMP, code, 'j', 3+i, craftStats );
			CreateSheet( numMP, nomMP, code, 'l', 3+i, craftStats );
			CreateSheet( numMP, nomMP, code, 'p', 3+i, craftStats );
		}
	}
}
Beispiel #3
0
	void fillBitMemStream( const CCharacterInfos *charInfo,CStringManager::TLanguages language, const CStringManager::TReplacement &rep, NLMISC::CBitMemStream &bms)
	{
		if ( EId == CEntityId::Unknown && _AIAlias != 0)
		{							
			CAIAliasManager& aiAliasMgr = IOS->getAIAliasManager();
			if (aiAliasMgr.is(_AIAlias)) 
			{

				static const string NAME("name");
				CSString format = rep.Format;
				if (format.left(4) != NAME)
				{
					// can't replace this parameter, write a del char
					const static string s("\010");
					uint32 index = SM->storeString(s);
					bms.serial(index);
					return;
				}
				else
				{
					uint32 index ;
					index = aiAliasMgr.getShortNameIndex(_AIAlias);
					if (index)
					{
						bms.serial(index);
						return;
					}
					index = aiAliasMgr.getTitleIndex(_AIAlias, language);
					if (index)
					{
						bms.serial(index);
						return;
					}
				}
				// No translated title or translated phrase found send ''
				//		ucstring temp(EId.toString());
				const ucstring NoName("''");
				uint32 index = SM->storeString(NoName);
				bms.serial(index);
				return;
			}
		}

		if (EId.getType() == RYZOMID::player || EId.getType() == RYZOMID::npc)
		{	
			CCharacterInfos	*playerInfo = IOS->getCharInfos(EId);
			if (playerInfo != 0)
			{
				static const string NAME("name");
				CSString format = rep.Format;
				if (format.left(4) != NAME)
				{
					// can't replace this parameter, write a del char
					const static string s("\010");
					uint32 index = SM->storeString(s);
					bms.serial(index);
					return;
				}
				else
				{
					if (!playerInfo->ShortName.empty())
					{
						uint32 index = playerInfo->ShortNameIndex;
						bms.serial(index);
						return;
					}
					if (!playerInfo->Title.empty())
					{
						uint32 index = SM->translateTitle(playerInfo->Title, language);
						// we must match this index against the function table
						bms.serial(index);
						return;
					}
				}
			}
		}

		// special case fauna entity or unnamed npc (i.e. npc not registered with a character name, like fauna in npc state machine)
		if (EId.getType() == RYZOMID::creature || EId.getType() == RYZOMID::npc)
		{
			// a big FAKE
			STRING_MANAGER::TParamType realType = ParamId.Type;
			ParamId.Type = STRING_MANAGER::creature;
			CParameterTraits::fillBitMemStream(charInfo, language, rep, bms);

			// restore normal type
			ParamId.Type = realType;
			return;
		}

		// no info on the name, just send the EID as string.
//		ucstring temp(EId.toString());
		const ucstring NoName("''");
		uint32 index = SM->storeString(NoName);
		bms.serial(index);
	}
Beispiel #4
0
// Nouvelle MP à traiter
void NewMP( CSString& ligne )
{
	CSString nomMP, groupe, loc, icon, overlay, special, stat, specialAttributes;
	MPCraftStats craftStats;
	CExtraInfo	extraInfo;
	int numMP;
	bool specialOnly = false;
	CSortedStringSet specialNames;

	// nouveau nom de famille
	nomMP = ligne.splitTo( ";", true );
	if ( nomMP == "" )
	{
		// cette ligne ne contient pas d'info
		return;
	}
	
	// récupération des infos
	groupe = ligne.splitTo( ";", true );
	craftStats.Craft = ligne.splitTo( ";", true );
	specialAttributes= ligne.splitTo( ";" , true );
	parseSpecialAttributes(specialAttributes, craftStats, extraInfo);
	ligne.splitTo( ";" , true );
	loc = ligne.splitTo( ";" , true );
	icon = ligne.splitTo( ";", true );
	ligne.splitTo( ";", true );
	ligne.splitTo( ";", true );
	ligne.splitTo( ";", true );

	stat = ligne.splitTo( ";", true );
	if ( stat.firstWord() != "" )
		craftStats.bestStatA = stat.atoi();
	else
		craftStats.bestStatA = -1;

	stat = ligne.splitTo( ";", true );
	if ( stat.firstWord() != "" )
		craftStats.worstStatA1 = stat.atoi();
	else
		craftStats.worstStatA1 = -1;

	stat = ligne.splitTo( ";", true );
	if ( stat.firstWord() != "" )
		craftStats.worstStatA2 = stat.atoi();
	else
		craftStats.worstStatA2 = -1;

	stat = ligne.splitTo( ";", true );
	if ( stat.firstWord() != "" )
		craftStats.bestStatB = stat.atoi();
	else
		craftStats.bestStatB = -1;

	stat = ligne.splitTo( ";", true );
	if ( stat.firstWord() != "" )
		craftStats.worstStatB1 = stat.atoi();
	else
		craftStats.worstStatB1 = -1;

	stat = ligne.splitTo( ";", true );
	if ( stat.firstWord() != "" )
		craftStats.worstStatB2 = stat.atoi();
	else
		craftStats.worstStatB2 = -1;

	stat = ligne.splitTo( ";", true );
	craftStats.color = stat.firstWord().atoi();

	stat = ligne.splitTo( ";", true );
	specialOnly = stat.firstWord().contains( "x" );
	
	// cas particuliers
	while ( ligne != "" )
	{
		if ( !ligne.contains( ";" ) ) 
		{
			special = ligne;
			if ( special.firstWord() != "" )
				specialNames.insert( special );
			ligne = "";
		}
		else
		{
			special = ligne.splitTo( ";", true );
			if ( special != "" )
				specialNames.insert( special );
		}
	}


	currentDocItem.push( DtRMFamily, nomMP );
	currentDocItem.push( DtGroup, groupe );
	
	// récupréation du numéro de MP
	numMP = GetNumeroMP( nomMP );
	printf( "    Processing Family %d : %s\n", numMP, nomMP.c_str() );

	GetNumeroGroupe( groupe );


	// Add the MPFamily into the list
	if(numMP>=(sint)MPFamilies.size())
		MPFamilies.resize(numMP+1);
	MPFamilies[numMP].Name= nomMP;
	MPFamilies[numMP].Icon= icon;

	
	// MP trouvées dans les déposits ou dans la goo
	if ( loc.left(1) != "C" )
	{
		if ( !specialOnly )
		{
			// Génération des items
			GenerateDepositItems( numMP, nomMP, craftStats, loc );
		}
		
		// on enregistre les items se trouvant dans les deposits
		if ( loc.left(1) == "D" )
		{
			CSString output;
			output.writeToFile( toString( "%s%s_%d.mp", DEPOSIT_MPS.c_str(), nomMP.toLower().replace( " ", "_" ).c_str(), numMP ) );
		}

		overlay = nomMP.firstWord().toUpper().left(6);
	}
	// MP trouvées sur les creature
	else
	{
		GenerateCreatureItems( numMP, nomMP, craftStats );
	}


	// items spéciaux
	CSString codeSpecial, nouveauCode;
	int variation = 1;
	CSortedStringSet::const_iterator it = specialNames.begin();

	while ( it != specialNames.end() )
	{
		CSString name = (*it);
		
		nouveauCode = name.left(2).toLower();

		if ( nouveauCode == codeSpecial )
			variation++;
		else
			variation = 1;

		GenerateSpecialItem( numMP, nomMP, craftStats, loc, name, variation );
		codeSpecial = nouveauCode;
		it++;
	}
		
		
	// Création de la fiche parente pour la MP
	CreateParentSItem( numMP, nomMP, groupe, extraInfo.DropOrSell, icon, overlay );

	currentDocItem.reset( DtRMFamily );
	currentDocItem.reset( DtGroup );
	currentDocItem.reset( DtProp );
	currentDocItem.reset( DtCreature );
}