def _should_skip_species(species: PrimalDinoCharacter, overrides: OverrideSettings): if overrides.skip_export: return True if not species.has_override('DescriptiveName'): return True return False
def convert_level_data( species: PrimalDinoCharacter, dcsc: DinoCharacterStatusComponent) -> Optional[LevelData]: if bool(species.bIsBossDino[0]): return None pgd_asset = species.get_source().asset.loader[COREMEDIA_PGD_PKG] assert pgd_asset.default_export pgd: PropertyTable = pgd_asset.default_export.properties result = LevelData() # Max experience points max_xp_override = species.OverrideDinoMaxExperiencePoints[0] if max_xp_override > 0: result.maxExperience = max_xp_override else: result.maxExperience = dcsc.MaxExperiencePoints[0] # Export ramp type and find one from PGD ramp_type = dcsc.LevelExperienceRampType[0].get_enum_value_name() if ramp_type != LevelExperienceRampType.DinoEasy.name: result.ramp = ramp_type ramp_id = LevelExperienceRampType[ramp_type].value ramp_prop = pgd.get_property('LevelExperienceRamps', index=ramp_id, fallback=None) if not ramp_prop: # No ramp (MAX). result.maxLevels = 0 else: ramp = ramp_prop.values[0].value # Find highest level using a vanilla ramp for index, threshold in enumerate(ramp.values): if result.maxExperience >= threshold: result.maxLevels = index + 1 else: break # Level cap offset if species.has_override('DestroyTamesOverLevelClampOffset'): result.capOffset = species.DestroyTamesOverLevelClampOffset[0] return result
def convert_level_data(species: PrimalDinoCharacter, dcsc: DinoCharacterStatusComponent) -> LevelData: pgd_asset = species.get_source().asset.loader[COREMEDIA_PGD_PKG] assert pgd_asset.default_export pgd: PropertyTable = pgd_asset.default_export.properties result = LevelData() # Max experience points max_xp_override = species.OverrideDinoMaxExperiencePoints[0] if max_xp_override > 0: result.maxExperience = max_xp_override else: result.maxExperience = dcsc.MaxExperiencePoints[0] # Export ramp type and find one from PGD ramp_type = dcsc.LevelExperienceRampType[0].get_enum_value_name() if ramp_type != LevelExperienceRampType.DinoEasy.name: result.xpRamp = ramp_type # Calculate max levels out of max XP. ramp_id = LevelExperienceRampType[ramp_type].value ramp_prop = pgd.get_property('LevelExperienceRamps', index=ramp_id, fallback=None) if not ramp_prop: # No ramp (MAX). Tame level ups not possible. result.maxTameLevels = 0 else: ramp = ramp_prop.values[0].value # Find highest level using a vanilla ramp for index, threshold in enumerate(ramp.values): if result.maxExperience >= threshold: result.maxTameLevels = index + 1 else: break # Official servers' level cap if species.has_override('DestroyTamesOverLevelClampOffset'): result.levelCapOffset = species.DestroyTamesOverLevelClampOffset[0] # Wild spawn levels base_level_override = species.AbsoluteBaseLevel[0] fixed_level = species.bUseFixedSpawnLevel[0] if base_level_override != 0 or fixed_level: # Forced base level. Does not scale with difficulty. result.wildForcedLevel = base_level_override or 1 result.ignoresLevelModifiers = fixed_level # If level modifiers are enabled, multiply the level by final level multiplier. if not fixed_level: result.wildForcedLevel *= species.FinalNPCLevelMultiplier[0] else: # Weighed level range table. level_weights = species.get('DinoBaseLevelWeightEntries', fallback=None) out_level_table = list() if level_weights and level_weights.values: weight_sum = 0 entries = list() final_mult = species.FinalNPCLevelMultiplier[0] # Gather the data into a temporary list, with weight and range. for entry in level_weights: d = entry.as_dict() entries.append( (d['EntryWeight'], d['BaseLevelMinRange'] * final_mult, d['BaseLevelMaxRange'] * final_mult)) weight_sum += d['EntryWeight'] # Pack gathered data into MinMaxChanceRanges with calculated chances. The properties cannot be modified through INI # configs. for weight, min_lvl, max_lvl in entries: out_level_table.append( MinMaxChanceRange(chance=clean_float(weight / weight_sum), min=clean_float(min_lvl), max=clean_float(max_lvl))) result.wildLevelTable = out_level_table # Calculate required amount of Mutagen needed to use it. # Formula extracted from PrimalItemConsumable_Mutagen_C's scripts # Vultures cannot use Mutagen as it can't enter their inventories. # IsRobot and IsVehicle banned from Mutagen in v329.51. if species.DinoNameTag[0] != 'Vulture' and not species.bIsRobot[ 0] and not species.bIsVehicle[0]: mutagen_base = species.MutagenBaseCost[0] if mutagen_base <= 0: mutagen_base = species.CloneBaseElementCost[0] if mutagen_base > 0: cost = 1 + 99 * mutagen_base # Round up 0.5 to conform with in-game calculations. if (cost % 1) >= 0.5: result.mutagenCost = ceil(cost) else: result.mutagenCost = round(cost) return result