use of POGOProtos.Settings.Master.PlayerLevelSettingsOuterClass.PlayerLevelSettings in project PokeGOAPI-Java by Grover-c13.
the class ItemTemplates method reloadTemplates.
private void reloadTemplates() {
templates.clear();
pokemonSettings.clear();
moveSettings.clear();
badgeSettings.clear();
itemSettings.clear();
for (ItemTemplate template : provider.getTemplates().values()) {
if (template.hasPokemonSettings()) {
PokemonSettings pokemonSettings = template.getPokemonSettings();
this.pokemonSettings.put(pokemonSettings.getPokemonId(), pokemonSettings);
} else if (template.hasMoveSettings()) {
MoveSettings moveSettings = template.getMoveSettings();
this.moveSettings.put(moveSettings.getMovementId(), moveSettings);
} else if (template.hasBadgeSettings()) {
BadgeSettings badgeSettings = template.getBadgeSettings();
this.badgeSettings.put(badgeSettings.getBadgeType(), badgeSettings);
} else if (template.hasItemSettings()) {
ItemSettings itemSettings = template.getItemSettings();
this.itemSettings.put(itemSettings.getItemId(), itemSettings);
} else if (template.hasBattleSettings()) {
battleSettings = template.getBattleSettings();
} else if (template.hasPokemonUpgrades()) {
upgradeSettings = template.getPokemonUpgrades();
} else if (template.hasPlayerLevel()) {
PlayerLevelSettings settings = template.getPlayerLevel();
List<Float> multipliers = settings.getCpMultiplierList();
for (int i = 0; i < multipliers.size(); i++) {
double multiplier = multipliers.get(i);
levelCpMultiplier.put(i + 1.0F, multiplier);
double nextMultiplier = multipliers.get(Math.min(multipliers.size() - 1, i + 1));
double step = ((nextMultiplier * nextMultiplier) - (multiplier * multiplier)) / 2.0F;
if (i >= 30) {
step /= 2.0;
}
levelCpMultiplier.put(i + 1.5F, Math.sqrt((multiplier * multiplier) + step));
}
}
templates.add(template);
}
evolutions = new Evolutions(this);
loaded = true;
}
Aggregations