-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcrittersplus.user.js
314 lines (275 loc) · 8.93 KB
/
crittersplus.user.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
// ==UserScript==
// @name Critters+
// @namespace https://boxcrittersmods.ga/authors/slaggo/
// @supportURL http://discord.gg/D2ZpRUW
// @version 2.5.2.161
// @description Adds new features to BoxCritters to improve your experience!
// @author slaggo, Tumble
// @require https://github.com/tumble1999/mod-utils/raw/master/mod-utils.js
// @require https://github.com/tumble1999/modial/raw/master/modial.js
// @require https://github.com/SArpnt/ctrl-panel/raw/master/script.user.js
// @require https://github.com/tumble1999/critterguration/raw/master/critterguration.user.js
// @require https://github.com/boxcrittersmods/bcmacros/raw/master/bcmacro-api.user.js
// @require https://github.com/SArpnt/joinFunction/raw/master/script.js
// @require https://github.com/SArpnt/EventHandler/raw/master/script.js
// @require https://github.com/SArpnt/cardboard/raw/master/script.user.js
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @match https://boxcritters.com/play/
// @match https://boxcritters.com/play/?*
// @match https://boxcritters.com/play/#*
// @match https://boxcritters.com/play/index.html
// @match https://boxcritters.com/play/index.html?*
// @match https://boxcritters.com/play/index.html#*
// @icon https://raw.githubusercontent.com/boxcritters/CrittersPlus/master/icon.png
// @run-at document-start
// ==/UserScript==
(function () {
'use strict';
const uWindow = typeof unsafeWindow != 'undefined' ? unsafeWindow : window;
const CrittersPlus = new TumbleMod({
id: "crittersPus",
name: "Critters+",
abriv: "CP",
cardboard: true
});
uWindow.CrittersPlus = CrittersPlus;
let jokes = [
{
j: "What do you call a hamster in a tophat?",
p: "Abrahamster Lincoln!",
},
{ j: "Where does a hamster go for vacation?", p: "Hamsterdam!" },
{ j: "What do you call a hamster with no legs?", p: "A furball!" },
{
j: "What do you call a hamster that can't run in a wheel?",
p: "Hamateur.",
},
{
j: "Why was the hamster upset with his job?",
p: "It didn't pay enough celery.",
},
{ j: "What do you call a hamster with three legs?", p: "Hamputee." },
{
j: "What happens when two snails get into a fight?",
p: "They slug it out!",
},
{
j: "Why is the snail the strongest animal?",
p: "Because he carries a house on his back!",
},
{ j: "How do snails make important calls?", p: "On shell phones." },
{ j: "What kind of car does a raccoon drive?", p: "A furrari." },
];
// Code for delay function
let delay = (function () {
let timer = 0;
return function (callback, ms) {
clearTimeout(timer);
timer = setTimeout(callback, ms);
};
})();
function sendJoke() {
document.getElementById("message").value = "";
let joke = jokes[Math.floor(Math.random() * jokes.length)]; // Retrieve random joke from variable
BCMacros.sendMessage(joke.j); // Send the first part of the joke
delay(function () {
BCMacros.sendMessage(joke.p); // Send the punchline
}, 5000); // end delay
}
function sendClap() {
let message = document.getElementById("message").value;
document.getElementById("message").value = "";
message = message.split(" ").join(" 👏 ");
message = "👏" + message + "👏";
CrittersPlus.log(message);
BCMacro.sendMessage(message);
}
CrittersPlus.sendJoke = sendJoke;
CrittersPlus.sendClap = sendClap;
let cpMacros = BCMacros.CreateMacroPack({
name: "Critters Plus"
});
cpMacros.createMacro({
name: "Joke",
action: CrittersPlus.sendJoke,
button: {
color: "warning"
}
});
cpMacros.createMacro({
name: "pop",
action: _ => {
BCMacros.sendMessage("/pop");
},
button: {}
});
cpMacros.createMacro({
name: "darkmode",
action: _ => {
BCMacros.sendMessage("/darkmode");
},
button: {}
});
cpMacros.createMacro({
name: "Hello",
action: _ => {
BCMacros.sendMessage("Hello");
},
key: "KeyH"
});
cpMacros.createMacro({
name: "Good Bye",
action: _ => {
BCMacros.sendMessage("Good Bye");
},
key: "KeyB"
});
cpMacros.createMacro({
name: "Ok",
action: _ => {
BCMacros.sendMessage("OK");
},
key: "KeyO"
});
cpMacros.createMacro({
name: "Yes",
action: _ => {
BCMacros.sendMessage("Yes");
},
key: "KeyY"
});
cpMacros.createMacro({
name: "No",
action: _ => {
BCMacros.sendMessage("No");
},
key: "KeyN"
});
let emotes = {
laugh: { name: "Laughing face", key: "Digit1" },
smile: { name: "Smiley", key: "Digit2" },
happy: { name: "Straight face", key: "Digit3" },
sad: { name: "Frown", key: "Digit4" },
awe: { name: "Surprise", key: "Digit5" },
cheeky: { name: "Sticking out tongue", key: "Digit6" },
thumbs_up: { name: "Wink", key: "Digit7" },
sick: { name: "Green sickly face", key: "Digit8" },
angry: { name: "Red angry face", key: "Digit9" },
upset: { name: "Sad face", key: "Digit0" },
daze: { name: "Crooked face", key: "KeyU" },
coffee: { name: "Coffee Cup", key: "KeyC" },
gg: { name: "Game", key: "KeyG" },
// laugh: {name: "Popcorn", key: "KeyO"},
// laugh: {name: "Pizza", key: "KeyZ"},
// laugh: {name: "Ice Cream", key: "KeyQ"},
// laugh: {name: "Cake", key: "KeyK"},
// laugh: {name: "Good Luck", key: "KeyL"},
idea: { name: "Light Bulb", key: "KeyB" },
// laugh: {name: "Heart", key: "KeyH"},
// laugh: {name: "Flower", key: "KeyF"}
};
cpMacros.createMacro({
name: "Emote Chord",
action: null,
key: "KeyE"
});
for (const emote in emotes) {
let { name, key } = emotes[emote];
cpMacros.createMacro({
name,
action: _ => {
if (BCMacros.isChording(["emoteChord"])) {
world.emote(emote);
}
},
key
});
}
cpMacros.createMacro({
name: "Punctuation Chord",
action: null,
key: "ShiftLeft"
});
cpMacros.createMacro({
name: "Punctuation Chord2",
action: null,
key: "ShiftRight"
});
cpMacros.createMacro({
name: "Exclamation Point",
action: _ => {
if (BCMacros.isChording(["punctuationChord"]) || BCMacros.isChording(["punctuationChord2"])) {
BCMacros.sendMessage("!");
}
},
key: "Digit1"
});
cpMacros.createMacro({
name: "Question Mark",
action: _ => {
if (BCMacros.isChording(["punctuationChord"]) || BCMacros.isChording(["punctuationChord2"])) {
world.emote("confused");
}
},
key: "Slash"
});
//}
//-------------------------------------------------------------------------------------------------------------------------
/*let darkmodeHTML = `<div id="dmDiv" class="row justify-content-center"><span><input class="form-check-input" type="checkbox" value="" id="darkmode"><label class="form-check-label" for="darkmode" style="color:#696f75;">Dark Mode</label></span></div>`;
chatBox.insertAdjacentHTML("afterend", darkmodeHTML);
if (localStorage.getItem("theme") == "dark") {
document.body.style = "background-color:rgb(16, 21, 31);transition:0.5s;";
document.getElementById("darkmode").checked = true;
}
function darkmodeToggle() {
if (darkmodeBox.checked == true) {
localStorage.setItem("theme", "dark");
document.body.style =
"background-color:rgb(16, 21, 31);transition:0.5s;";
} else {
localStorage.setItem("theme", "light");
document.body.style = "background-color:#f7f7f7;transition:0.5s;";
}
}
let redeemallitemsBtn = document.querySelector("#redeemallitemsbtn");
if (redeemallitemsBtn) {
redeemallitemsBtn.addEventListener("click", redeemallitems, false);
}*/
let cpSettings = Critterguration.registerSettingsMenu({ id: "crittersPlus", name: "Layer Visibility" }),
sBalloon, sNames, sNavMesh, sTreasure;
cardboard.on("worldStageCreated", world => {
sBalloon = cpSettings.createInput({
name: "Chat Balloons", type: "checkbox", value: true, onInput: value => {
world.stage.room.balloons.visible = value;
}
});
sNames = cpSettings.createInput({
name: "Name Tags", type: "checkbox", value: true, onInput: value => {
world.stage.room.nicknames.visible = value;
}
});
sNavMesh = cpSettings.createInput({
name: "Nav Mesh", type: "checkbox", onInput: value => {
world.stage.room.navMesh.visible = value;
}
});
sTreasure = cpSettings.createInput({
name: "Treasure", type: "checkbox", onInput: value => {
world.stage.room.treasure.visible = value;
}
});
cpSettings.createInput({
name: "Mute Game", type: "checkbox", value: createjs.Sound.muted, onInput: value => {
createjs.Sound.muted = value;
}
});
});
cardboard.on("joinRoom", world => {
world.stage.room.balloons.visible = sBalloon.checked;
world.stage.room.nicknames.visible = sNames.checked;
world.stage.room.navMesh.visible = sNavMesh.checked;
world.stage.room.treasure.visible = sTreasure.checked;
});
})();