Jeopardy: fix defaultPointValue

This commit is contained in:
oddluck 2020-06-01 23:54:42 +00:00
parent 42fb7e1039
commit 6bc819ba21

View File

@ -91,6 +91,7 @@ class Jeopardy(callbacks.Plugin):
plugin, plugin,
): ):
self.registryValue = plugin.registryValue self.registryValue = plugin.registryValue
defaultPoints = self.registryValue("defaultPointValue")
self.active = True self.active = True
self.answered = 0 self.answered = 0
self.blankChar = self.registryValue("blankChar", channel) self.blankChar = self.registryValue("blankChar", channel)
@ -119,7 +120,6 @@ class Jeopardy(callbacks.Plugin):
self.numAsked = 0 self.numAsked = 0
self.numClues = num self.numClues = num
self.numHints = hints self.numHints = hints
self.points = self.registryValue("defaultPointValue")
self.question = "" self.question = ""
if restart: if restart:
self.question_template = Template( self.question_template = Template(
@ -207,11 +207,12 @@ class Jeopardy(callbacks.Plugin):
answer = item["answer"].strip() answer = item["answer"].strip()
category = string.capwords(item["category"]["title"]) category = string.capwords(item["category"]["title"])
invalid = item["invalid_count"] invalid = item["invalid_count"]
points = self.points points = defaultPoints
if int(item["value"]) >= 100: if item.get("value"):
points = int(item["value"]) try:
else: points = int(item["value"])
points = self.points except:
continue
if self.registryValue("keepHistory", channel): if self.registryValue("keepHistory", channel):
if ( if (
clue clue
@ -245,8 +246,9 @@ class Jeopardy(callbacks.Plugin):
self.questions.append(q) self.questions.append(q)
asked.append(id) asked.append(id)
n += 1 n += 1
except Exception: except Exception as e:
continue log.error("Jeopardy: Error: {0}".format(e))
break
else: else:
n = 0 n = 0
k = 0 k = 0
@ -336,11 +338,12 @@ class Jeopardy(callbacks.Plugin):
answer = item["answer"].strip() answer = item["answer"].strip()
category = string.capwords(item["category"]["title"]) category = string.capwords(item["category"]["title"])
invalid = item["invalid_count"] invalid = item["invalid_count"]
points = self.points points = defaultPoints
if int(item["value"]) >= 100: if item.get("value"):
points = int(item["value"]) try:
else: points = int(item["value"])
points = self.points except:
pass
if self.registryValue("keepHistory", channel): if self.registryValue("keepHistory", channel):
if ( if (
clue clue
@ -377,8 +380,10 @@ class Jeopardy(callbacks.Plugin):
n += 1 n += 1
j += 1 j += 1
k += 1 k += 1
except Exception: except Exception as e:
continue log.error("Jeopardy: Error: {0}".format(e))
k += 1
break
if self.shuffled or self.registryValue("randomize", channel): if self.shuffled or self.registryValue("randomize", channel):
random.shuffle(self.questions) random.shuffle(self.questions)
else: else:
@ -1111,4 +1116,3 @@ class Jeopardy(callbacks.Plugin):
Class = Jeopardy Class = Jeopardy