Untitled
unknown
plain_text
2 years ago
46 kB
8
Indexable
var s = {};
var ownerId = "S4a2iPT8qfLedAQhAz5PRRhhvd0";
var msg = [];
var admins = [];
var banned = [];
var serverNames = ["Robot", "Megaphone"];
var extendedCooldown = [];
var isTyping = true;
var user = "";
var wait = 0;
var mobileMode = false;
var input = "";
var spin = 0;
var lastUpdated = getTime();
var coins = 1000000;
var chatCensor = true;
var room = "home";
var framesSinceRoomChange = 0;
var showCursor = true;
var keepCursor = false;
var cooldown = 0;
var views = 0;
var safe = true;
var backspaceActive = 0;
var Screen = "Home";
var currentTheme = "lightmode";
var myThemes = ["lightmode"];
var purchasingTheme = false;
var themes = {
"Darkmode": {
name: "Dark Mode",
price: 0,
desc: "The starter theme you know and love.",
bg: "#151617",
color: "white",
input: "#232425",
theme: "dodgerblue"
},
"lightmode": ({
name: "Light Mode",
price: 10,
desc: "The classic eye breaking,Theme you know and hate",
bg: "white",
color: "black",
input: "lightgray",
theme: "#D74726"
}),
"purple": ({
name: "Purple",
price: 50,
desc: "My favorite color",
bg: "#663399",
color: "white",
input: "rgba(0, 0, 0, 0.1)",
theme: "white"
}),
"blue": ({
name: "Blue",
price: 50,
desc: "Its blue",
bg: "dodgerblue",
color: "white",
input: "rgba(0, 0, 0, 0.1)",
theme: "white"
}),
"green": ({
name: "Green",
price: 50,
desc: "green i guess",
bg: "limegreen",
color: "white",
input: "rgba(0, 0, 0, 0.1)",
theme: "white"
}),
"red": ({
name: "Red",
price: 50,
desc: "Another one of my fav colors",
bg: "tomato",
color: "white",
input: "rgba(0, 0, 0, 0.1)",
theme: "white"
}),
"yellow": ({
name: "Yellow",
price: 50,
desc: "Yellow cooooool",
bg: "gold",
color: "white",
input: "rgba(0, 0, 0, 0.1)",
theme: "white"
}),
"gold": ({
name: "Gold",
price: 500,
desc: "If oyu are buying this take a look at yellow ๐",
bg: "gold",
color: rgb(30, 30, 0),
input: rgb(255, 255, 255, 0.2),
theme: "goldenrod"
}),
"chocolate": ({
name: "Chocolate",
price: 50,
desc: "BROWN! ๐๐๐๐๐",
bg: "saddlebrown",
color: "white",
input: "sienna",
theme: "chocolate"
}),
"cottoncandy": ({
name: "Cotton Candy",
price: 200,
desc: "๐๐๐๐๐๐๐๐๐",
bg: "plum",
color: "black",
input: rgb(255, 255, 255, 0.3),
theme: "mediumslateblue"
}),
"popcorn": ({
name: "Popcorn",
price: 100,
desc: "Corny It is made of corn ๐๐๐๐๐๐๐๐๐",
bg: "#ffff33",
color: "black",
input: rgb(255, 255, 255, 0.4),
theme: "gold"
}),
"monochrome": ({
name: "Monochrome",
price: 25,
desc: "My go to theme",
bg: "black",
color: "white",
input: "black",
theme: "white"
}),
"silver": ({
name: "Silver",
price: 250,
desc: "",
bg: "darkgray",
color: "black",
input: "lightgray",
theme: "gray"
}),
"blinding": ({
name: "Blinding",
price: 25,
desc: "THE LIGHT",
bg: rgb(240, 240, 240),
color: "gray",
input: "white",
theme: "lightgray"
}),
"nightsky": ({
name: "Night Sky",
price: 50,
desc: "*meditating* ๐",
bg: rgb(30, 20, 60),
color: "white",
input: rgb(255, 255, 255, 0.1),
theme: "dodgerblue"
}),
"pink": ({
name: "Pink",
price: 50,
desc: "Pink is Pink ๐",
bg: "violet",
color: "white",
input: "rgba(0, 0, 0, 0.1)",
theme: "white"
}),
"orange": ({
name: "Orange",
price: 50,
desc: "A fruit and a color",
bg: "orange",
color: "white",
input: "rgba(0, 0, 0, 0.1)",
theme: "white"
}),
"diamond": ({
name: "Diamond",
price: 1000,
desc: "you can easily get this if you go to a different room and spam",
bg: "skyblue",
color: "white",
input: "rgba(255, 255, 255, 0.1)",
theme: "white"
}),
"shadow": ({
name: "Shadow",
price: 50,
desc: "Like the shadow animatronics",
bg: "black",
color: "rgb(77, 77, 77)",
input: "rgb(10, 10, 10)",
theme: "white"
}),
"cute": ({
name: "Cute",
price: 50,
desc: "๐",
bg: "violet",
color: "white",
input: "hotpink",
theme: "skyblue"
}),
"classic": ({
name: "Classic",
price: 50,
desc: "......",
bg: "saddlebrown",
color: "white",
input: "peru",
theme: "sandybrown"
}),
"tricolor": ({
name: "Tricolor",
price: 50,
desc: "I definetly did not desighn this",
bg: "goldenrod",
color: "white",
input: "midnightblue",
theme: "darkred"
}),
"cool": ({
name: "Cool",
price: 50,
desc: "No need for this if you are already cool ๐",
bg: "darkmagenta",
color: "white",
input: "indigo",
theme: "dodgerblue"
}),
"vintage": ({
name: "Vintage",
price: 99999999999999,
desc: "If this is vintage then the price must go up",
bg: "darkolivegreen",
color: "white",
input: "olivedrab",
theme: "khaki"
}),
"neon": ({
name: "Neon",
price: 50,
desc: "DONT GET IT",
bg: "limegreen",
color: "white",
input: "darkgoldenrod",
theme: "magenta"
}),
"mist": ({
name: "Mist",
price: 50,
desc: "When you are walking in the forest a 3am like i do๐",
bg: "darkslategray",
color: "white",
input: "slategray",
theme: "gray"
})
};
console.log("Your user ID is " + getUserId());
var shopThemes = [];
var shopCycle = Object.keys(themes);
shopCycle.splice(0, 1);
var ignoreTheme = false;
getKeyValue("main-views", function (rec) {
if (typeof rec == "number") {
setKeyValue("main-views", rec+1);
} else {
setKeyValue("main-views", 1);
}
});
var currentlyTyping = "";
var rank = "Guest";
var typeTimeout = 0;
var coinText = 335;
var systemFont = "system-ui, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"";
textFont(systemFont);
var day = 0;
var online = [];
var onlineTimer = randomNumber(30, 60);
var onlineFrames = 0;
var showOnline = false;
var onlineBox = 400;
function draw() {
s = themes[currentTheme];
if (typeof s != "object") {
currentTheme = "darkmode";
s = themes[currentTheme];
}
if ((Screen == "Home" || Screen == "Shop") && camera.x > 200) {
coinText = camera.x + 135;
} else {
coinText = 335;
}
if (Screen == "Theme") {
showMobileControls(false, true, true, true);
} else {
showMobileControls(false, false, false, false);
}
switch (Screen) {
case "Home":
camera.x += (200-camera.x)/5;
break;
case "Shop":
camera.x += (600-camera.x)/5;
break;
case "Theme":
camera.x += (-200-camera.x)/5;
break;
}
background(s.bg);
fill(s.input);
noStroke();
rect(5, 370, 390, 25, 5);
textSize(15);
fill(s.color);
textAlign(LEFT, CENTER);
if (input == "" || mobileMode) {
if (isTyping && showCursor && !mobileMode) {
text("|", 10, 383);
}
fill(s.color);
if (mobileMode) {
text("NO GET BACK IN REGULAR MODE", 13, 383);
} else {
text("Message or die", 13, 383);
}
} else {
var censoredInput = input;
if (chatCensor) {
censoredInput = censor(input);
}
if (isTyping && showCursor && !mobileMode) {
text(censoredInput + "|", 13, 383);
} else {
text(censoredInput, 13, 383);
}
}
textSize(12);
if (!safe) {
text("Loading...", 360, 40);
} else if (user == "") {
fill(s.input);
rect(325, 5, 70, 20, 5);
textAlign(CENTER, BASELINE);
fill(s.color);
text("Dont press this button", 360, 20);
rank = "guest";
text("Springlocked", 360, 40);
} else {
textAlign(RIGHT, CENTER);
fill(s.color);
text(coins.toLocaleString() + " ยฉ", coinText + 60, 15);
textAlign(CENTER, BASELINE);
if (admins.indexOf(encodeURIComponent(getUserId())) >= 0 || ownerId == getUserId()) {
if (ownerId == getUserId()) {
rank = "Owner";
text("Owner", 360, 40);
} else {
rank = "Admin";
text("Admin", 360, 40);
}
fill(s.input);
rect(325, 45, 70, 20, 5);
fill(s.color);
text("Clear Chat", 360, 60);
fill(s.input);
rect(325, 70, 70, 20, 5);
fill(s.color);
text("Ban/Unban", 360, 85);
fill(s.input);
rect(325, 95, 70, 20, 5);
fill(s.color);
text("Announce", 360, 110);
if (getUserId() == ownerId) {
fill(s.input);
rect(325, 120, 70, 20, 5);
fill(s.color);
text("Admins", 360, 135);
}
fill(s.input);
rect(325, 145, 70, 20, 5);
fill(s.color);
text("Cooldown", 360, 160);
} else {
fill(s.color);
text("User", 360, 40);
}
}
textAlign(CENTER, BASELINE);
fill(s.input);
rect(325, 170, 70, 20, 5);
fill(s.color);
textSize(12);
text("Rules", 360, 184);
fill(s.input);
rect(325, 195, 70, 20, 5);
fill(s.color);
textSize(12);
text("Music", 360, 209);
fill(s.input);
rect(325, 220, 70, 20, 5);
fill(s.color);
textSize(10);
text((mobileMode ? "โ " : "") + "Mobile Mode", 360, 234);
fill(s.input);
rect(325, 245, 70, 20, 5);
fill(s.color);
textSize(12);
text((chatCensor ? "โ " : "") + "Censor", 360, 260);
fill(s.input);
rect(325, 270, 70, 20, 5);
fill(s.color);
textSize(12);
text("Shop", 360, 285);
fill(s.input);
rect(325, 295, 70, 20, 5);
fill(s.color);
textSize(12);
text("Theme", 360, 310);
fill(s.input);
rect(325, 320, 70, 20, 5);
fill(s.color);
textSize(12);
text("Room", 360, 335);
fill(s.input);
rect(325, 345, 70, 20, 5);
fill(s.color);
textSize(11);
text("Online Users", 360, 360);
getKeyValue("name-" + encodeURIComponent(getUserId()), function (rec) {
if (typeof rec == "string") {
user = formatUsername(rec);
lastUpdated = getTime();
} else {
user = "";
}
safe = true;
});
getKeyValue("themes-" + encodeURIComponent(getUserId()), function (rec) {
if (Array.isArray(rec)) {
myThemes = rec;
lastUpdated = getTime();
} else {
myThemes = ["darkmode"];
}
});
getKeyValue("theme-" + encodeURIComponent(getUserId()), function (rec) {
if (typeof rec == "string") {
if (!ignoreTheme) {
currentTheme = rec;
}
lastUpdated = getTime();
} else {
currentTheme = 0;
}
});
getKeyValue("coins-" + encodeURIComponent(getUserId()), function (rec) {
if (typeof rec == "number") {
if (rec > 999999) {
coins = 999999;
} else if (rec < 1) {
coins = 0;
} else {
coins = Math.floor(rec);
}
lastUpdated = getTime();
} else {
coins = 0;
}
});
getKeyValue("msg-" + formatUsername(room + " "), function (rec) {
if (Array.isArray(rec)) {
if (rec.length != undefined && Object.keys(rec).indexOf("length") < 0) {
msg = rec;
lastUpdated = getTime();
}
} else {
msg = [];
}
});
getKeyValue("main-admins", function (rec) {
if (Array.isArray(rec)) {
if (rec.length != undefined && Object.keys(rec).indexOf("length") < 0) {
admins = rec;
lastUpdated = getTime();
}
} else {
admins = [];
}
});
getKeyValue("main-banned", function (rec) {
if (Array.isArray(rec)) {
if (rec.length != undefined && Object.keys(rec).indexOf("length") < 0) {
banned = rec;
lastUpdated = getTime();
}
} else {
banned = [];
}
});
getKeyValue("main-font", function (rec) {
if ((typeof rec == "string" && (rec != "system-ui" && rec != "")) && rec != null) {
textFont(rec);
lastUpdated = getTime();
} else {
textFont(systemFont);
}
});
getKeyValue("main-cooldown", function (rec) {
if (Array.isArray(rec)) {
if (rec.length != undefined && Object.keys(rec).indexOf("length") < 0) {
extendedCooldown = rec;
lastUpdated = getTime();
if (extendedCooldown.indexOf(encodeURIComponent(getUserId())) >= 0) {
cooldown = 10;
} else {
cooldown = 1;
}
}
} else {
extendedCooldown = [];
cooldown = 1;
}
});
getKeyValue("main-views", function (rec) {
if (typeof rec == "number") {
views = rec;
lastUpdated = getTime();
} else {
views = 1;
}
});
getKeyValue("online-" + formatUsername(room + " "), function (rec) {
if (typeof rec == "string") {
var valid = online.filter(function (entry) {
return (entry.name == formatUsername(rec));
});
if (valid.length > 0) {
online[online.indexOf(valid[0])].time = getTime();
} else {
online.push({name: formatUsername(rec), time: getTime()});
}
}
});
if (onlineFrames > onlineTimer && user != "") {
setKeyValue("online-" + formatUsername(room + " "), formatUsername(user));
onlineFrames = 0;
onlineTimer = randomNumber(30, 60)*(online.length+1);
} else {
onlineFrames++;
}
var removeOnline = online.filter(function (entry) {
return (getTime()-entry.time > 5000);
});
for (var i in removeOnline) {
online.splice(online.indexOf(removeOnline[i]), 1);
}
var y = 5;
for (var i = msg.length-9; i < msg.length; i++) {
if (typeof msg[i] == "object" && !Array.isArray(msg[i])) {
fill(s.input);
noStroke();
rect(5, y, 315, 35, 5);
if (mouseWentDown("left") && World.mouseX >= 5 && World.mouseX <= 320 && World.mouseY >= y && World.mouseY <= y+35 && (rank == "Admin" || rank == "Owner") && Screen == "Home" && !showOnline) {
prompt("@" + formatUsername(msg[i].user) + "'s User ID:", msg[i].uid);
}
y += 40;
var tag = "";
if (msg[i].uid == encodeURIComponent(ownerId)) {
tag = "[Owner] ";
} else if ((msg[i].uid == "Server")) {
tag = "[Server] ";
} else if (admins.indexOf(msg[i].uid) >= 0) {
tag = "[Admin] ";
} else if (banned.indexOf(msg[i].uid) >= 0) {
tag = "[Banned] ";
}
fill(s.color);
textSize(20);
textAlign(LEFT, TOP);
textStyle("normal");
if ((msg[i].uid != "Server" || (msg[i].uid == "Server" && serverNames.indexOf(msg[i].user) >= 0)) && formatUsername(msg[i].user).length >= 3) {
text(formatUsername(msg[i].user, msg[i].uid), 10, y-40);
} else {
text("Invalid Name", 10, y-40);
}
textSize(12);
fill(rgb(255, 255, 255, 0.5));
textAlign(RIGHT, TOP);
text(tag + formatTime(msg[i].time), 315, y-35);
textAlign(LEFT, BASELINE);
fill(s.color);
textSize(12);
if (typeof msg[i].msg == "string" && (msg[i].uid != "Server" || (msg[i].uid == "Server" && serverNames.indexOf(msg[i].user) >= 0))) {
if (msg[i].msg.length > 0) {
textStyle("normal");
if (chatCensor) {
text(censor(msg[i].msg.substring(0,50)), 10, y-10);
} else {
text(msg[i].msg.substring(0,50), 10, y-10);
}
} else {
textStyle("italic");
text("Error: Cannot load message.", 10, y-10);
}
} else {
textStyle("italic");
text("Error: Cannot load message.", 10, y-10);
}
}
}
if (mouseWentDown("left")) {
if (World.mouseX >= 325 && World.mouseY >= 5 && World.mouseX <= 395 && World.mouseY <= 25 && Screen == "Home" && !showOnline) {
if (user == "" && safe) {
var x = prompt("Enter a username.");
if (typeof x == "string") {
if (formatUsername(x).length >= 3) {
getKeyValue("taken-" + formatUsername(x + " "), function (re) {
if (re == true) {
prompt("Error: This username is taken.");
} else if (censor(formatUsername(x)).includes("*")) {
prompt("Error: This username contains inappropriate content and cannot be used.");
} else {
setKeyValue("name-" + encodeURIComponent(getUserId()), formatUsername(x + " "), function () {
user = x;
});
setKeyValue("taken-" + formatUsername(x + " "), true);
}
});
} else {
prompt("Error: This username doesn't meet the length requirements.");
}
} else {
user = "";
}
} else {
prompt("You have " + coins.toLocaleString() + " " + (coins == 1 ? "coin" : "coins") + ". You earn coins for chatting and you can spend them in the Theme Shop to get themes.");
}
}
if (World.mouseX >= 325 && World.mouseY >= 45 && World.mouseX <= 395 && World.mouseY <= 65 && (rank == "Admin" || rank == "Owner") && Screen == "Home" && !showOnline) {
setKeyValue("msg-" + formatUsername(room + " "), [{
uid: encodeURIComponent("Server"),
user: "Server",
time: getTime(),
msg: "Chat cleared by @" + user + "."
}]);
}
if (World.mouseX >= 325 && World.mouseY >= 70 && World.mouseX <= 395 && World.mouseY <= 90 && (rank == "Admin" || rank == "Owner") && Screen == "Home" && !showOnline) {
var b = prompt("Enter a user's User ID to ban them, or enter a banned user's ID to revive them. You can check a user's User ID by clicking on one of their messages. (You can also type \"@first\", \"@last\", and \"@all\".) Banned users:\n" + banned.join("\n"));
if (b != null) {
getKeyValue("main-banned", function (rec) {
if (!Array.isArray(rec)) {
rec = [];
}
if (b == "@first") {
rec.splice(0, 1);
} else if (b == "@last") {
rec.splice(rec.length-1, 1);
} else if (b == "@all") {
rec = [];
} else if (rec.indexOf(b) >= 0) {
rec.splice(rec.indexOf(b), 1);
} else {
rec.push(b);
}
setKeyValue("main-banned", rec);
});
}
}
if (World.mouseX >= 325 && World.mouseY >= 95 && World.mouseX <= 395 && World.mouseY <= 115 && (rank == "Admin" || rank == "Owner") && Screen == "Home" && !showOnline) {
var c = prompt("What do you want to announce?");
if (c != null) {
getKeyValue("msg-" + formatUsername(room + " "), function (rec) {
if (Array.isArray(rec)) {
rec.push({
uid: encodeURIComponent("Server"),
user: "Announcement",
time: getTime(),
msg: c
});
setKeyValue("msg-" + formatUsername(room + " "), rec);
} else {
setKeyValue("msg-" + formatUsername(room + " "), [{
uid: (encodeURIComponent("Server")),
user: "Announcement",
time: getTime(),
msg: c
}]);
}
});
}
}
if (World.mouseX >= 325 && World.mouseY >= 120 && World.mouseX <= 395 && World.mouseY <= 140 && (rank == "Owner") && Screen == "Home" && !showOnline) {
var ad = prompt("Enter a user's User ID to make them an admin, or enter an admins's ID to un-admin them. You can check a user's User ID by clicking on one of their messages. (You can also type \"@first\", \"@last\", and \"@all\".) Admins:\n" + admins.join("\n"));
if (ad != null) {
getKeyValue("main-admins", function (rec) {
if (!Array.isArray(rec)) {
rec = [];
}
if (ad == "@first") {
rec.splice(0, 1);
} else if (ad == "@last") {
rec.splice(rec.length-1, 1);
} else if (ad == "@all") {
rec = [];
} else if (rec.indexOf(ad) >= 0) {
rec.splice(rec.indexOf(ad), 1);
} else {
rec.push(ad);
}
setKeyValue("main-admins", rec);
});
}
}
if (World.mouseX >= 325 && World.mouseY >= 145 && World.mouseX <= 395 && World.mouseY <= 165 && (rank == "Admin" || rank == "Owner") && Screen == "Home" && !showOnline) {
var eC = prompt("Enter a user's User ID to extend their cooldown to 10 seconds, or enter an affected user's ID to reset their cooldown. You can check a user's User ID by clicking on one of their messages. (You can also type \"@first\", \"@last\", and \"@all\".) Users with extended cooldowns:\n" + extendedCooldown.join("\n"));
if (eC != null) {
getKeyValue("main-cooldown", function (rec) {
if (!Array.isArray(rec)) {
rec = [];
}
if (eC == "@first") {
rec.splice(0, 1);
} else if (eC == "@last") {
rec.splice(rec.length-1, 1);
} else if (eC == "@all") {
rec = [];
} else if (rec.indexOf(eC) >= 0) {
rec.splice(rec.indexOf(eC), 1);
} else {
rec.push(eC);
}
setKeyValue("main-cooldown", rec);
});
}
}
if (World.mouseX >= 325 && World.mouseY >= 170 && World.mouseX <= 395 && World.mouseY <= 190 && Screen == "Home" && !showOnline) {
prompt(("Rules:\n1. Do not report chat\n2. No profanity or spamming except in the room 'spam'\nBreaking any of these rules will result in a ban") + "!", "");
}
if (World.mouseX >= 325 && World.mouseY >= 190 && World.mouseX <= 395 && World.mouseY <= 215 && Screen == "Home" && !showOnline) {
camera.x = 200;
prompt("My favorite music:", "https://www.youtube.com/playlist?list=PLXvLgObZjWK3-8lYuqCti9oa-jHO6Kp-R")
}
if (World.mouseX >= 325 && World.mouseY >= 220 && World.mouseX <= 395 && World.mouseY <= 240 && Screen == "Home" && !showOnline) {
mobileMode = !mobileMode;
}
if (World.mouseX >= 325 && World.mouseY >= 245 && World.mouseX <= 395 && World.mouseY <= 265 && Screen == "Home" && !showOnline) {
chatCensor = !chatCensor;
}
if (World.mouseX >= 325 && World.mouseY >= 270 && World.mouseX <= 395 && World.mouseY <= 290 && Screen == "Home" && !showOnline) {
Screen = "Shop";
}
if (World.mouseX >= 325 && World.mouseY >= 295 && World.mouseX <= 395 && World.mouseY <= 315 && Screen == "Home" && !showOnline) {
Screen = "Theme";
}
if (World.mouseX >= 325 && World.mouseY >= 320 && World.mouseX <= 395 && World.mouseY <= 340 && Screen == "Home" && !showOnline) {
var cR = prompt("Enter a room name. The name must be 3-24 characters and can include lowercase letters, numbers, underscores, and dashes. Here are some examples:\nhome\nroleplay\n" + user + "s_chat");
if (typeof cR == "string" && cR.length >= 3) {
room = formatUsername(cR + " ");
online = [];
framesSinceRoomChange = 0;
}
}
if (World.mouseX >= 325 && World.mouseY >= 345 && World.mouseX <= 395 && World.mouseY <= 365 && Screen == "Home" && !showOnline) {
showOnline = true;
}
if (World.mouseX <= 45 && World.mouseY <= 45 && Screen == "Shop") {
Screen = "Home";
}
if (World.mouseX >= 355 && World.mouseY <= 45 && Screen == "Theme") {
Screen = "Home";
}
if (World.mouseY >= 370 && Screen == "Home" && !showOnline) {
if (mobileMode && getTime() > wait && user != "") {
input = prompt("Enter your message.");
if (typeof input == "string" && (banned.indexOf(encodeURIComponent(getUserId())) < 0 || (rank == "Admin" || rank == "Owner"))) {
if (input.replace(/\s/g, "").length > 0) {
wait = getTime() + cooldown*1000;
setTimeout(function () {
getKeyValue("msg-" + formatUsername(room + " "), function (rec) {
if (!Array.isArray(rec)) {
rec = [];
}
rec.push({
uid: encodeURIComponent(getUserId()),
user: formatUsername(user),
time: getTime(),
msg: input.substring(0, 50)
});
setKeyValue("typing-" + formatUsername(room + " "), "");
while (rec.length >= 10) {
rec.shift();
}
if (room == "home") {
setKeyValue("coins-" + encodeURIComponent(getUserId()), coins+getCoins());
}
input = "";
setKeyValue("msg-" + formatUsername(room + " "), rec);
});
}, 300);
}
}
} else {
isTyping = true;
}
} else {
isTyping = false;
}
}
getKeyValue("typing-" + formatUsername(room + " "), function (rec) {
if (rec != user) {
currentlyTyping = rec;
}
});
if (currentlyTyping != "" && formatUsername(currentlyTyping) != formatUsername(user) && typeof currentlyTyping == "string") {
fill(s.color);
textSize(10);
textAlign(LEFT, BASELINE);
text(formatUsername(currentlyTyping) + " is typing...", 5, 370);
}
if (getTime() < wait) {
fill(s.theme);
barX = (wait-getTime())/1000/cooldown*390;
rect(5, 370, barX, 2, 5);
}
if (World.mouseX > 370 && World.mouseY > 370 && Screen == "Home") {
fill(rgb(21, 22, 23, credits.bgc));
if (credits.bgc > 0.05) {
rect(0, 0, 400, 400);
}
credits.bgc += (0.9-credits.bgc)/5;
credits.t -= (credits.t-200)/5;
spin = 360;
} else {
fill(rgb(21, 22, 23, credits.bgc));
if (credits.bgc > 0.05) {
rect(0, 0, 400, 400);
credits.bgc -= (credits.bgc)/5;
} else {
credits.bgc = 0;
}
credits.t += (400-credits.t)/5;
spin = 0;
}
fill(rgb(220, 220, 220, credits.bgc));
textAlign(CENTER, CENTER);
textSize(30-((credits.t-200)/5));
if (credits.bgc > 0.05) {
text("Total views: " + views.toLocaleString(), credits.t, credits.t);
}
if (showOnline) {
onlineBox += (250-onlineBox)/5;
} else {
onlineBox += (400-onlineBox)/5;
}
if (onlineBox <= 399) {
fill(s.bg);
rect(onlineBox-5, 0, 10, 400);
fill(s.input);
rect(onlineBox, 5, 405-onlineBox, 390, 5);
fill(s.color);
textSize(20);
textAlign(LEFT, TOP);
text("Online Users", onlineBox+5, 10);
textAlign(RIGHT, TOP);
text("โง", onlineBox+145, 10);
if (camera.mouseX >= 370 && camera.mouseX <= 400 && camera.mouseY >= 5 && camera.mouseY <= 25 && mouseWentDown("left")) {
showOnline = false;
}
textAlign(LEFT, TOP);
textSize(15);
var onlineText = "";
for (var i in online) {
onlineText += "@" + formatUsername(online[i].name) + "\n";
}
text(onlineText, onlineBox+5, 30);
}
if (keyDown(BACKSPACE)) {
backspaceActive++;
if (backspaceActive >= World.frameRate/2) {
input = input.substring(0, input.length-1);
if (input.length == 0) {
setKeyValue("typing-" + formatUsername(room + " "), "");
}
}
} else {
backspaceActive = 1;
}
fill(s.input);
ellipse(425, 25, 40, 40);
fill(s.color);
textAlign(CENTER, CENTER);
textSize(15);
text("Back", 425, 25);
if (shopThemes.length > 0 && camera.x >= 200) {
fill(s.color);
textSize(25);
textAlign(CENTER, TOP);
text("Theme Shop", 600, 5);
textSize(15);
textAlign(CENTER, CENTER);
text("Themes change often.\nCollect coins by chatting in the home room.", 600, 370);
for (var a in shopThemes) {
var thisTheme = themes[shopThemes[a]];
if (typeof thisTheme == "object") {
var yx = 55+(50*a)+(60*a);
fill(s.input);
rect(705, yx+45, 60, 25, 5);
fill(thisTheme.bg);
rect(440, yx, 325, 50, 5);
fill(thisTheme.theme);
rect(760, yx, 5, 50);
fill(thisTheme.input);
rect(445, yx+5, 310, 40, 5);
fill(thisTheme.color);
textSize(20);
textAlign(LEFT, TOP);
text(thisTheme.name, 450, yx+10);
textSize(12);
textAlign(LEFT, BASELINE);
text(thisTheme.desc, 450, yx+40);
textAlign(LEFT, TOP);
fill(s.color);
text(thisTheme.price.toLocaleString() + " " + (thisTheme.price == 1 ? "coin" : "coins"), 440, yx+55);
fill(s.color);
textAlign(CENTER, CENTER);
if (myThemes.indexOf(shopThemes[a]) >= 0) {
text("Owned", 735, yx+60);
} else {
text("Buy", 735, yx+60);
if (!purchasingTheme) {
if (mouseWentDown("left") && camera.mouseX >= 705 && camera.mouseX <= 765 && camera.mouseY >= yx+50 && camera.mouseY <= yx+70) {
if (coins >= thisTheme.price) {
purchasingTheme = true;
var _cT = myThemes;
_cT.push(shopThemes[a]);
var _cP = thisTheme.price;
setKeyValue("themes-" + encodeURIComponent(getUserId()), _cT, function () {
purchasingTheme = false;
});
setKeyValue("coins-" + encodeURIComponent(getUserId()), coins-_cP);
}
}
}
}
if (a == 0) {
fill(thisTheme.theme);
rect(700, yx, 60, 20);
rect(700, yx, 65, 25, 5);
fill(thisTheme.bg);
textAlign(LEFT, BASELINE);
textSize(15);
text("NEW!!", 705, yx+20);
}
if (a == shopThemes.length-1) {
fill(thisTheme.theme);
rect(650, yx, 110, 20);
rect(650, yx, 115, 25, 5);
fill(thisTheme.bg);
textAlign(LEFT, BASELINE);
textSize(15);
text(timeUntil((day+1)*86400000) + "!", 655, yx+20);
}
}
}
} else {
textSize(30);
fill(s.color);
textAlign(CENTER, CENTER);
text("", 600, 200);
}
fill(s.color);
textSize(25);
textAlign(CENTER, TOP);
text("Select Theme", -200, 5);
fill(s.input);
ellipse(-25, 25, 40, 40);
fill(s.color);
textAlign(CENTER, CENTER);
textSize(15);
text("Back", -25, 25);
textSize(14);
textAlign(CENTER, CENTER);
fill(s.color);
text("Use the up and down arrow keys to change your theme.", -200, 55);
fill(s.input);
rect(-355, 165, 315, 40, 5);
textSize(20);
textAlign(LEFT, TOP);
fill(s.color);
text(s.name, -350, 170);
textAlign(LEFT, BASELINE);
textSize(12);
text(s.desc, -350, 200);
fill(s.theme);
rect(-45, 165, 5, 40);
textAlign(LEFT, TOP);
fill(s.color);
text("Theme " + (myThemes.indexOf(currentTheme) + 1) + "/" + myThemes.length, -355, 210);
if (ignoreTheme) {
textAlign(RIGHT, TOP);
text("Saving...", -40, 210);
}
textSize(12);
textAlign(CENTER, TOP);
text("Theme Collection", -200, 250);
textSize(30);
text(Math.floor((myThemes.length/Object.keys(themes).length)*100) + "%", -200, 270);
if (keyWentDown("up") && !ignoreTheme && Screen == "Theme") {
if (myThemes.indexOf(currentTheme) > 0) {
currentTheme = myThemes[myThemes.indexOf(currentTheme) - 1];
ignoreTheme = true;
setKeyValue("theme-" + encodeURIComponent(getUserId()), currentTheme, function () {
ignoreTheme = false;
});
}
}
if (keyWentDown("down") && !ignoreTheme && Screen == "Theme") {
if (myThemes.indexOf(currentTheme) < myThemes.length-1) {
currentTheme = myThemes[(myThemes.indexOf(currentTheme) + 1)];
ignoreTheme = true;
setKeyValue("theme-" + encodeURIComponent(getUserId()), currentTheme, function () {
ignoreTheme = false;
});
}
}
drawSprites();
if (getTime() - lastUpdated >= 60000) {
fill(s.bg);
rect(70, 0, 260, 160, 5);
fill(s.input);
rect(80, 10, 240, 140, 5);
fill(s.color);
textAlign(LEFT, TOP);
textSize(15);
text("You might have been disconnected. If this doesn't disappear, try reloading.\n\nLast updated: " + formatTime(lastUpdated), 85, 15, 240);
}
textAlign(LEFT, TOP);
if (framesSinceRoomChange < 30) {
fill(s.bg);
rect(0, 0, 155, 25, 5);
fill(s.input);
rect(0, 0, 150, 20, 5);
fill(s.color);
textSize(15);
text(room, 5, 5);
} else if (framesSinceRoomChange < 40) {
fill(s.bg);
rect(0, 0, 155, 25-((framesSinceRoomChange-30)*2), 5);
fill(s.input);
rect(0, 0, 150, 20-((framesSinceRoomChange-30)*2), 5);
fill(s.color);
textSize(15);
text(room, 5, 5-((framesSinceRoomChange-30)*2));
}
framesSinceRoomChange++;
day = Math.floor(getTime()/86400000);
shopThemes = [shopCycle[day%shopCycle.length], shopCycle[(day-1)%shopCycle.length], shopCycle[(day-2)%shopCycle.length]];
}
var credits = {
bgc: 0,
t: 315
};
var barX = (wait-getTime())/cooldown*400;
setInterval(function () {
if (isTyping && keepCursor && !mobileMode) {
showCursor = !showCursor;
} else {
showCursor = true;
if (keepCursor) {
keepCursor = false;
}
}
}, 500);
function censor(input) {
input = input.replace(/motherfuck/gi, "**********");
input = input.replace(/fuck/gi, "****");
input = input.replace(/fuk/gi, "***");
input = input.replace(/shit/gi, "****");
input = input.replace(/bitch/gi, "*****");
input = input.replace(/bich/gi, "****");
input = input.replace(/cunt/gi, "****");
input = input.replace(/dick/gi, "****");
input = input.replace(/pussy/gi, "*****");
input = input.replace(/nigga/gi, "*****");
input = input.replace(/nigger/gi, "******");
input = input.replace(/\bkkk\b/gi, "***");
input = input.replace(/piss/gi, "****");
input = input.replace(/vagina/gi, "******");
input = input.replace(/penis/gi, "*****");
input = input.replace(/pussies/gi, "*******");
input = input.replace(/titties/gi, "*******");
input = input.replace(/titty/gi, "*****");
input = input.replace(/cock/gi, "****");
input = input.replace(/hitler/gi, "******");
input = input.replace(/asshole/gi, "*******");
input = input.replace(/dumbass/gi, "*******");
input = input.replace(/\bcum\b/gi, "***");
input = input.replace(/wtf/gi, "***");
input = input.replace(/fuc/gi, "***");
input = input.replace(/\btf\b/gi, "**");
input = input.replace(/balls/gi, "*****");
input = input.replace(/horny/gi, "***");
input = input.replace(/boobs/gi, "****");
input = input.replace(/dookie/gi, "******");
input = input.replace(/deepthroat/gi, "**********");
return input;
}
function emojify(input) {
input = input.replace(/:skull:/g, "๐");
input = input.replace(/:coffee:/g, "โ");
input = input.replace(/:happy:/g, "๐");
input = input.replace(/:big_smile:/g, "๐");
input = input.replace(/:smile:/g, "๐");
input = input.replace(/:angry:/g, "๐ ");
input = input.replace(/:cheeks:/g, "๐");
input = input.replace(/:yell:/g, "๐ก");
input = input.replace(/:swear:/g, "๐คฌ");
input = input.replace(/:loud_cry:/g, "๐ญ");
input = input.replace(/:happy_tear:/g, "๐ฅฒ");
input = input.replace(/:tongue:/g, "๐");
input = input.replace(/:wink:/g, "๐");
input = input.replace(/:smooch:/g, "๐");
input = input.replace(/:laugh_loud:/g, "๐");
input = input.replace(/:shy:/g, "๐ณ");
input = input.replace(/:surprised:/g, "๐ฎ");
input = input.replace(/:cry:/g, "๐ข");
input = input.replace(/:cool:/g, "๐");
input = input.replace(/:eyeroll:/g, "๐");
input = input.replace(/:heart_eyes:/g, "๐");
input = input.replace(/:heart:/g, "โค");
input = input.replace(/:red_heart:/g, "โค");
input = input.replace(/:orange_heart:/g, "๐งก");
input = input.replace(/:yellow_heart:/g, "๐");
input = input.replace(/:green_heart:/g, "๐");
input = input.replace(/:blue_heart:/g, "๐");
input = input.replace(/:purple_heart:/g, "๐");
input = input.replace(/:heartbroken:/g, "๐");
input = input.replace(/:iced:/g, "๐ฅถ");
input = input.replace(/:devil:/g, "๐");
input = input.replace(/:speechless:/g, "๐ฐ");
input = input.replace(/:bruh:/g, "๐");
input = input.replace(/:scream:/g, "๐ฑ");
input = input.replace(/:swat:/g, "๐
");
input = input.replace(/:sick:/g, "๐คข");
input = input.replace(/:upside_down:/g, "๐");
input = input.replace(/:money:/g, "๐ค");
input = input.replace(/:moan:/g, "๐ฉ");
input = input.replace(/:nerd:/g, "๐ค");
input = input.replace(/:worried:/g, "๐");
input = input.replace(/:burger:/g, "๐");
input = input.replace(/:ok:/g, "๐");
input = input.replace(/:thumbs_up:/g, "๐");
input = input.replace(/:thumbs_down:/g, "๐");
input = input.replace(/:peace:/g, "โ");
input = input.replace(/:nails:/g, "๐
");
input = input.replace(/:eyes:/g, "๐");
input = input.replace(/:eye:/g, "๐");
input = input.replace(/:mouth:/g, "๐");
input = input.replace(/:box:/g, "โฌ");
input = input.replace(/:cat:/g, "๐ฑ");
input = input.replace(/:toxic:/g, "โฃ");
input = input.replace(/:kneeling:/g, "๐ง");
input = input.replace(/:vs:/g, "๐");
input = input.replace(/:hole:/g, "๐ณ");
input = input.replace(/:blood_type_a:/g, "๐
ฐ");
input = input.replace(/:blood_type_b:/g, "๐
ฑ");
input = input.replace(/:blood_type_ab:/g, "๐");
input = input.replace(/:blood_type_o:/g, "๐
พ");
input = input.replace(/:orange:/g, "๐");
input = input.replace(/:poop:/g, "๐ฉ");
input = input.replace(/:pride_flag:/g, "๐ณโ๐");
input = input.replace(/:aries:/g, "โ");
input = input.replace(/:taurus:/g, "โ");
input = input.replace(/:gemini:/g, "โ");
input = input.replace(/:cancer:/g, "โ");
input = input.replace(/:leo:/g, "โ");
input = input.replace(/:virgo:/g, "โ");
input = input.replace(/:libra:/g, "โ");
input = input.replace(/:scorpio:/g, "โ");
input = input.replace(/:sagittarius:/g, "โ");
input = input.replace(/:capricorn:/g, "โ");
input = input.replace(/:aquarius:/g, "โ");
input = input.replace(/:pisces:/g, "โ");
return input;
}
function keyTyped() {
if (encodeURIComponent(key) != "%0D") {
if (isTyping && !mobileMode && key.length == 1) {
input += key;
}
showCursor = true;
keepCursor = true;
input = emojify(input);
input = input.substring(0, 50);
if (input.length >= 1) {
if (getTime() - typeTimeout > 300) {
setKeyValue("typing-" + formatUsername(room + " "), formatUsername(user));
typeTimeout = getTime();
}
} else {
setKeyValue("typing-" + formatUsername(room + " "), "");
}
} else if (isTyping && !mobileMode) {
if (user != "") {
if (input.replace(/\s/g, "") != "" && getTime() > wait) {
if (banned.indexOf(encodeURIComponent(getUserId())) < 0 || (rank == "Administer" || rank == "Owner")) {
getKeyValue("msg-" + formatUsername(room + " "), function (rec) {
if (!Array.isArray(rec)) {
rec = [];
}
wait = getTime() + cooldown*1000;
rec.push({
uid: encodeURIComponent(getUserId()),
user: formatUsername(user),
time: getTime(),
msg: input.substring(0, 50)
});
setKeyValue("typing-" + formatUsername(room + " "), "");
while (rec.length >= 10) {
rec.shift();
}
if (room == "home") {
setKeyValue("coins-" + encodeURIComponent(getUserId()), coins+getCoins(input));
}
input = "";
setKeyValue("msg-" + formatUsername(room + " "), rec);
});
} else {
prompt("Your account was banned.");
}
}
} else {
prompt("You are currently in Guest Mode. Click \"Sign Up\" to choose a username.");
}
}
if (getUserId() == "Server") {
prompt("No.");
}
}
function keyPressed() {
if (keyCode == BACKSPACE && isTyping) {
input = input.substring(0, input.length-1);
if (input.length == 0) {
setKeyValue("typing-" + formatUsername(room + " "), "");
}
}
}
function formatUsername(i) {
var bypass = ["Server", "Announcement"];
if (bypass.indexOf(i) >= 0) {
return i;
} else if (typeof i == "string") {
return i.toLowerCase().substring(0,24).replace(/[^a-z0-9\_\-]/g, "");
} else {
return "Invalid Name";
}
}
function formatTime(time) {
var d = new Date();
var e = new Date(time);
var dow = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
var mo = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
if (d.getTime()-time >= -60000 && d.getTime()-time <= 60000) {
return "now";
} else if (d.getTime()-time <= 3600000) {
if (Math.floor((d.getTime()-time)/60000) == 1) {
return Math.floor((d.getTime()-time)/60000) + " min";
} else {
return Math.floor((d.getTime()-time)/60000) + " mins";
}
} else if (d.getTime()-time <= 14400000) {
if (Math.floor((d.getTime()-time)/3600000) == 1) {
return Math.floor((d.getTime()-time)/3600000) + " hr";
} else {
return Math.floor((d.getTime()-time)/3600000) + " hrs";
}
} else if (d.getMonth() + "" + d.getDate() + d.getFullYear() == e.getMonth() + "" + e.getDate() + e.getFullYear()) {
if (e.getHours() == 0) {
if (e.getMinutes() < 10) {
return "12:0" + e.getMinutes() + " AM";
} else {
return "12:" + e.getMinutes() + " AM";
}
} else if (e.getHours() == 12) {
if (e.getMinutes() < 10) {
return "12:0" + e.getMinutes() + " PM";
} else {
return "12:" + e.getMinutes() + " PM";
}
} else if (e.getHours() > 12) {
if (e.getMinutes() < 10) {
return (e.getHours()-12) + ":0" + e.getMinutes() + " PM";
} else {
return (e.getHours()-12) + ":" + e.getMinutes() + " PM";
}
} else {
if (e.getMinutes() < 10) {
return e.getHours() + ":0" + e.getMinutes() + " AM";
} else {
return e.getHours() + ":" + e.getMinutes() + " AM";
}
}
} else if (d.getTime()-time <= 604800000) {
if (e.getHours() == 0) {
if (e.getMinutes() < 10) {
return dow[e.getDay()] + ", 12:0" + e.getMinutes() + " AM";
} else {
return dow[e.getDay()] + ", 12:" + e.getMinutes() + " AM";
}
} else if (e.getHours() == 12) {
if (e.getMinutes() < 10) {
return dow[e.getDay()] + ", 12:0" + e.getMinutes() + " PM";
} else {
return dow[e.getDay()] + ", 12:" + e.getMinutes() + " PM";
}
} else if (e.getHours() > 12) {
if (e.getMinutes() < 10) {
return dow[e.getDay()] + ", " + (e.getHours()-12) + ":0" + e.getMinutes() + " PM";
} else {
return dow[e.getDay()] + ", " + (e.getHours()-12) + ":" + e.getMinutes() + " PM";
}
} else {
if (e.getMinutes() < 10) {
return dow[e.getDay()] + ", " + e.getHours() + ":0" + e.getMinutes() + " AM";
} else {
return dow[e.getDay()] + ", " + e.getHours() + ":" + e.getMinutes() + " AM";
}
}
} else if (d.getFullYear() == e.getFullYear()) {
if (e.getHours() == 0) {
if (e.getMinutes() < 10) {
return mo[e.getMonth()] + " " + e.getDate() + ", 12:0" + e.getMinutes() + " AM";
} else {
return mo[e.getMonth()] + " " + e.getDate() + ", 12:" + e.getMinutes() + " AM";
}
} else if (e.getHours() == 12) {
if (e.getMinutes() < 10) {
return mo[e.getMonth()] + " " + e.getDate() + ", 12:0" + e.getMinutes() + " PM";
} else {
return mo[e.getMonth()] + " " + e.getDate() + ", 12:" + e.getMinutes() + " PM";
}
} else if (e.getHours() > 12) {
if (e.getMinutes() < 10) {
return mo[e.getMonth()] + " " + e.getDate() + ", " + (e.getHours()-12) + ":0" + e.getMinutes() + " PM";
} else {
return mo[e.getMonth()] + " " + e.getDate() + ", " + (e.getHours()-12) + ":" + e.getMinutes() + " PM";
}
} else {
if (e.getMinutes() < 10) {
return mo[e.getMonth()] + " " + e.getDate() + ", " + e.getHours() + ":0" + e.getMinutes() + " AM";
} else {
return mo[e.getMonth()] + " " + e.getDate() + ", " + e.getHours() + ":" + e.getMinutes() + " AM";
}
}
} else {
return parseInt(e.getMonth() + 1, 10) + "/" + e.getDate() + "/" + e.getFullYear();
}
}
function logUsername(id) {
getKeyValue("name-" + id, function (v) {
console.log(v);
});
}
function logThemes(id) {
getKeyValue("themes-" + id, function (v) {
console.log(v);
});
}
function logCoins(id) {
getKeyValue("coins-" + id, function (v) {
console.log(v);
});
}
function getCoins() {
return 1;
}
function generateCycle() {
var a = Object.keys(themes);
a.splice(0, 1);
var b = Object.keys(themes);
for (var i in a) {
b.push(a[i]);
}
var c = [];
var d = b.length;
for (var i = 0; i < d; i++) {
var e = randomNumber(0, b.length-1);
c.push(b[e]);
b.splice(e, 1);
}
return c;
}
function timeUntil(input) {
var timeLeft = input-getTime();
if (timeLeft > 86400000) {
return "Days left: " + Math.floor(timeLeft/86400000);
}
if (timeLeft > 3600000) {
return "Hours left: " + Math.floor(timeLeft/3600000);
}
if (timeLeft > 60000) {
return "Minutes left: " + Math.floor(timeLeft/60000);
}
return "Seconds left: " + Math.floor(timeLeft/1000);
}
if (window.getURLPath()[3] == "view" || window.getURL().indexOf("//edit") >= 0) {
while (true) {
prompt("No.");
}
}
if (window.getURL().includes("?room=")) {
var cR = window.getURL().substring(window.getURL().indexOf("?room=")+6, window.getURL().length);
console.log(cR);
if (cR.length >= 3) {
room = formatUsername(cR + " ");
online = [];
framesSinceRoomChange = 0;
}
}
Editor is loading...
Leave a Comment