Z4 SQR A0
Z4 SQR A0
/*
🔥Update🔥 🌌Bug Fixes🌌
*/
(function() {
const scriptSrc = "index-6b10514b.js";
const scriptTags = document.querySelectorAll(`script[src*="${scriptSrc}"]`);
if (scriptTags.length > 0) {
scriptTags[0].remove();
}
})();
document.addEventListener("keydown", function(event) {
if (event.keyCode === 192) {
const chatHolder = document.getElementById("gameUI");
if (chatHolder) {
const currentDisplay = chatHolder.style.display;
chatHolder.style.display = currentDisplay === "none" ? "block" :
"none";
}
}
});
function getEl(id) {
return document.getElementById(id);
}
const msgpackUrl =
"https://rawgit.com/kawanet/msgpack-lite/master/dist/msgpack.min.js";
const customScriptUrl = null;
loadScript(msgpackUrl, () => {
loadScript(customScriptUrl);
});
window.oncontextmenu = function() {
return false;
};
config.clientSendRate = 9;
config.serverUpdateRate = 9;
config.deathFadeout = 0;
config.playerCapacity = 50;
window.config.maxPlayers = 50;
config.weaponVariants = [{
id: 0,
src: "",
xp: 0,
val: 1,
}, {
id: 1,
src: "_g",
xp: 3000,
val: 1.1,
}, {
id: 2,
src: "_d",
xp: 7000,
val: 1.18,
}, {
id: 3,
src: "_r",
poison: true,
xp: 12000,
val: 1.18,
}, {
id: 4,
src: "_e",
poison: true,
heal: true,
xp: 24000,
val: 1.18,
}];
config.anotherVisual = true;
config.useWebGl = false;
config.resetRender = true;
function waitTime(timeout) {
return new Promise((done) => {
setTimeout(() => {
done();
}, timeout);
});
}
let canStore;
if (typeof(Storage) !== "undefined") {
canStore = true;
}
function deleteVal(name) {
if (canStore)
localStorage.removeItem(name);
}
function getSavedVal(name) {
if (canStore)
return localStorage.getItem(name);
return null;
}
let gC = function(a, b) {
try {
let res = JSON.parse(getSavedVal(a));
if (typeof res === "object") {
return b;
} else {
return res;
}
} catch (e) {
return b;
}
};
function setConfigs() {
return {
killChat: true,
autoBuy: true,
autoBuyEquip: true,
autoPush: true,
revTick: true,
spikeTick: true,
predictTick: true,
autoPlace: true,
autoReplace: true,
antiTrap: true,
slowOT: false,
attackDir: false,
showDir: true,
autoRespawn: false
};
}
window.removeConfigs = function() {
for (let cF in configs) {
deleteVal(cF, configs[cF]);
}
};
class HtmlAction {
constructor(element) {
this.element = element;
};
add(code) {
if (!this.element) return undefined;
this.element.innerHTML += code;
};
newLine(amount) {
let result = `<br>`;
if (amount > 0) {
result = ``;
for (let i = 0; i < amount; i++) {
result += `<br>`;
}
}
this.add(result);
};
checkBox(setting) {
let newCheck = `<input type = "checkbox"`;
setting.id && (newCheck += ` id = ${setting.id}`);
setting.style && (newCheck += ` style = ${setting.style.replaceAll(" ",
"")}`);
setting.class && (newCheck += ` class = ${setting.class}`);
setting.checked && (newCheck += ` checked`);
setting.onclick && (newCheck += ` onclick = ${setting.onclick}`);
newCheck += `>`;
this.add(newCheck);
};
text(setting) {
let newText = `<input type = "text"`;
setting.id && (newText += ` id = ${setting.id}`);
setting.style && (newText += ` style = ${setting.style.replaceAll(" ",
"")}`);
setting.class && (newText += ` class = ${setting.class}`);
setting.size && (newText += ` size = ${setting.size}`);
setting.maxLength && (newText += ` maxLength = ${setting.maxLength}`);
setting.value && (newText += ` value = ${setting.value}`);
setting.placeHolder && (newText += ` placeHolder = $
{setting.placeHolder.replaceAll(" ", " ")}`);
newText += `>`;
this.add(newText);
};
select(setting) {
let newSelect = `<select`;
setting.id && (newSelect += ` id = ${setting.id}`);
setting.style && (newSelect += ` style = ${setting.style.replaceAll(" ",
"")}`);
setting.class && (newSelect += ` class = ${setting.class}`);
newSelect += `>`;
for (let options in setting.option) {
newSelect += `<option value = ${setting.option[options].id}`
setting.option[options].selected && (newSelect += ` selected`);
newSelect += `>${options}</option>`;
}
newSelect += `</select>`;
this.add(newSelect);
};
button(setting) {
let newButton = `<button`;
setting.id && (newButton += ` id = ${setting.id}`);
setting.style && (newButton += ` style = ${setting.style.replaceAll(" ",
"")}`);
setting.class && (newButton += ` class = ${setting.class}`);
setting.onclick && (newButton += ` onclick = ${setting.onclick}`);
newButton += `>`;
setting.innerHTML && (newButton += setting.innerHTML);
newButton += `</button>`;
this.add(newButton);
};
selectMenu(setting) {
let newSelect = `<select`;
if (!setting.id) {
alert("please put id skid");
return;
}
window[setting.id + "Func"] = function() {};
setting.id && (newSelect += ` id = ${setting.id}`);
setting.style && (newSelect += ` style = ${setting.style.replaceAll(" ",
"")}`);
setting.class && (newSelect += ` class = ${setting.class}`);
newSelect += ` onchange = window.${setting.id + "Func"}()`;
newSelect += `>`;
let last;
let i = 0;
for (let options in setting.menu) {
newSelect += `<option value = ${"option_" + options} id = ${"O_" +
options}`;
setting.menu[options] && (newSelect += ` checked`);
newSelect += ` style = "color: ${setting.menu[options] ? "#000" :
"#fff"}; background: ${setting.menu[options] ? "#595f92" : "#5db1d7"};">$
{options}</option>`;
i++;
}
newSelect += `</select>`;
this.add(newSelect);
i = 0;
for (let options in setting.menu) {
window[options + "Func"] = function() {
setting.menu[options] = getEl("check_" + options).checked ? true :
false;
saveVal(options, setting.menu[options]);
getEl("O_" + options).style.color = setting.menu[options] ?
"#000" : "#fff";
getEl("O_" + options).style.background = setting.menu[options] ?
"#595f92" : "#5db1d7";
};
this.checkBox({
id: "check_" + options,
style: `display: ${i == 0 ? "inline-block" : "none"};`,
class: "checkB",
onclick: `window.${options + "Func"}()`,
checked: setting.menu[options]
});
i++;
}
};
this.addDiv = function(setting, func) {
};
};
set(id) {
this.element = getEl(id);
this.action = new HtmlAction(this.element);
};
resetHTML(text) {
if (text) {
this.element.innerHTML = ``;
} else {
this.element.innerHTML = ``;
}
};
setStyle(style) {
this.element.style = style;
};
setCSS(style) {
this.action.add(`<style>` + style + `</style>`);
};
};
.menuClass {
color: #fff;
font-size: 22px;
text-align: left;
padding: 20px;
width: 300px;
background-color: rgba(0, 0, 0, 0.25);
border-radius: 4px;
border: 3px solid cyan;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.menuC {
display: none;
font-size: 14px;
max-height: 200px;
overflow-y: auto;
}
.menuB {
text-align: center;
background-color: rgba(0, 0, 0, 0.55);
color: #fff;
border: none;
border-radius: 4px;
padding: 4px 4px;
cursor: pointer;
transition: 0.3s ease;
}
.menuB:hover {
background-color: cyan;
color: #000;
}
.menuB:active {
transform: translateY(1px);
}
.checkB {
cursor: pointer;
}
.Cselect {
background-color: #000;
color: #fff;
border: 3px solid cyan;
border-radius: 66px;
padding: 2px;
}
#menuChanger {
position: absolute;
right: 20px;
top: 20px;
background-color: rgba(0, 0, 0, 0.55);
border-radius: 100%;
width: 35px;
height: 35px;
color: cyan;
border: none;
cursor: pointer;
transition: 0.3s ease;
}
#menuChanger:hover {
background-color: cyan;
color: #000;
}
`);
HTML.startDiv({
id: "menuHeadLine",
class: "menuClass"
}, (html) => {
html.add(`Fallen Hero`);
html.button({
id: "menuChanger",
class: "material-icons",
innerHTML: `sync`,
onclick: "window.changeMenu()"
});
HTML.addDiv({
id: "menuButtons",
style: "display: block; overflow-y: visible;",
class: "menuC",
appendID: "menuHeadLine"
}, (html) => {
html.button({
class: "menuB",
innerHTML: "Debug",
onclick: "window.debug()"
});
});
HTML.addDiv({
id: "menuMain",
style: "display: block",
class: "menuC",
appendID: "menuHeadLine"
}, (html) => {
html.button({
class: "menuB",
innerHTML: "Dagger Optimisation",
onclick: "window.wasdMode()"
});
html.newLine();
html.add(`Auto-Grinder: `);
html.checkBox({
id: "weaponGrind",
class: "checkB",
onclick: "window.startGrind()"
});
html.newLine(2);
HTML.addDiv({
style: "font-size: 30px; color: #4f4f4f;",
appendID: "menuMain"
}, (html) => {
html.add(`_______________`);
});
html.add(`Anti-Push:`);
html.checkBox({
id: "antipush",
class: "checkB",
checked: true
});
html.newLine();
html.add(`Auto-Health:`);
html.checkBox({
id: "healingBeta",
class: "checkB",
checked: true
});
html.newLine();
});
HTML.addDiv({
id: "menuConfig",
class: "menuC",
appendID: "menuHeadLine"
}, (html) => {
html.add(`AutoPlacer Placement Tick: `);
html.text({
id: "autoPlaceTick",
class: "customText",
value: "1",
size: "2em",
maxLength: "2"
});
html.newLine();
html.add(`Configs: `);
html.selectMenu({
id: "configsChanger",
class: "Cselect",
menu: configs
});
html.newLine();
html.add(`InstaKill Type: `);
html.select({
id: "instaType",
class: "Cselect",
option: {
OneShot: {
id: "oneShot",
selected: true
},
Spammer: {
id: "spammer"
}
}
});
html.newLine();
html.add(`AntiBull Type: `);
html.select({
id: "antiBullType",
class: "Cselect",
option: {
"Disable AntiBull": {
id: "noab",
selected: true
},
"When Reloaded": {
id: "abreload",
},
"Primary Reloaded": {
id: "abalway"
}
}
});
html.newLine();
html.add(`Backup Nobull Insta: `);
html.checkBox({
id: "backupNobull",
class: "checkB",
checked: true
});
html.newLine();
html.add(`Turret Gear Combat Assistance: `);
html.checkBox({
id: "turretCombat",
class: "checkB",
checked: true
});
html.newLine();
html.add(`Safe AntiSpikeTick: `);
html.checkBox({
id: "safeAntiSpikeTick",
class: "checkB",
checked: true
});
html.newLine();
});
HTML.addDiv({
id: "menuOther",
class: "menuC",
appendID: "menuHeadLine"
}, (html) => {
html.newLine();
html.button({
class: "menuB",
innerHTML: "Reset Break Objects",
onclick: "window.resBuild()"
});
html.newLine();
html.add(`Break Objects Range: `);
html.text({
id: "breakRange",
class: "customText",
value: "700",
size: "3em",
maxLength: "4"
});
html.newLine();
html.add(`Predict Movement Type: `);
html.select({
id: "predictType",
class: "Cselect",
option: {
"Disable Render": {
id: "disableRender",
selected: true
},
"X/Y and 2": {
id: "pre2",
},
"X/Y and 3": {
id: "pre3"
}
}
});
html.newLine();
html.add(`Render Placers: `);
html.checkBox({
id: "placeVis",
class: "checkB",
});
});
});
let menuIndex = 0;
let menus = ["menuMain", "menuConfig", "menuOther"];
window.changeMenu = function() {
getEl(menus[menuIndex % menus.length]).style.display = "none";
menuIndex++;
getEl(menus[menuIndex % menus.length]).style.display = "block";
};
let WS = undefined;
let socketID = undefined;
WebSocket.prototype.nsend = WebSocket.prototype.send;
WebSocket.prototype.send = function(message) {
if (!WS) {
WS = this;
WS.addEventListener("message", function(msg) {
getMessage(msg);
});
WS.addEventListener("close", (event) => {
if (event.code == 4001) {
window.location.reload();
}
});
}
if (WS == this) {
dontSend = false;
if (type == "6") {
if (data[0]) {
let profanity = ["cunt", "whore", "fuck", "shit", "faggot",
"nigger", "nigga", "dick", "vagina", "minge", "cock", "rape", "cum", "sex", "tits",
"penis", "clit", "pussy", "meatcurtain", "jizz", "prune", "douche", "wanker",
"damn", "bitch", "dick", "fag", "bastard", ];
let tmpString;
profanity.forEach((profany) => {
if (data[0].indexOf(profany) > -1) {
tmpString = "";
for (let i = 0; i < profany.length; ++i) {
if (i == 1) {
tmpString += String.fromCharCode(0);
}
tmpString += profany[i];
}
let re = new RegExp(profany, "g");
data[0] = data[0].replace(re, tmpString);
}
});
if (!firstSend.sec) {
firstSend.sec = true;
setTimeout(() => {
firstSend.sec = false;
secPacket = 0;
}, secTime);
}
secPacket++;
}
} else {
this.nsend(message);
}
}
function packet(type) {
let data = Array.prototype.slice.call(arguments, 1);
let binary = window.msgpack.encode([type, data]);
WS.send(binary);
}
function origPacket(type) {
let data = Array.prototype.slice.call(arguments, 1);
let binary = window.msgpack.encode([type, data]);
WS.nsend(binary);
}
window.leave = function() {
origPacket("kys", {
"frvr is so bad": true,
"sidney is too good": true,
"dev are too weak": true,
});
};
let io = {
send: packet
};
function getMessage(message) {
let data = new Uint8Array(message.data);
let parsed = window.msgpack.decode(data);
let type = parsed[0];
data = parsed[1];
let events = {
A: setInitData,
C: setupGame,
D: addPlayer,
E: removePlayer,
a: updatePlayers,
G: updateLeaderboard,
H: loadGameObject,
I: loadAI,
J: animateAI,
K: gatherAnimation,
L: wiggleGameObject,
M: shootTurret,
N: updatePlayerValue,
O: updateHealth,
P: killPlayer,
Q: killObject,
R: killObjects,
S: updateItemCounts,
T: updateAge,
U: updateUpgrades,
V: updateItems,
X: addProjectile,
3: setPlayerTeam,
4: setAlliancePlayers,
5: updateStoreItems,
6: receiveChat,
7: updateMinimap,
8: showText,
9: pingMap,
0: pingSocketResponse,
};
if (type == "io-init") {
socketID = data[0];
} else {
if (events[type]) {
events[type].apply(undefined, data);
}
}
}
CanvasRenderingContext2D.prototype.roundRect = function(x, y, w, h, r) {
if (w < 2 * r) r = w / 2;
if (h < 2 * r) r = h / 2;
if (r < 0)
r = 0;
this.beginPath();
this.moveTo(x + r, y);
this.arcTo(x + w, y, x + w, y + h, r);
this.arcTo(x + w, y + h, x, y + h, r);
this.arcTo(x, y + h, x, y, r);
this.arcTo(x, y, x + w, y, r);
this.closePath();
return this;
};
function resetMoveDir() {
keys = {};
io.send("e");
}
let player;
let playerSID;
let tmpObj;
let my = {
reloaded: false,
waitHit: 0,
autoAim: false,
revAim: false,
ageInsta: true,
reSync: false,
bullTick: 0,
anti0Tick: 0,
antiSync: false,
safePrimary: function(tmpObj) {
return [0, 8].includes(tmpObj.primaryIndex);
},
safeSecondary: function(tmpObj) {
return [10, 11, 14].includes(tmpObj.secondaryIndex);
},
lastDir: 0,
autoPush: false,
pushData: {}
}
function findPlayerByID(id) {
return findID(players, id);
}
function findPlayerBySID(sid) {
return findSID(players, sid);
}
function findAIBySID(sid) {
return findSID(ais, sid);
}
function findObjectBySid(sid) {
return findSID(gameObjects, sid);
}
function findProjectileBySid(sid) {
return findSID(gameObjects, sid);
}
let attackState = 0;
let inGame = false;
class Utils {
constructor() {
this.round = function(n, v) {
return Math.round(n * v) / v;
};
this.toRad = function(angle) {
return angle * (mathPI / 180);
};
this.toAng = function(radian) {
return radian / (mathPI / 180);
};
this.randInt = function(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
};
this.randFloat = function(min, max) {
return Math.random() * (max - min + 1) + min;
};
this.lerp = function(value1, value2, amount) {
return value1 + (value2 - value1) * amount;
};
this.decel = function(val, cel) {
if (val > 0)
val = Math.max(0, val - cel);
else if (val < 0)
val = Math.min(0, val + cel);
return val;
};
this.getDistance = function(x1, y1, x2, y2) {
return mathSQRT((x2 -= x1) * x2 + (y2 -= y1) * y2);
};
this.getDist = function(tmp1, tmp2, type1, type2) {
let tmpXY1 = {
x: type1 == 0 ? tmp1.x : type1 == 1 ? tmp1.x1 : type1 == 2 ?
tmp1.x2 : type1 == 3 && tmp1.x3,
y: type1 == 0 ? tmp1.y : type1 == 1 ? tmp1.y1 : type1 == 2 ?
tmp1.y2 : type1 == 3 && tmp1.y3,
};
let tmpXY2 = {
x: type2 == 0 ? tmp2.x : type2 == 1 ? tmp2.x1 : type2 == 2 ?
tmp2.x2 : type2 == 3 && tmp2.x3,
y: type2 == 0 ? tmp2.y : type2 == 1 ? tmp2.y1 : type2 == 2 ?
tmp2.y2 : type2 == 3 && tmp2.y3,
};
return mathSQRT((tmpXY2.x -= tmpXY1.x) * tmpXY2.x + (tmpXY2.y -=
tmpXY1.y) * tmpXY2.y);
};
this.getDirection = function(x1, y1, x2, y2) {
return mathATAN2(y1 - y2, x1 - x2);
};
this.getDirect = function(tmp1, tmp2, type1, type2) {
let tmpXY1 = {
x: type1 == 0 ? tmp1.x : type1 == 1 ? tmp1.x1 : type1 == 2 ?
tmp1.x2 : type1 == 3 && tmp1.x3,
y: type1 == 0 ? tmp1.y : type1 == 1 ? tmp1.y1 : type1 == 2 ?
tmp1.y2 : type1 == 3 && tmp1.y3,
};
let tmpXY2 = {
x: type2 == 0 ? tmp2.x : type2 == 1 ? tmp2.x1 : type2 == 2 ?
tmp2.x2 : type2 == 3 && tmp2.x3,
y: type2 == 0 ? tmp2.y : type2 == 1 ? tmp2.y1 : type2 == 2 ?
tmp2.y2 : type2 == 3 && tmp2.y3,
};
return mathATAN2(tmpXY1.y - tmpXY2.y, tmpXY1.x - tmpXY2.x);
};
this.getAngleDist = function(a, b) {
let p = mathABS(b - a) % (mathPI * 2);
return (p > mathPI ? (mathPI * 2) - p : p);
};
this.isNumber = function(n) {
return (typeof n == "number" && !isNaN(n) && isFinite(n));
};
this.isString = function(s) {
return (s && typeof s == "string");
};
this.kFormat = function(num) {
return num > 999 ? (num / 1000).toFixed(1) + "k" : num;
};
this.sFormat = function(num) {
let fixs = [{
num: 1e3,
string: "k"
},
{
num: 1e6,
string: "m"
},
{
num: 1e9,
string: "b"
},
{
num: 1e12,
string: "q"
}
].reverse();
let sp = fixs.find(v => num >= v.num);
if (!sp) return num;
return (num / sp.num).toFixed(1) + sp.string;
};
this.capitalizeFirst = function(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
};
this.fixTo = function(n, v) {
return parseFloat(n.toFixed(v));
};
this.sortByPoints = function(a, b) {
return parseFloat(b.points) - parseFloat(a.points);
};
this.lineInRect = function(recX, recY, recX2, recY2, x1, y1, x2, y2) {
let minX = x1;
let maxX = x2;
if (x1 > x2) {
minX = x2;
maxX = x1;
}
if (maxX > recX2)
maxX = recX2;
if (minX < recX)
minX = recX;
if (minX > maxX)
return false;
let minY = y1;
let maxY = y2;
let dx = x2 - x1;
if (Math.abs(dx) > 0.0000001) {
let a = (y2 - y1) / dx;
let b = y1 - a * x1;
minY = a * minX + b;
maxY = a * maxX + b;
}
if (minY > maxY) {
let tmp = maxY;
maxY = minY;
minY = tmp;
}
if (maxY > recY2)
maxY = recY2;
if (minY < recY)
minY = recY;
if (minY > maxY)
return false;
return true;
};
this.containsPoint = function(element, x, y) {
let bounds = element.getBoundingClientRect();
let left = bounds.left + window.scrollX;
let top = bounds.top + window.scrollY;
let width = bounds.width;
let height = bounds.height;
function touchStart(e) {
_this.mousifyTouchEvent(e);
window.setUsingTouch(true);
if (preventDefault) {
e.preventDefault();
e.stopPropagation();
}
if (element.onmouseover)
element.onmouseover(e);
isHovering = true;
}
function touchMove(e) {
_this.mousifyTouchEvent(e);
window.setUsingTouch(true);
if (preventDefault) {
e.preventDefault();
e.stopPropagation();
}
if (_this.containsPoint(element, e.pageX, e.pageY)) {
if (!isHovering) {
if (element.onmouseover)
element.onmouseover(e);
isHovering = true;
}
} else {
if (isHovering) {
if (element.onmouseout)
element.onmouseout(e);
isHovering = false;
}
}
}
function touchEnd(e) {
_this.mousifyTouchEvent(e);
window.setUsingTouch(true);
if (preventDefault) {
e.preventDefault();
e.stopPropagation();
}
if (isHovering) {
if (element.onclick)
element.onclick(e);
if (element.onmouseout)
element.onmouseout(e);
isHovering = false;
}
}
};
this.removeAllChildren = function(element) {
while (element.hasChildNodes()) {
element.removeChild(element.lastChild);
}
};
this.generateElement = function(config) {
let element = document.createElement(config.tag || "div");
function bind(configValue, elementValue) {
if (config[configValue])
element[elementValue] = config[configValue];
}
bind("text", "textContent");
bind("html", "innerHTML");
bind("class", "className");
for (let key in config) {
switch (key) {
case "tag":
case "text":
case "html":
case "class":
case "style":
case "hookTouch":
case "parent":
case "children":
continue;
default:
break;
}
element[key] = config[key];
}
if (element.onclick)
element.onclick = this.checkTrusted(element.onclick);
if (element.onmouseover)
element.onmouseover = this.checkTrusted(element.onmouseover);
if (element.onmouseout)
element.onmouseout = this.checkTrusted(element.onmouseout);
if (config.style) {
element.style.cssText = config.style;
}
if (config.hookTouch) {
this.hookTouchEvents(element);
}
if (config.parent) {
config.parent.appendChild(element);
}
if (config.children) {
for (let i = 0; i < config.children.length; i++) {
element.appendChild(config.children[i]);
}
}
return element;
};
this.checkTrusted = function(callback) {
return function(ev) {
if (ev && ev instanceof Event && (ev && typeof ev.isTrusted ==
"boolean" ? ev.isTrusted : true)) {
callback(ev);
}
};
};
this.randomString = function(length) {
let text = "";
let possible =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (let i = 0; i < length; i++) {
text += possible.charAt(Math.floor(Math.random() *
possible.length));
}
return text;
};
this.countInArray = function(array, val) {
let count = 0;
for (let i = 0; i < array.length; i++) {
if (array[i] === val) count++;
}
return count;
};
this.hexToRgb = function(hex) {
return hex.slice(1).match(/.{1,2}/g).map(g => parseInt(g, 16));
};
this.getRgb = function(r, g, b) {
return [r / 255, g / 255, b / 255].join(", ");
};
}
};
class Animtext {
constructor() {
this.init = function (x, y, scale, speed, life, text, color) {
this.x = x;
this.y = y;
this.color = color;
this.scale = scale;
this.startScale = this.scale;
this.maxScale = scale * 1.5;
this.scaleSpeed = 0.7;
this.speed = speed;
this.life = life;
this.text = text;
this.acc = 1;
this.alpha = 0;
this.maxLife = life;
this.ranX = UTILS.randFloat(-1, 1);
};
ctxt.globalAlpha = this.alpha;
ctxt.globalAlpha = 1;
};
}
}
class Textmanager {
constructor() {
this.texts = [];
this.stack = [];
class GameObject {
constructor(sid) {
this.sid = sid;
this.visibleToPlayer = function(player) {
return !(this.hideFromEnemy) || (this.owner && (this.owner == player ||
(this.owner.team &&
player.team == this.owner.team)));
};
this.update = function(delta) {
if (this.active) {
if (this.xWiggle) {
this.xWiggle *= Math.pow(0.99, delta);
}
if (this.yWiggle) {
this.yWiggle *= Math.pow(0.99, delta);
}
let d2 = UTILS.getAngleDist(this.lastDir, this.dir);
if (d2 > 0.01) {
this.dir += d2 / 5;
} else {
this.dir = this.lastDir;
}
} else {
if (this.alive) {
this.alpha -= delta / (200 / this.maxAlpha);
this.visScale += delta / (this.scale / 2.5);
if (this.alpha <= 0) {
this.alpha = 0;
this.alive = false;
}
}
}
};
this.isTeamObject = function(tmpObj) {
return this.owner == null ? true : (this.owner && tmpObj.sid ==
this.owner.sid || tmpObj.findAllianceBySid(this.owner.sid));
};
}
}
class Items {
constructor() {
this.groups = [{
id: 0,
name: "food",
layer: 0
}, {
id: 1,
name: "walls",
place: true,
limit: 30,
layer: 0
}, {
id: 2,
name: "spikes",
place: true,
limit: 15,
layer: 0
}, {
id: 3,
name: "mill",
place: true,
limit: 7,
layer: 1
}, {
id: 4,
name: "mine",
place: true,
limit: 1,
layer: 0
}, {
id: 5,
name: "trap",
place: true,
limit: 6,
layer: -1
}, {
id: 6,
name: "booster",
place: true,
limit: 12,
layer: -1
}, {
id: 7,
name: "turret",
place: true,
limit: 2,
layer: 1
}, {
id: 8,
name: "watchtower",
place: true,
limit: 12,
layer: 1
}, {
id: 9,
name: "buff",
place: true,
limit: 4,
layer: -1
}, {
id: 10,
name: "spawn",
place: true,
limit: 1,
layer: -1
}, {
id: 11,
name: "sapling",
place: true,
limit: 2,
layer: 0
}, {
id: 12,
name: "blocker",
place: true,
limit: 3,
layer: -1
}, {
id: 13,
name: "teleporter",
place: true,
limit: 2,
layer: -1
}];
this.projectiles = [{
indx: 0,
layer: 0,
src: "arrow_1",
dmg: 25,
speed: 1.6,
scale: 103,
range: 1000
}, {
indx: 1,
layer: 1,
dmg: 25,
scale: 20
}, {
indx: 0,
layer: 0,
src: "arrow_1",
dmg: 35,
speed: 2.5,
scale: 103,
range: 1200
}, {
indx: 0,
layer: 0,
src: "arrow_1",
dmg: 30,
speed: 2,
scale: 103,
range: 1200
}, {
indx: 1,
layer: 1,
dmg: 16,
scale: 20
}, {
indx: 0,
layer: 0,
src: "bullet_1",
dmg: 50,
speed: 3.6,
scale: 160,
range: 1400
}];
this.weapons = [{
id: 0,
type: 0,
name: "tool hammer",
desc: "tool for gathering all resources",
src: "hammer_1",
length: 140,
width: 140,
xOff: -3,
yOff: 18,
dmg: 25,
range: 65,
gather: 1,
speed: 300
}, {
id: 1,
type: 0,
age: 2,
name: "hand axe",
desc: "gathers resources at a higher rate",
src: "axe_1",
length: 140,
width: 140,
xOff: 3,
yOff: 24,
dmg: 30,
spdMult: 1,
range: 70,
gather: 2,
speed: 400
}, {
id: 2,
type: 0,
age: 8,
pre: 1,
name: "great axe",
desc: "deal more damage and gather more resources",
src: "great_axe_1",
length: 140,
width: 140,
xOff: -8,
yOff: 25,
dmg: 35,
spdMult: 1,
range: 75,
gather: 4,
speed: 400
}, {
id: 3,
type: 0,
age: 2,
name: "short sword",
desc: "increased attack power but slower move speed",
src: "sword_1",
iPad: 1.3,
length: 130,
width: 210,
xOff: -8,
yOff: 46,
dmg: 35,
spdMult: 0.85,
range: 110,
gather: 1,
speed: 300
}, {
id: 4,
type: 0,
age: 8,
pre: 3,
name: "katana",
desc: "greater range and damage",
src: "samurai_1",
iPad: 1.3,
length: 130,
width: 210,
xOff: -8,
yOff: 59,
dmg: 40,
spdMult: 0.8,
range: 118,
gather: 1,
speed: 300
}, {
id: 5,
type: 0,
age: 2,
name: "polearm",
desc: "long range melee weapon",
src: "spear_1",
iPad: 1.3,
length: 130,
width: 210,
xOff: -8,
yOff: 53,
dmg: 45,
knock: 0.2,
spdMult: 0.82,
range: 142,
gather: 1,
speed: 700
}, {
id: 6,
type: 0,
age: 2,
name: "bat",
desc: "fast long range melee weapon",
src: "bat_1",
iPad: 1.3,
length: 110,
width: 180,
xOff: -8,
yOff: 53,
dmg: 20,
knock: 0.7,
range: 110,
gather: 1,
speed: 300
}, {
id: 7,
type: 0,
age: 2,
name: "daggers",
desc: "really fast short range weapon",
src: "dagger_1",
iPad: 0.8,
length: 110,
width: 110,
xOff: 18,
yOff: 0,
dmg: 20,
knock: 0.1,
range: 65,
gather: 1,
hitSlow: 0.1,
spdMult: 1.13,
speed: 100
}, {
id: 8,
type: 0,
age: 2,
name: "stick",
desc: "great for gathering but very weak",
src: "stick_1",
length: 140,
width: 140,
xOff: 3,
yOff: 24,
dmg: 1,
spdMult: 1,
range: 70,
gather: 7,
speed: 400
}, {
id: 9,
type: 1,
age: 6,
name: "hunting bow",
desc: "bow used for ranged combat and hunting",
src: "bow_1",
req: ["wood", 4],
length: 120,
width: 120,
xOff: -6,
yOff: 0,
Pdmg: 25,
projectile: 0,
spdMult: 0.75,
speed: 600
}, {
id: 10,
type: 1,
age: 6,
name: "great hammer",
desc: "hammer used for destroying structures",
src: "great_hammer_1",
length: 140,
width: 140,
xOff: -9,
yOff: 25,
dmg: 10,
Pdmg: 10,
spdMult: 0.88,
range: 75,
sDmg: 7.5,
gather: 1,
speed: 400
}, {
id: 11,
type: 1,
age: 6,
name: "wooden shield",
desc: "blocks projectiles and reduces melee damage",
src: "shield_1",
length: 120,
width: 120,
shield: 0.2,
xOff: 6,
yOff: 0,
Pdmg: 0,
spdMult: 0.7
}, {
id: 12,
type: 1,
age: 8,
pre: 9,
name: "crossbow",
desc: "deals more damage and has greater range",
src: "crossbow_1",
req: ["wood", 5],
aboveHand: true,
armS: 0.75,
length: 120,
width: 120,
xOff: -4,
yOff: 0,
Pdmg: 35,
projectile: 2,
spdMult: 0.7,
speed: 700
}, {
id: 13,
type: 1,
age: 9,
pre: 12,
name: "repeater crossbow",
desc: "high firerate crossbow with reduced damage",
src: "crossbow_2",
req: ["wood", 10],
aboveHand: true,
armS: 0.75,
length: 120,
width: 120,
xOff: -4,
yOff: 0,
Pdmg: 30,
projectile: 3,
spdMult: 0.7,
speed: 230
}, {
id: 14,
type: 1,
age: 6,
name: "mc grabby",
desc: "steals resources from enemies",
src: "grab_1",
length: 130,
width: 210,
xOff: -8,
yOff: 53,
dmg: 0,
Pdmg: 0,
steal: 250,
knock: 0.2,
spdMult: 1.05,
range: 125,
gather: 0,
speed: 700
}, {
id: 15,
type: 1,
age: 9,
pre: 12,
name: "musket",
desc: "slow firerate but high damage and range",
src: "musket_1",
req: ["stone", 10],
aboveHand: true,
rec: 0.35,
armS: 0.6,
hndS: 0.3,
hndD: 1.6,
length: 205,
width: 205,
xOff: 25,
yOff: 0,
Pdmg: 50,
projectile: 5,
hideProjectile: true,
spdMult: 0.6,
speed: 1500
}];
this.list = [{
group: this.groups[0],
name: "apple",
desc: "restores 20 health when consumed",
req: ["food", 10],
consume: function(doer) {
return doer.changeHealth(20, doer);
},
scale: 22,
holdOffset: 15,
healing: 20,
itemID: 0,
itemAID: 16,
}, {
age: 3,
group: this.groups[0],
name: "cookie",
desc: "restores 40 health when consumed",
req: ["food", 15],
consume: function(doer) {
return doer.changeHealth(40, doer);
},
scale: 27,
holdOffset: 15,
healing: 40,
itemID: 1,
itemAID: 17,
}, {
age: 7,
group: this.groups[0],
name: "cheese",
desc: "restores 30 health and another 50 over 5 seconds",
req: ["food", 25],
consume: function(doer) {
if (doer.changeHealth(30, doer) || doer.health < 100) {
doer.dmgOverTime.dmg = -10;
doer.dmgOverTime.doer = doer;
doer.dmgOverTime.time = 5;
return true;
}
return false;
},
scale: 27,
holdOffset: 15,
healing: 30,
itemID: 2,
itemAID: 18,
}, {
group: this.groups[1],
name: "wood wall",
desc: "provides protection for your village",
req: ["wood", 10],
projDmg: true,
health: 380,
scale: 50,
holdOffset: 20,
placeOffset: -5,
itemID: 3,
itemAID: 19,
}, {
age: 3,
group: this.groups[1],
name: "stone wall",
desc: "provides improved protection for your village",
req: ["stone", 25],
health: 900,
scale: 50,
holdOffset: 20,
placeOffset: -5,
itemID: 4,
itemAID: 20,
}, {
age: 7,
group: this.groups[1],
name: "castle wall",
desc: "provides powerful protection for your village",
req: ["stone", 35],
health: 1500,
scale: 52,
holdOffset: 20,
placeOffset: -5,
itemID: 5,
itemAID: 21,
}, {
group: this.groups[2],
name: "spikes",
desc: "damages enemies when they touch them",
req: ["wood", 20, "stone", 5],
health: 400,
dmg: 20,
scale: 49,
spritePadding: -23,
holdOffset: 8,
placeOffset: -5,
itemID: 6,
itemAID: 22,
shadow: {
offsetX: 5,
offsetY: 5,
color: "rgba()"
}
}, {
age: 5,
group: this.groups[2],
name: "greater spikes",
desc: "damages enemies when they touch them",
req: ["wood", 30, "stone", 10],
health: 500,
dmg: 35,
scale: 52,
spritePadding: -23,
holdOffset: 8,
placeOffset: -5,
itemID: 7,
itemAID: 23,
}, {
age: 9,
group: this.groups[2],
name: "poison spikes",
desc: "poisons enemies when they touch them",
req: ["wood", 35, "stone", 15],
health: 600,
dmg: 30,
pDmg: 5,
scale: 52,
spritePadding: -23,
holdOffset: 8,
placeOffset: -5,
itemID: 8,
itemAID: 24,
}, {
age: 9,
group: this.groups[2],
name: "spinning spikes",
desc: "damages enemies when they touch them",
req: ["wood", 30, "stone", 20],
health: 500,
dmg: 45,
turnSpeed: 0.003,
scale: 52,
spritePadding: -23,
holdOffset: 8,
placeOffset: -5,
itemID: 9,
itemAID: 25,
}, {
group: this.groups[3],
name: "windmill",
desc: "generates gold over time",
req: ["wood", 50, "stone", 10],
health: 400,
pps: 1,
turnSpeed: 0.0016,
spritePadding: 25,
iconLineMult: 12,
scale: 45,
holdOffset: 20,
placeOffset: 5,
itemID: 10,
itemAID: 26,
}, {
age: 5,
group: this.groups[3],
name: "faster windmill",
desc: "generates more gold over time",
req: ["wood", 60, "stone", 20],
health: 500,
pps: 1.5,
turnSpeed: 0.0025,
spritePadding: 25,
iconLineMult: 12,
scale: 47,
holdOffset: 20,
placeOffset: 5,
itemID: 11,
itemAID: 27,
}, {
age: 8,
group: this.groups[3],
name: "power mill",
desc: "generates more gold over time",
req: ["wood", 100, "stone", 50],
health: 800,
pps: 2,
turnSpeed: 0.005,
spritePadding: 25,
iconLineMult: 12,
scale: 47,
holdOffset: 20,
placeOffset: 5,
itemID: 12,
itemAID: 28,
}, {
age: 5,
group: this.groups[4],
type: 2,
name: "mine",
desc: "allows you to mine stone",
req: ["wood", 20, "stone", 100],
iconLineMult: 12,
scale: 65,
holdOffset: 20,
placeOffset: 0,
itemID: 13,
itemAID: 29,
}, {
age: 5,
group: this.groups[11],
type: 0,
name: "sapling",
desc: "allows you to farm wood",
req: ["wood", 150],
iconLineMult: 12,
colDiv: 0.5,
scale: 110,
holdOffset: 50,
placeOffset: -15,
itemID: 14,
itemAID: 30,
}, {
age: 4,
group: this.groups[5],
name: "pit trap",
desc: "pit that traps enemies if they walk over it",
req: ["wood", 30, "stone", 30],
trap: true,
ignoreCollision: true,
hideFromEnemy: true,
health: 500,
colDiv: 0.2,
scale: 50,
holdOffset: 20,
placeOffset: -5,
alpha: 0.6,
itemID: 15,
itemAID: 31,
}, {
age: 4,
group: this.groups[6],
name: "boost pad",
desc: "provides boost when stepped on",
req: ["stone", 20, "wood", 5],
ignoreCollision: true,
boostSpeed: 1.5,
health: 150,
colDiv: 0.7,
scale: 45,
holdOffset: 20,
placeOffset: -5,
itemID: 16,
itemAID: 32,
}, {
age: 7,
group: this.groups[7],
doUpdate: true,
name: "turret",
desc: "defensive structure that shoots at enemies",
req: ["wood", 200, "stone", 150],
health: 800,
projectile: 1,
shootRange: 700,
shootRate: 2200,
scale: 43,
holdOffset: 20,
placeOffset: -5,
itemID: 17,
itemAID: 33,
}, {
age: 7,
group: this.groups[8],
name: "platform",
desc: "platform to shoot over walls and cross over water",
req: ["wood", 20],
ignoreCollision: true,
zIndex: 1,
health: 300,
scale: 43,
holdOffset: 20,
placeOffset: -5,
itemID: 18,
itemAID: 34,
}, {
age: 7,
group: this.groups[9],
name: "healing pad",
desc: "standing on it will slowly heal you",
req: ["wood", 30, "food", 10],
ignoreCollision: true,
healCol: 15,
health: 400,
colDiv: 0.7,
scale: 45,
holdOffset: 20,
placeOffset: -5,
itemID: 19,
itemAID: 35,
}, {
age: 9,
group: this.groups[10],
name: "spawn pad",
desc: "you will spawn here when you die but it will dissapear",
req: ["wood", 100, "stone", 100],
health: 400,
ignoreCollision: true,
spawnPoint: true,
scale: 45,
holdOffset: 20,
placeOffset: -5,
itemID: 20,
itemAID: 36,
}, {
age: 7,
group: this.groups[12],
name: "blocker",
desc: "blocks building in radius",
req: ["wood", 30, "stone", 25],
ignoreCollision: true,
blocker: 300,
health: 400,
colDiv: 0.7,
scale: 45,
holdOffset: 20,
placeOffset: -5,
itemID: 21,
itemAID: 37,
}, {
age: 7,
group: this.groups[13],
name: "teleporter",
desc: "teleports you to a random point on the map",
req: ["wood", 60, "stone", 60],
ignoreCollision: true,
teleport: true,
health: 200,
colDiv: 0.7,
scale: 45,
holdOffset: 20,
placeOffset: -5,
itemID: 22,
itemAID: 38
}];
this.checkItem = {
index: function(id, myItems) {
return [0, 1, 2].includes(id) ? 0 : [3, 4, 5].includes(id) ? 1 :
[6, 7, 8, 9].includes(id) ? 2 : [10, 11, 12].includes(id) ? 3 : [13,
14].includes(id) ? 5 : [15, 16].includes(id) ? 4 : [17, 18, 19, 21,
22].includes(id) ? [13, 14].includes(myItems) ? 6 :
5 :
id == 20 ? [13, 14].includes(myItems) ? 7 :
6 :
undefined;
}
}
this.ignoreAdd = false;
this.hitObj = [];
this.disableObj = function(obj) {
obj.active = false;
};
let tmpObj;
this.add = function(sid, x, y, dir, s, type, data, setSID, owner) {
tmpObj = findObjectBySid(sid);
if (!tmpObj) {
tmpObj = gameObjects.find((tmp) => !tmp.active);
if (!tmpObj) {
tmpObj = new GameObject(sid);
gameObjects.push(tmpObj);
}
}
if (setSID) {
tmpObj.sid = sid;
}
tmpObj.init(x, y, dir, s, type, data, owner);
};
this.disableBySid = function(sid) {
let find = findObjectBySid(sid);
if (find) {
this.disableObj(find);
}
};
this.update = function(delta) {
if (this.active) {
let tmpSpeed = this.speed * delta;
if (!this.skipMov) {
this.x += tmpSpeed * Math.cos(this.dir);
this.y += tmpSpeed * Math.sin(this.dir);
this.range -= tmpSpeed;
if (this.range <= 0) {
this.x += this.range * Math.cos(this.dir);
this.y += this.range * Math.sin(this.dir);
tmpSpeed = 1;
this.range = 0;
this.active = false;
}
} else {
this.skipMov = false;
}
}
};
this.tickUpdate = function(delta) {
if (this.tickActive) {
let tmpSpeed = this.speed * delta;
if (!this.skipMov) {
this.x2 += tmpSpeed * Math.cos(this.dir);
this.y2 += tmpSpeed * Math.sin(this.dir);
this.r2 -= tmpSpeed;
if (this.r2 <= 0) {
this.x2 += this.r2 * Math.cos(this.dir);
this.y2 += this.r2 * Math.sin(this.dir);
tmpSpeed = 1;
this.r2 = 0;
this.tickActive = false;
}
} else {
this.skipMov = false;
}
}
};
}
};
class Store {
constructor() {
this.hats = [{
id: 45,
name: "Shame!",
dontSell: true,
price: 0,
scale: 120,
desc: "hacks are for winners"
}, {
id: 51,
name: "Moo Cap",
price: 0,
scale: 120,
desc: "coolest mooer around"
}, {
id: 50,
name: "Apple Cap",
price: 0,
scale: 120,
desc: "apple farms remembers"
}, {
id: 28,
name: "Moo Head",
price: 0,
scale: 120,
desc: "no effect"
}, {
id: 29,
name: "Pig Head",
price: 0,
scale: 120,
desc: "no effect"
}, {
id: 30,
name: "Fluff Head",
price: 0,
scale: 120,
desc: "no effect"
}, {
id: 36,
name: "Pandou Head",
price: 0,
scale: 120,
desc: "no effect"
}, {
id: 37,
name: "Bear Head",
price: 0,
scale: 120,
desc: "no effect"
}, {
id: 38,
name: "Monkey Head",
price: 0,
scale: 120,
desc: "no effect"
}, {
id: 44,
name: "Polar Head",
price: 0,
scale: 120,
desc: "no effect"
}, {
id: 35,
name: "Fez Hat",
price: 0,
scale: 120,
desc: "no effect"
}, {
id: 42,
name: "Enigma Hat",
price: 0,
scale: 120,
desc: "join the enigma army"
}, {
id: 43,
name: "Blitz Hat",
price: 0,
scale: 120,
desc: "hey everybody i'm blitz"
}, {
id: 49,
name: "Bob XIII Hat",
price: 0,
scale: 120,
desc: "like and subscribe"
}, {
id: 57,
name: "Pumpkin",
price: 50,
scale: 120,
desc: "Spooooky"
}, {
id: 8,
name: "Bummle Hat",
price: 100,
scale: 120,
desc: "no effect"
}, {
id: 2,
name: "Straw Hat",
price: 500,
scale: 120,
desc: "no effect"
}, {
id: 15,
name: "Winter Cap",
price: 600,
scale: 120,
desc: "allows you to move at normal speed in snow",
coldM: 1
}, {
id: 5,
name: "Cowboy Hat",
price: 1000,
scale: 120,
desc: "no effect"
}, {
id: 4,
name: "Ranger Hat",
price: 2000,
scale: 120,
desc: "no effect"
}, {
id: 18,
name: "Explorer Hat",
price: 2000,
scale: 120,
desc: "no effect"
}, {
id: 31,
name: "Flipper Hat",
price: 2500,
scale: 120,
desc: "have more control while in water",
watrImm: true
}, {
id: 1,
name: "Marksman Cap",
price: 3000,
scale: 120,
desc: "increases arrow speed and range",
aMlt: 1.3
}, {
id: 10,
name: "Bush Gear",
price: 3000,
scale: 160,
desc: "allows you to disguise yourself as a bush"
}, {
id: 48,
name: "Halo",
price: 3000,
scale: 120,
desc: "no effect"
}, {
id: 6,
name: "Soldier Helmet",
price: 4000,
scale: 120,
desc: "reduces damage taken but slows movement",
spdMult: 0.94,
dmgMult: 0.75
}, {
id: 23,
name: "Anti Venom Gear",
price: 4000,
scale: 120,
desc: "makes you immune to poison",
poisonRes: 1
}, {
id: 13,
name: "Medic Gear",
price: 5000,
scale: 110,
desc: "slowly regenerates health over time",
healthRegen: 3
}, {
id: 9,
name: "Miners Helmet",
price: 5000,
scale: 120,
desc: "earn 1 extra gold per resource",
extraGold: 1
}, {
id: 32,
name: "Musketeer Hat",
price: 5000,
scale: 120,
desc: "reduces cost of projectiles",
projCost: 0.5
}, {
id: 7,
name: "Bull Helmet",
price: 6000,
scale: 120,
desc: "increases damage done but drains health",
healthRegen: -5,
dmgMultO: 1.5,
spdMult: 0.96
}, {
id: 22,
name: "Emp Helmet",
price: 6000,
scale: 120,
desc: "turrets won't attack but you move slower",
antiTurret: 1,
spdMult: 0.7
}, {
id: 12,
name: "Booster Hat",
price: 6000,
scale: 120,
desc: "increases your movement speed",
spdMult: 1.16
}, {
id: 26,
name: "Barbarian Armor",
price: 8000,
scale: 120,
desc: "knocks back enemies that attack you",
dmgK: 0.6
}, {
id: 21,
name: "Plague Mask",
price: 10000,
scale: 120,
desc: "melee attacks deal poison damage",
poisonDmg: 5,
poisonTime: 6
}, {
id: 46,
name: "Bull Mask",
price: 10000,
scale: 120,
desc: "bulls won't target you unless you attack them",
bullRepel: 1
}, {
id: 14,
name: "Windmill Hat",
topSprite: true,
price: 10000,
scale: 120,
desc: "generates points while worn",
pps: 1.5
}, {
id: 11,
name: "Spike Gear",
topSprite: true,
price: 10000,
scale: 120,
desc: "deal damage to players that damage you",
dmg: 0.45
}, {
id: 53,
name: "Turret Gear",
topSprite: true,
price: 10000,
scale: 120,
desc: "you become a walking turret",
turret: {
proj: 1,
range: 700,
rate: 2500
},
spdMult: 0.7
}, {
id: 20,
name: "Samurai Armor",
price: 12000,
scale: 120,
desc: "increased attack speed and fire rate",
atkSpd: 0.78
}, {
id: 58,
name: "Dark Knight",
price: 12000,
scale: 120,
desc: "restores health when you deal damage",
healD: 0.4
}, {
id: 27,
name: "Scavenger Gear",
price: 15000,
scale: 120,
desc: "earn double points for each kill",
kScrM: 2
}, {
id: 40,
name: "Tank Gear",
price: 15000,
scale: 120,
desc: "increased damage to buildings but slower movement",
spdMult: 0.3,
bDmg: 3.3
}, {
id: 52,
name: "Thief Gear",
price: 15000,
scale: 120,
desc: "steal half of a players gold when you kill them",
goldSteal: 0.5
}, {
id: 55,
name: "Bloodthirster",
price: 20000,
scale: 120,
desc: "Restore Health when dealing damage. And increased damage",
healD: 0.25,
dmgMultO: 1.2,
}, {
id: 56,
name: "Assassin Gear",
price: 20000,
scale: 120,
desc: "Go invisible when not moving. Can't eat. Increased speed",
noEat: true,
spdMult: 1.1,
invisTimer: 1000
}];
this.accessories = [{
id: 12,
name: "Snowball",
price: 1000,
scale: 105,
xOff: 18,
desc: "no effect"
}, {
id: 9,
name: "Tree Cape",
price: 1000,
scale: 90,
desc: "no effect"
}, {
id: 10,
name: "Stone Cape",
price: 1000,
scale: 90,
desc: "no effect"
}, {
id: 3,
name: "Cookie Cape",
price: 1500,
scale: 90,
desc: "no effect"
}, {
id: 8,
name: "Cow Cape",
price: 2000,
scale: 90,
desc: "no effect"
}, {
id: 11,
name: "Monkey Tail",
price: 2000,
scale: 97,
xOff: 25,
desc: "Super speed but reduced damage",
spdMult: 1.35,
dmgMultO: 0.2
}, {
id: 17,
name: "Apple Basket",
price: 3000,
scale: 80,
xOff: 12,
desc: "slowly regenerates health over time",
healthRegen: 1
}, {
id: 6,
name: "Winter Cape",
price: 3000,
scale: 90,
desc: "no effect"
}, {
id: 4,
name: "Skull Cape",
price: 4000,
scale: 90,
desc: "no effect"
}, {
id: 5,
name: "Dash Cape",
price: 5000,
scale: 90,
desc: "no effect"
}, {
id: 2,
name: "Dragon Cape",
price: 6000,
scale: 90,
desc: "no effect"
}, {
id: 1,
name: "Super Cape",
price: 8000,
scale: 90,
desc: "no effect"
}, {
id: 7,
name: "Troll Cape",
price: 8000,
scale: 90,
desc: "no effect"
}, {
id: 14,
name: "Thorns",
price: 10000,
scale: 115,
xOff: 20,
desc: "no effect"
}, {
id: 15,
name: "Blockades",
price: 10000,
scale: 95,
xOff: 15,
desc: "no effect"
}, {
id: 20,
name: "Devils Tail",
price: 10000,
scale: 95,
xOff: 20,
desc: "no effect"
}, {
id: 16,
name: "Sawblade",
price: 12000,
scale: 90,
spin: true,
xOff: 0,
desc: "deal damage to players that damage you",
dmg: 0.15
}, {
id: 13,
name: "Angel Wings",
price: 15000,
scale: 138,
xOff: 22,
desc: "slowly regenerates health over time",
healthRegen: 3
}, {
id: 19,
name: "Shadow Wings",
price: 15000,
scale: 138,
xOff: 22,
desc: "increased movement speed",
spdMult: 1.1
}, {
id: 18,
name: "Blood Wings",
price: 20000,
scale: 178,
xOff: 26,
desc: "restores health when you deal damage",
healD: 0.2
}, {
id: 21,
name: "Corrupt X Wings",
price: 20000,
scale: 178,
xOff: 26,
desc: "deal damage to players that damage you",
dmg: 0.25
}];
}
};
class ProjectileManager {
constructor(Projectile, projectiles, players, ais, objectManager, items,
config, UTILS, server) {
this.addProjectile = function(x, y, dir, range, speed, indx, owner,
ignoreObj, layer, inWindow) {
let tmpData = items.projectiles[indx];
let tmpProj;
for (let i = 0; i < projectiles.length; ++i) {
if (!projectiles[i].active) {
tmpProj = projectiles[i];
break;
}
}
if (!tmpProj) {
tmpProj = new Projectile(players, ais, objectManager, items,
config, UTILS, server);
tmpProj.sid = projectiles.length;
projectiles.push(tmpProj);
}
tmpProj.init(indx, x, y, dir, speed, tmpData.dmg, range, tmpData.scale,
owner);
tmpProj.ignoreObj = ignoreObj;
tmpProj.layer = layer || tmpData.layer;
tmpProj.inWindow = inWindow;
tmpProj.src = tmpData.src;
return tmpProj;
};
}
};
class AiManager {
this.aiTypes = [{
id: 0,
src: "cow_1",
killScore: 150,
health: 500,
weightM: 0.8,
speed: 0.00095,
turnSpeed: 0.001,
scale: 72,
drop: ["food", 50]
}, {
id: 1,
src: "pig_1",
killScore: 200,
health: 800,
weightM: 0.6,
speed: 0.00085,
turnSpeed: 0.001,
scale: 72,
drop: ["food", 80]
}, {
id: 2,
name: "Bull",
src: "bull_2",
hostile: true,
dmg: 20,
killScore: 1000,
health: 1800,
weightM: 0.5,
speed: 0.00094,
turnSpeed: 0.00074,
scale: 78,
viewRange: 800,
chargePlayer: true,
drop: ["food", 100]
}, {
id: 3,
name: "Bully",
src: "bull_1",
hostile: true,
dmg: 20,
killScore: 2000,
health: 2800,
weightM: 0.45,
speed: 0.001,
turnSpeed: 0.0008,
scale: 90,
viewRange: 900,
chargePlayer: true,
drop: ["food", 400]
}, {
id: 4,
name: "Wolf",
src: "wolf_1",
hostile: true,
dmg: 8,
killScore: 500,
health: 300,
weightM: 0.45,
speed: 0.001,
turnSpeed: 0.002,
scale: 84,
viewRange: 800,
chargePlayer: true,
drop: ["food", 200]
}, {
id: 5,
name: "Quack",
src: "chicken_1",
dmg: 8,
killScore: 2000,
noTrap: true,
health: 300,
weightM: 0.2,
speed: 0.0018,
turnSpeed: 0.006,
scale: 70,
drop: ["food", 100]
}, {
id: 6,
name: "MOOSTAFA",
nameScale: 50,
src: "enemy",
hostile: true,
dontRun: true,
fixedSpawn: true,
spawnDelay: 60000,
noTrap: true,
colDmg: 100,
dmg: 40,
killScore: 8000,
health: 18000,
weightM: 0.4,
speed: 0.0007,
turnSpeed: 0.01,
scale: 80,
spriteMlt: 1.8,
leapForce: 0.9,
viewRange: 1000,
hitRange: 210,
hitDelay: 1000,
chargePlayer: true,
drop: ["food", 100]
}, {
id: 7,
name: "Treasure",
hostile: true,
nameScale: 35,
src: "crate_1",
fixedSpawn: true,
spawnDelay: 120000,
colDmg: 200,
killScore: 5000,
health: 20000,
weightM: 0.1,
speed: 0.0,
turnSpeed: 0.0,
scale: 70,
spriteMlt: 1.0
}, {
id: 8,
name: "MOOFIE",
src: "wolf_2",
hostile: true,
fixedSpawn: true,
dontRun: true,
hitScare: 4,
spawnDelay: 30000,
noTrap: true,
nameScale: 35,
dmg: 10,
colDmg: 100,
killScore: 3000,
health: 7000,
weightM: 0.45,
speed: 0.0015,
turnSpeed: 0.002,
scale: 90,
viewRange: 800,
chargePlayer: true,
drop: ["food", 1000]
}, {
id: 9,
name: "💀MOOFIE",
src: "wolf_2",
hostile: !0,
fixedSpawn: !0,
dontRun: !0,
hitScare: 50,
spawnDelay: 6e4,
noTrap: !0,
nameScale: 35,
dmg: 12,
colDmg: 100,
killScore: 3e3,
health: 9e3,
weightM: .45,
speed: .0015,
turnSpeed: .0025,
scale: 94,
viewRange: 1440,
chargePlayer: !0,
drop: ["food", 3e3],
minSpawnRange: .85,
maxSpawnRange: .9
}, {
id: 10,
name: "💀Wolf",
src: "wolf_1",
hostile: !0,
fixedSpawn: !0,
dontRun: !0,
hitScare: 50,
spawnDelay: 3e4,
dmg: 10,
killScore: 700,
health: 500,
weightM: .45,
speed: .00115,
turnSpeed: .0025,
scale: 88,
viewRange: 1440,
chargePlayer: !0,
drop: ["food", 400],
minSpawnRange: .85,
maxSpawnRange: .9
}, {
id: 11,
name: "💀Bully",
src: "bull_1",
hostile: !0,
fixedSpawn: !0,
dontRun: !0,
hitScare: 50,
dmg: 20,
killScore: 5e3,
health: 5e3,
spawnDelay: 1e5,
weightM: .45,
speed: .00115,
turnSpeed: .0025,
scale: 94,
viewRange: 1440,
chargePlayer: !0,
drop: ["food", 800],
minSpawnRange: .85,
maxSpawnRange: .9
}];
};
class AI {
constructor(sid, objectManager, players, items, UTILS, config, scoreCallback,
server) {
this.sid = sid;
this.isAI = true;
this.nameIndex = UTILS.randInt(0, config.cowNames.length - 1);
let tmpRatio = 0;
let animIndex = 0;
this.animate = function(delta) {
if (this.animTime > 0) {
this.animTime -= delta;
if (this.animTime <= 0) {
this.animTime = 0;
this.dirPlus = 0;
tmpRatio = 0;
animIndex = 0;
} else {
if (animIndex == 0) {
tmpRatio += delta / (this.animSpeed *
config.hitReturnRatio);
this.dirPlus = UTILS.lerp(0, this.targetAngle, Math.min(1,
tmpRatio));
if (tmpRatio >= 1) {
tmpRatio = 1;
animIndex = 1;
}
} else {
tmpRatio -= delta / (this.animSpeed * (1 -
config.hitReturnRatio));
this.dirPlus = UTILS.lerp(0, this.targetAngle, Math.max(0,
tmpRatio));
}
}
}
};
this.startAnim = function() {
this.animTime = this.animSpeed = 600;
this.targetAngle = Math.PI * 0.8;
tmpRatio = 0;
animIndex = 0;
};
};
};
class addCh {
constructor(x, y, chat, tmpObj) {
this.x = x;
this.y = y;
this.alpha = 0;
this.active = true;
this.alive = false;
this.chat = chat;
this.owner = tmpObj;
};
};
class DeadPlayer {
constructor(x, y, dir, buildIndex, weaponIndex, weaponVariant, skinColor,
scale, name) {
this.x = x;
this.y = y;
this.lastDir = dir;
this.dir = dir + Math.PI;
this.buildIndex = buildIndex;
this.weaponIndex = weaponIndex;
this.weaponVariant = weaponVariant;
this.skinColor = skinColor;
this.scale = scale;
this.visScale = 0;
this.name = name;
this.alpha = 1;
this.active = true;
this.animate = function(delta) {
let d2 = UTILS.getAngleDist(this.lastDir, this.dir);
if (d2 > 0.01) {
this.dir += d2 / 20;
} else {
this.dir = this.lastDir;
}
if (this.visScale < this.scale) {
this.visScale += delta / (this.scale / 2);
if (this.visScale >= this.scale) {
this.visScale = this.scale;
}
}
this.alpha -= delta / 30000;
if (this.alpha <= 0) {
this.alpha = 0;
this.active = false;
}
}
}
};
class Player {
constructor(id, sid, config, UTILS, projectileManager, objectManager, players,
ais, items, hats, accessories, server, scoreCallback, iconCallback) {
this.id = id;
this.sid = sid;
this.tmpScore = 0;
this.team = null;
this.latestSkin = 0;
this.oldSkinIndex = 0;
this.skinIndex = 0;
this.latestTail = 0;
this.oldTailIndex = 0;
this.tailIndex = 0;
this.hitTime = 0;
this.lastHit = 0;
this.showName = 'NOOO';
this.tails = {};
this.points = 0;
this.dt = 0;
this.hidden = false;
this.itemCounts = {};
this.isPlayer = true;
this.pps = 0;
this.moveDir = undefined;
this.skinRot = 0;
this.lastPing = 0;
this.iconIndex = 0;
this.skinColor = 0;
this.dist2 = 0;
this.aim2 = 0;
this.maxSpeed = 1;
this.chat = {
message: null,
count: 0
};
this.backupNobull = true;
this.spawn = function(moofoll) {
this.attacked = false;
this.timeDamaged = 0;
this.timeHealed = 0;
this.pinge = 0;
this.millPlace = 'NOOO';
this.lastshamecount = 0;
this.death = false;
this.spinDir = 0;
this.sync = false;
this.antiBull = 0;
this.bullTimer = 0;
this.poisonTimer = 0;
this.active = true;
this.alive = true;
this.lockMove = false;
this.lockDir = false;
this.minimapCounter = 0;
this.chatCountdown = 0;
this.shameCount = 0;
this.shameTimer = 0;
this.sentTo = {};
this.gathering = 0;
this.gatherIndex = 0;
this.shooting = {};
this.shootIndex = 9;
this.autoGather = 0;
this.animTime = 0;
this.animSpeed = 0;
this.mouseState = 0;
this.buildIndex = -1;
this.weaponIndex = 0;
this.weaponCode = 0;
this.weaponVariant = 0;
this.primaryIndex = undefined;
this.secondaryIndex = undefined;
this.dmgOverTime = {};
this.noMovTimer = 0;
this.maxXP = 300;
this.XP = 0;
this.age = 1;
this.kills = 0;
this.upgrAge = 2;
this.upgradePoints = 0;
this.x = 0;
this.y = 0;
this.oldXY = {
x: 0,
y: 0
};
this.zIndex = 0;
this.xVel = 0;
this.yVel = 0;
this.slowMult = 1;
this.dir = 0;
this.dirPlus = 0;
this.targetDir = 0;
this.targetAngle = 0;
this.maxHealth = 100;
this.health = this.maxHealth;
this.oldHealth = this.maxHealth;
this.damaged = 0;
this.scale = config.playerScale;
this.speed = config.playerSpeed;
this.resetMoveDir();
this.resetResources(moofoll);
this.items = [0, 3, 6, 10];
this.weapons = [0];
this.shootCount = 0;
this.weaponXP = [];
this.reloads = {
0: 0,
1: 0,
2: 0,
3: 0,
4: 0,
5: 0,
6: 0,
7: 0,
8: 0,
9: 0,
10: 0,
11: 0,
12: 0,
13: 0,
14: 0,
15: 0,
53: 0,
};
this.bowThreat = {
9: 0,
12: 0,
13: 0,
15: 0,
};
this.damageThreat = 0;
this.inTrap = false;
this.canEmpAnti = false;
this.empAnti = false;
this.soldierAnti = false;
this.poisonTick = 0;
this.bullTick = 0;
this.setPoisonTick = false;
this.setBullTick = false;
this.antiTimer = 2;
};
this.resetMoveDir = function() {
this.moveDir = undefined;
};
this.resetResources = function(moofoll) {
for (let i = 0; i < config.resourceTypes.length; ++i) {
this[config.resourceTypes[i]] = moofoll ? 100 : 0;
}
};
this.getItemType = function(id) {
let findindx = this.items.findIndex((ids) => ids == id);
if (findindx != -1) {
return findindx;
} else {
return items.checkItem.index(id, this.items);
}
};
this.setData = function(data) {
this.id = data[0];
this.sid = data[1];
this.name = data[2];
this.x = data[3];
this.y = data[4];
this.dir = data[5];
this.health = data[6];
this.maxHealth = data[7];
this.scale = data[8];
this.skinColor = data[9];
};
this.updateTimer = function() {
this.bullTimer -= 1;
if (this.bullTimer <= 0) {
this.setBullTick = false;
this.bullTick = game.tick - 1;
this.bullTimer = config.serverUpdateRate;
}
this.poisonTimer -= 1;
if (this.poisonTimer <= 0) {
this.setPoisonTick = false;
this.poisonTick = game.tick - 1;
this.poisonTimer = config.serverUpdateRate;
}
};
this.update = function(delta) {
if (this.active) {
let gear = {
skin: findID(hats, this.skinIndex),
tail: findID(accessories, this.tailIndex)
}
let spdMult = ((this.buildIndex >= 0) ? 0.5 : 1) *
(items.weapons[this.weaponIndex].spdMult || 1) * (gear.skin ? (gear.skin.spdMult ||
1) : 1) * (gear.tail ? (gear.tail.spdMult || 1) : 1) * (this.y <=
config.snowBiomeTop ? ((gear.skin && gear.skin.coldM) ? 1 : config.snowSpeed) : 1)
* this.slowMult;
this.maxSpeed = spdMult;
}
};
let tmpRatio = 0;
let animIndex = 0;
let crazyFactor = 3;
let waveAmplitude = Math.PI / -16;
this.animate = function(delta) {
if (this.animTime > 0) {
this.animTime -= delta;
if (this.animTime <= 0) {
this.animTime = 0;
this.dirPlus = 0;
tmpRatio = 0;
animIndex = 0;
} else {
if (animIndex == 0) {
tmpRatio += delta / (this.animSpeed *
config.hitReturnRatio);
let progress = Math.min(1, tmpRatio);
this.dirPlus = UTILS.lerp(0, this.targetAngle,
easeInOutSine(progress)) + waveAmplitude * Math.sin(progress * crazyFactor *
Math.PI);
if (progress >= 1) {
tmpRatio = 1;
animIndex = 1;
}
} else {
tmpRatio -= delta / (this.animSpeed * (1 -
config.hitReturnRatio));
let progress = Math.max(0, tmpRatio);
this.dirPlus = UTILS.lerp(0, this.targetAngle,
easeInOutSine(progress)) + waveAmplitude * Math.cos(progress * crazyFactor *
Math.PI);
}
}
}
};
this.canSee = function(other) {
if (!other) return false;
let dx = Math.abs(other.x - this.x) - other.scale;
let dy = Math.abs(other.y - this.y) - other.scale;
return dx <= (config.maxScreenWidth / 2) * 1.3 && dy <=
(config.maxScreenHeight / 2) * 1.3;
};
this.judgeShame = function() {
this.lastshamecount = this.shameCount;
if (this.oldHealth < this.health) {
if (this.hitTime) {
let timeSinceHit = game.tick - this.hitTime;
this.lastHit = game.tick;
this.hitTime = 0;
if (timeSinceHit < 2) {
this.shameCount++;
} else {
this.shameCount = Math.max(0, this.shameCount - 2);
}
}
} else if (this.oldHealth > this.health) {
this.hitTime = game.tick;
}
};
this.addShameTimer = function() {
this.shameCount = 0;
this.shameTimer = 30;
let interval = setInterval(() => {
this.shameTimer--;
if (this.shameTimer <= 0) {
clearInterval(interval);
}
}, 1000);
};
this.isTeam = function(tmpObj) {
return (this == tmpObj || (this.team && this.team == tmpObj.team));
};
this.findAllianceBySid = function(sid) {
return this.team ? alliancePlayers.find((THIS) => THIS === sid) : null;
};
this.checkCanInsta = function(nobull) {
let totally = 0;
if (this.alive && inGame) {
let primary = {
weapon: this.weapons[0],
variant: this.primaryVariant,
dmg: this.weapons[0] == undefined ? 0 :
items.weapons[this.weapons[0]].dmg,
};
let secondary = {
weapon: this.weapons[1],
variant: this.secondaryVariant,
dmg: this.weapons[1] == undefined ? 0 :
items.weapons[this.weapons[1]].Pdmg,
};
let bull = this.skins[7] && !nobull ? 1.5 : 1;
let pV = primary.variant != undefined ?
config.weaponVariants[primary.variant].val : 1;
if (primary.weapon != undefined && this.reloads[primary.weapon] ==
0) {
totally += primary.dmg * pV * bull;
}
if (secondary.weapon != undefined && this.reloads[secondary.weapon]
== 0) {
totally += secondary.dmg;
}
if (this.skins[53] && this.reloads[53] <= (player.weapons[1] ==
10 ? 0 : game.tickRate) && near.skinIndex != 22) {
totally += 25;
}
totally *= near.skinIndex == 6 ? 0.75 : 1;
return totally;
}
return 0;
};
this.manageReload = function() {
if (this.shooting[53]) {
this.shooting[53] = 0;
this.reloads[53] = (2500 - game.tickRate);
} else {
if (this.reloads[53] > 0) {
this.reloads[53] = Math.max(0, this.reloads[53] -
game.tickRate);
}
}
if (this.gathering || this.shooting[1]) {
if (this.gathering) {
this.gathering = 0;
this.reloads[this.gatherIndex] =
(items.weapons[this.gatherIndex].speed * (this.skinIndex == 20 ? 0.78 : 1));
this.attacked = true;
}
if (this.shooting[1]) {
this.shooting[1] = 0;
this.reloads[this.shootIndex] =
(items.weapons[this.shootIndex].speed * (this.skinIndex == 20 ? 0.78 : 1));
this.attacked = true;
}
} else {
this.attacked = false;
if (this.buildIndex < 0) {
if (this.reloads[this.weaponIndex] > 0) {
this.reloads[this.weaponIndex] = Math.max(0,
this.reloads[this.weaponIndex] - 110);
if (this == player) {
if (getEl("weaponGrind").checked) {
for (let i = 0; i < Math.PI * 2; i += Math.PI / 2)
{
checkPlace(player.getItemType(22), i);
}
}
}
if (this.reloads[this.primaryIndex] == 0 &&
this.reloads[this.weaponIndex] == 0) {
this.antiBull++;
game.tickBase(() => {
this.antiBull = 0;
}, 1);
}
}
}
}
};
this.addDamageThreat = function(tmpObj) {
let primary = {
weapon: this.primaryIndex,
variant: this.primaryVariant
};
primary.dmg = primary.weapon == undefined ? 45 :
items.weapons[primary.weapon].dmg;
let secondary = {
weapon: this.secondaryIndex,
variant: this.secondaryVariant
};
secondary.dmg = secondary.weapon == undefined ? 75 :
items.weapons[secondary.weapon].Pdmg;
let bull = 1.5;
let pV = primary.variant != undefined ?
config.weaponVariants[primary.variant].val : 1.18;
let sV = secondary.variant != undefined ? [9, 12, 13,
15].includes(secondary.weapon) ? 1 : config.weaponVariants[secondary.variant].val :
1.18;
if (primary.weapon == undefined ? true : this.reloads[primary.weapon]
== 0) {
this.damageThreat += primary.dmg * pV * bull;
}
if (secondary.weapon == undefined ? true :
this.reloads[secondary.weapon] == 0) {
this.damageThreat += secondary.dmg * sV;
}
if (this.reloads[53] <= game.tickRate) {
this.damageThreat += 25;
}
this.damageThreat *= tmpObj.skinIndex == 6 ? 0.75 : 1;
if (!this.isTeam(tmpObj)) {
if (this.dist2 <= 300) {
tmpObj.damageThreat += this.damageThreat;
}
}
};
}
};
function sendUpgrade(index) {
player.reloads[index] = 0;
packet("H", index);
}
function sendAutoGather() {
packet("K", 1, 1);
}
if (canPlaceItem) {
selectToBuild(player.items[itemId]);
sendAtck(1, angle);
selectWeapon(player.weaponCode, 1);
game.tickBase(() => {
placeVisible.shift();
}, 1);
}
}
} catch (error) {
console.error("Error while placing item:", error);
}
}
function soldierMult() {
return player.latestSkin == 6 ? 0.75 : 1;
}
function healthBased() {
if (player.health === 100) {
return 0;
}
function getAttacker(damaged) {
let attackers = enemy.filter(tmp => {
let rule = {
three: tmp.attacked
}
return rule.three;
});
return attackers;
}
function healer() {
for (let i = 0; i < healthBased(); i++) {
place(0, getAttackDir());
}
}
function healer33() {
for (let i = 0; i < healthBased(); i++) {
place(0, getAttackDir());
}
}
function healer1() {
place(0, getAttackDir());
return Math.ceil((100 - player.health) / items.list[player.items[0]].healing);
}
function noshameheal() {
place(0, getAttackDir());
if (player.shameCount >= 5) {
place(0, getAttackDir());
healer33();
} else {
if (player.skinIndex != 6 && player.skinIndex != 22) {
healer33();
buyEquip(6, 0);
} else {
const neededHealing = Math.ceil((100 - player.health) /
items.list[player.items[0]].healing);
healer33();
return neededHealing;
}
}
}
function antiSyncHealing() {
if (my.antiSync) return;
my.antiSync = true;
const healAnti = setInterval(() => {
const shameCount = player.shameCount;
const attackDirection = getAttackDir();
if (shameCount < 5) {
place(0, attackDirection);
} else {
clearInterval(healAnti);
my.antiSync = false;
}
}, 75);
setTimeout(() => {
clearInterval(healAnti);
my.antiSync = false;
}, game.tickRate);
}
if (returns) return 0;
}
class Traps {
constructor(UTILS, items) {
this.dist = 0;
this.aim = 0;
this.inTrap = false;
this.replaced = false;
this.antiTrapped = false;
this.info = {};
this.trappling = false;
this.spikeplacer = false;
this.spikePlaced = false;
this.spikSync = false;
this.notFast = function() {
return player.weapons[1] === 10 && ((this.info.health >
items.weapons[player.weapons[0]].dmg) || player.weapons[0] === 5);
};
liztobj.forEach(p => {
tmpObjects.push({
x: p.x,
y: p.y,
active: p.active,
blocker: p.blocker,
scale: p.scale,
isItem: p.isItem,
type: p.type,
colDiv: p.colDiv,
getScale: function(sM = 1, ig) {
return this.scale * ((this.isItem || [2, 3,
4].includes(this.type)) ? 1 : (0.6 * sM)) * (ig ? 1 : this.colDiv);
}
});
});
tmpObjects.push({
x: tmpX,
y: tmpY,
active: true,
blocker: item.blocker,
scale: item.scale,
isItem: true,
type: null,
colDiv: item.colDiv,
getScale: function() {
return this.scale;
}
});
this.checkSpikeTick = function() {
try {
if (![3, 4, 5].includes(near.primaryIndex)) return false;
if ((getEl("safeAntiSpikeTick").checked || my.autoPush) ? false :
near.primaryIndex === undefined ? true : near.reloads[near.primaryIndex] >
game.tickRate) return false;
if (near.dist2 <= items.weapons[near.primaryIndex || 5].range +
near.scale * 1.8) {
let item = items.list[9];
let tmpS = near.scale + item.scale + (item.placeOffset || 0);
let danger = 0;
let counts = { attempts: 0, block: `unblocked` };
this.protect = function(aim) {
if (!configs.antiTrap) return;
if (player.items[4]) {
this.testCanPlace(4, -(Math.PI / 2), Math.PI / 2, Math.PI / 18, aim
+ Math.PI);
this.antiTrapped = true;
}
};
this.autoPlace = function() {
if (enemy.length && configs.autoPlace && !instaC.ticking) {
let nearTrap = gameObjects.find(obj => obj.trap && obj.active &&
obj.isTeamObject(player) && UTILS.getDist(obj, near, 0, 2) <= near.scale +
obj.getScale() + 5);
let nearDistance = UTILS.getDist(player, near, 0, 2);
this.replacer = function(findObj) {
if (!findObj || !configs.autoReplace || !inGame || this.antiTrapped)
return;
game.tickBase(() => {
let objAim = UTILS.getDirect(findObj, player, 0, 2);
let objDst = UTILS.getDist(findObj, player, 0, 2);
this.replaced = true;
} else if (!this.spikePlaced && near.dist2 <= 250) {
for (let i = 0; i < 24; i++) {
let angle = (Math.PI * 2) * i / 24;
this.testCanPlace(2, angle, angle + Math.PI / 24, Math.PI /
24, objAim, 1);
}
this.spikePlaced = true;
}
}, 1);
};
}
}
class Instakill {
constructor() {
this.wait = false;
this.can = false;
this.isTrue = false;
this.nobull = false;
this.ticking = false;
this.canSpikeTick = false;
this.startTick = false;
this.readyTick = false;
this.canCounter = false;
this.revTick = false;
this.syncHit = false;
this.changeType = function(type) {
this.wait = false;
this.isTrue = true;
my.autoAim = true;
near.backupNobull = false;
const actions = {
"rev": () => this.revInstakill(),
"nobull": () => this.noBullInstakill(),
"normal": () => this.normalInstakill(),
"default": () => {
setTimeout(() => {
this.isTrue = false;
my.autoAim = false;
}, 50);
}
};
(actions[type] || actions.default)();
};
this.revInstakill = function() {
healer1();
selectWeapon(player.weapons[1]);
buyEquip(53, 0);
sendAutoGather();
setTimeout(() => {
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
setTimeout(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 225);
}, 100);
};
this.noBullInstakill = function() {
selectWeapon(player.weapons[0]);
healer1();
buyEquip(7, 0);
buyEquip(21, 1);
sendAutoGather();
setTimeout(() => {
selectWeapon(player.weapons[1]);
buyEquip(player.reloads[53] == 0 ? 53 : 6, 0);
setTimeout(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 255);
}, 105);
};
this.normalInstakill = function() {
selectWeapon(player.weapons[0]);
healer1();
buyEquip(7, 0);
buyEquip(21, 1);
sendAutoGather();
setTimeout(() => {
selectWeapon(player.weapons[1]);
buyEquip(player.reloads[53] == 0 ? 53 : 6, 0);
setTimeout(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 255);
}, 100);
};
this.spikeTickType = function() {
this.isTrue = true;
my.autoAim = true;
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
sendAutoGather();
game.tickBase(() => {
buyEquip(53, 0);
selectWeapon(player.weapons[0]);
buyEquip(53, 0);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
buyEquip(6, 0);
buyEquip(21, 1);
}, 3);
}, 1);
};
this.counterType = function() {
this.isTrue = true;
my.autoAim = true;
my.revAim = true;
if (!recording) {
sendChat("SUPER T R A S H counter instakill");
}
selectWeapon(player.weapons[1]);
buyEquip(53, 0);
buyEquip(19, 1);
sendAutoGather();
packet("f", near.aim2, 1);
game.tickBase(() => {
my.revAim = false;
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
buyEquip(19, 1);
packet("f", near.aim2, 1);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
packet("f", undefined, 1);
}, 1);
}, 1);
};
this.antiCounterType = function() {
my.autoAim = true;
this.isTrue = true;
selectWeapon(player.weapons[0]);
buyEquip(6, 0);
buyEquip(21, 1);
io.send("D", near.aim2);
sendAutoGather();
game.tickBase(() => {
buyEquip(player.reloads[53] == 0 ? player.skins[53] ? 53 : 6 : 6,
0);
buyEquip(21, 1);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 1);
}, 1);
};
this.rangeType = function(type) {
this.isTrue = true;
my.autoAim = true;
if (type === "ageInsta") {
this.ageInstaKill();
} else {
this.rangeInstaKill();
}
};
this.ageInstaKill = function() {
my.ageInsta = false;
if (player.items[5] === 18) {
place(5, near.aim2);
}
packet("f", undefined, 1);
buyEquip(22, 0);
buyEquip(21, 1);
game.tickBase(() => {
selectWeapon(player.weapons[1]);
buyEquip(53, 0);
buyEquip(21, 1);
sendAutoGather();
game.tickBase(() => {
sendUpgrade(12);
selectWeapon(player.weapons[1]);
buyEquip(53, 0);
buyEquip(21, 1);
game.tickBase(() => {
sendUpgrade(15);
selectWeapon(player.weapons[1]);
buyEquip(53, 0);
buyEquip(21, 1);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 1);
}, 1);
}, 1);
}, 1);
};
this.rangeInstaKill = function() {
selectWeapon(player.weapons[1]);
if (player.reloads[53] == 0 && near.dist2 <= 700 && near.skinIndex !=
22) {
buyEquip(53, 0);
} else {
buyEquip(20, 0);
}
buyEquip(11, 1);
sendAutoGather();
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 1);
};
this.oneTickType = function() {
io.send("7113213.29154");
this.isTrue = true;
my.autoAim = true;
selectWeapon(player.weapons[1]);
buyEquip(53, 0);
buyEquip(19, 1);
packet("f", near.aim2, 1);
if (player.weapons[1] == 15) {
my.revAim = true;
sendAutoGather();
}
game.tickBase(() => {
my.revAim = false;
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
buyEquip(19, 1);
packet("f", near.aim2, 1);
if (player.weapons[1] != 15) {
sendAutoGather();
}
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
packet("f", undefined, 1);
}, 1);
}, 1);
};
this.threeOneTickType = function() {
io.send("Tick2");
this.isTrue = true;
my.autoAim = true;
selectWeapon(player.weapons[[10, 14].includes(player.weapons[1]) ? 1 :
0]);
biomeGear();
buyEquip(19, 1);
packet("f", near.aim2, 1);
game.tickBase(() => {
selectWeapon(player.weapons[[10, 14].includes(player.weapons[1]) ?
1 : 0]);
buyEquip(53, 0);
buyEquip(19, 1);
packet("f", near.aim2, 1);
game.tickBase(() => {
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
buyEquip(19, 1);
sendAutoGather();
packet("f", near.aim2, 1);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
packet("f", undefined, 1);
}, 1);
}, 1);
}, 1);
};
this.kmTickType = function() {
this.isTrue = true;
my.autoAim = true;
my.revAim = true;
selectWeapon(player.weapons[1]);
buyEquip(53, 0);
buyEquip(19, 1);
sendAutoGather();
packet("f", near.aim2, 1);
game.tickBase(() => {
my.revAim = false;
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
buyEquip(19, 1);
packet("f", near.aim2, 1);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
packet("f", undefined, 1);
}, 1);
}, 1);
};
this.boostTickType = function() {
this.isTrue = true;
my.autoAim = true;
biomeGear();
buyEquip(19, 1);
packet("f", near.aim2, 1);
game.tickBase(() => {
if (player.weapons[1] == 15) {
my.revAim = true;
}
selectWeapon(player.weapons[[9, 12, 13,
15].includes(player.weapons[1]) ? 1 : 0]);
buyEquip(53, 0);
buyEquip(19, 1);
if ([9, 12, 13, 15].includes(player.weapons[1])) {
sendAutoGather();
}
packet("f", near.aim2, 1);
place(4, near.aim2);
game.tickBase(() => {
my.revAim = false;
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
buyEquip(19, 1);
if (![9, 12, 13, 15].includes(player.weapons[1])) {
sendAutoGather();
}
packet("f", near.aim2, 1);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
packet("f", undefined, 1);
}, 1);
}, 1);
}, 1);
};
if (enemy.length) {
let dst = near.dist2;
this.ticking = true;
if (dst >= goal.a && dst <= goal.b) {
bQ(22, 0);
bQ(11, 1);
if (player.weaponIndex != player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0] || player.buildIndex > -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
return {
dir: undefined,
action: 1
};
} else {
if (dst < goal.a) {
if (dst >= goal.g) {
if (dst >= goal.e) {
if (dst >= goal.c) {
bQ(40, 0);
bQ(10, 1);
if (configs.none) {
player.buildIndex != player.items[1] &&
selectToBuild(player.items[1]);
} else {
if ((player.weaponIndex !=
player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex
> -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
} else {
bQ(22, 0);
bQ(19, 1);
if ((player.weaponIndex != player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
} else {
bQ(6, 0);
bQ(12, 1);
if ((player.weaponIndex != player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
} else {
biomeGear();
bQ(11, 1);
if ((player.weaponIndex != player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
return {
dir: near.aim2 + Math.PI,
action: 0
};
} else if (dst > goal.b) {
if (dst <= goal.h) {
if (dst <= goal.f) {
if (dst <= goal.d) {
bQ(40, 0);
bQ(9, 1);
if (configs.none) {
player.buildIndex != player.items[1] &&
selectToBuild(player.items[1]);
} else {
if ((player.weaponIndex !=
player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex
> -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
} else {
bQ(22, 0);
bQ(19, 1);
if ((player.weaponIndex != player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
} else {
bQ(6, 0);
bQ(12, 1);
if ((player.weaponIndex != player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
} else {
biomeGear();
bQ(11, 1);
if ((player.weaponIndex != player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
return {
dir: near.aim2,
action: 0
};
}
return {
dir: undefined,
action: 0
};
}
} else {
this.ticking = false;
return {
dir: undefined,
action: 0
};
}
};
this.bowMovement = function() {
let moveMent = this.gotoGoal(685, 3);
if (moveMent.action) {
if (player.reloads[53] == 0 && !this.isTrue) {
this.rangeType("ageInsta");
} else {
packet("f", moveMent.dir, 1);
}
} else {
packet("f", moveMent.dir, 1);
}
};
this.tickMovement = function() {
let moveMent = this.gotoGoal(238, 3);
if (moveMent.action) {
if (player.reloads[53] == 0 && !this.isTrue) {
this.boostTickType();
} else {
packet("f", moveMent.dir, 1);
}
} else {
packet("f", moveMent.dir, 1);
}
};
this.kmTickMovement = function() {
let moveMent = this.gotoGoal(240, 3);
if (moveMent.action) {
if (near.skinIndex != 22 && player.reloads[53] == 0 && !this.isTrue
&& ((game.tick - near.poisonTick) % config.serverUpdateRate == 8)) {
this.kmTickType();
} else {
packet("f", moveMent.dir, 1);
}
} else {
packet("f", moveMent.dir, 1);
}
};
this.boostTickMovement = function() {
let dist = player.weapons[1] == 9 ? 365 : player.weapons[1] == 12 ? 380
: player.weapons[1] == 13 ? 365 : player.weapons[1] == 15 ? 365 : 370;
let moveMent = this.gotoGoal(372, 3);
if (moveMent.action) {
if (player.reloads[53] == 0 && !this.isTrue) {
this.boostTickType();
} else {
packet("f", moveMent.dir, 1);
}
} else {
packet("f", moveMent.dir, 1);
}
};
class Autobuy {
constructor(buyHat, buyAcc) {
this.hat = function() {
buyHat.forEach((id) => {
let find = findID(hats, id);
if (find && !player.skins[id] && player.points >= find.price)
packet("c", 1, id, 0);
});
};
this.acc = function() {
buyAcc.forEach((id) => {
let find = findID(accessories, id);
if (find && !player.tails[id] && player.points >= find.price)
packet("c", 1, id, 1);
});
};
}
};
class Autoupgrade {
constructor() {
this.sb = function(upg) {
upg(3);
upg(17);
upg(31);
upg(23);
upg(9);
upg(38);
};
this.kh = function(upg) {
upg(3);
upg(17);
upg(31);
upg(23);
upg(10);
upg(38);
upg(4);
upg(25);
};
this.pb = function(upg) {
upg(5);
upg(17);
upg(32);
upg(23);
upg(9);
upg(38);
};
this.ph = function(upg) {
upg(5);
upg(17);
upg(32);
upg(23);
upg(10);
upg(38);
upg(28);
upg(25);
};
this.db = function(upg) {
upg(7);
upg(17);
upg(31);
upg(23);
upg(9);
upg(34);
};
this.km = function(upg) {
upg(7);
upg(17);
upg(31);
upg(23);
upg(10);
upg(38);
upg(4);
upg(15);
};
};
};
class Damages {
constructor(items) {
this.calcDmg = function(dmg, val) {
return dmg * val;
};
this.getAllDamage = function(dmg) {
return [this.calcDmg(dmg, 0.75), dmg, this.calcDmg(dmg, 1.125),
this.calcDmg(dmg, 1.5)];
};
this.weapons = [];
for (let i = 0; i < items.weapons.length; i++) {
let wp = items.weapons[i];
let name = wp.name.split(" ").length <= 1 ? wp.name : (wp.name.split("
")[0] + "_" + wp.name.split(" ")[1]);
this.weapons.push(this.getAllDamage(i > 8 ? wp.Pdmg : wp.dmg));
this[name] = this.weapons[i];
}
}
}
let lastDeath;
let minimapData;
let mapMarker = {};
let mapPings = [];
let tmpPing;
function sendChat(message) {
packet("6", message.slice(0, 30));
}
} else if (isWeapon) {
UTILS.generateElement({
class: "itemInfoReq",
text: !item.type ? "primary" : "secondary",
parent: itemInfoHolder
});
} else {
for (let i = 0; i < item.req.length; i += 2) {
UTILS.generateElement({
class: "itemInfoReq",
html: item.req[i] + "<span class='itemInfoReqVal'> x" +
item.req[i + 1] + "</span>",
parent: itemInfoHolder
});
}
if (item.group.limit) {
UTILS.generateElement({
class: "itemInfoLmt",
text: (player.itemCounts[item.group.id] || 0) + "/" +
(config.isSandbox ? 99 : item.group.limit),
parent: itemInfoHolder
});
}
}
} else {
itemInfoHolder.classList.remove("visible");
}
}
window.addEventListener("resize", UTILS.checkTrusted(resize));
function resize() {
screenWidth = window.innerWidth;
screenHeight = window.innerHeight;
let scaleFillNative = Math.max(screenWidth / maxScreenWidth, screenHeight /
maxScreenHeight) * pixelDensity;
gameCanvas.width = screenWidth * pixelDensity;
gameCanvas.height = screenHeight * pixelDensity;
gameCanvas.style.width = screenWidth + "px";
gameCanvas.style.height = screenHeight + "px";
mainContext.setTransform(
scaleFillNative, 0,
0, scaleFillNative,
(screenWidth * pixelDensity - (maxScreenWidth * scaleFillNative)) / 2,
(screenHeight * pixelDensity - (maxScreenHeight * scaleFillNative)) / 2
);
}
resize();
var usingTouch;
const mals = document.getElementById('touch-controls-fullscreen');
mals.style.display = 'block';
mals.addEventListener("mousemove", gameInput, false);
function gameInput(e) {
mouseX = e.clientX;
mouseY = e.clientY;
}
let clicks = {
left: false,
middle: false,
right: false,
};
mals.addEventListener("mousedown", mouseDown, false);
function mouseDown(e) {
if (attackState != 1) {
attackState = 1;
if (e.button == 0) {
clicks.left = true;
} else if (e.button == 1) {
clicks.middle = true;
} else if (e.button == 2) {
clicks.right = true;
}
}
}
mals.addEventListener("mouseup", UTILS.checkTrusted(mouseUp));
function mouseUp(e) {
if (attackState != 0) {
attackState = 0;
if (e.button == 0) {
clicks.left = false;
} else if (e.button == 1) {
clicks.middle = false;
} else if (e.button == 2) {
clicks.right = false;
}
}
}
mals.addEventListener("wheel", wheel, false);
function wheel(e) {
if(player.shameCount > 1) {
buyEquip(7, 0);
} else {
buyEquip(6, 0);
}
}
function getMoveDir() {
let dx = 0;
let dy = 0;
for (let key in moveKeys) {
let tmpDir = moveKeys[key];
dx += !!keys[key] * tmpDir[0];
dy += !!keys[key] * tmpDir[1];
}
return dx == 0 && dy == 0 ? undefined : Math.atan2(dy, dx);
}
function getSafeDir() {
if (!player) {
return 0;
}
if (!player.lockDir) {
lastDir = Math.atan2(mouseY - (screenHeight / 2), mouseX - (screenWidth /
2));
}
return lastDir || 0;
}
let plusDir = 0;
let lastSpin = Date.now();
function getAttackDir() {
const now = Date.now();
if (!player) {
return "0";
}
function getBestTargetDirection() {
if (enemy.length) {
return near.aim2;
}
return getSafeDir();
}
lastDir = smoothTransition(lastDir);
return lastDir;
}
function smoothTransition(targetDir) {
const smoothingFactor = 0.1;
return (1 - smoothingFactor) * lastDir + smoothingFactor * targetDir;
}
function getVisualDir() {
if (!player) {
return 0;
}
lastDir = getSafeDir();
return lastDir || 0;
}
function keysActive() {
return (allianceMenu.style.display != "block" &&
chatHolder.style.display != "block");
}
function keyDown(event) {
let keyNum = event.which || event.keyCode || 0;
if (player && player.alive && keysActive()) {
if (!keys[keyNum]) {
keys[keyNum] = 1;
macro[event.key] = 1;
if (keyNum == 27) {
openMenu = !openMenu;
$("#menuDiv").toggle();
} else if (keyNum == 109) {
recording = !recording;
console.log(recording);
} else if (keyNum == 69) {
sendAutoGather();
} else if (keyNum == 67) {
updateMapMarker();
} else if (player.weapons[keyNum - 49] != undefined) {
player.weaponCode = player.weapons[keyNum - 49];
} else if (moveKeys[keyNum]) {
sendMoveDir();
} else if (event.key == "m") {
mills.placeSpawnPads = !mills.placeSpawnPads;
} else if (event.key == "z") {
mills.place = !mills.place;
} else if (event.key == "²") {
io.send("6", "Fallen Hero Mod")
} else if (event.key == "Z") {
typeof window.debug == "function" && window.debug();
} else if (keyNum == 32) {
packet("F", 1, getSafeDir(), 1);
packet("F", 0, getSafeDir(), 1);
}
}
}
}
addEventListener("keydown", UTILS.checkTrusted(keyDown));
function keyUp(event) {
if (player && player.alive) {
let keyNum = event.which || event.keyCode || 0;
if (keysActive()) {
if (keys[keyNum]) {
keys[keyNum] = 0;
macro[event.key] = 0;
if (moveKeys[keyNum]) {
sendMoveDir();
} else if (event.key == ",") {
player.sync = false;
}
}
}
}
}
window.addEventListener("keyup", UTILS.checkTrusted(keyUp));
function sendMoveDir() {
if(found) {
packet("f", undefined, 1);
} else {
let newMoveDir = getMoveDir();
if (lastMoveDir == undefined || newMoveDir == undefined ||
Math.abs(newMoveDir - lastMoveDir) > 0.3) {
if (!my.autoPush && !found) {
packet("f", newMoveDir, 1);
}
lastMoveDir = newMoveDir;
}
}
}
function bindEvents() {}
bindEvents();
function addDeadPlayer(tmpObj) {
deadPlayers.push(new DeadPlayer(tmpObj.x, tmpObj.y, tmpObj.dir,
tmpObj.buildIndex, tmpObj.weaponIndex, tmpObj.weaponVariant, tmpObj.skinColor,
tmpObj.scale, tmpObj.name));
}
function setInitData(data) {
alliances = data.teams;
}
function setupGame(yourSID) {
keys = {};
macro = {};
playerSID = yourSID;
attackState = 0;
inGame = true;
musicToggle()
packet("F", 0, getAttackDir(), 1);
my.ageInsta = true;
if (firstSetup) {
firstSetup = false;
gameObjects.length = 0;
liztobj.length = 0;
}
}
function removePlayer(id) {
for (let i = 0; i < players.length; i++) {
if (players[i].id == id) {
players.splice(i, 1);
break;
}
}
}
if(player.shameCount > 1) {
buyEquip(7, 0);
buyEquip(13, 1);
} else {
if(player.lastshamecount != 1 || player.lastshamecount != 2 ||
player.lastshamecount != 3 || player.lastshamecount != 4 || player.lastshamecount !
= 5 || player.lastshamecount != 6 || player.lastshamecount == 0) {
buyEquip(6, 0);
}
}
if (inGame) {
let attackers = getAttacker(damaged);
let gearDmgs = [0.25, 0.45].map((val) => val *
items.weapons[player.weapons[0]].dmg);
let includeSpikeDmgs = near.length ? !bullTicked &&
(gearDmgs.includes(damaged) && near[0].skinIndex == 11 && near[0].tailIndex ==
21) : false;
let healTimeout = 140 - window.ping;
function killPlayer(sid) {
inGame = false;
lastDeath = {
x: player.x,
y: player.y,
};
musicToggle();
}
if (!player) return;
traps.replacer(findObj);
};
function killObjects(sid) {
if (player) objectManager.removeAllItems(sid);
}
function caf(e, t) {
try {
return Math.atan2((t.y2 || t.y) - (e.y2 || e.y), (t.x2 || t.x) - (e.x2 ||
e.x));
} catch (e) {
return 0;
}
}
let autos = {
insta: {
todo: false,
wait: false,
count: 4,
shame: 5
},
bull: false,
antibull: 0,
reloaded: false,
stopspin: true
}
function fadeIn(audio) {
let volume = 0;
audio.volume = volume;
audio.play();
const fadeInterval = setInterval(() => {
if (volume <= 0.4) {
volume += 0.02;
audio.volume = Math.min(volume, 1).toFixed(1);
} else {
clearInterval(fadeInterval);
audio.volume = 0.4;
}
}, 30);
}
function musicToggle() {
if (inGame) {
fadeOut(outGameAudio, () => fadeIn(inGameAudio));
} else {
fadeOut(inGameAudio, () => fadeIn(outGameAudio));
}
}
function updatePlayers(data) {
const shameCounts = [1, 2, 3, 4, 5, 6];
if (player.shameCount > 1) {
buyEquip(7, 0);
buyEquip(13, 1);
} else {
if (!shameCounts.includes(player.lastshamecount) || player.lastshamecount
=== 0) {
buyEquip(6, 0);
}
}
player.lastshamecount = player.shameCount;
function getAngleDifference(angle1, angle2) {
angle1 = angle1 % (2 * Math.PI);
angle2 = angle2 % (2 * Math.PI);
let diff = Math.abs(angle1 - angle2);
if (diff > Math.PI) {
diff = (2 * Math.PI) - diff;
}
return diff;
}
game.tick++;
enemy = [];
nears = [];
near = [];
game.tickSpeed = performance.now() - game.lastTick;
game.lastTick = performance.now();
players.forEach((tmp) => {
tmp.forcePos = !tmp.visible;
tmp.visible = false;
if((tmp.timeHealed - tmp.timeDamaged)>0 &&
tmp.lastshamecount<tmp.shameCount) {
tmp.pinge = (tmp.timeHealed - tmp.timeDamaged);
}
});
for (let i = 0; i < data.length;) {
tmpObj = findPlayerBySID(data[i]);
if (tmpObj) {
tmpObj.t1 = (tmpObj.t2 === undefined) ? game.lastTick : tmpObj.t2;
tmpObj.t2 = game.lastTick;
tmpObj.oldPos.x2 = tmpObj.x2;
tmpObj.oldPos.y2 = tmpObj.y2;
tmpObj.x1 = tmpObj.x;
tmpObj.y1 = tmpObj.y;
tmpObj.x2 = data[i + 1];
tmpObj.y2 = data[i + 2];
tmpObj.x3 = tmpObj.x2 + (tmpObj.x2 - tmpObj.oldPos.x2);
tmpObj.y3 = tmpObj.y2 + (tmpObj.y2 - tmpObj.oldPos.y2);
tmpObj.d1 = (tmpObj.d2 === undefined) ? data[i + 3] : tmpObj.d2;
tmpObj.d2 = data[i + 3];
tmpObj.dt = 0;
tmpObj.buildIndex = data[i + 4];
tmpObj.weaponIndex = data[i + 5];
tmpObj.weaponVariant = data[i + 6];
tmpObj.team = data[i + 7];
tmpObj.isLeader = data[i + 8];
tmpObj.oldSkinIndex = tmpObj.skinIndex;
tmpObj.oldTailIndex = tmpObj.tailIndex;
tmpObj.skinIndex = data[i + 9];
tmpObj.tailIndex = data[i + 10];
tmpObj.iconIndex = data[i + 11];
tmpObj.zIndex = data[i + 12];
tmpObj.visible = true;
tmpObj.update(game.tickSpeed);
tmpObj.dist2 = UTILS.getDist(tmpObj, player, 2, 2);
tmpObj.aim2 = UTILS.getDirect(tmpObj, player, 2, 2);
tmpObj.dist3 = UTILS.getDist(tmpObj, player, 3, 3);
tmpObj.aim3 = UTILS.getDirect(tmpObj, player, 3, 3);
tmpObj.damageThreat = 0;
if (tmpObj.skinIndex == 45 && tmpObj.shameTimer <= 0) {
tmpObj.addShameTimer();
}
if (tmpObj.oldSkinIndex == 45 && tmpObj.skinIndex != 45) {
tmpObj.shameTimer = 0;
tmpObj.shameCount = 0;
if (tmpObj == player) {
healer();
}
}
if (tmpObj == player) {
if (liztobj.length) {
liztobj.forEach((tmp) => {
tmp.onNear = false;
if (tmp.active) {
if (!tmp.onNear && UTILS.getDist(tmp, tmpObj, 0, 2) <=
tmp.scale + items.weapons[tmpObj.weapons[0]].range) {
tmp.onNear = true;
}
if (tmp.isItem && tmp.owner) {
if (!tmp.pps && tmpObj.sid == tmp.owner.sid &&
UTILS.getDist(tmp, tmpObj, 0, 2) > (parseInt(getEl("breakRange").value) || 0) && !
tmp.breakObj && ![13, 14, 20].includes(tmp.id)) {
tmp.breakObj = true;
breakObjects.push({
x: tmp.x,
y: tmp.y,
sid: tmp.sid
});
}
}
}
});
let nearTrap = liztobj.filter(e => e.trap && e.active &&
UTILS.getDist(e, tmpObj, 0, 2) <= (tmpObj.scale + e.getScale() + 25) && !
e.isTeamObject(tmpObj)).sort(function(a, b) {
return UTILS.getDist(a, tmpObj, 0, 2) - UTILS.getDist(b,
tmpObj, 0, 2);
})[0];
if (nearTrap) {
let spike = gameObjects.filter(obj => obj.dmg &&
cdf(tmpObj, obj) <= tmpObj.scale + nearTrap.scale/2 && !obj.isTeamObject(tmpObj) &&
obj.active)[0]
traps.dist = UTILS.getDist(nearTrap, tmpObj, 0, 2);
traps.aim = UTILS.getDirect(spike ? spike : nearTrap,
tmpObj, 0, 2);
traps.protect(caf(nearTrap, tmpObj) - Math.PI);
traps.inTrap = true;
traps.info = nearTrap;
} else {
traps.inTrap = false;
traps.info = {};
}
} else {
traps.inTrap = false;
}
}
if (tmpObj.weaponIndex < 9) {
tmpObj.primaryIndex = tmpObj.weaponIndex;
tmpObj.primaryVariant = tmpObj.weaponVariant;
} else if (tmpObj.weaponIndex > 8) {
tmpObj.secondaryIndex = tmpObj.weaponIndex;
tmpObj.secondaryVariant = tmpObj.weaponVariant;
}
}
i += 13;
}
if (textManager.stack.length) {
let stacks = [];
let notstacks = [];
let num = 0;
let num2 = 0;
let pos = {
x: null,
y: null
};
let pos2 = {
x: null,
y: null
}
textManager.stack.forEach((text) => {
if (text.value >= 0) {
if (num == 0) pos = {
x: text.x,
y: text.y
};
num += Math.abs(text.value);
} else {
if (num2 == 0) pos2 = {
x: text.x,
y: text.y
};
num2 += Math.abs(text.value);
}
});
if (num2 > 0) {
textManager.showText(pos2.x, pos2.y, Math.max(45, Math.min(50, num2)),
0.18, 500, num2, "#8ecc51");
}
if (num > 0) {
textManager.showText(pos.x, pos.y, Math.max(45, Math.min(50, num)),
0.18, 500, num, "#fff");
}
textManager.stack = [];
}
if (runAtNextTick.length) {
runAtNextTick.forEach((tmp) => {
checkProjectileHolder(...tmp);
});
runAtNextTick = [];
}
for (let i = 0; i < data.length;) {
tmpObj = findPlayerBySID(data[i]);
if (tmpObj) {
if (!tmpObj.isTeam(player)) {
enemy.push(tmpObj);
if (tmpObj.dist2 <= items.weapons[tmpObj.primaryIndex ==
undefined ? 5 : tmpObj.primaryIndex].range + (player.scale * 2)) {
nears.push(tmpObj);
}
}
tmpObj.manageReload();
if (tmpObj != player) {
tmpObj.addDamageThreat(player);
}
}
i += 13;
}
if (player && player.alive) {
if (enemy.length) {
near = enemy.sort(function(tmp1, tmp2) {
return tmp1.dist2 - tmp2.dist2;
})[0];
}
if (game.tickQueue[game.tick]) {
game.tickQueue[game.tick].forEach((action) => {
action();
});
game.tickQueue[game.tick] = null;
}
players.forEach((tmp) => {
if (!tmp.visible && player != tmp) {
tmp.reloads = {
0: 0,
1: 0,
2: 0,
3: 0,
4: 0,
5: 0,
6: 0,
7: 0,
8: 0,
9: 0,
10: 0,
11: 0,
12: 0,
13: 0,
14: 0,
15: 0,
53: 0,
};
}
if (tmp.setBullTick) {
tmp.bullTimer = 0;
}
if (tmp.setPoisonTick) {
tmp.poisonTimer = 0;
}
tmp.updateTimer();
});
if (inGame) {
if (enemy.length) {
if (player.canEmpAnti) {
player.canEmpAnti = false;
if (near.dist2 <= 300 && !my.safePrimary(near) && !
my.safeSecondary(near)) {
if (near.reloads[53] == 0) {
player.empAnti = true;
player.soldierAnti = false;
} else {
player.empAnti = false;
player.soldierAnti = true;
}
}
}
let prehit = liztobj.filter(tmp => tmp.dmg && tmp.active &&
tmp.isTeamObject(player) && UTILS.getDist(tmp, near, 0, 3) <= (tmp.scale +
near.scale)).sort(function(a, b) {
return UTILS.getDist(a, near, 0, 2) - UTILS.getDist(b, near, 0,
2);
})[0];
if (prehit) {
if (near.dist3 <= items.weapons[player.weapons[0]].range +
player.scale * 1.8 && configs.predictTick) {
instaC.canSpikeTick = true;
instaC.syncHit = true;
if (configs.revTick && player.weapons[1] == 15 &&
player.reloads[53] == 0 && instaC.perfCheck(player, near)) {
instaC.revTick = true;
}
}
}
let antiSpikeTick = liztobj.filter(tmp => tmp.dmg && tmp.active
&& !tmp.isTeamObject(player) && UTILS.getDist(tmp, player, 0, 3) < (tmp.scale +
player.scale)).sort(function(a, b) {
return UTILS.getDist(a, player, 0, 2) - UTILS.getDist(b,
player, 0, 2);
})[0];
if (antiSpikeTick && !traps.inTrap) {
if (near.dist3 <= items.weapons[5].range + near.scale * 1.8) {
my.anti0Tick = 1;
}
}
}
if ((useWasd ? true : ((player.checkCanInsta(true) >= 100 ?
player.checkCanInsta(true) : player.checkCanInsta(false)) >= (player.weapons[1] ==
10 ? 95 : 100))) && near.dist2 <= items.weapons[player.weapons[1] == 10 ?
player.weapons[1] : player.weapons[0]].range + near.scale * 1.8 && (instaC.wait ||
(useWasd && Math.floor(Math.random() * 5) == 0)) && !instaC.isTrue && !my.waitHit
&& player.reloads[player.weapons[0]] == 0 && player.reloads[player.weapons[1]] == 0
&& (useWasd ? true : getEl("instaType").value == "oneShot" ? (player.reloads[53] <=
(player.weapons[1] == 10 ? 0 : game.tickRate)) : true) && instaC.perfCheck(player,
near)) {
if (player.checkCanInsta(true) >= 100) {
instaC.nobull = useWasd ? false : instaC.canSpikeTick ? false :
true;
} else {
instaC.nobull = false;
}
instaC.can = true;
} else {
instaC.can = false;
}
macro.q && place(0, getAttackDir());
macro.f && place(4, getSafeDir());
macro.v && place(2, getSafeDir());
macro.y && place(5, getSafeDir());
macro.h && place(player.getItemType(22), getSafeDir());
macro.n && place(3, getSafeDir());
if (game.tick % 1 == 0) {
if (mills.place) {
let plcAng = 7.7;
for (let i = -plcAng; i <= plcAng; i += plcAng) {
checkPlace(3, UTILS.getDirect(player.oldPos, player, 2, 2)
+ i);
}
} else {
if (mills.placeSpawnPads) {
for (let i = 0; i < Math.PI * 2; i += Math.PI / 2) {
checkPlace(player.getItemType(20),
UTILS.getDirect(player.oldPos, player, 2, 2) + i);
}
}
}
}
if (instaC.can) {
instaC.changeType(player.weapons[1] == 10 ? "rev" : "normal");
}
if (instaC.canCounter) {
instaC.canCounter = false;
if (player.reloads[player.weapons[0]] == 0 && !instaC.isTrue) {
instaC.counterType();
if (!recording) {
sendChat("SUPER T R A S H counter insta");
}
}
}
if (instaC.canSpikeTick) {
instaC.canSpikeTick = false;
if (instaC.revTick) {
instaC.revTick = false;
if ([1, 2, 3, 4, 5, 6].includes(player.weapons[0]) &&
player.reloads[player.weapons[1]] == 0 && !instaC.isTrue) {
instaC.changeType("rev");
}
} else {
if ([1, 2, 3, 4, 5, 6].includes(player.weapons[0]) &&
player.reloads[player.weapons[0]] == 0 && !instaC.isTrue) {
instaC.spikeTickType();
if (instaC.syncHit) {
}
}
}
}
if (!clicks.middle && (clicks.left || clicks.right) && !instaC.isTrue)
{
if ((player.weaponIndex != (clicks.right && player.weapons[1] == 10
? player.weapons[1] : player.weapons[0])) || player.buildIndex > -1) {
selectWeapon(clicks.right && player.weapons[1] == 10 ?
player.weapons[1] : player.weapons[0]);
}
if (player.reloads[clicks.right && player.weapons[1] == 10 ?
player.weapons[1] : player.weapons[0]] == 0 && !my.waitHit) {
sendAutoGather();
my.waitHit = 1;
game.tickBase(() => {
sendAutoGather();
my.waitHit = 0;
}, 1);
}
}
if (useWasd && !clicks.left && !clicks.right && !instaC.isTrue &&
near.dist2 <= (items.weapons[player.weapons[0]].range + near.scale * 1.8) && !
traps.inTrap) {
if ((player.weaponIndex != player.weapons[0]) || player.buildIndex
> -1) {
selectWeapon(player.weapons[0]);
}
if (player.reloads[player.weapons[0]] == 0 && !my.waitHit) {
sendAutoGather();
my.waitHit = 1;
game.tickBase(() => {
sendAutoGather();
my.waitHit = 0;
}, 1);
}
}
if (traps.inTrap) {
if (!clicks.left && !clicks.right && !instaC.isTrue) {
if (player.weaponIndex != (traps.notFast() ?
player.weapons[1] : player.weapons[0]) || player.buildIndex > -1) {
selectWeapon(traps.notFast() ? player.weapons[1] :
player.weapons[0]);
}
if (player.reloads[traps.notFast() ? player.weapons[1] :
player.weapons[0]] == 0 && !my.waitHit) {
sendAutoGather();
my.waitHit = 1;
game.tickBase(() => {
sendAutoGather();
my.waitHit = 0;
}, 1);
}
}
}
if (clicks.middle && !traps.inTrap) {
if (!instaC.isTrue && player.reloads[player.weapons[1]] == 0) {
if (my.ageInsta && player.weapons[0] != 4 && player.weapons[1]
== 9 && player.age >= 9 && enemy.length) {
instaC.bowMovement();
} else {
instaC.rangeType();
}
}
}
if (macro.t && !traps.inTrap) {
if (!instaC.isTrue && player.reloads[player.weapons[0]] == 0 &&
(player.weapons[1] == 15 ? (player.reloads[player.weapons[1]] == 0) : true) &&
(player.weapons[0] == 5 || (player.weapons[0] == 4 && player.weapons[1] == 15))) {
instaC[(player.weapons[0] == 4 && player.weapons[1] == 15) ?
"kmTickMovement" : "tickMovement"]();
}
}
if (macro["."] && !traps.inTrap) {
if (!instaC.isTrue && player.reloads[player.weapons[0]] == 0 &&
([9, 12, 13, 15].includes(player.weapons[1]) ? (player.reloads[player.weapons[1]]
== 0) : true)) {
instaC.boostTickMovement();
}
}
if (player.weapons[1] && !clicks.left && !clicks.right && !traps.inTrap
&& !instaC.isTrue && !(useWasd && near.dist2 <=
items.weapons[player.weapons[0]].range + near.scale * 1.8)) {
if (player.reloads[player.weapons[0]] == 0 &&
player.reloads[player.weapons[1]] == 0) {
if (!my.reloaded) {
my.reloaded = true;
let fastSpeed = items.weapons[player.weapons[0]].spdMult <
items.weapons[player.weapons[1]].spdMult ? 1 : 0;
if (player.weaponIndex != player.weapons[fastSpeed] ||
player.buildIndex > -1) {
selectWeapon(player.weapons[fastSpeed]);
}
}
} else {
my.reloaded = false;
if(useWasd) {
autos.stopspin = false;
}
if (player.reloads[player.weapons[0]] > 0) {
if (player.weaponIndex != player.weapons[0] ||
player.buildIndex > -1) {
selectWeapon(player.weapons[0]);
}
} else if (player.reloads[player.weapons[0]] == 0 &&
player.reloads[player.weapons[1]] > 0) {
if (player.weaponIndex != player.weapons[1] ||
player.buildIndex > -1) {
selectWeapon(player.weapons[1]);
}
if(useWasd) {
if (!autos.stopspin) {
setTimeout(()=>{
autos.stopspin = true;
}, 750);
}
}
}
}
}
if (!instaC.isTrue && !traps.inTrap && !traps.replaced) {
traps.autoPlace();
}
if (!macro.q && !macro.f && !macro.v && !macro.h && !macro.n) {
packet("D", getAttackDir());
}
let hatChanger = function () {
if (clicks.left || clicks.right) {
if (clicks.left) {
buyEquip(player.reloads[player.weapons[0]] == 0 ?
getEl("weaponGrind").checked ? 40 : 7 : player.empAnti ? 22 : 6, 0);
} else if (clicks.right) {
buyEquip(player.reloads[clicks.right && player.weapons[1]
== 10 ? player.weapons[1] : player.weapons[0]] == 0 ? 40 : player.empAnti ? 22 : 6,
0);
}
} else {
if (clicks.left || clicks.right) {
if (
((player.shameCount > 0 && (game.tick -
player.bullTick) % config.serverUpdateRate === 0 && player.skinIndex != 45) ||
my.reSync) &&
((near && near.dist2 > 120) || !near)
) {
} else {
if (clicks.left) {
buyEquip(
player.reloads[player.weapons[0]] == 0
? getEl('weaponGrind').checked
? 40
: 7
: player.empAnti
? 22
: player.soldierAnti
? 6
: getEl('antiBullType').value == 'abreload' &&
near.antiBull > 0
? 11
: near.dist2 <= 300
? getEl('antiBullType').value == 'abalway' &&
near.reloads[near.primaryIndex] == 0
? 11
: 6
: biomeGear(1, 1),
0
);
} else if (clicks.right) {
buyEquip(
player.reloads[clicks.right &&
player.weapons[1] == 10 ? player.weapons[1] : player.weapons[0]] == 0
? 40
: player.empAnti
? 22
: player.soldierAnti
? 6
: getEl('antiBullType').value == 'abreload' &&
near.antiBull > 0
? 11
: near.dist2 <= 300
? getEl('antiBullType').value == 'abalway' &&
near.reloads[near.primaryIndex] == 0
? 11
: 6
: biomeGear(1, 1),
0
);
}
}
} else if (traps.inTrap) {
if (traps.info.health <=
items.weapons[player.weaponIndex].dmg ? false : player.reloads[player.weapons[1] ==
10 ? player.weapons[1] : player.weapons[0]] == 0) {
buyEquip(40, 0);
buyEquip(21, 1);
} else {
if (
((player.shameCount > 0 && (game.tick -
player.bullTick) % config.serverUpdateRate === 0 && player.skinIndex != 45) ||
my.reSync) &&
((near && near.dist2 > 140) || !near)
) {
}
}
} else {
if (
((player.shameCount > 0 && (game.tick -
player.bullTick) % config.serverUpdateRate === 0 && player.skinIndex != 45) ||
my.reSync) &&
((near && near.dist2 > 140) || !near)
) {
} else {
if (near.dist2 <= 300) {
buyEquip(
getEl('antiBullType').value == 'abreload' &&
near.antiBull > 0
? 11
: getEl('antiBullType').value == 'abalway' &&
near.reloads[near.primaryIndex] == 0
? 11
: 6,
0
);
} else {
biomeGear(1);
}
}
}
}
};
replaceable.forEach(build => {
let angle = findPlacementAngle(player, buildId, build);
if (angle !== null) {
place(buildId, angle);
}
});
});
function updateLeaderboard(data) {
lastLeaderboardData = data;
return;
UTILS.removeAllChildren(leaderboardData);
let tmpC = 1;
for (let i = 0; i < data.length; i += 3) {
(function(i) {
UTILS.generateElement({
class: "leaderHolder",
parent: leaderboardData,
children: [
UTILS.generateElement({
class: "leaderboardItem",
style: "color:" + ((data[i] == playerSID) ? "#fff" :
"rgba(255,255,255,0.6)"),
text: tmpC + ". " + (data[i + 1] != "" ? data[i + 1] :
"unknown")
}),
UTILS.generateElement({
class: "leaderScore",
text: UTILS.sFormat(data[i + 2]) || "0"
})
]
});
})(i);
tmpC++;
}
}
function loadGameObject(data) {
for (let i = 0; i < data.length;) {
objectManager.add(data[i], data[i + 1], data[i + 2], data[i + 3], data[i +
4],
data[i + 5], items.list[data[i + 6]], true, (data[i + 7]
>= 0 ? {
sid: data[i + 7]
} : null));
i += 8;
}
}
function loadAI(data) {
for (let i = 0; i < ais.length; ++i) {
ais[i].forcePos = !ais[i].visible;
ais[i].visible = false;
}
if (data) {
let tmpTime = performance.now();
for (let i = 0; i < data.length;) {
tmpObj = findAIBySID(data[i]);
if (tmpObj) {
tmpObj.index = data[i + 1];
tmpObj.t1 = (tmpObj.t2 === undefined) ? tmpTime : tmpObj.t2;
tmpObj.t2 = tmpTime;
tmpObj.x1 = tmpObj.x;
tmpObj.y1 = tmpObj.y;
tmpObj.x2 = data[i + 2];
tmpObj.y2 = data[i + 3];
tmpObj.d1 = (tmpObj.d2 === undefined) ? data[i + 4] : tmpObj.d2;
tmpObj.d2 = data[i + 4];
tmpObj.health = data[i + 5];
tmpObj.dt = 0;
tmpObj.visible = true;
} else {
tmpObj = aiManager.spawn(data[i + 2], data[i + 3], data[i + 4],
data[i + 1]);
tmpObj.x2 = tmpObj.x;
tmpObj.y2 = tmpObj.y;
tmpObj.d2 = tmpObj.dir;
tmpObj.health = data[i + 5];
if (!aiManager.aiTypes[data[i + 1]].name)
tmpObj.name = config.cowNames[data[i + 6]];
tmpObj.forcePos = true;
tmpObj.sid = data[i];
tmpObj.visible = true;
}
i += 7;
}
}
}
function animateAI(sid) {
tmpObj = findAIBySID(sid);
if (tmpObj) tmpObj.startAnim();
}
function setAlliancePlayers(data) {
alliancePlayers = data;
}
::-webkit-input-placeholder {
color: #000000;
}
:-moz-placeholder {
color: #7DDA58;
opacity: 1;
}
::-moz-placeholder {
color: #7DDA58;
opacity: 1;
}
:-ms-input-placeholder {
color: #7DDA58;
}
input[type=text] {
-webkit-touch-callout: text;
-webkit-user-select: text;
-khtml-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
}
.menuLink {
font-size: 20px;
}
a {
color: ;
text-decoration: none;
}
a:active {
color: ;
}
a:visited {
color: ;
}
a:hover {
color: ;
}
* {
font-family: 'Comic Sans MS', 'Comic Neue', cursive;
font-size: 12px;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
transition: background-color 0.5s;
}
span {
font-size: inherit;
}
#errorNotification {
position: absolute;
top: 20px;
left: 50%;
transform: translateX(-50%);
max-width: 500px;
z-index: 99999;
background-color: ;
border-radius: 8px;
padding: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
#errorNotification .errorClose {
position: absolute;
top: 5px;
left: 5px;
}
#youtuberOf {
position: absolute;
top: 10px;
left: 10px;
color: #000;
font-size: 24px;
}
.ytLink {
color: #6EB3EF;
font-size: 24px;
text-decoration: none;
}
.ytLink:hover {
color: #5C96C9;
}
#featuredYoutube {
margin-top: 5px;
}
#featuredYoutube a {
color: #6EB3EF !important;
}
#featuredYoutube a:hover {
color: #5C96C9 !important;
}
#mainMenu {
background-color: rgba(8,8,8);
position: absolute;
width: 100%;
height: 100%;
z-index: 10;
}
#menuContainer {
width: 100%;
white-space: nowrap;
text-align: center;
position: absolute;
top: 45%;
transform: translateY(-50%);
}
#soundSetting {
position: absolute;
top: 10px;
right: 10px;
}
#joinPartyButton {
position: absolute;
top: 54px;
right: 20px;
cursor: pointer;
}
#pingDisplay {
position: absolute;
top: 20px;
left: 50%;
transform: translateX(-50%);
color: white;
}
#shutdownDisplay {
position: absolute;
top: 20px;
left: 50%;
transform: translateX(-50%);
color: white;
font-size: 25px;
z-index: 100;
}
#settingsButton {
position: absolute;
cursor: pointer;
display: none;
}
#followText {
position: absolute;
bottom: 40px;
left: 10px;
color: #000;
font-size: 22px;
}
#twitterFollow {
position: absolute;
bottom: 10px;
left: 10px;
}
#youtubeFollow {
position: absolute;
bottom: 10px;
left: 10px;
}
#linksContainer1 {
border-radius: 4px;
position: absolute;
bottom: 0px;
left: 0px;
background-color: #FFFACD;
font-size: 20px;
padding: 8px;
border-radius: 0 4px 0 0;
}
#linksContainer2 {
border-radius: 4px;
position: absolute;
bottom: 0px;
right: 0px;
background-color: #FFFACD;
text-align: right;
font-size: 20px;
padding: 8px;
border-radius: 4px 0 0 0;
}
#loadingText {
font-size: 45px;
color: #5DE2E7;
text-align: center;
}
#loadingText a {
display: block;
}
.menuCard, .adMenuCard {
vertical-align: top;
text-align: left;
white-space: normal;
word-wrap: break-word;
margin: 5px;
display: inline-block;
width: 300px;
padding: 18px;
background-color: #FFF;
box-shadow: 0px 7px #C4C4C4;
border-radius: 10px;
overflow: hidden;
}
.adMenuCard {
min-width: 0;
min-height: 0;
height: initial;
width: initial;
padding: 0;
box-shadow: none;
}
.menuHeader {
font-size: 24px;
color: #292929;
margin-bottom: 5px;
}
.menuText {
font-size: 18px;
color: #A8A8A8;
margin-bottom: 10px;
}
#serverBrowser select {
width: 100%;
height: 24px;
}
#altServer {
width: 100%;
text-align: center;
margin-top: 10px;
}
#skinColorHolder {
width: 100%;
padding: 0px;
padding-top: 5px;
padding-bottom: 0px;
}
.activeSkin {
border-radius: 8px !important;
}
.skinColorItem {
cursor: pointer;
display: inline-block;
margin-right: 10px;
width: 30px;
height: 30px;
border-radius: 20px;
border: 3px solid #525252;
}
.skinColorItem:hover {
border-radius: 8px;
}
.settingRadio {
font-size: 18px;
color: #A8A8A8;
margin-bottom: 10px;
}
#gameName {
font-size: 170px;
margin-bottom: -25px;
text-shadow: 0 1px 0 #98F5F9, 0 2px 0 #98F5F9, 0 3px 0 #98F5F9, 0 4px 0
#98F5F9, 0 5px 0 #98F5F9, 0 6px 0 #98F5F9, 0 7px 0 #98F5F9, 0 8px 0 #98F5F9, 0 9px
0 #98F5F9 !important;
color: #5DE2E7;
}
#guideCard {
max-height: 250px;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
}
#guideCard #smallLinks {
display: none;
}
#guideCard #desktopInstructions {
display: block;
}
#guideCard #mobileInstructions {
display: none;
}
#guideCard.touch #desktopInstructions {
display: none;
}
#guideCard.touch #mobileInstructions {
display: block;
}
#promoImgHolder {
text-align: center;
}
#promoImg:hover {
opacity: 0.9;
}
#rightCardHolder {
display: inline-block;
vertical-align: top;
}
#downloadButtonContainer {
display: block;
text-align: center;
padding-bottom: 12px;
margin-top: 14px;
}
#downloadButtonContainer.cordova {
display: none;
}
#mobileDownloadButtonContainer {
display: none;
}
#mobileDownloadButtonContainer.cordova {
display: none;
}
.downloadBadge {
margin: 0 6px 0 6px;
}
.downloadBadge img {
height: 40px;
}
#adCard {
text-align: center;
width: 300px;
height: auto;
}
#nameInput {
text-align: center;
font-size: 26px;
margin-bottom: 16px;
padding: 6px;
border: none;
outline: none;
box-sizing: border-box;
color: #4A4A4A;
background-color: #5DE2E7;
width: 100%;
border-radius: 8px;
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
}
.menuButton {
text-align: center;
font-size: 23px;
padding: 6px;
margin-top: 10px;
border: none;
outline: none;
cursor: pointer;
background-color: #5DE2E7;
color: white;
box-shadow: 0px 5px #98F5F9;
width: 100%;
border-radius: 8px;
}
.menuButton:hover {
background-color: #98F5F9;
}
#leftCard {
display: inline-block;
vertical-align: top;
margin-right: 5px;
}
#rightCard {
display: inline-block;
vertical-align: top;
margin-left: 5px;
}
.card {
display: inline-block;
vertical-align: top;
}
#inputWrapper {
width: 100%;
text-align: center;
}
#playCard {
display: inline-block;
vertical-align: top;
width: 300px;
margin-left: 0px;
margin-right: 5px;
}
#skinsButton {
width: 50%;
margin-right: 3px;
display: inline-block;
vertical-align: top;
}
#shopButton {
width: 50%;
margin-left: 3px;
display: inline-block;
vertical-align: top;
}
#mainCard {
display: inline-block;
vertical-align: top;
margin-left: 5px;
margin-right: 5px;
width: 300px;
}
#nickCard {
display: inline-block;
vertical-align: top;
width: 300px;
margin-left: 5px;
margin-right: 0px;
}
#footerCard {
display: inline-block;
vertical-align: top;
width: 300px;
margin-left: 5px;
margin-right: 5px;
}
#centeredHr {
width: 40%;
}
#socialCard {
width: 300px;
}
.newsCard {
display: inline-block;
vertical-align: top;
width: 300px;
margin-left: 5px;
margin-right: 5px;
}
#newsCardContainer {
white-space: nowrap;
width: 100%;
overflow-y: hidden;
overflow-x: auto;
}
#subTitle {
font-size: 35px;
color: #000;
text-align: center;
}
#gameContainerWrapper {
width: 100%;
height: 100%;
position: absolute;
}
#gameContainer {
position: relative;
width: 100%;
height: 100%;
}
#mobileStuff {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 30;
}
#centerButton {
position: absolute;
width: 12%;
padding-top: 12%;
bottom: 15%;
left: 50%;
transform: translateX(-50%);
z-index: 100;
border-radius: 50%;
background-color: #000000;
box-shadow: 0 5px rgba(0, 0, 0, 0.2);
}
#scoreHolder {
width: 100%;
text-align: center;
font-size: 45px;
}
#scoreText {
padding: 6px;
font-size: 20px;
color: #000;
background-color: rgba(0, 0, 0, 0.1);
border-radius: 4px;
display: inline-block;
}
#timeHolder {
width: 100%;
text-align: center;
font-size: 45px;
}
#timeText {
padding: 6px;
font-size: 20px;
color: #000;
background-color: rgba(0, 0, 0, 0.1);
border-radius: 4px;
display: inline-block;
}
#chatLog {
position: absolute;
top: 20px;
left: 20px;
width: 300px;
height: 100px;
overflow-y: scroll;
background-color: rgba(0, 0, 0, 0.25);
border-radius: 4px;
padding: 10px;
font-family: Arial, sans-serif;
z-index: 9999;
}
#chatLog::-webkit-scrollbar {
width: 10px;
}
#chatLog::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.1);
border-radius: 10px;
}
#chatLog::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.25);
border-radius: 10px;
border: 2px solid #ccc;
}
#chatLog::-webkit-scrollbar-thumb:hover {
background: rgba(0, 0, 0, 0.35);
}
#chatLog {
scrollbar-width: thin;
scrollbar-color: rgba(0, 0, 0, 0.25) rgba(0, 0, 0, 0.1);
}
.chatMessage {
margin-bottom: 5px;
padding: 7px;
background-color: rgba(0, 0, 0, 0.25);
border-radius: 5px;
font-size: 13px;
}
`;
document.head.appendChild(style);
function prepareMenuBackground() {
if (obj.tailIndex > 0) {
renderTailTextureImage(obj.tailIndex, ctxt, obj);
}
items.projectiles[items.weapons[obj.weaponIndex].projectile], mainContext);
}
}
ctxt.fillStyle = config.skinColors[obj.skinColor];
renderCircle(obj.scale * Math.cos(handAngle), (obj.scale *
Math.sin(handAngle)), 14);
renderCircle((obj.scale * oHandDist) * Math.cos(-handAngle * oHandAngle),
(obj.scale * oHandDist) * Math.sin(-handAngle * oHandAngle), 14);
items.projectiles[items.weapons[obj.weaponIndex].projectile], mainContext);
}
}
if (obj.buildIndex >= 0) {
var tmpSprite = getItemSprite(items.list[obj.buildIndex]);
ctxt.drawImage(tmpSprite, obj.scale -
items.list[obj.buildIndex].holdOffset, -tmpSprite.width / 2);
}
if (obj.skinIndex > 0) {
ctxt.rotate(Math.PI / 2);
renderTextureSkin(obj.skinIndex, ctxt, null, obj);
}
}
function getResSprite(obj) {
let biomeID = (obj.y>=config.mapScale-config.snowBiomeTop)?2:
((obj.y<=config.snowBiomeTop)?1:0);
let tmpIndex = (obj.type + "_" + obj.scale + "_" + biomeID);
let tmpSprite = gameObjectSprites[tmpIndex];
if (!tmpSprite) {
let tmpCanvas = document.createElement("canvas");
tmpCanvas.width = tmpCanvas.height = (obj.scale * 2.1) + outlineWidth;
let tmpContext = tmpCanvas.getContext('2d');
tmpContext.translate((tmpCanvas.width / 2), (tmpCanvas.height / 2));
tmpContext.rotate(UTILS.randFloat(0, Math.PI));
tmpContext.strokeStyle = outlineColor;
tmpContext.lineWidth = outlineWidth;
if (obj.type == 0) {
let tmpScale;
let tmpCount = 7;
tmpContext.globalAlpha = 1;
for (let i = 0; i < 2; ++i) {
tmpScale = tmpObj.scale * (!i?1:0.5);
renderStar(tmpContext, tmpCount, tmpScale, tmpScale * 0.7);
tmpContext.fillStyle = !biomeID?(!i?"#9ebf57":"#b4db62"):(!
i?"#e3f1f4":"#fff");
tmpContext.fill();
if (!i) {
tmpContext.stroke();
tmpContext.globalAlpha = 1;
}
}
} else if (obj.type == 1) {
if (biomeID == 2) {
tmpContext.fillStyle = "#606060";
renderStar(tmpContext, 6, obj.scale * 0.3, obj.scale * 0.71);
tmpContext.fill();
tmpContext.stroke();
tmpContext.fillStyle = "#89a54c";
renderCircle(0, 0, obj.scale * 0.55, tmpContext);
tmpContext.fillStyle = "#a5c65b";
renderCircle(0, 0, obj.scale * 0.3, tmpContext, true);
} else {
renderBlob(tmpContext, 6, tmpObj.scale, tmpObj.scale * 0.7);
tmpContext.fillStyle = biomeID?"#e3f1f4":"#89a54c";
tmpContext.fill();
tmpContext.stroke();
tmpContext.fillStyle = biomeID?"#FFB6C1":"#FF6F61";
let tmpRange;
let berries = 4;
let rotVal = (Math.PI * 2) / berries;
for (let i = 0; i < berries; ++i) {
tmpRange = UTILS.randInt(tmpObj.scale/3.5, tmpObj.scale/2.3);
renderCircle(tmpRange * Math.cos(rotVal * i), tmpRange *
Math.sin(rotVal * i),
UTILS.randInt(10, 12), tmpContext);
}
}
} else if (obj.type == 2 || obj.type == 3) {
tmpContext.fillStyle = (obj.type==2)?
(biomeID==2?"#938d77":"#939393"):"#e0c655";
renderStar(tmpContext, 3, obj.scale, obj.scale);
tmpContext.fill();
tmpContext.stroke();
tmpContext.fillStyle = (obj.type==2)?
(biomeID==2?"#b2ab90":"#bcbcbc"):"#ebdca3";
renderStar(tmpContext, 3, obj.scale * 0.55, obj.scale * 0.65);
tmpContext.fill();
}
tmpSprite = tmpCanvas;
gameObjectSprites[tmpIndex] = tmpSprite;
}
return tmpSprite;
}
function hexToRgb(hex) {
return hex.slice(1).match(/.{1,2}/g).map(g => parseInt(g, 16));
}
function getRgb(r, g, b) {
return [r / 255, g / 255, b / 255].join(", ");
}
if (obj.name == "apple") {
tmpContext.fillStyle = "#595f92";
renderCircle(0, 0, obj.scale, tmpContext);
tmpContext.fillStyle = "#5db1d7";
let leafDir = -(Math.PI / 2);
renderLeaf(obj.scale * Math.cos(leafDir), obj.scale *
Math.sin(leafDir),
25, leafDir + Math.PI / 2, tmpContext);
} else if (obj.name == "cookie") {
tmpContext.fillStyle = "#595f92";
renderCircle(0, 0, obj.scale, tmpContext);
tmpContext.fillStyle = "#f0fcfb";
let chips = 4;
let rotVal = (Math.PI * 2) / chips;
let tmpRange;
for (let i = 0; i < chips; ++i) {
tmpRange = UTILS.randInt(obj.scale / 2.5, obj.scale / 1.7);
renderCircle(tmpRange * Math.cos(rotVal * i), tmpRange *
Math.sin(rotVal * i),
UTILS.randInt(4, 5), tmpContext, true);
}
} else if (obj.name == "cheese") {
tmpContext.fillStyle = "#595f92";
renderCircle(0, 0, obj.scale, tmpContext);
tmpContext.fillStyle = "#f0fcfb";
let chips = 4;
let rotVal = (Math.PI * 2) / chips;
let tmpRange;
for (let i = 0; i < chips; ++i) {
tmpRange = UTILS.randInt(obj.scale / 2.5, obj.scale / 1.7);
renderCircle(tmpRange * Math.cos(rotVal * i), tmpRange *
Math.sin(rotVal * i),
UTILS.randInt(4, 5), tmpContext, true);
}
} else if (obj.name == "wood wall" || obj.name == "stone wall" ||
obj.name == "castle wall") {
tmpContext.fillStyle = (obj.name == "castle wall") ? "#595f92" :
(obj.name == "wood wall") ?
"#595f92" : "#263860";
let sides = (obj.name == "castle wall") ? 4 : 3;
renderStar(tmpContext, sides, obj.scale * 1.1, obj.scale * 1.1);
tmpContext.fill();
tmpContext.stroke();
tmpContext.fillStyle = (obj.name == "castle wall") ? "#9da4aa" :
(obj.name == "wood wall") ?
"#c9b758" : "#bcbcbc";
renderStar(tmpContext, sides, obj.scale * 0.65, obj.scale * 0.65);
tmpContext.fill();
} else if (obj.name == "spikes" || obj.name == "greater spikes" ||
obj.name == "poison spikes" ||
obj.name == "spinning spikes") {
tmpContext.fillStyle = (obj.name == "poison spikes") ? "#7b935d" :
"#939393";
let tmpScale = (obj.scale * 0.6);
renderStar(tmpContext, (obj.name == "spikes") ? 5 : 6, obj.scale,
tmpScale);
tmpContext.fill();
tmpContext.stroke();
tmpContext.fillStyle = "#a5974c";
renderCircle(0, 0, tmpScale, tmpContext);
tmpContext.fillStyle = "#7DDA58";
renderCircle(0, 0, tmpScale / 2, tmpContext, true);
} else if (obj.name == "windmill" || obj.name == "faster windmill" ||
obj.name == "power mill") {
tmpContext.fillStyle = "#a5974c";
renderCircle(0, 0, reScale, tmpContext);
tmpContext.fillStyle = "#c9b758";
renderRectCircle(0, 0, reScale * 1.5, 29, 4, tmpContext);
tmpContext.fillStyle = "#a5974c";
renderCircle(0, 0, reScale * 0.5, tmpContext);
} else if (obj.name == "mine") {
tmpContext.fillStyle = "#939393";
renderStar(tmpContext, 3, obj.scale, obj.scale);
tmpContext.fill();
tmpContext.stroke();
tmpContext.fillStyle = "#bcbcbc";
renderStar(tmpContext, 3, obj.scale * 0.55, obj.scale * 0.65);
tmpContext.fill();
} else if (obj.name == "sapling") {
for (let i = 0; i < 2; ++i) {
let tmpScale = obj.scale * (!i ? 1 : 0.5);
renderStar(tmpContext, 7, tmpScale, tmpScale * 0.7);
tmpContext.fillStyle = (!i ? "#9ebf57" : "#b4db62");
tmpContext.fill();
if (!i) tmpContext.stroke();
}
} else if (obj.name == "pit trap") {
tmpContext.fillStyle = "#a5974c";
renderStar(tmpContext, 3, obj.scale * 1.1, obj.scale * 1.1);
tmpContext.fill();
tmpContext.stroke();
tmpContext.fillStyle = outlineColor;
renderStar(tmpContext, 3, obj.scale * 0.65, obj.scale * 0.65);
tmpContext.fill();
} else if (obj.name == "boost pad") {
tmpContext.fillStyle = "#7e7f82";
renderRect(0, 0, obj.scale * 2, obj.scale * 2, tmpContext);
tmpContext.fill();
tmpContext.stroke();
tmpContext.fillStyle = "#dbd97d";
renderTriangle(obj.scale * 1, tmpContext);
} else if (obj.name == "turret") {
tmpContext.fillStyle = "#a5974c";
renderCircle(0, 0, obj.scale, tmpContext);
tmpContext.fill();
tmpContext.stroke();
tmpContext.fillStyle = "#939393";
let tmpLen = 50;
renderRect(0, -tmpLen / 2, obj.scale * 0.9, tmpLen, tmpContext);
renderCircle(0, 0, obj.scale * 0.6, tmpContext);
tmpContext.fill();
tmpContext.stroke();
} else if (obj.name == "platform") {
tmpContext.fillStyle = "#cebd5f";
let tmpCount = 4;
let tmpS = obj.scale * 2;
let tmpW = tmpS / tmpCount;
let tmpX = -(obj.scale / 2);
for (let i = 0; i < tmpCount; ++i) {
renderRect(tmpX - (tmpW / 2), 0, tmpW, obj.scale * 2,
tmpContext);
tmpContext.fill();
tmpContext.stroke();
tmpX += tmpS / tmpCount;
}
} else if (obj.name == "healing pad") {
tmpContext.fillStyle = "#7e7f82";
renderRect(0, 0, obj.scale * 2, obj.scale * 2, tmpContext);
tmpContext.fill();
tmpContext.stroke();
tmpContext.fillStyle = "#db6e6e";
renderRectCircle(0, 0, obj.scale * 0.65, 20, 4, tmpContext, true);
} else if (obj.name == "spawn pad") {
tmpContext.fillStyle = "#7e7f82";
renderRect(0, 0, obj.scale * 2, obj.scale * 2, tmpContext);
tmpContext.fill();
tmpContext.stroke();
tmpContext.fillStyle = "#71aad6";
renderCircle(0, 0, obj.scale * 0.6, tmpContext);
} else if (obj.name == "blocker") {
tmpContext.fillStyle = "#7e7f82";
renderCircle(0, 0, obj.scale, tmpContext);
tmpContext.fill();
tmpContext.stroke();
tmpContext.rotate(Math.PI / 4);
tmpContext.fillStyle = "#db6e6e";
renderRectCircle(0, 0, obj.scale * 0.65, 20, 4, tmpContext, true);
} else if (obj.name == "teleporter") {
tmpContext.fillStyle = "#7e7f82";
renderCircle(0, 0, obj.scale, tmpContext);
tmpContext.fill();
tmpContext.stroke();
tmpContext.rotate(Math.PI / 4);
tmpContext.fillStyle = "#d76edb";
renderCircle(0, 0, obj.scale * 0.5, tmpContext, true);
}
}
tmpSprite = tmpCanvas;
if (!asIcon) {
itemSprites[obj.id] = tmpSprite;
}
}
return tmpSprite;
}
function getObjSprite(obj) {
let tmpSprite = objSprites[obj.id];
if (!tmpSprite) {
let tmpCanvas = document.createElement("canvas");
tmpCanvas.width = tmpCanvas.height = obj.scale * 2.5 + outlineWidth +
(items.list[obj.id].spritePadding || 0);
let tmpContext = tmpCanvas.getContext("2d");
tmpContext.translate(tmpCanvas.width / 2, tmpCanvas.height / 2);
tmpContext.rotate(Math.PI / 2);
tmpContext.strokeStyle = outlineColor;
tmpContext.lineWidth = outlineWidth;
if (obj.name == "spikes" || obj.name == "greater spikes" || obj.name ==
"poison spikes" || obj.name == "spinning spikes") {
tmpContext.fillStyle = obj.name == "poison spikes" ? "#7b935d" :
"#939393";
let tmpScale = obj.scale * 0.6;
renderStar(tmpContext, obj.name == "spikes" ? 5 : 6, obj.scale,
tmpScale);
tmpContext.fill();
tmpContext.stroke();
tmpContext.fillStyle = "#a5974c";
renderCircle(0, 0, tmpScale, tmpContext);
tmpContext.fillStyle = "#E4080A";
renderCircle(0, 0, tmpScale / 2, tmpContext, true);
} else if (obj.name == "pit trap") {
tmpContext.fillStyle = "#a5974c";
renderStar(tmpContext, 3, obj.scale * 1.1, obj.scale * 1.1);
tmpContext.fill();
tmpContext.stroke();
tmpContext.fillStyle = "#E4080A";
renderStar(tmpContext, 3, obj.scale * 0.65, obj.scale * 0.65);
tmpContext.fill();
}
tmpSprite = tmpCanvas;
objSprites[obj.id] = tmpSprite;
}
return tmpSprite;
}
function isOnScreen(x, y, s) {
const distanceSquared = (x - maxScreenWidth / 2) ** 2 + (y - maxScreenHeight /
2) ** 2;
// if you see this it means (SUPER T R A S H) is original owner of this mod.
return distanceSquared <= renderDistance ** 2;
}
mainContext.save();
mainContext.translate(tmpX, tmpY);
mainContext.rotate(tmpObj.dir);
if (!tmpObj.active) {
mainContext.scale(tmpObj.visScale / tmpObj.scale,
tmpObj.visScale / tmpObj.scale);
}
mainContext.drawImage(tmpSprite, -(tmpSprite.width / 2), -
(tmpSprite.height / 2));
if (tmpObj.blocker) {
mainContext.strokeStyle = "cyan";
mainContext.globalAlpha = 0.3;
mainContext.lineWidth = 6;
renderCircle(0, 0, tmpObj.blocker, mainContext, false,
true);
}
mainContext.restore();
} else {
tmpSprite = getResSprite(tmpObj);
mainContext.drawImage(tmpSprite, tmpX - (tmpSprite.width / 2),
tmpY - (tmpSprite.height / 2));
}
}
if (layer == 3) {
if (tmpObj.health < tmpObj.maxHealth) {
const radius = 25;
mainContext.strokeStyle = '#333';
mainContext.lineWidth = 5;
mainContext.fillStyle = '#FFF';
mainContext.beginPath();
mainContext.arc(tmpX, tmpY, radius + 5, 0, 2 * Math.PI);
mainContext.fill();
mainContext.stroke();
if (layer == 0) {
if (placeVisible.length) {
placeVisible.forEach((places) => {
tmpX = places.x - xOffset;
tmpY = places.y - yOffset;
markObject(places, tmpX, tmpY);
});
}
}
}
class MapPing {
constructor(color, scale) {
this.init = function(x, y) {
this.scale = 0;
this.x = x;
this.y = y;
this.active = true;
};
this.update = function(ctxt, delta) {
if (this.active) {
this.scale += 0.05 * delta;
if (this.scale >= scale) {
this.active = false;
} else {
ctxt.globalAlpha = (1 - Math.max(0, this.scale / scale));
ctxt.beginPath();
ctxt.arc((this.x / config.mapScale) * mapDisplay.width, (this.y
/ config.mapScale) *
mapDisplay.width, this.scale, 0, 2 * Math.PI);
ctxt.stroke();
}
}
};
this.color = color;
}
}
function pingMap(x, y) {
tmpPing = mapPings.find(pings => !pings.active);
if (!tmpPing) {
tmpPing = new MapPing("#FFB6C1", config.mapPingScale);
mapPings.push(tmpPing);
}
tmpPing.init(x, y);
}
function updateMapMarker() {
mapMarker.x = player.x;
mapMarker.y = player.y;
}
function renderMinimap(delta) {
if (player && player.alive) {
mapContext.clearRect(0, 0, mapDisplay.width, mapDisplay.height);
mapContext.lineWidth = 4;
for (let i = 0; i < mapPings.length; ++i) {
tmpPing = mapPings[i];
mapContext.strokeStyle = tmpPing.color;
tmpPing.update(mapContext, delta);
}
mapContext.globalAlpha = 1;
mapContext.fillStyle = "#FFB6C1";
renderCircle((player.x / config.mapScale) * mapDisplay.width,
(player.y / config.mapScale) * mapDisplay.height, 7,
mapContext, true);
mapContext.fillStyle = "rgba(255, 182, 193, 0.35)";
if (player.team && minimapData) {
for (let i = 0; i < minimapData.length;) {
renderCircle((minimapData[i] / config.mapScale) * mapDisplay.width,
(minimapData[i + 1] / config.mapScale) *
mapDisplay.height, 7, mapContext, true);
i += 2;
}
}
if (lastDeath) {
mapContext.fillStyle = "#fc5553";
mapContext.font = "34px 'Comic Sans MS', cursive";
mapContext.textBaseline = "middle";
mapContext.textAlign = "center";
mapContext.fillText("x", (lastDeath.x / config.mapScale) *
mapDisplay.width,
(lastDeath.y / config.mapScale) *
mapDisplay.height);
}
if (mapMarker) {
mapContext.fillStyle = "#fff";
mapContext.font = "34px 'Comic Sans MS', cursive";
mapContext.textBaseline = "middle";
mapContext.textAlign = "center";
mapContext.fillText("x", (mapMarker.x / config.mapScale) *
mapDisplay.width,
(mapMarker.y / config.mapScale) *
mapDisplay.height);
}
}
}
function loadIcons() {
for (let i = 0; i < icons.length; ++i) {
let tmpSprite = new Image();
tmpSprite.onload = function() {
this.isLoaded = true;
};
tmpSprite.src = "./../img/icons/" + icons[i] + ".png";
iconSprites[icons[i]] = tmpSprite;
}
}
loadIcons();
function updateGame() {
if(gameObjects.length && inGame) {
gameObjects.forEach((tmp) => {
if(UTILS.getDistance(tmp.x, tmp.y, player.x, player.y) <= 1200) {
if(!liztobj.includes(tmp)) {
liztobj.push(tmp);
tmp.render = true;
}
} else {
if(liztobj.includes(tmp)) {
if(UTILS.getDistance(tmp.x, tmp.y, player.x, player.y) >= 1200)
{
tmp.render = false;
const index = liztobj.indexOf(tmp);
if (index > -1) {
liztobj.splice(index, 1);
}
}
} else if(UTILS.getDistance(tmp.x, tmp.y, player.x, player.y) >=
1200) {
tmp.render = false;
const index = liztobj.indexOf(tmp);
if (index > -1) {
liztobj.splice(index, 1);
}
} else {
tmp.render = false;
const index = liztobj.indexOf(tmp);
if (index > -1) {
liztobj.splice(index, 1);
}
}
}
})
}
mainContext.beginPath();
mainContext.clearRect(0, 0, gameCanvas.width, gameCanvas.height);
mainContext.globalAlpha = 1;
if (player) {
let easingFactor = 0.1;
camX += (player.x - camX) * easingFactor;
camY += (player.y - camY) * easingFactor;
let time = performance.now() * 0.002;
let floatFactor = 1.5;
camX += floatFactor * Math.sin(time);
camY += floatFactor * Math.cos(time);
} else {
camX = config.mapScale / 2;
camY = config.mapScale / 2;
}
if (!firstSetup) {
waterMult += waterPlus * config.waveSpeed * delta;
if (waterMult >= config.waveMax) {
waterMult = config.waveMax;
waterPlus = -1;
} else if (waterMult <= 1) {
waterMult = waterPlus = 1;
}
mainContext.globalAlpha = 1;
mainContext.fillStyle = "#dbc666";
renderWaterBodies(xOffset, yOffset, mainContext, config.riverPadding);
mainContext.fillStyle = "#91b2db";
renderWaterBodies(xOffset, yOffset, mainContext, (waterMult - 1) * 250);
}
mainContext.lineWidth = 6;
mainContext.strokeStyle = "#000";
mainContext.globalAlpha = 0.06;
mainContext.beginPath();
for (let x = -camX; x < maxScreenWidth; x += useWasd ? 60 : 60) {
if (x > 0) {
mainContext.moveTo(x, 0);
mainContext.lineTo(x, maxScreenHeight);
}
}
for (let y = -camY; y < maxScreenHeight; y += useWasd ? 60 : 60) {
if (y > 0) {
mainContext.moveTo(0, y);
mainContext.lineTo(maxScreenWidth, y);
}
}
mainContext.stroke();
mainContext.globalAlpha = 1;
mainContext.strokeStyle = outlineColor;
renderGameObjects(-1, xOffset, yOffset);
mainContext.globalAlpha = 1;
mainContext.lineWidth = outlineWidth;
renderProjectiles(0, xOffset, yOffset);
mainContext.globalAlpha = 1;
for (let i = 0; i < ais.length; ++i) {
tmpObj = ais[i];
if (tmpObj.active && tmpObj.visible) {
tmpObj.animate(delta);
mainContext.save();
mainContext.translate(tmpObj.x - xOffset, tmpObj.y - yOffset);
mainContext.rotate(tmpObj.dir + tmpObj.dirPlus - (Math.PI / 2));
renderAI(tmpObj, mainContext);
mainContext.restore();
}
}
mainContext.fillStyle = "#000";
mainContext.globalAlpha = 0.09;
if (xOffset <= 0) {
mainContext.fillRect(0, 0, -xOffset, maxScreenHeight);
}
if (config.mapScale - xOffset <= maxScreenWidth) {
let tmpY = Math.max(0, -yOffset);
mainContext.fillRect(config.mapScale - xOffset, tmpY, maxScreenWidth -
(config.mapScale - xOffset), maxScreenHeight - tmpY);
}
if (yOffset <= 0) {
mainContext.fillRect(-xOffset, 0, maxScreenWidth + xOffset, -yOffset);
}
if (config.mapScale - yOffset <= maxScreenHeight) {
let tmpX = Math.max(0, -xOffset);
let tmpMin = 0;
if (config.mapScale - xOffset <= maxScreenWidth)
tmpMin = maxScreenWidth - (config.mapScale - xOffset);
mainContext.fillRect(tmpX, config.mapScale - yOffset,
(maxScreenWidth - tmpX) - tmpMin, maxScreenHeight -
(config.mapScale - yOffset));
}
mainContext.globalAlpha = 1;
mainContext.fillStyle = "rgba(0, 0, 70, 0.35)";
mainContext.fillRect(0, 0, maxScreenWidth, maxScreenHeight);
const FallenHero = {
darkOutline: "#3d3f42",
healthBarFriend: "#7DDA58",
healthBarFoe: "#E4080A",
background: "#fff8e7",
tracer: "#E4080A",
nameFill: "#000000"
};
mainContext.strokeStyle = FallenHero.darkOutline;
mainContext.globalAlpha = 1;
for (let i = 0; i < players.length + ais.length; ++i) {
tmpObj = players[i] || ais[i - players.length];
if (tmpObj.visible) {
mainContext.strokeStyle = FallenHero.darkOutline;
if (tmpObj.skinIndex != 10 || (tmpObj === player) || (tmpObj.team &&
tmpObj.team == player.team)) {
let tmpText = (tmpObj.team ? "[" + tmpObj.team + "] " : "") +
(tmpObj.name || "") + (" [" + tmpObj.shameCount + "]");
if (!recording) {
player.name = originalName;
} else {
player.name = "unknown";
}
if (tmpText != "") {
mainContext.font = (tmpObj.nameScale || 30) + "px 'Comic Sans
MS', cursive";
mainContext.fillStyle = FallenHero.nameFill;
mainContext.textBaseline = "middle";
mainContext.textAlign = "center";
mainContext.lineWidth = (tmpObj.nameScale ? 11 : 8);
mainContext.lineJoin = "round";
mainContext.strokeText(tmpText, tmpObj.x - xOffset, (tmpObj.y -
yOffset - tmpObj.scale) - config.nameY);
mainContext.fillText(tmpText, tmpObj.x - xOffset, (tmpObj.y -
yOffset - tmpObj.scale) - config.nameY);
config.healthBarPad = 4;
if (tmpObj.isLeader && iconSprites.crown.isLoaded) {
let tmpS = config.crownIconScale;
let tmpX = tmpObj.x - xOffset - (tmpS / 2) -
(mainContext.measureText(tmpText).width / 2) - config.crownPad;
mainContext.drawImage(iconSprites.crown, tmpX, (tmpObj.y -
yOffset - tmpObj.scale)
- config.nameY - (tmpS / 2) - 5,
tmpS, tmpS);
}
if (tmpObj.iconIndex == 1 && iconSprites.skull.isLoaded) {
let tmpS = config.crownIconScale;
let tmpX = tmpObj.x - xOffset - (tmpS / 2) +
(mainContext.measureText(tmpText).width / 2) + config.crownPad;
mainContext.drawImage(iconSprites.skull, tmpX, (tmpObj.y -
yOffset - tmpObj.scale)
- config.nameY - (tmpS / 2) - 5,
tmpS, tmpS);
}
if (tmpObj.isPlayer && instaC.wait && near == tmpObj &&
enemy.length) {
let tmpS = tmpObj.scale * 20;
mainContext.beginPath();
mainContext.arc(tmpObj.x - xOffset, tmpObj.y - yOffset, 3,
0, 2 * Math.PI);
mainContext.fillStyle = 'red';
mainContext.fill();
}
}
if (tmpObj.health > 0) {
mainContext.fillStyle = FallenHero.darkOutline;
mainContext.roundRect(
tmpObj.x - xOffset - (config.healthBarWidth +
config.healthBarPad),
tmpObj.y - yOffset + tmpObj.scale + config.nameY,
(config.healthBarWidth * 2) + (config.healthBarPad * 2),
17,
8
);
mainContext.fill();
mainContext.save();
if (tmpObj.isPlayer) {
let reloads = {
primary: (tmpObj.primaryIndex == undefined ? 1 :
((items.weapons[tmpObj.primaryIndex].speed - tmpObj.reloads[tmpObj.primaryIndex]) /
items.weapons[tmpObj.primaryIndex].speed)),
secondary: (tmpObj.secondaryIndex == undefined ? 1 :
((items.weapons[tmpObj.secondaryIndex].speed -
tmpObj.reloads[tmpObj.secondaryIndex]) /
items.weapons[tmpObj.secondaryIndex].speed)),
turret: (2500 - tmpObj.reloads[53]) / 2500
};
CanvasRenderingContext2D.prototype.roundRectWithTailAndEars = function(x, y,
width, height, radius, tailSize, earSize) {
if (width < 2 * radius) radius = width / 2;
if (height < 2 * radius) radius = height / 2;
this.beginPath();
this.moveTo(x + radius, y);
this.arcTo(x + width, y, x + width, y + height, radius);
this.arcTo(x + width, y + height, x, y + height, radius);
this.arcTo(x, y + height, x, y, radius);
this.arcTo(x, y, x + width, y, radius);
this.closePath();
return this;
};
players.forEach((tmp) => {
tmpObj = tmp;
if (tmpObj.visible && tmpObj.chatCountdown > 0) {
tmpObj.chatCountdown = Math.max(0, (tmpObj.chatCountdown -= delta));
mainContext.font = "32px 'Comic Sans MS', cursive";
var tmpSize = mainContext.measureText(tmpObj.chatMessage);
mainContext.textBaseline = "middle";
mainContext.textAlign = "center";
var tmpX = tmpObj.x - xOffset;
var tmpY = tmpObj.y - tmpObj.scale - yOffset - 90;
var tmpH = 47;
var tmpW = tmpSize.width + 30;
var padding = 10;
var tailSize = 12;
var earSize = 30;
var bubbleColor = "rgba(152, 245, 249)";
var textColor = "#fff";
mainContext.fillStyle = textColor;
mainContext.fillText(tmpObj.chatMessage, tmpX, tmpY);
}
});
mainContext.globalAlpha = 1;
renderMinimap(delta);
}
window.requestAnimFrame = function() {
return null;
}
window.rAF = (function() {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function(callback) {
window.setTimeout(callback, 1000/9);
};
})();
function doUpdate() {
now = performance.now();
delta = now - lastUpdate;
lastUpdate = now;
updateGame();
rAF(doUpdate);
ms.avg = Math.round((ms.min+ms.max)/2);
}
prepareMenuBackground();
doUpdate();
function toggleUseless(boolean) {
getEl("instaType").disabled = boolean;
getEl("antiBullType").disabled = boolean;
getEl("predictType").disabled = boolean;
}
toggleUseless(useWasd);
window.debug = function() {
my.waitHit = 0;
my.autoAim = false;
instaC.isTrue = false;
traps.inTrap = false;
itemSprites = [];
objSprites = [];
gameObjectSprites = [];
skinSprites = [];
skinPointers = [];
skinSprites2 = [];
skinPointers2 = [];
accessSprites = [];
toolSprites = [];
projectileSprites = [];
aiSprites = [];
console.clear();
};
window.wasdMode = function() {
useWasd = !useWasd;
toggleUseless(useWasd);
};
window.startGrind = function() {
if (getEl("weaponGrind").checked) {
for (let i = 0; i < Math.PI * 2; i += Math.PI / 2) {
checkPlace(player.getItemType(22), i);
}
}
};
window.resBuild = function() {
if (gameObjects.length) {
gameObjects.forEach((tmp) => {
tmp.breakObj = false;
});
breakObjects = [];
}
};
window.toggleVisual = function() {
config.anotherVisual = !config.anotherVisual;
gameObjects.forEach((tmp) => {
if (tmp.active) {
tmp.dir = tmp.lastDir;
}
});
};
window.prepareUI = function(tmpObj) {
resize();
var chatBox = document.getElementById("chatBox");
var chatHolder = document.getElementById("chatHolder");
var suggestBox = document.createElement("div");
suggestBox.id = "suggestBox";
function closeChat() {
chatBox.value = "";
chatHolder.style.display = "none";
}
if (items.weapons[i]) {
tmpContext.rotate((Math.PI / 4) + Math.PI);
let tmpSprite = new Image();
toolSprites[items.weapons[i].src] = tmpSprite;
tmpSprite.onload = function () {
this.isLoaded = true;
let tmpPad = 1 / (this.height / this.width);
let tmpMlt = (items.weapons[i].iPad || 1);
tmpContext.drawImage(this, -(tmpCanvas.width * tmpMlt *
config.iconPad * tmpPad) / 2, -(tmpCanvas.height * tmpMlt * config.iconPad) / 2,
tmpCanvas.width * tmpMlt * tmpPad *
config.iconPad, tmpCanvas.height * tmpMlt * config.iconPad);
tmpContext.fillStyle = "rgba(0, 0, 70, 0.1)";
tmpContext.globalCompositeOperation = "source-atop";
tmpContext.fillRect(-tmpCanvas.width / 2, -tmpCanvas.height /
2, tmpCanvas.width, tmpCanvas.height);
getEl('actionBarItem' + i).style.backgroundImage = "url(" +
tmpCanvas.toDataURL() + ")";
};
tmpSprite.src = "./../img/weapons/" + items.weapons[i].src +
".png";
let tmpUnit = getEl('actionBarItem' + i);
tmpUnit.onmouseover = UTILS.checkTrusted(function () {
showItemInfo(items.weapons[i], true);
});
tmpUnit.onclick = UTILS.checkTrusted(function () {
selectWeapon(tmpObj.weapons[items.weapons[i].type]);
});
UTILS.hookTouchEvents(tmpUnit);
} else {
let tmpSprite = getItemSprite(items.list[i - items.weapons.length],
true);
let tmpScale = Math.min(tmpCanvas.width - config.iconPadding,
tmpSprite.width);
tmpContext.globalAlpha = 1;
tmpContext.drawImage(tmpSprite, -tmpScale / 2, -tmpScale / 2,
tmpScale, tmpScale);
tmpContext.fillStyle = "rgba(0, 0, 70, 0.1)";
tmpContext.globalCompositeOperation = "source-atop";
tmpContext.fillRect(-tmpScale / 2, -tmpScale / 2, tmpScale,
tmpScale);
getEl('actionBarItem' + i).style.backgroundImage = "url(" +
tmpCanvas.toDataURL() + ")";
let tmpUnit = getEl('actionBarItem' + i);
tmpUnit.onmouseover = UTILS.checkTrusted(function () {
showItemInfo(items.list[i - items.weapons.length]);
});
tmpUnit.onclick = UTILS.checkTrusted(function () {
selectToBuild(tmpObj.items[tmpObj.getItemType(i -
items.weapons.length)]);
});
UTILS.hookTouchEvents(tmpUnit);
}
})(i);
}
};
window.profineTest = function(data) {
if (data) {
let name = data + "";
name = name.slice(0, config.maxNameLength);
return name;
}
};
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 2024-10-28
// @description try to take over the world!
// @author You
// @match http://*/*
// @icon
data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
(function() {
'use strict';