source: tags/start/modules/leet.tcl @ 1143

Revision 2, 5.1 KB checked in by jamesoff, 9 years ago (diff)

Initial revision

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1# bMotion - Leet-izer
2#
3# $Id$
4#
5
6###############################################################################
7# bMotion - an 'AI' TCL script for eggdrops
8# Copyright (C) James Michael Seward 2000-2002
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful, but
16# WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18# General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23###############################################################################
24
25#load alphaset transforms
26source "$bMotionModules/leet_settings.tcl"
27
28# Binds
29bind pub - "!leet" bMotionLeetChannel
30bind msg - leet leetPrivate
31
32proc bMotionLeetChannel {nick host handle channel text} {
33  global botnick bMotionInfo
34  if {$bMotionInfo(balefire) != 1} {
35    return 0
36  }
37  puthelp "PRIVMSG $channel :[makeLeet2 $text]"
38}
39
40proc makeLeet { line } {
41  return "Warning! Call to old makeLeet."
42}
43
44
45
46proc makeLeet2 {line} {
47  global leet bMotionInfo
48  if [rand 2] { regsub -nocase -all {(\d+)} $line "1337" line }
49  #if [rand 2] { regsub -nocase -all "hackers" $line "hax0rz" line }
50  if [rand 2] { regsub -nocase -all "cool" $line "kewl" line }
51  if [rand 2] { regsub -nocase -all "dudes" $line "d00dz" line }
52  if [rand 2] { regsub -nocase -all "dude" $line "d00d" line }
53  #if [rand 2] { regsub -nocase -all "er" $line "hax0r" line }
54  #if [rand 2] { regsub -nocase -all "ed" $line "hax0red" line }
55  #if [rand 2] { regsub -nocase -all "owned" $line "own0red" line }
56  #if [rand 2] { regsub -nocase -all "rocks" $line "rox0rs" line }
57  #if [rand 2] { regsub -nocase -all "rock" $line "r0x0r" line }
58  if [rand 2] { regsub -nocase -all "boxes" $line "b0xen" line }
59  if [rand 2] { regsub -nocase -all "porn" $line "pr0n" line }
60  if [rand 2] { regsub -nocase -all "elite" $line "l33t" line }
61  if [rand 2] { regsub -nocase -all "your" $line "j00r" line }
62  if [rand 2] { regsub -nocase -all "fear" $line "ph33r" line }
63  if [rand 2] { regsub -nocase -all "wins" $line "win0rs" line }
64  if [rand 2] { regsub -nocase -all "you" $line "j00" line }
65  if [rand 2] { regsub -nocase -all "money" $line "monies" line }
66  if [rand 2] { regsub -nocase -all "like" $line "liek" line }
67  if [rand 2] { regsub -nocase -all "hacking" $line "hax0ring" line }
68  if [rand 2] { regsub -nocase -all "skills" $line "skillz" line }
69
70 
71
72  #...cked -> x0r3d
73  if [rand 2] { regsub -nocase -all {[[:<:]](\w+?)?cked[[:>:]]} $line {\1x0r3d} line }
74
75  #...cker(s) -> x0r(s)
76  if [rand 2] { regsub -nocase -all {[[:<:]](\w+?)?cker(s|z)?[[:>:]]} $line {\1x0r\2} line }
77
78  #[constonant]ed -> 0r3d
79  if [rand 2] { regsub -nocase -all {***:(\w+[^aeiouy])ed[[:>:]]} $line {\10r3d} line } 
80
81  #...s --> ...z
82  if [rand 2] { regsub -nocase -all {(\w+)s[[:>:]]} $line {\1z} line }
83
84  #f... -> oph...
85  if [rand 2] { regsub -nocase -all {[[:<:]]f+(\w+)} $line {ph\1} line }
86
87  #...f -> ...oph
88  if [rand 2] { regsub -nocase -all {(\w+?)f+[[:>:]]} $line {\1ph} line }
89
90
91 if [rand 2] { set line [string map -nocase { ROFL roflmaolozz!!111 loser lossarzz!! hehe HUHEHUHEHEHUEHUEH ike iek ter tar ife ief hah hehue ule lue ota oat ver var is si ome oem ame aem oe eo aid iad ers ars erz arz per par nic nix aye aey ade aed ite eit} $line ] }
92 if [rand 2] { set line [string map -nocase { he eh re er ea ae hi ih or ro ip pi ho oh in ni lol lo!lololololzz! ! !!!111111 ir ri ou uo ha ah ui iu ig gi } $line ] }
93
94  set letters [split [string tolower $line] {}]
95  set line ""
96 
97  set alphabet [split "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" {}]
98
99  foreach letter $letters {
100    set newChar $letter
101    if {[rand 10] > $bMotionInfo(leetChance)} {
102      if {[regexp -nocase {[A-Za-z]} $letter]} {
103        set newChar [pickRandom $leet($letter)]
104      }
105    }
106
107    if [rand 2] {
108      set newChar [string toupper $newChar]
109    } else {
110      set newChar [string tolower $newChar]
111    }     
112    set line "$line$newChar"
113  }
114
115  return $line
116}
117#end of makeleet2
118
119proc leetPrivate {nick host handle arg} {
120  #set handle [finduser $host]
121  if {$handle == "*"} {
122    return 0
123  }
124  if [regexp {(\#\w+) (.+)} $arg ming channel param] {
125    set val [makeLeet2 $param]
126    putlog "bMotion: $nick asked !$param! to be leeted to !$channel!"
127    if {![botonchan $channel]} {
128      puthelp "PRIVMSG $nick :Sorry, I'm not on $channel"
129      return 0
130    }
131    if {![onchan $nick $channel]} {
132      set name [bMotionTransformNick $nick $nick $host]
133      puthelp "PRIVMSG $nick :I'm sorry $name, I can't do that."
134      putlog "bMotion: ALERT! $nick failed query leet to $channel ($param)."
135      return 0
136    }
137    puthelp "PRIVMSG $channel :\[\002$nick\002\] $val"
138    return 0
139  }
140
141  putlog "bMotion: $nick asked !$arg! to be leeted"
142  puthelp "PRIVMSG $nick :[makeLeet2 $arg]"
143  return 0
144}
Note: See TracBrowser for help on using the repository browser.