From 47c1c09290bde1ae59d1a9152090f55aeb9b7818 Mon Sep 17 00:00:00 2001 From: Pedro Diaz Date: Fri, 30 Sep 2016 07:29:48 -0400 Subject: [PATCH] Better IV and Level format. Rename nicknamed pokemons also --- .../snorlax/module/feature/rename/Rename.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/icecream/snorlax/module/feature/rename/Rename.java b/app/src/main/java/com/icecream/snorlax/module/feature/rename/Rename.java index a19611d..afb5567 100644 --- a/app/src/main/java/com/icecream/snorlax/module/feature/rename/Rename.java +++ b/app/src/main/java/com/icecream/snorlax/module/feature/rename/Rename.java @@ -16,6 +16,7 @@ package com.icecream.snorlax.module.feature.rename; +import java.text.DecimalFormat; import java.util.List; import java.util.Locale; @@ -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; @@ -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); } @@ -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()) ); } }