mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-25 12:31:07 -05:00
fix a bug where it produces an error and stops the hunt when that happens (#69)
This hopefully fixes the "If the hunt starts a day and ends the day after, this will produce an error" [here](8a87fa6892/DuckHunt/plugin.py (L146)
)
This commit is contained in:
parent
8a87fa6892
commit
c816dee66f
@ -141,10 +141,32 @@ class DuckHunt(callbacks.Plugin):
|
|||||||
if self.worsttimes[channel][player] > value:
|
if self.worsttimes[channel][player] > value:
|
||||||
self.channelworsttimes[channel][player] = value
|
self.channelworsttimes[channel][player] = value
|
||||||
|
|
||||||
|
# # week scores
|
||||||
|
# for player, value in self.scores[channel].items():
|
||||||
|
# # FIXME: If the hunt starts a day and ends the day after, this will produce an error:
|
||||||
|
# if not player in self.channelweek[channel][self.woy][self.dow]:
|
||||||
|
# # It's a new player
|
||||||
|
# self.channelweek[channel][self.woy][self.dow][player] = value
|
||||||
|
# else:
|
||||||
|
# # It's a player that already has a saved score
|
||||||
|
# self.channelweek[channel][self.woy][self.dow][player] += value
|
||||||
|
|
||||||
# week scores
|
# week scores
|
||||||
for player, value in self.scores[channel].items():
|
for player, value in self.scores[channel].items():
|
||||||
# FIXME: If the hunt starts a day and ends the day after, this will produce an error:
|
# Ensure that the channel exists
|
||||||
if not player in self.channelweek[channel][self.woy][self.dow]:
|
if channel not in self.channelweek:
|
||||||
|
self.channelweek[channel] = {}
|
||||||
|
|
||||||
|
# Ensure that the week of year (self.woy) exists for the channel
|
||||||
|
if self.woy not in self.channelweek[channel]:
|
||||||
|
self.channelweek[channel][self.woy] = {}
|
||||||
|
|
||||||
|
# Ensure that the day of week (self.dow) exists for the week
|
||||||
|
if self.dow not in self.channelweek[channel][self.woy]:
|
||||||
|
self.channelweek[channel][self.woy][self.dow] = {}
|
||||||
|
|
||||||
|
# Now it's safe to check for the player
|
||||||
|
if player not in self.channelweek[channel][self.woy][self.dow]:
|
||||||
# It's a new player
|
# It's a new player
|
||||||
self.channelweek[channel][self.woy][self.dow][player] = value
|
self.channelweek[channel][self.woy][self.dow][player] = value
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user