From: Giuseppe Bilotta Date: Sun, 15 Oct 2006 19:36:36 +0000 (+0000) Subject: Make the lart plugin use language-specific lart/praises X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=a708da678ebafbfac08e1c867610fc809680ae68;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git Make the lart plugin use language-specific lart/praises --- diff --git a/data/rbot/plugins/lart.rb b/data/rbot/plugins/lart.rb index d4abee3b..40a0432a 100644 --- a/data/rbot/plugins/lart.rb +++ b/data/rbot/plugins/lart.rb @@ -1,9 +1,13 @@ -# Author: Michael Brailsford -# aka brailsmt -# Purpose: Provide for humorous larts and praises -# Copyright: 2002 Michael Brailsford. All rights reserved. -# License: This plugin is licensed under the BSD license. The terms of -# which follow. +# Original Author: +# Michael Brailsford +# aka brailsmt +# Author: Giuseppe "Oblomov" Bilotta +# Purpose: Provide for humorous larts and praises +# Original Copyright: +# 2002 Michael Brailsford. All rights reserved. +# Copyright: 2006 Giuseppe Bilotta. All rights reserved. +# License: This plugin is licensed under the BSD license. The terms of +# which follow. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -33,17 +37,26 @@ class LartPlugin < Plugin end def initialize - super @larts = Array.new @praises = Array.new - #read in the lart and praise files - if File.exists? "#{@bot.botclass}/lart/larts" - IO.foreach("#{@bot.botclass}/lart/larts") { |line| + @lartfile = nil + @praisefile = nil + super + end + + def set_language(lang) + save + @lartfile = "#{@bot.botclass}/lart/larts-#{lang}" + @praisefile = "#{@bot.botclass}/lart/praises-#{lang}" + @larts.clear + @praises.clear + if File.exists? @lartfile + IO.foreach(@lartfile) { |line| @larts << line.chomp } end - if File.exists? "#{@bot.botclass}/lart/praises" - IO.foreach("#{@bot.botclass}/lart/praises") { |line| + if File.exists? @praisefile + IO.foreach(@praisefile) { |line| @praises << line.chomp } end @@ -53,12 +66,13 @@ class LartPlugin < Plugin end def save + return if @lartfile.nil? and @praisefile.nil? Dir.mkdir("#{@bot.botclass}/lart") if not FileTest.directory? "#{@bot.botclass}/lart" # TODO implement safe saving here too - File.open("#{@bot.botclass}/lart/larts", "w") { |file| + File.open(@lartfile, "w") { |file| file.puts @larts } - File.open("#{@bot.botclass}/lart/praises", "w") { |file| + File.open(@praisefile, "w") { |file| file.puts @praises } end diff --git a/data/rbot/templates/lart/larts b/data/rbot/templates/lart/larts deleted file mode 100644 index c3a25880..00000000 --- a/data/rbot/templates/lart/larts +++ /dev/null @@ -1,98 +0,0 @@ -swaps 's shampoo with nair -installs windows on 's machine -forces to use perl for 3 weeks -registers 's name with 50 known spammers -resizes 's terminal to 40x24 -takes 's tea -dispenses 's email address to a few hundred 'bulk mailing services' -pokes in the eye -beats senseless with a 50lb Unix manual -cats /dev/urandom into 's ear -signs up for AOL -enrolls in Visual Basic 101 -sporks -drops a truckload of VAXen on -judo chops -resizes 's terminal to 40x24 -formats 's harddrive to fat12 -rm -rf's -stabs -steals 's mojo -strangles with a doohicky mouse cord -whacks with the cluebat -sells on E-Bay -uses as a biological warfare study -uses the "Customer Appreciation Bat" on -reads some vogon poetry -puts in the Total Perspective Vortex -casts into the fires of Mt. Doom -gives a melvin -turns over to Agent Smith to be "bugged" -takes away 's internet connection -pushes past the Shoe Event Horizon -counts "1, 2, 5... er... 3!" and hurls the Holy Handgrenade Of Antioch at -puts in a nest of camel spiders -makes read slashdot at -1 -puts "alias vim=emacs" in 's /etc/profile -uninstalls ld from 's system -locks in the Chateau d'If -signs up for getting hit on the head lessons -makes try to set up a Lexmark printer -fills 's Visene eyedrop bottle with lime juice -casts into the fires of Mt. Doom. -gives a Chicago Steamer -rips off 's arm, and uses it to beat them to death -pierces 's nose with a rusty paper hole puncher -pokes with a rusty nail -puts sugar between 's bedsheets -pours sand into 's oatmeal -mixes epoxy into 's toothpaste -puts Icy-Hot in 's lip balm -straps to a chair, and plays a endless low bitrate MP3 loop of "the world's most annoying sound" from "Dumb and Dumber" -tells Dr. Dre that was talking smack -forces to use a Commodore 64 for all their word processing -smacks in the face with a burlap sack full of broken glass -puts in a room with several heavily armed manic depressives -makes watch reruns of "Blue's Clues" -puts lye in 's coffee -tattoos the Windows symbol on 's ass -lets Borg have his way with -signs up for line dancing classes at the local senior center -wakes out of a sound sleep with some brand new nipple piercings -gives a 2 guage Prince Albert -forces to eat all their veggies -covers 's toilet paper with lemon-pepper -fills 's ketchup bottle with Dave's Insanity sauce -forces to stare at an incredibly frustrating and seemingly neverending IRC political debate -knocks two of 's teeth out with a 2x4 -removes debian from 's system -uses 's debian cds for skeet shooting practice -gives 's phone number to Borg -posts 's IP and root password on alt.2600 -forces to use words like "irregardless" and "administrate" (thereby sounding like a real dumbass)" -tickles until they wet their pants and pass out -replaces 's KY with elmer's clear wood glue -replaces 's TUMS with alka-seltzer tablets -squeezes habanero pepper juice into 's tub of vaseline for -submits 's photo to the people at SA for photoshopping -Forces to learn the Win32 API -gives an atomic wedgie -ties to a chair and forces them to listen to 'N Sync at full blast -forces to use emacs for text editing -frowns at really really hard -jabs a hot car lighter into 's eye sockets -forces to browse the web with IE -takes out at the knees with a broken pool cue -forces to listen to only emo music -signs up for the Iowa State Ferret Legging Championship -attempts to hotswap 's RAM -donkey punches -puts track spikes into 's side -replaces 's Astroglide with JB Weld -replaces 's hypertension pills with rat poison pellets -replaces s jock itch cream with Nair -does the Australian Death Grip on -dances upon the grave of 's ancestors. -farts in 's general direction -flogs with stinging neddle -hands a poison ivy joint diff --git a/data/rbot/templates/lart/larts-english b/data/rbot/templates/lart/larts-english new file mode 100644 index 00000000..c3a25880 --- /dev/null +++ b/data/rbot/templates/lart/larts-english @@ -0,0 +1,98 @@ +swaps 's shampoo with nair +installs windows on 's machine +forces to use perl for 3 weeks +registers 's name with 50 known spammers +resizes 's terminal to 40x24 +takes 's tea +dispenses 's email address to a few hundred 'bulk mailing services' +pokes in the eye +beats senseless with a 50lb Unix manual +cats /dev/urandom into 's ear +signs up for AOL +enrolls in Visual Basic 101 +sporks +drops a truckload of VAXen on +judo chops +resizes 's terminal to 40x24 +formats 's harddrive to fat12 +rm -rf's +stabs +steals 's mojo +strangles with a doohicky mouse cord +whacks with the cluebat +sells on E-Bay +uses as a biological warfare study +uses the "Customer Appreciation Bat" on +reads some vogon poetry +puts in the Total Perspective Vortex +casts into the fires of Mt. Doom +gives a melvin +turns over to Agent Smith to be "bugged" +takes away 's internet connection +pushes past the Shoe Event Horizon +counts "1, 2, 5... er... 3!" and hurls the Holy Handgrenade Of Antioch at +puts in a nest of camel spiders +makes read slashdot at -1 +puts "alias vim=emacs" in 's /etc/profile +uninstalls ld from 's system +locks in the Chateau d'If +signs up for getting hit on the head lessons +makes try to set up a Lexmark printer +fills 's Visene eyedrop bottle with lime juice +casts into the fires of Mt. Doom. +gives a Chicago Steamer +rips off 's arm, and uses it to beat them to death +pierces 's nose with a rusty paper hole puncher +pokes with a rusty nail +puts sugar between 's bedsheets +pours sand into 's oatmeal +mixes epoxy into 's toothpaste +puts Icy-Hot in 's lip balm +straps to a chair, and plays a endless low bitrate MP3 loop of "the world's most annoying sound" from "Dumb and Dumber" +tells Dr. Dre that was talking smack +forces to use a Commodore 64 for all their word processing +smacks in the face with a burlap sack full of broken glass +puts in a room with several heavily armed manic depressives +makes watch reruns of "Blue's Clues" +puts lye in 's coffee +tattoos the Windows symbol on 's ass +lets Borg have his way with +signs up for line dancing classes at the local senior center +wakes out of a sound sleep with some brand new nipple piercings +gives a 2 guage Prince Albert +forces to eat all their veggies +covers 's toilet paper with lemon-pepper +fills 's ketchup bottle with Dave's Insanity sauce +forces to stare at an incredibly frustrating and seemingly neverending IRC political debate +knocks two of 's teeth out with a 2x4 +removes debian from 's system +uses 's debian cds for skeet shooting practice +gives 's phone number to Borg +posts 's IP and root password on alt.2600 +forces to use words like "irregardless" and "administrate" (thereby sounding like a real dumbass)" +tickles until they wet their pants and pass out +replaces 's KY with elmer's clear wood glue +replaces 's TUMS with alka-seltzer tablets +squeezes habanero pepper juice into 's tub of vaseline for +submits 's photo to the people at SA for photoshopping +Forces to learn the Win32 API +gives an atomic wedgie +ties to a chair and forces them to listen to 'N Sync at full blast +forces to use emacs for text editing +frowns at really really hard +jabs a hot car lighter into 's eye sockets +forces to browse the web with IE +takes out at the knees with a broken pool cue +forces to listen to only emo music +signs up for the Iowa State Ferret Legging Championship +attempts to hotswap 's RAM +donkey punches +puts track spikes into 's side +replaces 's Astroglide with JB Weld +replaces 's hypertension pills with rat poison pellets +replaces s jock itch cream with Nair +does the Australian Death Grip on +dances upon the grave of 's ancestors. +farts in 's general direction +flogs with stinging neddle +hands a poison ivy joint diff --git a/data/rbot/templates/lart/praises b/data/rbot/templates/lart/praises deleted file mode 100644 index 3d89df74..00000000 --- a/data/rbot/templates/lart/praises +++ /dev/null @@ -1,5 +0,0 @@ -hugs -gives some love -gives a cookie -slaps heartily on the back -tickles diff --git a/data/rbot/templates/lart/praises-english b/data/rbot/templates/lart/praises-english new file mode 100644 index 00000000..3d89df74 --- /dev/null +++ b/data/rbot/templates/lart/praises-english @@ -0,0 +1,5 @@ +hugs +gives some love +gives a cookie +slaps heartily on the back +tickles