X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fgames%2Fquiz.rb;h=a9ceddaf2af3529a16a4b3a391c119312fdd9565;hb=7a128ab6457c9b79ed31a5562be98e1718bfaf80;hp=d73de90e0fced58b4dfef798a27c898b7605fc7c;hpb=a7b2718fb0ee7309fa73458b660112e046cf957e;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/games/quiz.rb b/data/rbot/plugins/games/quiz.rb index d73de90e..a9ceddaf 100644 --- a/data/rbot/plugins/games/quiz.rb +++ b/data/rbot/plugins/games/quiz.rb @@ -27,10 +27,10 @@ # TODO:: when Ruby 2.0 gets out, fix the FIXME 2.0 UTF-8 workarounds # Class for storing question/answer pairs -QuizBundle = Struct.new( "QuizBundle", :question, :answer ) +define_structure :QuizBundle, :question, :answer # Class for storing player stats -PlayerStats = Struct.new( "PlayerStats", :score, :jokers, :jokers_time ) +define_structure :PlayerStats, :score, :jokers, :jokers_time # Why do we still need jokers_time? //Firetech # Maximum number of jokers a player can gain @@ -156,11 +156,11 @@ end # CLASS QuizPlugin ####################################################################### class QuizPlugin < Plugin - BotConfig.register BotConfigBooleanValue.new('quiz.dotted_nicks', + Config.register Config::BooleanValue.new('quiz.dotted_nicks', :default => true, :desc => "When true, nicks in the top X scores will be camouflaged to prevent IRC hilighting") - BotConfig.register BotConfigArrayValue.new('quiz.sources', + Config.register Config::ArrayValue.new('quiz.sources', :default => ['quiz.rbot'], :desc => "List of files and URLs that will be used to retrieve quiz questions") @@ -360,9 +360,7 @@ class QuizPlugin < Plugin # Reimplemented from Plugin # - def listen( m ) - return unless m.kind_of?(PrivMessage) - + def message(m) chan = m.channel return unless @quizzes.has_key?( chan ) q = @quizzes[chan] @@ -706,7 +704,7 @@ class QuizPlugin < Plugin score = player[1].score ar << "#{i + 1}. #{unhilight_nick( nick )} (#{score})" end - m.reply ar.join(" | ") + m.reply ar.join(" | "), :split_at => /\s+\|\s+/ end