X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fgames%2Fwheelfortune.rb;h=e0b0930d93528d3d0e6f0295b17307351b267e92;hb=7a128ab6457c9b79ed31a5562be98e1718bfaf80;hp=febf70e34bf38997a78628e518d4f26137ff375d;hpb=3021159615e5e6452d9f6d526d95ae7120e3fa46;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/games/wheelfortune.rb b/data/rbot/plugins/games/wheelfortune.rb index febf70e3..e0b0930d 100644 --- a/data/rbot/plugins/games/wheelfortune.rb +++ b/data/rbot/plugins/games/wheelfortune.rb @@ -9,7 +9,8 @@ # Wheel-of-Fortune Question/Answer class WoFQA - attr_accessor :cat, :clue, :answer, :hint + attr_accessor :cat, :clue, :hint + attr_reader :answer def initialize(cat, clue, ans=nil) @cat = cat # category @clue = clue # clue phrase @@ -223,6 +224,23 @@ class WheelOfFortune < Plugin @games = Hash.new end + def help(plugin, topic="") + case topic + when 'play' + _("wof [] play [] for to => starts a wheel-of-fortune game on channel (default: current channel), named (default: wheelfortune.game_name config setting, or the last game name used by the user), with points per round. the game is won when a player reachers points. vowels cost */ points. The user that starts the game is the game manager and must set up the clues and answers in private. All the other users have to learn the answer to each clue by saying single consonants or the whole sentence. Every time a consonant is guessed, the bot will reveal the partial answer, showing the missing letters as * (asterisks).") + when 'category', 'clue', 'answer' + _("wof [category: ,] clue: , answer: => set up a new question for the wheel-of-fortune game being played on channel . This command must be sent in private by the game manager. The category can be omitted. If you make mistakes, you can use 'wof replace' (see help) before the question gets asked") + when 'replace' + _("wof replace [category: ,] [clue: ,] [answer: ] => fix the question for round of the wheel-of-fortune game being played on by replacing the category and/or clue and/or answer") + when 'cancel' + _("wof cancel => cancels the wheel-of-fortune being played on the current channel") + when 'buy' + _("wof buy => buy the vowel : the user buying the vowel will lose points equal to the vowel price, and the corresponding vowel will be revealed in the answer (if present)") + else + _("wof: wheel-of-fortune plugin. topics: play, category, clue, answer, replace, cancel, buy") + end + end + def setup_game(m, p) chan = p[:chan] || m.channel if !chan @@ -471,7 +489,7 @@ class WheelOfFortune < Plugin } score_table(m.channel, game) @games.delete(ch) - else :more + else m.reply _("%{bold}%{color}%{name}%{bold}, round %{count}%{nocolor} -- score so far:") % { :bold => Bold, :color => Irc.color(:green), @@ -488,8 +506,8 @@ class WheelOfFortune < Plugin end end - def listen(m) - return unless m.kind_of?(PrivMessage) and not m.address? + def message(m) + return if m.address? ch = m.channel.irc_downcase(m.server.casemap).intern return unless game = @games[ch] return unless game.running? @@ -545,7 +563,7 @@ class WheelOfFortune < Plugin return end # is the botuser the manager or allowed to cancel someone else's game? - if m.botuser == game.manager or m.botuser.permit?('wheelfortune::manage::other::cancel') + if m.botuser == @games[ch].manager or m.botuser.permit?('wheelfortune::manage::other::cancel') do_cancel(ch) else m.reply _("you can't cancel the current game")