X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fgames%2Froulette.rb;h=adf755fdaa7a8f9bf97cc3eba71359689b6715e0;hb=959bc65b4852e313fbc51d0f8d097b670324b1d2;hp=3b954077fd0a37c8a0913c7880dce457627e459a;hpb=46f1fd3ae3aaecbbc36b987e356393500431d498;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/games/roulette.rb b/data/rbot/plugins/games/roulette.rb index 3b954077..adf755fd 100644 --- a/data/rbot/plugins/games/roulette.rb +++ b/data/rbot/plugins/games/roulette.rb @@ -1,13 +1,13 @@ define_structure :RouletteHistory, :games, :shots, :deaths, :misses, :wins class RoulettePlugin < Plugin - BotConfig.register BotConfigBooleanValue.new('roulette.autospin', + Config.register Config::BooleanValue.new('roulette.autospin', :default => true, :desc => "Automatically spins the roulette at the butlast shot") - BotConfig.register BotConfigBooleanValue.new('roulette.kick', + Config.register Config::BooleanValue.new('roulette.kick', :default => false, :desc => "Kicks shot players from the channel") - BotConfig.register BotConfigBooleanValue.new('roulette.twice_in_a_row', + Config.register Config::BooleanValue.new('roulette.twice_in_a_row', :default => false, :desc => "Allow players to go twice in a row") @@ -15,6 +15,7 @@ class RoulettePlugin < Plugin super reset_chambers @players = Array.new + @last = '' end def help(plugin, topic="") @@ -46,11 +47,12 @@ class RoulettePlugin < Plugin totals = RouletteHistory.new(0,0,0,0,0) end - if @players.last == m.sourcenick and not @bot.config['roulette.twice_in_a_row'] + if @last == m.sourcenick and not @bot.config['roulette.twice_in_a_row'] m.reply "you can't go twice in a row!" return end + @last = m.sourcenick unless @players.include?(m.sourcenick) @players << m.sourcenick playerdata.games += 1 @@ -72,6 +74,7 @@ class RoulettePlugin < Plugin @registry["player " + plyr] = pdata } @players.clear + @last = '' @bot.kick(m.replyto, m.sourcenick, "*BANG*") if @bot.config['roulette.kick'] else m.reply "#{m.sourcenick}: chamber #{6 - @chambers.length} of 6 => +click+" @@ -118,6 +121,7 @@ class RoulettePlugin < Plugin @registry["totals"] = totals @players.clear + @last = '' end def spin(m, params={})