-
Notifications
You must be signed in to change notification settings - Fork 3
/
slapyou_tsm_theoddone.js
173 lines (154 loc) · 5.28 KB
/
slapyou_tsm_theoddone.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/* Use blocks for comments, Nightbot likes it this way */
/** !slapyou
* !slapyou for tsm_theoddone
*
* Contributors:
* copchase
*
*/
/* Any accounts similar to OddOne's name have a 100% failure rate using !slapyou */
const imposters = [
"tsmthegodone"
];
const immuneresponse = [
"Treason shall not be tolerated oddoneVillain ",
"You fools! TheOddOne cannot be touched oddoneW",
"TheOddOne is far too powerful to be slapped oddoneBakana"
];
const goodcrit = [
"POGGERS",
"oddonePOG"
];
const badcrit = [
"Pepega",
"POOGERS",
"FeelsTastyMan",
"OMEGALUL",
"LUL",
"oddoneLOL",
"PepeLaugh",
"HanVetInte",
"ElNoKaga"
];
/**
* C# style String.format
*/
if (!String.format) {
String.format = function(format) {
var args = Array.prototype.slice.call(arguments, 1);
return format.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined' ? args[number] : match;
});
};
}
function slapyou(from, to) {
let crit = Math.random() < 0.0625;
let critexp = Math.round(Math.random() * (1500 - 1001) + 1001);
let oddoneRegex = /^(.*odd|.*awd|.*god)(?=.*one|.*juan|.*wan|.*1|.*wun|wiggle|weeb)(.*)$/i;
let oddoneRegex2 = /^((.*brian)|(.*brain)|(.*chubby))(?=.*damage|.*wyllie|.*boomer)(.*)$/i;
let selfRegex = /^((.*self)|(.*selves))$/i;
let oddone = from.toLowerCase() === "tsm_theoddone";
let splits = to.split(/\s+/);
let emoteSet = new Set();
emoteSet.add("oddone7");
emoteSet.add("oddoneAYAYA");
emoteSet.add("oddoneBully");
emoteSet.add("oddoneChair");
emoteSet.add("oddoneClown");
emoteSet.add("oddoneCop");
emoteSet.add("oddoneCute");
emoteSet.add("oddoneDiplomacy");
emoteSet.add("oddoneDuel");
emoteSet.add("oddoneGhost");
emoteSet.add("oddoneGreen");
emoteSet.add("oddoneHmm");
emoteSet.add("oddoneLOL");
emoteSet.add("oddoneLick");
emoteSet.add("oddoneLurk");
emoteSet.add("oddoneOKO");
emoteSet.add("oddonePOG");
emoteSet.add("oddonePat");
emoteSet.add("oddoneREE");
emoteSet.add("oddoneShrug");
emoteSet.add("oddoneSiSenor");
emoteSet.add("oddoneSip");
emoteSet.add("oddoneSleeper");
emoteSet.add("oddoneWeird");
emoteSet.add("oddoneWel");
emoteSet.add("oddAYAYA");
emoteSet.add("oddCute");
emoteSet.add("oddHeart");
emoteSet.add("oddHYPERS");
emoteSet.add("oddoneHeh");
emoteSet.add("oddoneSmug");
emoteSet.add("oddOwO");
emoteSet.add("oddREE");
emoteSet.add("oddSip");
emoteSet.add("oddSlain");
emoteSet.add("oddThump");
let anti = "";
for (let idx = 0; idx < splits.length; ++idx) {
let curr = splits[idx];
if (emoteSet.has(curr)) {
splits[idx] = "";
}
}
splits.forEach(word => {
if (word.length > 0) {
anti = anti.concat(" " + word);
}
});
let leetMap = new Map();
/* leetMap.set(/4|(\/[-_=+]+\\)|@|\^/g, "A");
leetMap.set(/13/g, "B");
leetMap.set(/\/3/g, "B");
leetMap.set(/\|3/g, "B");
leetMap.set(/8/g, "B");
leetMap.set(/</g, "C");
leetMap.set(/\(/g, "C"); */
leetMap.set(/\|[)}\]>]/g, "D");
leetMap.set(/[3\u0395\u03F5\u03B5\u00A3\u20A4\u20AC]/g, "E");
/* leetMap.set(/6/g, "G"); */
leetMap.set(/[#4]|([\|\[\]\{\}\/\\\(\)\:I][-=+]+[\|\[\]\{\}\/\\\(\)\:I])|([\}\)][\{\(])/g, "H");
/* leetMap.set(/!/g, "I");
leetMap.set(/_\//g, "J");
leetMap.set(/_\|/g, "J");
leetMap.set(/\|_/g, "L");
leetMap.set(/1/g, "L"); */
leetMap.set(/0|[\(\[\{\<][\)\]\}\>]/g, "O");
leetMap.set(/[\u0418\u0438]|((\||\/|l|I)\\+(\||\/|l|I))|(\/V)|(\]\[\\+]\[)/g, "N");
/* leetMap.set(/5/g, "S"); */
leetMap.set(/(7`?)|\+|(['`~-](\|+|(\]\[))['`~-])/g, "T");
/* leetMap.set(/\\\/\\\//g, "W");
leetMap.set(/\\\//g, "V");
leetMap.set(/></g, "X");
leetMap.set(/2/g, "Z"); */
if (from === to | !(to.match(selfRegex) === null)) {
return "ERROR: You cannot attempt to intentionally slap yourself PepeLaugh ";
}
for (let [key, value] of leetMap) {
anti = anti.replace(key, value);
}
if (!(anti.match(oddoneRegex) === null) || !(anti.match(oddoneRegex2) === null)) {
if (crit) {
return String.format("{0} attempted to slap TheOddOne, but was struck down and lost {1} EXP! oddoneVillain ", from, critexp.toString());
} else {
return immuneresponse[Math.floor(Math.random() * immuneresponse.length)];
}
}
let exp = Math.round(Math.random() * 999 + 1);
if (!oddone && (Math.random() <= 0.2 || imposters.includes(from.toLowerCase()))) {
if (crit) {
return String.format("{0} slaps themselves in confusion, losing {1} EXP! {2}", from, critexp.toString(), badcrit[Math.floor(Math.random() * badcrit.length)]);
} else {
return String.format("{0} fails to slap {1} and loses {2} EXP!", from, to, exp.toString());
}
} else {
if (crit) {
return String.format("{0} slaps {1} and critically hits, gaining {2} EXP! {3}", from, to, critexp.toString(), goodcrit[Math.floor(Math.random() * goodcrit.length)]);
} else {
return String.format("{0} slaps {1} and gains {2} EXP!", from, to, exp.toString());
}
}
}
slapyou(user, input);