Skip to content

Commit

Permalink
NicknamePokemon: Format iv_pct on 3 digits (#3698)
Browse files Browse the repository at this point in the history
For better sorting on pokemon's name, format iv_pct on 3 digits.
  • Loading branch information
vdubus authored and elicwhite committed Aug 12, 2016
1 parent b8ea368 commit ac07ad3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pokemongo_bot/cell_workers/nickname_pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _nickname_pokemon(self,pokemon):
iv_list = [iv_attack,iv_defense,iv_stamina]
iv_ads = "/".join(map(str,iv_list))
iv_sum = sum(iv_list)
iv_pct = "{:0.0f}".format(100*iv_sum/45.0)
iv_pct = "{:03.0f}".format(100*iv_sum/45.0)
log_color = 'red'
try:
new_name = self.template.format(name=name,
Expand Down

5 comments on commit ac07ad3

@z-jun
Copy link

@z-jun z-jun commented on ac07ad3 Aug 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not work well on whole ten numbers. 80% mon will produce 08 suffix insteed of 080.

@Biromain
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it with "nickname_template": "{iv_pct:0>3}_{iv_ads}" and seems to work.

@z-jun
Copy link

@z-jun z-jun commented on ac07ad3 Aug 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My fault. Suffix was truncated by name length limit.

@TCB13
Copy link

@TCB13 TCB13 commented on ac07ad3 Aug 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can I NOT HAVE this 3-digit thing? My current config: "nickname_template": "{name} {iv_pct}". Thanks!

@TCB13
Copy link

@TCB13 TCB13 commented on ac07ad3 Aug 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, {iv_pct2} does the trick.

Please sign in to comment.