mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-25 20:41:21 -05:00
Jeopardy: add points to hint template
This commit is contained in:
parent
2c40713d3a
commit
1ef8fb2b88
@ -148,7 +148,7 @@ conf.registerChannelValue(Jeopardy.template.restart, 'correct',
|
||||
_("""The template used to render correct answer replies when autoRestart is True.""")))
|
||||
|
||||
conf.registerChannelValue(Jeopardy.template, 'hint',
|
||||
registry.String("HINT: {{hint}}{% if time %} | ({{time}} seconds remaining){% endif %}", _("""The template used to render hints.""")))
|
||||
registry.String("HINT: {{hint}}{% if time %} | ({{time}} seconds remaining){% endif %}{% if points %} | \x0309[${{points}}]{% endif %}", _("""The template used to render hints.""")))
|
||||
|
||||
conf.registerChannelValue(Jeopardy.template, 'correct',
|
||||
registry.String("\x0313{{nick}}\x03 got it! The full answer was: {{answer}}. Points: \x0309{{points}}\x03 | Round Score: \x0309{{round}}\x03 | Total: \x0309{{total}}",
|
||||
|
@ -110,6 +110,7 @@ class Jeopardy(callbacks.Plugin):
|
||||
else:
|
||||
self.question_template = Template(self.registryValue("template.question", channel))
|
||||
self.questions = []
|
||||
self.points = 0
|
||||
self.reduction = self.registryValue('hintReduction', self.channel)
|
||||
self.restart = restart
|
||||
self.roundscores = requests.structures.CaseInsensitiveDict()
|
||||
@ -313,6 +314,7 @@ class Jeopardy(callbacks.Plugin):
|
||||
self.id = q[0]
|
||||
question['airdate'] = q[1]
|
||||
self.p = int(q[2])
|
||||
self.points = self.p
|
||||
question['category'] = q[3]
|
||||
question['clue'] = q[4]
|
||||
self.a = q[5]
|
||||
@ -457,8 +459,12 @@ class Jeopardy(callbacks.Plugin):
|
||||
self.currentHint = ''.join(self.show[self.id])
|
||||
if self.hints > 0:
|
||||
self.p -= int(self.p * self.reduction)
|
||||
if self.points > self.p:
|
||||
points = self.p
|
||||
else:
|
||||
points = None
|
||||
if self.timeout > 0:
|
||||
reply = self.hint_template.render(hint = self.currentHint, time = round(self.endTime - time.time()))
|
||||
reply = self.hint_template.render(hint = self.currentHint, time = round(self.endTime - time.time()), points = points)
|
||||
if self.showHints or self.showTime:
|
||||
def event():
|
||||
self.timedEvent()
|
||||
@ -466,7 +472,7 @@ class Jeopardy(callbacks.Plugin):
|
||||
if eventTime < self.endTime:
|
||||
schedule.addEvent(event, eventTime, 'event_%s' % self.channel)
|
||||
else:
|
||||
reply = self.hint_template.render(hint = self.currentHint, time = None)
|
||||
reply = self.hint_template.render(hint = self.currentHint, time = None, points = points)
|
||||
self.reply(reply)
|
||||
self.hints += 1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user