Skip to content

Commit

Permalink
Better IV and Level format. Rename nicknamed pokemons also
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Diaz committed Sep 30, 2016
1 parent 33abc2e commit 47c1c09
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.icecream.snorlax.module.feature.rename;

import java.text.DecimalFormat;
import java.util.List;
import java.util.Locale;

Expand All @@ -24,7 +25,6 @@

import com.google.protobuf.ByteString;
import com.google.protobuf.InvalidProtocolBufferException;
import com.icecream.snorlax.common.Strings;
import com.icecream.snorlax.module.Pokemons;
import com.icecream.snorlax.module.feature.Feature;
import com.icecream.snorlax.module.feature.mitm.MitmListener;
Expand Down Expand Up @@ -103,9 +103,9 @@ private ByteString processInventory(GetInventoryResponse response) {
if (data.getPokemonData().getPokemonId() != PokemonId.MISSINGNO) {
PokemonData.Builder pokemon = data.getPokemonData().toBuilder();

if (Strings.isEmpty(pokemon.getNickname())) {
//if (Strings.isEmpty(pokemon.getNickname())) {
pokemon.setNickname(processNickname(data.getPokemonData()));
}
//}
data.setPokemonData(pokemon);
}

Expand All @@ -118,14 +118,17 @@ private ByteString processInventory(GetInventoryResponse response) {
private String processNickname(PokemonData pokemonData) {
Pokemons.Data data = mPokemons.with(pokemonData);

DecimalFormat ivFormatter = new DecimalFormat("000.0");
DecimalFormat lvFormatter = new DecimalFormat("00.0");

return String.format(
Locale.US,
"%4.1f %s/%s/%s %3.1f",
data.getIvPercentage(),
"%s %d/%d/%d %s",
ivFormatter.format(data.getIvPercentage()),
data.getAttack(),
data.getDefense(),
data.getStamina(),
data.getLevel()
lvFormatter.format(data.getLevel())
);
}
}

0 comments on commit 47c1c09

Please sign in to comment.