pike.git
/
lib
/
modules
/
String.pmod
/
Elite.pmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/String.pmod/Elite.pmod:1:
#pike __REAL_VERSION__
-
//
neccesary
translation (in order)
+
//
necessary
translation (in order)
array(array(string|array(string))) elite_short = ({ ({" you are"," your"}), ({" you'r"," your"}), ({" what the"," wt"}), ({" wt fuck"," wt\1001"}), ({" wt\1001?"," wt\1001!"}), ({" download"," d/l"}), ({" upload"," u/l"}), ({"picture","pic"}),
pike.git/lib/modules/String.pmod/Elite.pmod:164:
]); //! Translates one word to 1337. The optional //! argument leetp is the maximum percentage of //! leetness (100=max leet, 0=no leet). //! elite_word only do character-based translation, //! for instance from "k" to "|<", but no language //! translation (no "cool" to "kewl"). string elite_word(string in, void|int(0..100) leetp, void|int(0..2) eightbit) {
-
if (
zero_type
(leetp)) leetp=50; // aim for 50% leetness
+
if (
undefinedp
(leetp)) leetp=50; // aim for 50% leetness
else if (!leetp) return replace(in,"\1001\1002\1003"/1,"fpl"/1); array v; switch (eightbit) { case 0: v=rows(elite_char, lower_case(in)/1); break;
pike.git/lib/modules/String.pmod/Elite.pmod:233:
} return res; } //! Translates a string to 1337. The optional //! argument leetp is the maximum percentage of //! leetness (100=max leet, 0=no leet). //! //! The translation is performed in three steps,
-
//! first the
neccesary
elite translations (picture -> pic,
+
//! first the
necessary
elite translations (picture -> pic,
//! cool->kewl etc), then optional translations //! (ok->k, dude->dood, -ers -> -orz), then //! calls elite_word on the resulting words. string elite_string(string in, void|int(0..100) leetp, void|int(0..1) eightbit) {
-
if (
zero_type
(leetp)) leetp=50; // aim for 50% leetness
+
if (
undefinedp
(leetp)) leetp=50; // aim for 50% leetness
in=" "+in+" "; foreach (elite_short;;[string what,array(string)|string dest]) { string res=""; int i; while ((i=search(lower_case(in),what))!=-1) { if (arrayp(dest)) dest=dest[random(sizeof(dest))]; res+=in[..i-1]+dest;