source: trunk/modules/leet.tcl @ 1143

Revision 937, 5.1 KB checked in by james, 4 years ago (diff)

tidy up header comments

  • 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
4###############################################################################
5# bMotion - an 'AI' TCL script for eggdrops
6# Copyright (C) James Michael Seward 2000-2008
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21###############################################################################
22
23#load alphaset transforms
24source "$bMotionModules/leet_settings.tcl"
25
26# Binds
27bind pub - "!leet" bMotionLeetChannel
28bind msg - leet leetPrivate
29
30proc bMotionLeetChannel {nick host handle channel text} {
31  global botnick bMotionInfo
32  if {$bMotionInfo(balefire) != 1} {
33    return 0
34  }
35  puthelp "PRIVMSG [chandname2name $channel] :[makeLeet2 $text]"
36}
37
38proc makeLeet { line } {
39  return "Warning! Call to old makeLeet."
40}
41
42proc makeLeet2 {line} {
43  global leet bMotionInfo
44  if [rand 2] { regsub -nocase -all {(\d+)} $line "1337" line }
45  #if [rand 2] { regsub -nocase -all "hackers" $line "hax0rz" line }
46  if [rand 2] { regsub -nocase -all "cool" $line "kewl" line }
47  if [rand 2] { regsub -nocase -all "dudes" $line "d00dz" line }
48  if [rand 2] { regsub -nocase -all "dude" $line "d00d" line }
49  #if [rand 2] { regsub -nocase -all "er" $line "hax0r" line }
50  #if [rand 2] { regsub -nocase -all "ed" $line "hax0red" line }
51  #if [rand 2] { regsub -nocase -all "owned" $line "own0red" line }
52  #if [rand 2] { regsub -nocase -all "rocks" $line "rox0rs" line }
53  #if [rand 2] { regsub -nocase -all "rock" $line "r0x0r" line }
54  if [rand 2] { regsub -nocase -all "boxes" $line "b0xen" line }
55  if [rand 2] { regsub -nocase -all "porn" $line "pr0n" line }
56  if [rand 2] { regsub -nocase -all "elite" $line "l33t" line }
57  if [rand 2] { regsub -nocase -all "your" $line "j00r" line }
58  if [rand 2] { regsub -nocase -all "fear" $line "ph33r" line }
59  if [rand 2] { regsub -nocase -all "wins" $line "win0rs" line }
60  if [rand 2] { regsub -nocase -all "you" $line "j00" line }
61  if [rand 2] { regsub -nocase -all "money" $line "monies" line }
62  if [rand 2] { regsub -nocase -all "like" $line "liek" line }
63  if [rand 2] { regsub -nocase -all "hacking" $line "hax0ring" line }
64  if [rand 2] { regsub -nocase -all "skills" $line "skillz" line }
65
66  #...cked -> x0r3d
67  if [rand 2] { regsub -nocase -all {\m(\w+?)?cked\M} $line {\1x0r3d} line }
68
69  #...cker(s) -> x0r(s)
70  if [rand 2] { regsub -nocase -all {\m(\w+?)?cker(s|z)?\M} $line {\1x0r\2} line }
71
72  #[constonant]ed -> 0r3d
73  if [rand 2] { regsub -nocase -all {***:(\w+[^aeiouy])ed\M} $line {\10r3d} line }
74
75  #...s --> ...z
76  if [rand 2] { regsub -nocase -all {(\w+)s\M} $line {\1z} line }
77
78  #f... -> oph...
79  if [rand 2] { regsub -nocase -all {\mf+(\w+)} $line {ph\1} line }
80
81  #...f -> ...oph
82  if [rand 2] { regsub -nocase -all {(\w+?)f+\M} $line {\1ph} line }
83  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 ] }
84  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 ] }
85  set letters [split [string tolower $line] {}]
86  set line ""
87
88  set alphabet [split "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" {}]
89
90  foreach letter $letters {
91    set newChar $letter
92    if {[rand 10] > $bMotionInfo(leetChance)} {
93      if {[regexp -nocase {[A-Za-z]} $letter]} {
94        set newChar [pickRandom $leet($letter)]
95      }
96    }
97
98    if [rand 2] {
99      set newChar [string toupper $newChar]
100    } else {
101      set newChar [string tolower $newChar]
102    }
103    set line "$line$newChar"
104  }
105
106  return $line
107}
108
109#end of makeleet2
110
111proc leetPrivate {nick host handle arg} {
112  #set handle [finduser $host]
113  if {$handle == "*"} {
114    return 0
115  }
116  if [regexp {(\[#!\]\w+) (.+)} $arg ming channel param] {
117    set val [makeLeet2 $param]
118    putlog "bMotion: $nick asked !$param! to be leeted to !$channel!"
119    if {![botonchan $channel]} {
120      puthelp "PRIVMSG $nick :Sorry, I'm not on $channel"
121      return 0
122    }
123    if {![onchan $nick $channel]} {
124      set name [bMotionTransformNick $nick $nick $host]
125      puthelp "PRIVMSG $nick :I'm sorry $name, I can't do that."
126      putlog "bMotion: ALERT! $nick failed query leet to $channel ($param)."
127      return 0
128    }
129    puthelp "PRIVMSG [chandname2name $channel] :\[\002$nick\002\] $val"
130    return 0
131  }
132
133  putlog "bMotion: $nick asked !$arg! to be leeted"
134  puthelp "PRIVMSG $nick :[makeLeet2 $arg]"
135  return 0
136}
Note: See TracBrowser for help on using the repository browser.