AsyncEclipse / DiscordBot

GNU General Public License v3.0
1 stars 3 forks source link

Map Drawing Error - Resource drawing index error #67

Closed TaylorBoyd closed 1 month ago

TaylorBoyd commented 1 month ago

Traceback (most recent call last): File "/home/eatingflowers/.local/lib/python3.10/site-packages/discord/client.py", line 449, in _run_event await coro(*args, **kwargs) File "/home/eatingflowers/DiscordBot/./listeners/ButtonListener.py", line 40, in on_interaction await TurnButtons.showGame(game, interaction, self.bot) File "/home/eatingflowers/DiscordBot/./Buttons/Turn.py", line 127, in showGame stats = drawing.show_stats() File "/home/eatingflowers/DiscordBot/./helpers/DrawHelper.py", line 637, in show_stats context2 = create_player_area() File "/home/eatingflowers/DiscordBot/./helpers/DrawHelper.py", line 620, in create_player_area player_image = self.player_area(self.gamestate["players"][player]) File "/home/eatingflowers/DiscordBot/./helpers/DrawHelper.py", line 446, in player_area draw_resource(context, img_path, text_color, player_key, amount_key, (x, y)) File "/home/eatingflowers/DiscordBot/./helpers/DrawHelper.py", line 436, in draw_resource amountIncrease = player["population_track"][player[amount_key]-1] - (player["influence_track"][player["influence_discs"]] if player_key == "money" else 0) IndexError: list index out of range

TaylorBoyd commented 1 month ago

Game 71 gamestate at the time aeb71.json

Fingon00 commented 1 month ago

Have written code to protect against this, though should probably also write code to limit how large these values can get