diff options
author | David Gadling <dave@toasterwaffles.com> | 2009-05-05 14:57:13 -0700 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-05-19 00:56:49 +0200 |
commit | 11e245be3a7974edcf5b174af5a3af5a548f39f3 (patch) | |
tree | 1d6eeb05d5276dcaeadcab27ec69da2e80bdac29 /data/rbot | |
parent | e412b9bc6b66935638b693fe627d557ea82766bb (diff) |
quiz: Make maximum number of jokers configurable.
Diffstat (limited to 'data/rbot')
-rw-r--r-- | data/rbot/plugins/games/quiz.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/data/rbot/plugins/games/quiz.rb b/data/rbot/plugins/games/quiz.rb index aaac24fa..63a5dde4 100644 --- a/data/rbot/plugins/games/quiz.rb +++ b/data/rbot/plugins/games/quiz.rb @@ -33,9 +33,6 @@ define_structure :QuizBundle, :question, :answer 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" @@ -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 @@ -406,7 +408,7 @@ class QuizPlugin < Plugin 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 @@ -899,7 +901,7 @@ class QuizPlugin < Plugin 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 |