Skip to content

Commit

Permalink
quiz: Make maximum number of jokers configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgadling authored and Oblomov committed May 18, 2009
1 parent e412b9b commit 11e245b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions data/rbot/plugins/games/quiz.rb
Expand Up @@ -33,9 +33,6 @@
define_structure :PlayerStats, :score, :jokers, :jokers_time
# Why do we still need jokers_time? //Firetech

# Maximum number of jokers a player can gain
Max_Jokers = 3

# Control codes
Color = "\003"
Bold = "\002"
Expand Down Expand Up @@ -164,6 +161,11 @@ class QuizPlugin < Plugin
:default => ['quiz.rbot'],
:desc => "List of files and URLs that will be used to retrieve quiz questions")


Config.register Config::IntegerValue.new('quiz.max_jokers',
:default => 3,
:desc => "Maximum number of jokers a player can gain")

def initialize()
super

Expand Down Expand Up @@ -406,7 +408,7 @@ def message(m)
player.score = player.score + points

# Reward player with a joker every X points
if player.score % 15 == 0 and player.jokers < Max_Jokers
if player.score % 15 == 0 and player.jokers < @bot.config['quiz.max_jokers']
player.jokers += 1
m.reply "#{nick} gains a new joker. Rejoice :)"
end
Expand Down Expand Up @@ -899,7 +901,7 @@ def cmd_set_jokers(m, params)
debug q.rank_table.inspect

nick = params[:nick]
val = [params[:jokers].to_i, Max_Jokers].min
val = [params[:jokers].to_i, @bot.config['quiz.max_jokers']].min
if q.registry.has_key?(nick)
player = q.registry[nick]
player.jokers = val
Expand Down

0 comments on commit 11e245b

Please sign in to comment.