From 11e245be3a7974edcf5b174af5a3af5a548f39f3 Mon Sep 17 00:00:00 2001 From: David Gadling Date: Tue, 5 May 2009 14:57:13 -0700 Subject: quiz: Make maximum number of jokers configurable. --- data/rbot/plugins/games/quiz.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'data/rbot/plugins/games') 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 -- cgit v1.2.3