// Retourne le numéro du groupe passé en paramètre int GetNumeroGroupe( const CSString& groupe ) { CSString result; char buffer[100]; char buffer2[100]; int res; // *** Get the group number, and add it to group.typ if not already done // on recherche si le groupe est présent // dans le fichier item_mp_group.typ sprintf( buffer, "%s\" Value=\"", groupe.c_str() ); result = GroupTypContent.splitFrom( buffer ); // si oui, on retourne son numéro de groupe if ( result != "" ) res = result.splitTo( "\"" ).atoi(); else { // sinon, on génère un nouveau numéro : // on recupère le dernier numéro de groupe (le max) result = GroupTypContent.splitTo( "<LOG>" ).right(10); result.splitTo( "\"", true ); result = result.splitTo( "\"" ); // on ajoute 1 pour avoir un numéro non utilisé res = result.atoi() + 1; // on ajoute la nouvelle MP : // dans le fichier item_mp_group.typ sprintf( buffer, "<DEFINITION Label=\"%s\" Value=\"%d\"/>\n<LOG>", groupe.c_str(), res ); GroupTypContent= GroupTypContent.replace( "<LOG>", buffer ); GroupTypContent.writeToFile( ITEM_MP_GROUPE_TYP ); } // *** Add the text in wk.uxt (if not done) // Exist in wk.uxt ??? sprintf( buffer, "mpgroup%d\t", res ); sprintf( buffer2, "mpgroup%d ", res ); // if not found if ( !WKContent.contains(buffer) && !WKContent.contains(buffer2) ) { // add it at end sprintf( buffer, "mpgroup%d\t\t\t[%s]\n\r\nmpSource", res, groupe.c_str() ); WKContent= WKContent.replace( "\r\nmpSource", buffer ); WKContent.writeToFile( WK_UXT ); } return res; }
// 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 ); }
// 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 ); }
/* * Return the key contained in the provided string returned by lookup() (without extension) */ CSString CWordsDictionary::getWordsKey( const CSString& resultStr ) { return resultStr.splitTo( ':' ); }
void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *pIS, ucstring &itemText, sint32 itemQuality) { // check if some effects are present on this item ucstring effects(""); uint i; for( i=0; i<pIS->Consumable.Properties.size(); ++i ) { CSString eff = pIS->Consumable.Properties[i]; if (eff == "") continue; // Get name id of effect CSString name = toUpper(eff.splitTo(':', true)); // Extract parameters from sheet vector<CSString> params; CSString param = eff.splitTo(':', true); while (param != "") { params.push_back(param); param = eff.splitTo(':', true); } if( name == "SP_CHG_CHARAC" ) { CHARACTERISTICS::TCharacteristics charac = CHARACTERISTICS::toCharacteristic(params[0]); string characUIId = "uiCaracId" + toString((uint8)charac); double param1, param2; fromString(params[1].c_str(), param1); fromString(params[2].c_str(), param2); sint32 bonus = (uint32)(param1 * itemQuality + param2); uint32 timeInSec; fromString(params[3].c_str(), timeInSec); ucstring result; if (bonus >= 0) result = CI18N::get("uiItemConsumableEffectUpCharac"); else result = CI18N::get("uiItemConsumableEffectDownCharac"); strFindReplace(result, "%charac", CI18N::get(characUIId)); strFindReplace(result, "%bonus", toString(bonus)); strFindReplace(result, "%minutes", toString(timeInSec/60)); strFindReplace(result, "%secondes", toString(timeInSec%60)); effects += result; effects += "\n"; } if ( name == "SP_LIFE_AURA" ) { uint16 regenMod; fromString(params[0].c_str(), regenMod); uint32 duration; fromString(params[1].c_str(), duration); uint32 radius; fromString(params[2].c_str(), radius); uint32 targetDisableTime; fromString(params[3].c_str(), targetDisableTime); uint32 userDisableTime; fromString(params[4].c_str(), userDisableTime); ucstring result = CI18N::get("uiItemConsumableEffectLifeAura"); strFindReplace(result, "%modifier", toString(regenMod)); strFindReplace(result, "%minutes", toString(duration/60)); strFindReplace(result, "%secondes", toString(duration%60)); strFindReplace(result, "%radius", toString(radius)); strFindReplace(result, "%targetDisableTime", toString(targetDisableTime)); strFindReplace(result, "%userDisableTime", toString(userDisableTime)); effects += result; effects += "\n"; } if ( name == "SP_STAMINA_AURA" ) { uint16 regenMod; fromString(params[0].c_str(), regenMod); uint32 duration; fromString(params[1].c_str(), duration); uint32 radius; fromString(params[2].c_str(), radius); uint32 targetDisableTime; fromString(params[3].c_str(), targetDisableTime); uint32 userDisableTime; fromString(params[4].c_str(), userDisableTime); ucstring result = CI18N::get("uiItemConsumableEffectStaminaAura"); strFindReplace(result, "%modifier", toString(regenMod)); strFindReplace(result, "%minutes", toString(duration/60)); strFindReplace(result, "%secondes", toString(duration%60)); strFindReplace(result, "%radius", toString(radius)); strFindReplace(result, "%targetDisableTime", toString(targetDisableTime)); strFindReplace(result, "%userDisableTime", toString(userDisableTime)); effects += result; effects += "\n"; } if ( name == "SP_SAP_AURA" ) { uint16 regenMod; fromString(params[0].c_str(), regenMod); uint32 duration; fromString(params[1].c_str(), duration); uint32 radius; fromString(params[2].c_str(), radius); uint32 targetDisableTime; fromString(params[3].c_str(), targetDisableTime); uint32 userDisableTime; fromString(params[4].c_str(), userDisableTime); ucstring result = CI18N::get("uiItemConsumableEffectSapAura"); strFindReplace(result, "%modifier", toString(regenMod)); strFindReplace(result, "%minutes", toString(duration/60)); strFindReplace(result, "%secondes", toString(duration%60)); strFindReplace(result, "%radius", toString(radius)); strFindReplace(result, "%targetDisableTime", toString(targetDisableTime)); strFindReplace(result, "%userDisableTime", toString(userDisableTime)); effects += result; effects += "\n"; } // skill modifier consumables //--------------------------- ucstring result(""); uint8 paramIdx = 0; if( name == "SP_MOD_DEFENSE" ) { if( toLower(params[0]) == "dodge" ) result = CI18N::get("uiItemConsumableEffectModDodgeSuccess"); else if( toLower(params[0]) == "parry" ) result = CI18N::get("uiItemConsumableEffectModParrySuccess"); else result = CI18N::get("uiItemConsumableEffectModDefenseSuccess"); paramIdx++; } if( name == "SP_MOD_MELEE_SUCCESS" ) { result = CI18N::get("uiItemConsumableEffectModMeleeSuccess"); } if( name == "SP_MOD_RANGE_SUCCESS" ) { result = CI18N::get("uiItemConsumableEffectModRangeSuccess"); } if( name == "SP_MOD_MAGIC_SUCCESS" ) { result = CI18N::get("uiItemConsumableEffectModMagicSuccess"); } if( name == "SP_MOD_CRAFT_SUCCESS" ) { result = CI18N::get("uiItemConsumableEffectModCraftSuccess"); } if( name == "SP_MOD_FORAGE_SUCCESS" ) { if( toLower(params[0]) == "commonecosystem" ) result = CI18N::get("uiItemConsumableEffectModForageSuccess"); if( toLower(params[0]) == "desert" ) result = CI18N::get("uiItemConsumableEffectModDesertForageSuccess"); if( toLower(params[0]) == "forest" ) result = CI18N::get("uiItemConsumableEffectModForestForageSuccess"); if( toLower(params[0]) == "lacustre" ) result = CI18N::get("uiItemConsumableEffectModLacustreForageSuccess"); if( toLower(params[0]) == "jungle" ) result = CI18N::get("uiItemConsumableEffectModJungleForageSuccess"); if( toLower(params[0]) == "primaryroot" ) result = CI18N::get("uiItemConsumableEffectModPrimaryRootForageSuccess"); paramIdx++; } if( !result.empty() ) { double param1, param2; fromString(params[paramIdx], param1); fromString(params[paramIdx+1], param2); sint32 modifier = (sint32)(param1 * itemQuality + param2); if( modifier < 0 ) strFindReplace(result, "%modifier", "@{E42F}-"+toString(modifier)+"@{FFFF}"); else strFindReplace(result, "%modifier", "@{0F0F}"+toString(modifier)+"@{FFFF}"); uint32 timeInSec; fromString(params[paramIdx+2], timeInSec); strFindReplace(result, "%minutes", toString(timeInSec/60)); strFindReplace(result, "%secondes", toString(timeInSec%60)); effects += result; effects += "\n"; } } // Display consumable effects info. strFindReplace(itemText, "%consumable_effects", effects); }