//----------------------------------------------- // build : // Build the sheet from an external script. //----------------------------------------------- void CMissionSheet::build(const NLGEORGES::UFormElm &item) { // Load the descriptors. if(!item.getValueByName(Name, "Name")) debug("key 'Name' not found."); if(!item.getValueByName(Description, "Description")) debug("key 'Description' not found."); if(!item.getValueByName(RewardDescription, "RewardDescription")) debug("key 'RewardDescription' not found."); // load mission steps description for (uint i =1; i< NB_STEPS_PER_MISSION + 1;i++) { const UFormElm * stepStruct; string varName = string("step") + NLMISC::toString(i); item.getNodeByName (&stepStruct, varName.c_str()); if (stepStruct) { string stepDesc; stepStruct->getValueByName(stepDesc,"Description"); if ( !stepDesc.empty() ) StepsDescription.push_back(stepDesc); } } }// build //
void CContinentParameters::buildFogMapBuild(const NLGEORGES::UFormElm &item) { item.getValueByName (FogMapBuild.Map[CFogMapBuild::Day], "FogDayMap"); item.getValueByName (FogMapBuild.Map[CFogMapBuild::Night], "FogNightMap"); item.getValueByName (FogMapBuild.Map[CFogMapBuild::Distance], "FogDistMap"); item.getValueByName (FogMapBuild.Map[CFogMapBuild::Depth], "FogDepthMap"); item.getValueByName (FogMapBuild.Map[CFogMapBuild::NoPrecipitation], "NoRainMap"); item.getValueByName (FogStart, "FogStart"); item.getValueByName (FogEnd, "FogEnd"); item.getValueByName (FogMapBuild.ZoneMin, "ZoneMin"); item.getValueByName (FogMapBuild.ZoneMax, "ZoneMax"); if (FogStart > FogEnd) { std::swap(FogStart, FogEnd); } if (!item.getValueByName (RootFogStart, "RootFogStart")) { RootFogStart = FogStart; } if (!item.getValueByName (RootFogEnd, "RootFogEnd")) { RootFogEnd = FogEnd; } if (RootFogStart > RootFogEnd) { std::swap(RootFogStart, RootFogEnd); } }
void CStreamSound::importForm(const std::string &filename, NLGEORGES::UFormElm &root) { // cannot do this debug check because used also by CStreamFileSound /*NLGEORGES::UFormElm *psoundType; std::string dfnName; // some basic checking. root.getNodeByName(&psoundType, ".SoundType"); nlassert(psoundType != NULL); psoundType->getDfnName(dfnName); nlassert(dfnName == "stream_sound.dfn");*/ // Call the base class CSound::importForm(filename, root); // MaxDistance root.getValueByName(_MaxDist, ".SoundType.MaxDistance"); // MinDistance root.getValueByName(_MinDist, ".SoundType.MinDistance"); // Alpha root.getValueByName(m_Alpha, ".SoundType.Alpha"); #if NLSOUND_SHEET_VERSION_BUILT < 2 _GroupController = CGroupControllerRoot::getInstance()->getGroupController(NLSOUND_SHEET_V1_DEFAULT_SOUND_STREAM_GROUP_CONTROLLER); #endif }
// **************************************************************************** void COutpostSheet::build(const NLGEORGES::UFormElm &root) { root.getValueByName(NbMaxSpawnedSquad, "Max Number of Spawned Squads"); root.getValueByName(NbMaxSpawnedMercenarySquad, "Max Number of Spawned Mercenary Squads"); root.getValueByName(ChallengeCost, "Challenge Cost"); root.getValueByName(MaxTotalSquad, "Max Total Squads"); }
void CBackgroundSound::importForm(const std::string& filename, NLGEORGES::UFormElm& formRoot) { NLGEORGES::UFormElm *psoundType; std::string dfnName; // some basic checking. formRoot.getNodeByName(&psoundType, ".SoundType"); nlassert(psoundType != NULL); psoundType->getDfnName(dfnName); nlassert(dfnName == "background_sound.dfn"); // Call the base class CSound::importForm(filename, formRoot); // Read the array of sound with there respective filter. { _Sounds.clear(); NLGEORGES::UFormElm *psoundList; formRoot.getNodeByName(&psoundList, ".SoundType.Sounds"); if (psoundList != 0 && psoundList->isArray()) { uint size; psoundList->getArraySize(size); for (uint i=0; i<size; ++i) { TSoundInfo sound; NLGEORGES::UFormElm *psoundItem; psoundList->getArrayNode(&psoundItem, i); if (psoundItem != NULL) { // Read the sound name. std::string soundName; psoundItem->getValueByName(soundName, "Sound"); sound.SoundName = CStringMapper::map(CFile::getFilenameWithoutExtension(soundName)); // Read the environnement flag. for (uint j=0; j<UAudioMixer::TBackgroundFlags::NB_BACKGROUND_FLAGS; j++) { char tmp[200]; sprintf(tmp, "Filter%2.2u", j); psoundItem->getValueByName(sound.Filter.Flags[j], tmp); } } _Sounds.push_back(sound); } } } _DurationValid = false; }
// *************************************************************************************************** void CPlantInfo::build(const NLGEORGES::UFormElm &item) { item.getValueByName(SheetName, "File name"); item.getValueByName(Weight, "MicroLifeWeight"); if (Weight == 0) { nlwarning("Plant with weight equal to 0"); } }
void CSampleBankManager::init(NLGEORGES::UFormElm *mixerConfig) { if (mixerConfig == 0) return; NLGEORGES::UFormElm *virtualBanks; mixerConfig->getNodeByName(&virtualBanks, ".VirtualBanks"); if (virtualBanks == 0) return; uint size; virtualBanks->getArraySize(size); for (uint i=0; i<size; ++i) { NLGEORGES::UFormElm *virtualBank; virtualBanks->getArrayNode(&virtualBank, i); if (virtualBank != 0) { std::vector<TFilteredBank> vfb; std::string virtualName; virtualBank->getValueByName(virtualName, ".VirtualName"); NLGEORGES::UFormElm *realBanks; virtualBank->getNodeByName(&realBanks, ".FilteredBank"); if (realBanks != 0) { uint size2; realBanks->getArraySize(size2); for (uint j=0; j<size2; ++j) { TFilteredBank fb; std::string bankName; NLGEORGES::UFormElm *realBank; realBank->getArrayNode(&realBank, j); realBank->getValueByName(bankName, ".SampleBank"); fb.BankName = CStringMapper::map(bankName); realBank->getValueByName(fb.Filter, ".Filter"); vfb.push_back(fb); } } if (!vfb.empty()) { TStringId virtualNameId = CStringMapper::map(virtualName); m_VirtualBanks.insert(std::make_pair(virtualNameId, vfb)); // create the sample bank CSampleBank *sampleBank = new CSampleBank(virtualNameId, this); } } } }
//----------------------------------------------- // build //----------------------------------------------- bool CFXStickMode::build(const NLGEORGES::UFormElm &item, const std::string &prefix /* = ""*/) { bool ok = true; uint32 stickMode; ok &= item.getValueByName(stickMode, (prefix + "StickMode").c_str()); if (ok) Mode = (CFXStickMode::TStickMode) stickMode; std::string userBoneName; ok &= item.getValueByName(userBoneName, (prefix + "UserBone").c_str()); UserBoneName = NLMISC::CStringMapper::map(userBoneName); return ok; }// build //
//----------------------------------------------- // build : // Build the sheet from an external script. //----------------------------------------------- void CBuildingSheet::build(const NLGEORGES::UFormElm &item) { // Load the name. if(!item.getValueByName(BuildedIg, "builded_ig")) debug("builded_ig not found."); if(!item.getValueByName(BuildedIcon, "builded_icon")) debug("builded_icon not found."); if(!item.getValueByName(BuildingIcon, "building_icon")) debug("building_icon not found."); if(!item.getValueByName(Name, "name")) debug("name not found."); }// build //
//======================================================= void CPlantSheet::build(const NLGEORGES::UFormElm &item) { if(!(item.getValueByName(_ShapeName, "3D.Shape") && item.getValueByName(_MaxDist, "3D.MaxDist") && item.getValueByName(_CoarseMeshDist, "3D.CoarseMeshDist"))) { nldebug("Key not found."); } // serial fxs by season SeasonFX[EGSPD::CSeason::Spring].build(item, Id, "3D.SpringFX."); SeasonFX[EGSPD::CSeason::Summer].build(item, Id, "3D.SummerFX."); SeasonFX[EGSPD::CSeason::Autumn].build(item, Id, "3D.AutomnFX."); SeasonFX[EGSPD::CSeason::Winter].build(item, Id, "3D.WinterFX."); }
/** * Load the sound parameters from georges' form */ void CSimpleSound::importForm(const std::string& filename, NLGEORGES::UFormElm& root) { NLGEORGES::UFormElm *psoundType; std::string dfnName; // some basic checking. root.getNodeByName(&psoundType, ".SoundType"); nlassert(psoundType != NULL); psoundType->getDfnName(dfnName); nlassert(dfnName == "simple_sound.dfn"); // Call the base class CSound::importForm(filename, root); // Name _Filename = CStringMapper::map(filename); // Buffername std::string bufferName; root.getValueByName(bufferName, ".SoundType.Filename"); bufferName = CFile::getFilenameWithoutExtension(bufferName); _Buffername = CStringMapper::map(bufferName); setBuffer(NULL); // contain % so it need a context to play if (bufferName.find ("%") != string::npos) { _NeedContext = true; } // MaxDistance root.getValueByName(_MaxDist, ".SoundType.MaxDistance"); // MinDistance root.getValueByName(_MinDist, ".SoundType.MinDistance"); // Alpha root.getValueByName(_Alpha, ".SoundType.Alpha"); }
void loadCharacteristicsFromSheet(const NLGEORGES::UFormElm &rootNode, std::string prefix, sint8 dest[CHARACTERISTICS::NUM_CHARACTERISTICS]) { for(uint k = 0; k < CHARACTERISTICS::NUM_CHARACTERISTICS; ++k) { const std::string &characName = CHARACTERISTICS::toString((CHARACTERISTICS::TCharacteristics) k); std::string characPath = prefix + characName; if(!rootNode.getValueByName(dest[k], characPath.c_str())) { nlwarning(("Key " + characName + "not found.").c_str()); } } }
//=============================================================================== void CWorldSheet::build(const NLGEORGES::UFormElm &item) { const UFormElm *pElt; uint size; nlverify (item.getNodeByName (&pElt, "continents list")); if(!pElt) { nlwarning("node 'continents list' not found in a .world"); } else { nlverify (pElt->getArraySize (size)); ContLocs.reserve(size); for (uint32 i = 0; i <size; ++i) { const UFormElm *pEltOfList; // Get the continent if (pElt->getArrayNode (&pEltOfList, i) && pEltOfList) { SContLoc clTmp; clTmp.build (pEltOfList); ContLocs.push_back (clTmp); } } item.getValueByName (Name, "name"); } // Maps loading nlverify (item.getNodeByName (&pElt, "maps list")); if(!pElt) { nlwarning("node 'maps list' is not found in a .world"); } else { nlverify (pElt->getArraySize (size)); Maps.reserve(size); for (uint32 i = 0; i < size; ++i) { const UFormElm *pEltOfList; // Get the continent if (pElt->getArrayNode (&pEltOfList, i) && pEltOfList) { SMap mapTmp; mapTmp.build (pEltOfList); Maps.push_back (mapTmp); } } } }
//----------------------------------------------- // readEquipment : // Read an equipment slot. //----------------------------------------------- void CCharacterSheet::readEquipment(const NLGEORGES::UFormElm &form, const string &key, CEquipment &slot) { // Get the item (or shape) name. string itemName; if(!form.getValueByName(itemName, string(key + ".Item").c_str() )) debug(NLMISC::toString("Key '%s.Item' not found.", key.c_str())); slot.IdItem = ClientSheetsStrings.add(NLMISC::strlwr(itemName)); // Get the texture. if(!form.getValueByName(slot.Texture, string(key + ".Texture").c_str() )) debug(NLMISC::toString("Key '%s.Texture' not found.", key.c_str())); // Get the color. if(!form.getValueByName(slot.Color, string(key + ".Color").c_str() )) debug(NLMISC::toString("Key '%s.Color' not found.", key.c_str())); // Get the Bind point. string bindPointName; if(!form.getValueByName(bindPointName, string(key + ".Bind Point").c_str() )) debug(NLMISC::toString("Key '%s.Bind Point' not found.", key.c_str())); slot.IdBindPoint = ClientSheetsStrings.add(bindPointName); }// readEquipment //
void CStreamSound::importForm(const std::string &filename, NLGEORGES::UFormElm &root) { NLGEORGES::UFormElm *psoundType; std::string dfnName; // some basic checking. root.getNodeByName(&psoundType, ".SoundType"); nlassert(psoundType != NULL); psoundType->getDfnName(dfnName); nlassert(dfnName == "stream_sound.dfn"); // Call the base class CSound::importForm(filename, root); // MaxDistance root.getValueByName(_MaxDist, ".SoundType.MaxDistance"); // MinDistance root.getValueByName(_MinDist, ".SoundType.MinDistance"); // Alpha root.getValueByName(m_Alpha, ".SoundType.Alpha"); }
/// Load the sound parameters from georges' form void CContextSound::importForm(const std::string& filename, NLGEORGES::UFormElm& formRoot) { NLGEORGES::UFormElm *psoundType; std::string dfnName; // some basic checking. formRoot.getNodeByName(&psoundType, ".SoundType"); nlassert(psoundType != NULL); psoundType->getDfnName(dfnName); nlassert(dfnName == "context_sound.dfn"); // Call the base class CSound::importForm(filename, formRoot); // Read the pattern name formRoot.getValueByName(_PatternName, ".SoundType.PatternName"); }
// *************************************************************************************************** void CFloraSheet::build(const NLGEORGES::UFormElm &item) { const UFormElm *plantArray = NULL; if (item.getNodeByName(&plantArray, "Plants") && plantArray) { uint numPlants; nlverify(plantArray->getArraySize(numPlants)); _Plants.reserve(numPlants); for(uint k = 0; k < numPlants; ++k) { const UFormElm *subNode = NULL; if (plantArray->getArrayNode(&subNode, k) && subNode) { CPlantInfo pi; pi.build(*subNode); pi.CumulatedWeight = _TotalWeight; _TotalWeight += pi.Weight; _Plants.push_back(pi); } } } item.getValueByName(MicroLifeThreshold, "MicroLifeThreshold"); }
//----------------------------------------------- // build : // Build the sheet from an external script. //----------------------------------------------- void CItemSheet::build(const NLGEORGES::UFormElm &item) { // Load the name. string Shape; if(!item.getValueByName(Shape, "3d.shape")) debug("key '3d.shape' not found."); IdShape = ClientSheetsStrings.add(Shape); // Load the name. string ShapeFemale; if(!item.getValueByName(ShapeFemale, "3d.shape_female")) debug("key '3d.shape_female' not found."); IdShapeFemale = ClientSheetsStrings.add(ShapeFemale); // Get the icon associated. string IconMain; if(!item.getValueByName (IconMain, "3d.icon")) debug("key '3d.icon' not found."); IconMain = strlwr (IconMain); IdIconMain = ClientSheetsStrings.add(IconMain); // Get the icon associated. string IconBack; if(!item.getValueByName (IconBack, "3d.icon background")) debug("key '3d.icon background' not found."); IconBack = strlwr (IconBack); IdIconBack = ClientSheetsStrings.add(IconBack); // Get the icon associated. string IconOver; if(!item.getValueByName (IconOver, "3d.icon overlay")) debug("key '3d.icon overlay' not found."); IconOver = strlwr (IconOver); IdIconOver = ClientSheetsStrings.add(IconOver); // Get the icon associated. string IconOver2; if(!item.getValueByName (IconOver2, "3d.icon overlay2")) debug("key '3d.icon overlay2' not found."); IconOver2 = strlwr (IconOver2); IdIconOver2 = ClientSheetsStrings.add(IconOver2); // Get Special modulate colors item.getValueByName (IconColor, "3d.IconColor" ); item.getValueByName (IconBackColor, "3d.IconBackColor"); item.getValueByName (IconOverColor, "3d.IconOverColor"); item.getValueByName (IconOver2Color, "3d.IconOver2Color"); // Get the icon text associated. string IconText; if(!item.getValueByName (IconText, "3d.text overlay")) debug("key '3d.text overlay' not found."); IconText = strlwr (IconText); IdIconText = ClientSheetsStrings.add(IconText); // See if this item can be hiden when equiped if(!item.getValueByName (NeverHideWhenEquiped, "3d.never hide when equiped")) debug("key '3d.never hide when equiped."); // Load the different slot in wicth the item can be equipped. const UFormElm *pElt = 0; // check uint32 is OK! nlassert( SLOTTYPE::NB_SLOT_TYPE <= 32 ); SlotBF= 0; if(item.getNodeByName(&pElt, "basics.EquipmentInfo.EquipmentSlots") && pElt) { // Get all slots. uint size; if(pElt->getArraySize(size)) { for(uint i = 0; i < size; ++i) { string slotName; if(pElt->getArrayValue(slotName, i)) { // Check name. if(slotName.empty()) debug(toString("The slot name %d is Empty.", i)); // Push the possible slots for the item in the list. SlotBF|= SINT64_CONSTANT(1)<< (SLOTTYPE::stringToSlotType(NLMISC::toUpper(slotName))); } } } else debug("The element 'basics.Equipment Slot' is not an array."); } else debug("Cannot create the element from the name 'basics.Equipment Slot'."); // Get the Item Family. string family; if(!item.getValueByName(family, "basics.family")) { debug("Key 'basics.family' not found."); Family = ITEMFAMILY::UNDEFINED; } else { Family = (ITEMFAMILY::EItemFamily) ITEMFAMILY::stringToItemFamily(NLMISC::toUpper( family) ); if(Family == ITEMFAMILY::UNDEFINED) debug("Item Family Undefined."); } // Get the Item Type. string itemtype; if(!item.getValueByName(itemtype, "basics.ItemType")) { debug("Key 'basics.ItemType' not found."); ItemType = ITEM_TYPE::UNDEFINED; } else { ItemType = (ITEM_TYPE::TItemType) ITEM_TYPE::stringToItemType(NLMISC::toUpper(itemtype) ); if (ItemType == ITEM_TYPE::UNDEFINED) debug("Item Type Undefined."); } // Get the DropOrSell property if(!item.getValueByName (DropOrSell, "basics.Drop or Sell")) debug("key 'basics.Drop or Sell' not found."); // Get the IsItemNoRent property if(!item.getValueByName (IsItemNoRent, "basics.No Rent")) debug("key 'basics.No Rent' not found."); // Get the stackable property if(!item.getValueByName (Stackable, "basics.stackable")) debug("key 'basics.stackable' not found."); // Get the Consumable property if(!item.getValueByName (IsConsumable, "basics.Consumable")) debug("key 'basics.Consumable' not found."); // Get the texture variante. if(!item.getValueByName(MapVariant, "3d.map_variant")) debug("Key '3d.map_variant' not found."); // Load the name. string AnimSet; if(!item.getValueByName(AnimSet, "3d.anim_set")) debug("key '3d.anim_set' not found."); // Force the CASE in UPPER to not be CASE SENSITIVE. else NLMISC::strlwr(AnimSet); IdAnimSet = ClientSheetsStrings.add(AnimSet); // Get the Trail Shape if(!item.getValueByName(Color, "3d.color")) debug("key '3d.color' not found."); // Get the Fx flag if(!item.getValueByName(HasFx, "3d.has_fx")) debug("key '3d.has_fx' not found."); // Get special Effect1 string Effect1; if(!item.getValueByName(Effect1, "Effects.Effect1")) debug("key 'Effects.Effect1' not found."); Effect1 = strlwr(Effect1); IdEffect1 = ClientSheetsStrings.add(Effect1); // Get special Effect2 string Effect2; if(!item.getValueByName(Effect2, "Effects.Effect2")) debug("key 'Effects.Effect2' not found."); Effect2 = strlwr(Effect2); IdEffect2 = ClientSheetsStrings.add(Effect2); // Get special Effect3 string Effect3; if(!item.getValueByName(Effect3, "Effects.Effect3")) debug("key 'Effects.Effect3' not found."); Effect3 = strlwr(Effect3); IdEffect3 = ClientSheetsStrings.add(Effect3); // Get special Effect4 string Effect4; if(!item.getValueByName(Effect4, "Effects.Effect4")) debug("key 'Effects.Effect4' not found."); Effect4 = strlwr(Effect4); IdEffect4 = ClientSheetsStrings.add(Effect4); // Get its bulk TRANSLATE_VAL( Bulk, "basics.Bulk" ); // Get its equip time TRANSLATE_VAL( EquipTime, "basics.Time to Equip In Ticks" ); // build fx part FX.build(item, "3d.fx."); // **** Build Help Infos string val; TRANSLATE_ENUM( RequiredCharac, CHARACTERISTICS::Unknown, CHARACTERISTICS::toCharacteristic, "basics.RequiredCharac"); TRANSLATE_VAL( RequiredCharacLevel, "basics.MinRequiredCharacLevel"); TRANSLATE_ENUM( RequiredSkill, SKILLS::unknown, SKILLS::toSkill, "basics.RequiredSkill"); TRANSLATE_VAL( RequiredSkillLevel, "basics.MinRequiredSkillLevel"); // item Origin TRANSLATE_ENUM ( ItemOrigin, ITEM_ORIGIN::UNKNOWN, ITEM_ORIGIN::stringToEnum, "basics.origin"); /// item craft plan TRANSLATE_VAL( val, "basics.CraftPlan" ); if (!val.empty()) CraftPlan = CSheetId(val); // Special according to Family; switch(Family) { // COSMETIC case ITEMFAMILY::COSMETIC : { string sheetName = Id.toString(); string::size_type pos = sheetName.find('.',0); if (pos == string::npos) nlwarning("<loadCosmetics> Can't load the VPValue from sheet name in sheet %s", Id.toString().c_str() ); else { sint i = (sint)pos - 1; for(; i >= 0; i-- ) { if ( !isdigit( sheetName[i] ) ) break; } if ( i >= -1 ) { string val = sheetName.substr( i + 1, pos - i - 1); NLMISC::fromString( val, Cosmetic.VPValue ); } } if ( sheetName.find( "hof" ) != string::npos ) Cosmetic.Gender = GSGENDER::female; else Cosmetic.Gender = GSGENDER::male; } break; // ARMOR case ITEMFAMILY::ARMOR : { // ArmorType TRANSLATE_ENUM ( Armor.ArmorType, ARMORTYPE::UNKNOWN, ARMORTYPE::toArmorType, "armor.Armor category" ); } break; // MELEE_WEAPON case ITEMFAMILY::MELEE_WEAPON : { // WeaponType TRANSLATE_ENUM ( MeleeWeapon.WeaponType, WEAPONTYPE::UNKNOWN, WEAPONTYPE::stringToWeaponType, "melee weapon.category" ); // Skill TRANSLATE_ENUM ( MeleeWeapon.Skill, SKILLS::unknown, SKILLS::toSkill, "melee weapon.skill" ); // DamageType TRANSLATE_ENUM ( MeleeWeapon.DamageType, DMGTYPE::UNDEFINED, DMGTYPE::stringToDamageType, "melee weapon.damage type" ); // DamageType TRANSLATE_VAL ( MeleeWeapon.MeleeRange, "melee weapon.melee range" ); } break; // RANGE_WEAPON case ITEMFAMILY::RANGE_WEAPON : { // WeaponType TRANSLATE_ENUM ( RangeWeapon.WeaponType, WEAPONTYPE::UNKNOWN, WEAPONTYPE::stringToWeaponType, "range weapon.category" ); // Range weapon type TRANSLATE_ENUM ( RangeWeapon.RangeWeaponType, RANGE_WEAPON_TYPE::Generic, RANGE_WEAPON_TYPE::stringToRangeWeaponType, "range weapon.RangeWeaponType" ); // Skill TRANSLATE_ENUM ( RangeWeapon.Skill, SKILLS::unknown, SKILLS::toSkill, "range weapon.skill" ); } break; // AMMO case ITEMFAMILY::AMMO : { // Skill TRANSLATE_ENUM ( Ammo.Skill, SKILLS::unknown, SKILLS::toSkill, "ammo.weapon type" ); // DamageType TRANSLATE_ENUM ( Ammo.DamageType, DMGTYPE::UNDEFINED, DMGTYPE::stringToDamageType, "ammo.damage type" ); // Magazine TRANSLATE_VAL( Ammo.Magazine, "ammo.magazine" ); } break; // RAW_MATERIAL case ITEMFAMILY::RAW_MATERIAL : { // Ecosystem TRANSLATE_ENUM( Mp.Ecosystem, ECOSYSTEM::unknown, ECOSYSTEM::stringToEcosystem, "mp.Ecosystem" ); // MpCategory TRANSLATE_ENUM( Mp.MpCategory, MP_CATEGORY::Undefined, MP_CATEGORY::stringToMPCategory, "mp.Category" ); // Skill TRANSLATE_ENUM( Mp.HarvestSkill, SKILLS::unknown, SKILLS::toSkill, "mp.HarvestSkill" ); // MP Family TRANSLATE_VAL( Mp.Family, "mp.Family" ); // Faber Item Part uint i; char keyTmp[256]; // ensure that if you modify RM_FABER_TYPE, you have to rebuild the item sheets. nlctassert(RM_FABER_TYPE::NUM_FABER_TYPE == 26); // ensure that the bitfields are enough (nb: unknown can be stored) nlctassert(ITEM_ORIGIN::NUM_ITEM_ORIGIN < 256); // ensure that the bitfield for item part buildable for this MP is possible nlctassert(RM_FABER_TYPE::NUM_FABER_TYPE <= 32); // reset Mp.ItemPartBF= 0; MpItemParts.clear(); // check if ok for each for(i=0;i<RM_FABER_TYPE::NUM_FABER_TYPE ;i++) { uint32 durability= 0; string sheetEntry= RM_FABER_TYPE::faberTypeToSheetEntry((RM_FABER_TYPE::TRMFType)i); // read the associated durablity of the MP faberType sprintf(keyTmp, "mp.MpParam.%s.Durability", sheetEntry.c_str()); TRANSLATE_VAL(durability, keyTmp); // If not null, ok this MP is associated to this faberType if(durability) { Mp.ItemPartBF |= SINT64_CONSTANT(1)<<i; MpItemParts.push_back(CMpItemPart()); CMpItemPart &itemPart= MpItemParts.back(); // read origin filter sprintf(keyTmp, "mp.MpParam.%s.CraftCivSpec", sheetEntry.c_str()); TRANSLATE_ENUM( itemPart.OriginFilter, ITEM_ORIGIN::UNKNOWN, ITEM_ORIGIN::stringToEnum, keyTmp); // read each stat for(uint j=0;j<RM_FABER_STAT_TYPE::NumRMStatType;j++) { sprintf(keyTmp, "mp.MpParam.%s.%s", sheetEntry.c_str(), RM_FABER_STAT_TYPE::toString((RM_FABER_STAT_TYPE::TRMStatType)j).c_str()); TRANSLATE_VAL( itemPart.Stats[j], keyTmp); } } } // UsedAsCraftRequirement TRANSLATE_VAL( Mp.UsedAsCraftRequirement, "mp.UsedAsCraftRequirement" ); // MpColor TRANSLATE_VAL( Mp.MpColor, "mp.MpColor" ); // Mp Stat Energy TRANSLATE_VAL( Mp.StatEnergy, "mp.StatEnergy"); } break; // SHIELD case ITEMFAMILY::SHIELD : { // ShieldType TRANSLATE_ENUM( Shield.ShieldType, SHIELDTYPE::NONE, SHIELDTYPE::stringToShieldType, "shield.Category" ); } break; // TOOL: different for any tool case ITEMFAMILY::CRAFTING_TOOL : { // CraftingToolType TRANSLATE_ENUM( Tool.CraftingToolType, TOOL_TYPE::Unknown, TOOL_TYPE::toToolType, "crafting tool.type"); } break; case ITEMFAMILY::HARVEST_TOOL : { // Skill TRANSLATE_ENUM( Tool.Skill, SKILLS::unknown, SKILLS::toSkill, "harvest tool.skill" ); } break; case ITEMFAMILY::TAMING_TOOL : { // Skill TRANSLATE_ENUM( Tool.Skill, SKILLS::unknown, SKILLS::toSkill, "taming tool.skill" ); // CommandRange TRANSLATE_VAL( Tool.CommandRange, "taming tool.command range" ); // MaxDonkey TRANSLATE_VAL( Tool.MaxDonkey, "taming tool.max donkey" ); } break; case ITEMFAMILY::GUILD_OPTION : { // Cost in money of the tool TRANSLATE_VAL( GuildOption.MoneyCost, "guild option.Money Cost" ); // Cost in guild XP TRANSLATE_VAL( GuildOption.XPCost, "guild option.Guild XP Cost" ); } break; case ITEMFAMILY::PET_ANIMAL_TICKET : { // Cost in money of the tool TRANSLATE_VAL( Pet.Slot, "pet.Pet Slot" ); } break; case ITEMFAMILY::TELEPORT: { // Type of teleport TRANSLATE_ENUM( Teleport.Type, TELEPORT_TYPES::NONE, TELEPORT_TYPES::getTpTypeFromString, "teleport.Type" ); } break; case ITEMFAMILY::SCROLL: { // Scroll texture TRANSLATE_VAL( Scroll.Texture, "Scroll.Texture"); } break; case ITEMFAMILY::CONSUMABLE: { TRANSLATE_VAL( Consumable.ConsumptionTime, "Consumable.ConsumptionTime"); TRANSLATE_VAL( Consumable.OverdoseTimer, "Consumable.OverdoseTimer"); Consumable.Properties.clear(); for(uint i=0;i<4;i++) { string val; item.getValueByName(val, toString("Consumable.Property %d", i).c_str() ); if(!val.empty() && val!="NULL") { Consumable.Properties.push_back(val); } } } break; default: break; }; }// build //
//========================================================================= void CContinentParameters::build(const NLGEORGES::UFormElm &item) { // Name. item.getValueByName (Name, "Name"); // WorldMap item.getValueByName (WorldMap, "WorldMap"); //Zone min/max item.getValueByName (ZoneMin, "ZoneMin"); item.getValueByName (ZoneMax, "ZoneMax"); // Load Light Landscape Day. const UFormElm *elm; if (item.getNodeByName (&elm, "LightLandscapeDay") && elm) LandscapeLightDay.build(*elm); // Load Light Landscape Night. if (item.getNodeByName (&elm, "LightLandscapeNight") && elm) LandscapeLightNight.build(*elm); // Load Light Landscape Dusk. if (item.getNodeByName (&elm, "LightLandscapeDusk") && elm) { if (!LandscapeLightDusk.build(*elm)) LandscapeLightDusk.blend(LandscapeLightDay, LandscapeLightNight, 0.5f); } else LandscapeLightDusk.blend(LandscapeLightDay, LandscapeLightNight, 0.5f); // Load Landscape PointLightMaterial if (item.getNodeByName (&elm, "LandscapePointLightMaterial") && elm) CGeorgesHelper::convert (LandscapePointLightMaterial, *elm); else LandscapePointLightMaterial= CRGBA::White; // Load Light Entity Day. if (item.getNodeByName (&elm, "LightEntityDay") && elm) EntityLightDay.build(*elm); // Load Light Entity Night. if (item.getNodeByName (&elm, "LightEntityNight") && elm) EntityLightNight.build(*elm); // Load Light Entity Dusk if (item.getNodeByName (&elm, "LightEntityDusk") && elm) { if (!EntityLightDusk.build(*elm)) EntityLightDusk.blend(EntityLightDay, EntityLightNight, 0.5f); } else EntityLightDusk.blend(EntityLightDay, EntityLightNight, 0.5f); // Load Light Root Day. if (item.getNodeByName (&elm, "LightRootDay") && elm) RootLightDay.build(*elm); // Load Light Root Night. if (item.getNodeByName (&elm, "LightRootNight") && elm) RootLightNight.build(*elm); // Load Light Root Dusk if (item.getNodeByName (&elm, "LightRootDusk") && elm) { if (!RootLightDusk.build(*elm)) RootLightDusk.blend(RootLightDay, RootLightNight, 0.5f); } else RootLightDusk.blend(RootLightDay, RootLightNight, 0.5f); // Load Entity sun contribution power. item.getValueByName (EntitySunContributionPower, "EntitySunPower"); // Load Entity sun contribution max threshold. item.getValueByName (EntitySunContributionMaxThreshold, "EntitySunMaxThreshold"); // Load PACS RBank. item.getValueByName (PacsRBank, "PacsRBank"); // Load PACS RBank. item.getValueByName (PacsGR, "PacsGR"); // Load IG list filename. item.getValueByName (LandscapeIG, "LandscapeIG"); // Load Sky day filename. item.getValueByName (SkyDay, "SkyDay"); // Load Sky night filename. item.getValueByName (SkyNight, "SkyNight"); // Load Sky fog part filename. item.getValueByName (SkyFogPartName, "SkyFogPart"); // Load Sky ig filename. item.getValueByName (BackgroundIGName, "SkyIg"); // Load IG for canopy for each season for (uint season = 0; season < EGSPD::CSeason::Invalid; ++season) { item.getValueByName(CanopyIGfileName[season], (EGSPD::CSeason::toString( (EGSPD::CSeason::TSeason)season) + "CanopyIG").c_str()); } // Load the form string filename; if (item.getValueByName (filename, "Ecosystem")) { UFormLoader *loader = UFormLoader::createLoader(); if (loader) { // Load the form CSmartPtr<UForm> form = loader->loadForm (filename.c_str ()); // Form loaded ? if (form) { // Root node elm = &form->getRootNode (); // MicroVeget. elm->getValueByName (MicroVeget, "MicroVeget"); // Small bank. elm->getValueByName (SmallBank, "SmallBank"); // Far bank. elm->getValueByName (FarBank, "FarBank"); // Coarse mesh texture. elm->getValueByName (CoarseMeshMap, "CoarseMeshMap"); } else { nlwarning("CContinent::build : Can't load form %s.", filename.c_str()); } UFormLoader::releaseLoader(loader); } } // Load all "Zone Constructible". if(item.getNodeByName(&elm, "ZCs") && elm) { // Get number of ZC uint nbZC; if(elm->getArraySize(nbZC)) { // For each village for(uint i = 0; i < nbZC; ++i) { // Village pointer const UFormElm *zc; if(elm->getArrayNode(&zc, i) && zc) { // Get the zone associated. CZC zone; zone.EnableRuins= true; if(!zc->getValueByName(zone.Name, "Zone")) nlwarning("CContinent::build : key 'Zone' not found."); if(!zc->getValueByName(zone.ForceLoadDist, "ForceLoadDist")) nlwarning("CContinent::build : key 'ForceLoadDist' not found."); if(!zc->getValueByName(zone.LoadDist, "LoadDist")) nlwarning("CContinent::build : key 'LoadDist' not found."); if(!zc->getValueByName(zone.UnloadDist, "UnloadDist")) nlwarning("CContinent::build : key 'UnloadDist' not found."); if(!zc->getValueByName(zone.EnableRuins, "EnableRuins")) nlwarning("CContinent::build : key 'EnableRuins' not found."); ZCList.push_back(zone); } } } else nlwarning("CContinent::build : it seems 'ZCs' is not an array."); } // build fog map descriptor buildFogMapBuild(item); // Load Sky ig filename. item.getValueByName (Indoor, "Indoor"); // Load the landmark list /* if(item.getNodeByName (&elm, "LandMarks") && elm) { // Get number of village uint numLandMarks; nlverify (elm->getArraySize (numLandMarks)); LandMarks.resize(numLandMarks); // For each village for(uint k = 0; k < numLandMarks; ++k) { // Village pointer const UFormElm *landMarkForm; if (elm->getArrayNode (&landMarkForm, k) && landMarkForm) { LandMarks[k].build(*landMarkForm); } } }*/ // LocalizedName item.getValueByName (LocalizedName, "LocalizedName"); // Micro-life primitives if(item.getNodeByName(&elm, "MicroLifePrimitives") && elm) { // Get number of prims uint numPrims; if(elm->getArraySize(numPrims)) { // For each prims for(uint i = 0; i < numPrims; ++i) { std::string primFilename; if (elm->getArrayValue(primFilename, i)) { MicroLifeZones.push_back(primFilename); } } } else nlwarning("CContinent::build : it seems 'ZCs' is not an array."); } // Read Season related parameters for (uint season = 0; season < EGSPD::CSeason::Invalid; ++season) { item.getValueByName(TileColorMono[season], (EGSPD::CSeason::toString( (EGSPD::CSeason::TSeason)season) + "TileColorMono").c_str()); item.getValueByName(TileColorFactor[season], (EGSPD::CSeason::toString( (EGSPD::CSeason::TSeason)season ) + "TileColorFactor").c_str()); item.getValueByName(StaticLightingFactor[season], (EGSPD::CSeason::toString( (EGSPD::CSeason::TSeason)season ) + "StaticLightingFactor").c_str()); item.getValueByName(SkySheet[season], ("SkySheet" + EGSPD::CSeason::toString( (EGSPD::CSeason::TSeason)season )).c_str()); // A continent may want to force some season instead another. read it ForceDisplayedSeason[season]= (EGSPD::CSeason::TSeason)season; string strSeason; item.getValueByName(strSeason, ("DisplayedSeasonFor" + EGSPD::CSeason::toString( (EGSPD::CSeason::TSeason)season)).c_str()); EGSPD::CSeason::TSeason readSeason= ForceDisplayedSeason[season]= EGSPD::CSeason::fromString(strSeason); if(readSeason<EGSPD::CSeason::Invalid) ForceDisplayedSeason[season]= readSeason; } }
//********************************************************************************************** void CVillageGrid::addVillagesFromContinent(const std::string &continentSheetName) { // Load the form NLGEORGES::UFormLoader *loader = NLGEORGES::UFormLoader::createLoader(); // std::string path = CPath::lookup(continentSheetName, false, false); if (path.empty()) { nlwarning("Path not found for %s.", continentSheetName.c_str()); return; } NLGEORGES::UForm *villageForm; villageForm = loader->loadForm(path.c_str()); if(villageForm != NULL) { NLGEORGES::UFormElm &rootItem = villageForm->getRootNode(); // try to get the village list // Load the village list NLGEORGES::UFormElm *villagesItem; if(!(rootItem.getNodeByName (&villagesItem, "Villages") && villagesItem)) { nlwarning("No villages where found in %s", continentSheetName.c_str()); return; } // Get number of village uint numVillage; nlverify (villagesItem->getArraySize (numVillage)); // For each village for(uint k = 0; k < numVillage; ++k) { NLGEORGES::UFormElm *currVillage; if (!(villagesItem->getArrayNode (&currVillage, k) && currVillage)) { nlwarning("Couldn't get village %d in continent %s", continentSheetName.c_str(), k); continue; } // check that this village is in the dependency zones NLGEORGES::UFormElm *zoneNameItem; if (!currVillage->getNodeByName (&zoneNameItem, "Zone") && zoneNameItem) { nlwarning("Couldn't get zone item of village %d in continent %s", continentSheetName.c_str(), k); continue; } std::string zoneName; if (!zoneNameItem->getValue(zoneName)) { nlwarning("Couldn't get zone name of village %d in continent %s", continentSheetName.c_str(), k); continue; } sint zoneX, zoneY; if (!getZonePos(zoneName, zoneX, zoneY)) { nlwarning("Zone name of village %d in continent %s is invalid", continentSheetName.c_str(), k); continue; } sint villageMinX, villageMinY; sint villageMaxX, villageMaxY; // retrieve width & height of covered region uint32 regionWidth; uint32 regionHeight; float centerX, centerY; if (!currVillage->getValueByName(regionWidth, "Width") || !currVillage->getValueByName(regionHeight, "Height") || !currVillage->getValueByName(centerX, "CenterX") || !currVillage->getValueByName(centerY, "CenterY")) { nlwarning("Can't retrieve region covered by village %d in continent %s", continentSheetName.c_str(), k); continue; } // villageMinX = villageMaxX = zoneX; villageMinY = villageMaxY = zoneY; // extends with bbox from center to min corner if leveldesigner forgot to enter good width & height villageMaxX = std::max(villageMaxX, (sint) ((zoneX * 160.f + 2.f * centerX) / 160.f)); villageMaxY = std::max(villageMaxY, (sint) ((zoneY * 160.f + 2.f * centerY) / 160.f)); // villageMinX -= _ZoneMinX; villageMaxX -= _ZoneMinX; villageMinY -= _ZoneMinY; villageMaxY -= _ZoneMinY; // CVillage village; if (loadVillageSheet(currVillage, continentSheetName, k, village)) { // village.FileModificationDate = std::max(village.FileModificationDate, CFile::getFileModificationDate(path)); // Villages.push_back(CVillage()); Villages.back().swap(village); // for (sint y = villageMinY; y <= (sint) villageMaxY; ++y) { if (y < 0) continue; if (y >= (sint) VillageGrid.getHeight()) continue; for (sint x = villageMinX; x <= (sint) villageMaxX; ++x) { if (x < 0) continue; if (x >= (sint) VillageGrid.getWidth()) continue; VillageGrid(x, y).push_back(Villages.size() - 1); } } } } } else { nlwarning("Can't load continent form : %s", continentSheetName.c_str()); } }
// ******************************************************************************************* void CIDToString::build(const NLGEORGES::UFormElm &item) { item.getValueByName(String, "String"); item.getValueByName(ID, "ID"); }
// *************************************************************************** void CSBrickSheet::build (const NLGEORGES::UFormElm &root) { string sTmp; uint i; // read the array of skills string skillUseStr; TRANSLATE_VAL(skillUseStr, "Basics.Skill"); while(strFindReplace(skillUseStr, ":", " ")); std::vector<string> listSkill; splitString(skillUseStr," ",listSkill); // build the req skill array UsedSkills.clear(); UsedSkills.reserve(listSkill.size()); for(i=0;i<listSkill.size();i++) { SKILLS::ESkills skill= SKILLS::toSkill(listSkill[i]); // Yoyo: patch to read auto generated bricks if(skill==SKILLS::unknown) { skill = (SKILLS::ESkills)SKILLS::toSkill("S" + listSkill[i]); } // keep only whats work if(skill!=SKILLS::unknown) { UsedSkills.push_back(skill); } } // if empty, fill at least with unknown if(UsedSkills.empty()) UsedSkills.push_back(SKILLS::unknown); // get family id root.getValueByName (sTmp, "Basics.FamilyId" ); BrickFamily = BRICK_FAMILIES::toSBrickFamily (sTmp); if(BrickFamily==BRICK_FAMILIES::Unknown) nlwarning("CSBrickSheet:build: BrickFamily Unknown '%s'.", sTmp.c_str()); /* // Yoyo: patch to read auto generated bricks if(BrickFamily==BRICK_FAMILIES::Unknown) { string sheetName= Id.toString(); std::string::size_type end= sheetName.find(".sbrick")-2; BrickFamily = BRICK_FAMILIES::toSBrickFamily ( NLMISC::toUpper(sheetName.substr(0,end)) ); if(BrickFamily==BRICK_FAMILIES::Unknown) nlwarning("Unknown Family for SBrick: %s", sheetName.c_str()); } */ root.getValueByName (IndexInFamily, "Basics.IndexInFamily" ); root.getValueByName (Level, "Basics.Level" ); // read icons string Icon; root.getValueByName (Icon, "Client.Icon" ); Icon = strlwr(Icon); IdIcon = ClientSheetsStrings.add(Icon); string IconBack; root.getValueByName (IconBack, "Client.IconBack" ); IconBack = strlwr(IconBack); IdIconBack = ClientSheetsStrings.add(IconBack); string IconOver; root.getValueByName (IconOver, "Client.IconOver" ); IconOver = strlwr(IconOver); IdIconOver = ClientSheetsStrings.add(IconOver); string IconOver2; root.getValueByName (IconOver2, "Client.IconOver2" ); IconOver2 = strlwr(IconOver2); IdIconOver2 = ClientSheetsStrings.add(IconOver2); root.getValueByName (IconColor, "Client.IconColor" ); root.getValueByName (IconBackColor, "Client.IconBackColor"); root.getValueByName (IconOverColor, "Client.IconOverColor"); root.getValueByName (IconOver2Color, "Client.IconOver2Color"); root.getValueByName (SabrinaCost, "Basics.SabrinaCost" ); root.getValueByName (SabrinaRelativeCost, "Basics.SabrinaRelativeValue" ); // mandatory families MandatoryFamilies.clear(); char tmp[256]; for(i=0;i<SBRICK_MAX_MANDATORY;i++) { sprintf(tmp, "Mandatory.f%d", i); root.getValueByName (sTmp, tmp); if (!sTmp.empty()) { BRICK_FAMILIES::TBrickFamily bf= BRICK_FAMILIES::toSBrickFamily(sTmp); if(bf != BRICK_FAMILIES::Unknown) MandatoryFamilies.push_back( bf ); else nlwarning("Unknown Mandatory family %s",sTmp.c_str()); } } // Optional families OptionalFamilies.clear(); for(i=0;i<SBRICK_MAX_OPTIONAL;i++) { sprintf(tmp, "Optional.f%d", i); root.getValueByName (sTmp, tmp); if (!sTmp.empty()) { BRICK_FAMILIES::TBrickFamily bf= BRICK_FAMILIES::toSBrickFamily(sTmp); if(bf != BRICK_FAMILIES::Unknown) OptionalFamilies.push_back( bf ); else nlwarning("Unknown optional family %s",sTmp.c_str()); } } // Parameter families ParameterFamilies.clear(); for(i=0;i<SBRICK_MAX_PARAMETER;i++) { sprintf(tmp, "Parameter.f%d", i); root.getValueByName (sTmp, tmp); if (!sTmp.empty()) { BRICK_FAMILIES::TBrickFamily bf= BRICK_FAMILIES::toSBrickFamily(sTmp); if(bf != BRICK_FAMILIES::Unknown) ParameterFamilies.push_back( bf ); else nlwarning("Unknown Parameter family %s",sTmp.c_str()); } } // Credit families CreditFamilies.clear(); for(i=0;i<SBRICK_MAX_CREDIT;i++) { sprintf(tmp, "Credit.f%d", i); root.getValueByName (sTmp, tmp); BRICK_FAMILIES::TBrickFamily bf= BRICK_FAMILIES::toSBrickFamily(sTmp); if(bf != BRICK_FAMILIES::Unknown) CreditFamilies.push_back( bf ); } string ForbiddenDef; root.getValueByName (ForbiddenDef, "Basics.ForbiddenDef" ); IdForbiddenDef = ClientSheetsStrings.add(ForbiddenDef); string ForbiddenExclude; root.getValueByName (ForbiddenExclude, "Basics.ForbiddenExclude" ); IdForbiddenExclude = ClientSheetsStrings.add(ForbiddenExclude); // **** Properties Properties.clear(); for(i=0;i<MaxProperties;i++) { string val; root.getValueByName(val, toString("Basics.Property %d", i).c_str() ); if(!val.empty() && val!="NULL") { CProperty prop; prop.Text= val; Properties.push_back(prop); } } // **** Faber // The FaberPlan are stored in Mandatory only, but the tool filter is in root if( isFaber() && (isMandatory() || isRoot()) ) { string val; FaberPlan.ItemPartMps.clear(); FaberPlan.FormulaMps.clear(); // Get Item Built TRANSLATE_VAL(val, "faber.Create.Crafted Item"); FaberPlan.ItemBuilt.buildSheetId(val); // Get Skill Filters TRANSLATE_ENUM ( FaberPlan.ToolType, TOOL_TYPE::Unknown, TOOL_TYPE::toToolType, "faber.Tool type"); // Get NB item built (for ammo) TRANSLATE_VAL( FaberPlan.NbItemBuilt, "faber.Create.Nb built items"); // MPs. Try all MP1 .. 5 slots. Stop when not valid for (uint k=0; k< MAX_FABER_REQ_MP; ++k) { sint32 mpQuantity= 0; root.getValueByName(mpQuantity, toString("faber.Create.Quantity %d", k+1).c_str() ); // if the req quantity is not 0 if ( mpQuantity>0 ) { CFaberPlan::CItemPartMP mpVal; mpVal.Quantity= mpQuantity; // No error if unknown: filter not used (all MPs match) TRANSLATE_ENUM_NODB( mpVal.FaberTypeFilter, RM_FABER_TYPE::Unknown, RM_FABER_TYPE::toFaberType, toString("faber.Create.MP %d", k+1).c_str() ); // Add this req MP. FaberPlan.ItemPartMps.push_back(mpVal); } // else subsequents MP slots are not used else break; } // Formula MPs. Try all MP1 .. 5 slots. Stop when not valid for (uint k=0; k< MAX_FABER_REQ_MP; ++k) { sint32 mpQuantity= 0; root.getValueByName(mpQuantity, toString("faber.Create.Quantity formula %d", k+1).c_str() ); // if the req quantity is not 0 if ( mpQuantity>0 ) { CFaberPlan::CFormulaMP mpVal; mpVal.Quantity= mpQuantity; // No error if unknown: filter not used (all MPs match) TRANSLATE_VAL(val, toString("faber.Create.MP formula %d", k+1).c_str()); mpVal.ItemRequired.buildSheetId(val); // Add this req MP. FaberPlan.FormulaMps.push_back(mpVal); } // else subsequents MP slots are not used else break; } } // read minmax range/cast time when guigui ready TRANSLATE_VAL(MinCastTime, "Basics.MinCastTime"); TRANSLATE_VAL(MaxCastTime, "Basics.MaxCastTime"); TRANSLATE_VAL(MinRange, "Basics.MinRange"); TRANSLATE_VAL(MaxRange, "Basics.MaxRange"); // Read SPCost TRANSLATE_VAL(SPCost, "Basics.SPCost"); // Read AvoidCyclic TRANSLATE_VAL(AvoidCyclic, "Basics.AvoidCyclic"); // Read UsableWithEmptyHands TRANSLATE_VAL(UsableWithEmptyHands, "Basics.UsableWithEmptyHands"); // Read Action Nature string val; TRANSLATE_ENUM(ActionNature, ACTNATURE::UNKNOWN, ACTNATURE::toActionNature, "Basics.Action Nature"); // Read CivRestriction TRANSLATE_ENUM(CivRestriction, EGSPD::CPeople::Common, EGSPD::CPeople::fromString, "Basics.CivRestriction"); // **** parse properties, to precompute the Bricks Flags. BrickRequiredFlags= 0; for(i=0;i<Properties.size();i++) { string text= NLMISC::toLower(Properties[i].Text); // If the property is an opening property const string openingProp[]= { "opening_1:", "opening_2:", "opening_3:" }; // or if the property is a general brick flag const string neededBrickFlag= "needed_brick_flag"; const uint nOpeningProp= sizeof(openingProp) / sizeof(openingProp[0]); for(uint j=0;j<nOpeningProp;j++) { const string &prop= openingProp[j]; // if found this property if( text.compare(0, prop.size(), prop)==0 || (j==0 && text.compare(0, neededBrickFlag.size(), neededBrickFlag)==0) ) { // get all the opening requirement vector<string> strList; strList.reserve(10); splitString(text, ":", strList); for(uint k=1;k<strList.size();k++) { // remove empty space, and convert to a bit strRemoveChar(strList[k], ' '); BRICK_FLAGS::TBrickFlag evFlag; evFlag= BRICK_FLAGS::toBrickFlag(strList[k]); if(evFlag!=BRICK_FLAGS::UnknownFlag) BrickRequiredFlags|= (uint64(1)<<(uint)evFlag); } break; } } } // **** parse required skills // parse the sheet str string skillReqStr; TRANSLATE_VAL(skillReqStr, "Basics.LearnRequiresOneOfSkills"); while(strFindReplace(skillReqStr, ":", " ")); listSkill.clear(); splitString(skillReqStr," ",listSkill); // build the req skill array RequiredSkills.clear(); RequiredSkills.reserve(listSkill.size()/2); for(i=0;i<listSkill.size()/2;i++) { CSkillValue sv; sv.Skill= SKILLS::toSkill(listSkill[i*2]); fromString(listSkill[i*2+1], sv.Value); // keep only whats work if(sv.Skill!=SKILLS::unknown) { RequiredSkills.push_back(sv); } } // **** parse required bricks // parse the sheet str string brickReqStr; TRANSLATE_VAL(brickReqStr, "Basics.LearnRequiresBricks"); while(strFindReplace(brickReqStr, ":", " ")); std::vector<string> listBrick; listBrick.clear(); splitString(brickReqStr," ",listBrick); // build the req skill array RequiredBricks.clear(); RequiredBricks.reserve(listBrick.size()); for(i=0;i<listBrick.size();i++) { CSheetId sheetId; string str= listBrick[i]; strlwr(str); if(str.find(".sbrick")==string::npos) str+= ".sbrick"; sheetId.buildSheetId(str); if(sheetId!=CSheetId::Unknown) { RequiredBricks.push_back(sheetId); } } // faction index string faction; root.getValueByName (faction, "Basics.Faction" ); FactionIndex = CStaticFames::getInstance().getFactionIndex( faction ); // min fame value TRANSLATE_VAL(MinFameValue, "Basics.Minimum fame"); // **** Magic only: try to get a ResistType against this brick for(i=0;i<Properties.size();i++) { string text= toLower(Properties[i].Text); // *** If the property is a DamageType const string dmgTypeProp= "ma_dmg_type:"; if( text.compare(0, dmgTypeProp.size(), dmgTypeProp)==0 ) { // extract the dmg type string dtStr= text.substr(dmgTypeProp.size()); strRemoveChar(dtStr, ' '); DMGTYPE::EDamageType dt= DMGTYPE::stringToDamageType(dtStr); if(dt!=DMGTYPE::UNDEFINED) { // Convert to a resist type RESISTANCE_TYPE::TResistanceType rt= DMGTYPE::getAssociatedResistanceType(dt); if(rt!=RESISTANCE_TYPE::None) MagicResistType= rt; } } // *** Do the same if the property is an effect family (affliction spells) const string effectFamProp= "ma_effect:"; if( text.compare(0, effectFamProp.size(), effectFamProp)==0 ) { // extract the effect family string efStr= text.substr(effectFamProp.size()); strRemoveChar(efStr, ' '); EFFECT_FAMILIES::TEffectFamily ef= EFFECT_FAMILIES::toEffectFamily(efStr); if(ef!=EFFECT_FAMILIES::Unknown) { // Convert to a resist type RESISTANCE_TYPE::TResistanceType rt= EFFECT_FAMILIES::getAssociatedResistanceType(ef); if(rt!=RESISTANCE_TYPE::None) MagicResistType= rt; } } } }
/** tool fct to get a float value from weather form, and to display an error msg if prb */ template <class T> static void getWeatherFuncFormValue(const NLGEORGES::UFormElm &item, T &dest, const char *name) { if (!item.getValueByName(dest, name)) nlwarning("Couldn't get %s from weather function form", name); }
//======================================================= void CSeasonFXSheet::build(const NLGEORGES::UFormElm &item, NLMISC::CSheetId parentId, const std::string &prefix) { bool ok = true; ok &= item.getValueByName(FXName, (prefix + "FXName").c_str()); if (FXName.empty()) return; uint32 fxMode = 0; ok &= item.getValueByName(fxMode, (prefix + "Mode").c_str()); Mode = (TMode) fxMode; ok &= item.getValueByName(CycleDuration, (prefix + "CycleDuration").c_str()); ok &= item.getValueByName(StartHourMin, (prefix + "StartHourMin").c_str()); ok &= item.getValueByName(StartHourMax, (prefix + "StartHourMax").c_str()); ok &= item.getValueByName(EndHourMin, (prefix + "EndHourMin").c_str()); ok &= item.getValueByName(EndHourMax, (prefix + "EndHourMax").c_str()); ok &= item.getValueByName(InheritScale, (prefix + "InheritScale").c_str()); ok &= item.getValueByName(InheritRot, (prefix + "InheritRot").c_str()); ok &= item.getValueByName(AngleMin, (prefix + "AngleMin").c_str()); ok &= item.getValueByName(AngleMax, (prefix + "AngleMax").c_str()); ok &= item.getValueByName(DontRotate, (prefix + "DontRotate").c_str()); ok &= item.getValueByName(DontRotateAroundLocalZ, (prefix + "DontRotateAroundLocalZ").c_str()); ok &= item.getValueByName(ScaleMin.x, (prefix + "ScaleMinX").c_str()); ok &= item.getValueByName(ScaleMin.y, (prefix + "ScaleMinY").c_str()); ok &= item.getValueByName(ScaleMin.z, (prefix + "ScaleMinZ").c_str()); ok &= item.getValueByName(ScaleMax.x, (prefix + "ScaleMaxX").c_str()); ok &= item.getValueByName(ScaleMax.y, (prefix + "ScaleMaxY").c_str()); ok &= item.getValueByName(ScaleMax.z, (prefix + "ScaleMaxZ").c_str()); ok &= item.getValueByName(UniformScale, (prefix + "UniformScale").c_str()); ok &= item.getValueByName(WantScaling, (prefix + "WantScaling").c_str()); ok &= item.getValueByName(AlignOnWater, (prefix + "AlignOnWater").c_str()); ok &= item.getValueByName(ZOffset, (prefix + "ZOffset").c_str()); // Anti Crash if(CycleDuration<=0) { nlwarning("FX: CPlantSheet '%s' has a season with a CycleDuration<=0: %f !!!!! setting it to 0.1.", parentId.toString().c_str(), CycleDuration); CycleDuration= 0.1f; } StartHourMin = fmodf(StartHourMin, CycleDuration); StartHourMax = fmodf(StartHourMax, CycleDuration); EndHourMin = fmodf(EndHourMin, CycleDuration); EndHourMax = fmodf(EndHourMax, CycleDuration); nlassert(isValidDouble(StartHourMin)); nlassert(isValidDouble(StartHourMax)); nlassert(isValidDouble(EndHourMin)); nlassert(isValidDouble(EndHourMax)); nlassert(isValidDouble(CycleDuration)); for(uint k = 0; k < 4; ++k) { ok &= item.getValueByName(UserParamsMin[k], (prefix + NLMISC::toString("UserParam%dMin", (int) k)).c_str()); ok &= item.getValueByName(UserParamsMax[k], (prefix + NLMISC::toString("UserParam%dMax", (int) k)).c_str()); } ok &= item.getValueByName(MinDuration, (prefix + "MinDuration").c_str()); ok &= item.getValueByName(MaxDuration, (prefix + "MaxDuration").c_str()); // prevent from overlapping interval if (Mode != AlwaysStarted && Mode != UseDuration && Mode != Spawn) { float startHourMin = StartHourMin; float startHourMax = StartHourMax; if (startHourMax < startHourMin) { startHourMax += CycleDuration; } float endHourMin = EndHourMin; float endHourMax = EndHourMax; if (endHourMax < endHourMin) { endHourMax += CycleDuration; } if (!(startHourMax <= endHourMin || startHourMin >= endHourMax)) { // intervals overlap -> bad nlwarning("Overlapping time intervals for fx spawn."); if (startHourMin <= endHourMin) { float inter = endHourMin; if (inter >= CycleDuration) { inter -= CycleDuration; } StartHourMax = inter; } else { float inter = startHourMin; if (inter >= CycleDuration) { inter -= CycleDuration; } EndHourMax = inter; } } } // compute duration of start interval float startHourMaxInterval; if (StartHourMin <= StartHourMax) { startHourMaxInterval = StartHourMax - StartHourMin; } else { startHourMaxInterval = CycleDuration - StartHourMin + StartHourMax; } NLMISC::clamp(MinDuration, 0.f, CycleDuration /*- startHourMaxInterval*/); NLMISC::clamp(MaxDuration, 0.f, CycleDuration /*- startHourMaxInterval*/); if (!ok) { nldebug("Key not found."); } }
//----------------------------------------------- // build : // Build the sheet from an external script. //----------------------------------------------- void CCharacterSheet::build(const NLGEORGES::UFormElm &item) { // First Name // string FirstName; // if(!item.getValueByName(FirstName, "Basics.First Name")) // debug("Key 'Basics.First Name' not found."); // IdFirstName = ClientSheetsStrings.add(FirstName); // // Character Name // string LastName; // if(!item.getValueByName(LastName, "Basics.CharacterName")) // debug("Key 'Basics.CharacterName' not found."); // IdLastName = ClientSheetsStrings.add(LastName); // Fame Name string FameName; if(!item.getValueByName(FameName, "Basics.Fame")) debug("Key 'Basics.Fame' not found."); IdFame = ClientSheetsStrings.add(FameName); // Character Race string raceStr; if(!item.getValueByName(raceStr, "Basics.Race")) debug("Key 'Basics.Race' not found."); else if (!raceStr.empty()) { Race = EGSPD::CPeople::fromString(raceStr); if (EGSPD::CPeople::toString(Race) != raceStr) { debug(toString("In sheet '%s': invalid race '%s', race is set to unknow", Id.toString().c_str(), raceStr.c_str())); } } else Race = EGSPD::CPeople::Unknown; // Player Gender. if(!item.getValueByName(Gender, "Basics.Gender")) debug("Key 'Gender' not found."); // Load the skel. string SkelFilename; if(!item.getValueByName(SkelFilename, "3d data.Skel")) debug("Key '3d data.Skel' not found."); IdSkelFilename = ClientSheetsStrings.add(SkelFilename); // BODY readEquipment(item, "Basics.Equipment.Body", Body); // LEGS readEquipment(item, "Basics.Equipment.Legs", Legs); // ARMS readEquipment(item, "Basics.Equipment.Arms", Arms); // HANDS readEquipment(item, "Basics.Equipment.Hands", Hands); // FEET readEquipment(item, "Basics.Equipment.Feet", Feet); // HEAD readEquipment(item, "Basics.Equipment.Head", Head); // FACE readEquipment(item, "Basics.Equipment.Face", Face); // IN RIGHT HAND readEquipment(item, "Basics.Equipment.HandR", ObjectInRightHand); // IN LEFT HAND readEquipment(item, "Basics.Equipment.HandL", ObjectInLeftHand); // Get the animation set Base Name. string AnimSetBaseName; if(item.getValueByName(AnimSetBaseName, "3d data.AnimSetBaseName")) { if(AnimSetBaseName.empty()) debug("AnimSetBaseName is Empty."); else NLMISC::strlwr(AnimSetBaseName); // Force the CASE in UPPER to not be CASE SENSITIVE. } else debug("Key '3d data.AnimSetBaseName' not found."); IdAnimSetBaseName = ClientSheetsStrings.add(AnimSetBaseName); // AUTOMATON TYPE string Automaton; if(item.getValueByName(Automaton, "3d data.Automaton")) { // Check there is an automaton if(Automaton.empty()) debug("Automaton is Empty."); // Lower Case else NLMISC::strlwr(Automaton); } // Key not Found else debug("Key '3d data.Automaton' not found."); IdAutomaton = ClientSheetsStrings.add(Automaton); // Display OSD if(!item.getValueByName(DisplayOSD, "3d data.DisplayOSD")) { debug("Key '3d data.DisplayOSD' not found -> set 'true'."); DisplayOSD = true; } // New Bot Object flags TRANSLATE_VAL(DisplayInRadar, "3d data.DisplayInRadar"); TRANSLATE_VAL(DisplayOSDName,"3d data.DisplayName"); TRANSLATE_VAL(DisplayOSDBars,"3d data.DisplayBars"); TRANSLATE_VAL(DisplayOSDForceOver, "3d data.DisplayAlwaysNameOver"); TRANSLATE_VAL(Traversable, "Collision.NotTraversable"); // invert Traversable= !Traversable; // CREATURE PROPERTIES (Possible Actions) // Is the character selectable ? if(!item.getValueByName(Selectable, "Properties.Selectable")) { debug("Key 'Properties.Selectable' not found -> set 'false'."); Selectable = false; } // Is the character Talkable ? if(!item.getValueByName(Talkable, "Properties.Talkable")) { debug("Key 'Properties.Talkable' not found -> set 'false'."); Talkable = false; } // Is the character Attackable ? if(!item.getValueByName(Attackable, "Properties.Attackable")) { debug("Key 'Properties.Attackable' not found -> set 'false'."); Attackable = false; } // Is the character Givable ? if(!item.getValueByName(Givable, "Properties.Givable")) { debug("Key 'Properties.Givable' not found -> set 'false'."); Givable = false; } // Is the character Mountable ? if(!item.getValueByName(Mountable, "Properties.Mountable")) { debug("Key 'Properties.Mountable' not found -> set 'false'."); Mountable = false; } // Is the character allowed to turn ? if(!item.getValueByName(Turn, "Properties.Turn")) { debug("Key 'Properties.Turn' not found -> set 'true'."); Turn = true; } // Is the character selectable by pressing space (default) ? if(!item.getValueByName(SelectableBySpace, "Properties.SelectableBySpace")) { debug("Key 'Properties.SelectableBySpace' not found -> set 'true'."); SelectableBySpace = true; } //Get the harvest/loot state string harvestLootStr; if( !item.getValueByName(harvestLootStr, "Properties.LootHarvestState") ) debug("Key 'roperties.LootHarvestState' not found."); else HLState = LHSTATE::stringToLHState(harvestLootStr); // Get the Hair Color. if(!item.getValueByName(HairColor, "3d data.HairColor")) debug("Key '3d data.HairColor' not found."); // Get the Skin Texture. if(!item.getValueByName(Skin, "3d data.Skin")) debug("Key '3d data.Skin' not found."); // Get the Eyes Color. if(!item.getValueByName(EyesColor, "3d data.EyesColor")) debug("Key '3d data.EyesColor' not found."); // Load Lod character name string LodCharacterName; if(!item.getValueByName(LodCharacterName, "3d data.LodCharacterName")) debug("Key '3d data.LodCharacterName' not found."); IdLodCharacterName = ClientSheetsStrings.add(LodCharacterName); // Load Lod character apparition distance if(!item.getValueByName(LodCharacterDistance, "3d data.LodCharacterDistance")) debug("Key '3d data.LodCharacterDistance' not found."); // value to scale the "pos" channel of the animation of the player. if(!item.getValueByName(CharacterScalePos, "3d data.CharacterScalePos")) debug("Key '3d data.CharacterScalePos' not found."); // value to scale the "pos" channel of the animation of the player. if(!item.getValueByName(Scale, "3d data.Scale")) debug("Key '3d data.Scale' not found."); else { if(Scale <= 0.0f) { nlwarning("CCharacterSheet:build: Scale(%f) <= 0.0 so fix scale to 1.0", Scale); Scale = 1.0f; } } // Load name positions on Z axis if(!item.getValueByName(NamePosZLow, "3d data.NamePosZLow")) { NamePosZLow = 0.f; debug("Key '3d data.NamePosZLow' not found."); } if(!item.getValueByName(NamePosZNormal, "3d data.NamePosZNormal")) { NamePosZNormal = 0.f; debug("Key '3d data.NamePosZNormal' not found."); } if(!item.getValueByName(NamePosZHigh, "3d data.NamePosZHigh")) { NamePosZHigh = 0.f; debug("Key '3d data.NamePosZHigh' not found."); } // value to change sound familly if(!item.getValueByName(SoundFamily, "3d data.SoundFamily")) debug("Key '3d data.SoundFamily' not found."); // value to change sound variation if(!item.getValueByName(SoundVariation, "3d data.SoundVariation")) debug("Key '3d data.SoundVariation' not found."); // Get the dist fromm Bip to Mid float tmpBip01ToMid; if(!item.getValueByName(tmpBip01ToMid, "Collision.Dist Bip01 to mid")) { tmpBip01ToMid = 0.f; debug("Key 'Collision.Dist Bip01 to mid' not found."); } // Get the distance from the bip01 to the front. if(!item.getValueByName(DistToFront, "Collision.Dist Bip01 to front")) { DistToFront = 1.f; debug("Key 'Collision.Dist Bip01 to front' not found."); } // Get the distance from the bip01 to the front. if(!item.getValueByName(DistToBack, "Collision.Dist Bip01 to back")) { DistToBack = 1.f; debug("Key 'Collision.Dist Bip01 to back' not found."); } // Get the creature Width. if(!item.getValueByName(ColWidth, "Collision.Width")) { ColWidth = 1.f; debug("Key 'Collision.Width' not found."); } DistToSide = ColWidth; DistToFront = DistToFront-tmpBip01ToMid; DistToBack = tmpBip01ToMid-DistToBack; DistToSide = DistToSide/2.f; // Get the creature collision Radius. if(!item.getValueByName(ColRadius, "Collision.CollisionRadius")) { ColRadius = 0.5f; debug("Key 'Collision.CollisionRadius' not found."); } // Get the creature collision Height. if(!item.getValueByName(ColHeight, "Collision.Height")) { ColHeight = 2.f; debug("Key 'Collision.Height' not found."); } // Get the creature collision Length. if(!item.getValueByName(ColLength, "Collision.Length")) { ColLength = 1.f; debug("Key 'Collision.Length' not found."); } // CLIP if(!item.getValueByName(ClipRadius, "Collision.ClipRadius")) { ClipRadius = 0.f; debug("Key 'Collision.ClipRadius' not found."); } if(!item.getValueByName(ClipHeight, "Collision.ClipHeight")) { ClipHeight = 0.f; debug("Key 'Collision.ClipHeight' not found."); } // SPEED // // Get the creature Max Speed (Run). if(!item.getValueByName(MaxSpeed, "Basics.MovementSpeeds.RunSpeed")) { MaxSpeed = 10.f; debug("Key 'Basics.MovementSpeeds.RunSpeed' not found."); } const UFormElm *elm = NULL; // Get all alternative Clothes. static const char alternativeClothesKey[] = "Basics.Alternative Clothes"; if(item.getNodeByName(&elm, alternativeClothesKey) && elm) { // Check array. if(elm->isArray()) { // Get Array Size uint altClothesArraySize; if(elm->getArraySize(altClothesArraySize)) { // Get values. string altClothes; for(uint i=0; i<altClothesArraySize; ++i) { if(elm->getArrayValue(altClothes, i)) { if(!altClothes.empty()) { TSStringId IdAltClothes = ClientSheetsStrings.add(altClothes); IdAlternativeClothes.push_back(IdAltClothes); } else debug(toString("'%s' field empty for the index '%d'.", alternativeClothesKey, i)); } else debug(toString("'%s' cannot get the array value for the index '%d'.", alternativeClothesKey, i)); } } else debug(toString("'%s' cannot get the array size.", alternativeClothesKey)); } else debug(toString("'%s' is not an array.", alternativeClothesKey)); } else debug(toString("'%s' key not found.", alternativeClothesKey)); // Hair item list static const char hairItemList[] = "3d data.HairItem"; if(item.getNodeByName(&elm, hairItemList) && elm) { // Check array. if(elm->isArray()) { // Get Array Size uint hairItemArraySize; if(elm->getArraySize(hairItemArraySize)) { if(hairItemArraySize > 0) { // Adjust the array size. HairItemList.resize(hairItemArraySize); // Get values. for(uint i=0; i<hairItemArraySize; ++i) { string arrayNodeName; if(elm->getArrayNodeName(arrayNodeName, i)) readEquipment(item, string(hairItemList)+"["+toString(i)+"]", HairItemList[i]); } } } else debug(toString("'%s' cannot get the array size.", hairItemList)); } else debug(toString("'%s' is not an array.", hairItemList)); } else debug(toString("'%s' key not found.", hairItemList)); // ground fxs static const char groundFXList[] = "3d data.GroundFX"; if(item.getNodeByName(&elm, groundFXList) && elm) { // Check array. if(elm->isArray()) { // Get Array Size uint groundFXArraySize; if(elm->getArraySize(groundFXArraySize)) { if(groundFXArraySize > 0) { // Adjust the array size. GroundFX.reserve(groundFXArraySize); // Get values. for(uint i=0; i< groundFXArraySize; ++i) { const UFormElm *node; if (elm->getArrayNode(&node, i) && node != NULL) { CGroundFXSheet gfs; if (!gfs.build(*node)) { nlwarning("Error while building node %d", (int) i); } else { uint k; for(k = 0; k < GroundFX.size(); ++k) { if (GroundFX[k].GroundID == gfs.GroundID) { debug("Duplicated material"); GroundFX[k] = gfs; break; } } if (k == GroundFX.size()) { GroundFX.push_back(gfs); } } } } } } else debug(toString("'%s' cannot get the array size.", groundFXList)); } else debug(toString("'%s' is not an array.", groundFXList)); } else debug(toString("'%s' key not found.", groundFXList)); // sort fxs by ground type std::sort(GroundFX.begin(), GroundFX.end()); // Load Ground FX string staticFx; if(!item.getValueByName(staticFx, "3d data.FX")) debug("Key '3d data.FX' not found."); IdStaticFX = ClientSheetsStrings.add(staticFx); BodyToBone.build(item, "Localisation."); // Attack lists for(uint k = 0; k < NumAttackLists; ++k) { std::string attackListName; if(item.getValueByName(attackListName, toString("attack_list%d", (int) k).c_str()) && !attackListName.empty()) { AttackLists.push_back(ClientSheetsStrings.add(attackListName)); } } if(!item.getValueByName(RegionForce, "Basics.RegionForce")) { RegionForce = 0; debug("Key 'Basics.RegionForce' not found."); } if(!item.getValueByName(ForceLevel, "Basics.ForceLevel")) { ForceLevel = 0; debug("Key 'Basics.Regio Force' not found."); } if(!item.getValueByName(Level, "Basics.XPLevel")) { Level = 0; debug("Key 'Basics.XPLevel' not found."); } // offset for projectiles const UFormElm *pElt; nlverify (item.getNodeByName (&pElt, "3d data.ProjectileCastRay")); uint arraySize; if (pElt != NULL) { nlverify (pElt->getArraySize (arraySize)); ProjectileCastRay.reserve(arraySize); for (uint32 i = 0; i < arraySize; ++i) { const UFormElm *pEltOfList; if (pElt->getArrayNode (&pEltOfList, i) && pEltOfList) { const UFormElm *pEltPos; const UFormElm *pEltOrigin; if (pEltOfList->getNodeByName(&pEltPos, "Pos") && pEltOfList->getNodeByName(&pEltOrigin, "Origin")) { CCharacterSheet::CCastRay cr; if (pEltPos->getValueByName(cr.Pos.x, "X") && pEltPos->getValueByName(cr.Pos.y, "Y") && pEltPos->getValueByName(cr.Pos.z, "Z") && pEltOrigin->getValueByName(cr.Origin.x, "X") && pEltOrigin->getValueByName(cr.Origin.y, "Y") && pEltOrigin->getValueByName(cr.Origin.z, "Z") ) { ProjectileCastRay.push_back(cr); } } } } } if(!item.getValueByName(R2Npc, "r2_npc")) { R2Npc = false; debug("Key 'R2Npc' not found."); } }// build //