Text
Text
function onBoxMouseOver() {
this.style.transform = 'scale(1.1)';
this.style.borderRadius = '10px';
this.style.boxShadow = '0 0 0 1px #0c3fcc';
}
function onBoxMouseLeave() {
this.style.transform = 'scale(1)';
this.style.borderRadius = '0';
this.style.boxShadow = 'none';
}
function onEnterGameMouseOver() {
const enterGameBox = document.getElementById('enterGame');
enterGameBox.style.transform = 'scale(1.05)';
enterGameBox.style.backgroundColor = 'rgba(11, 133, 189, 0.7)';
enterGameBox.style.borderRadius = '20px';
enterGameBox.style.transition = 'all 0.5s ease-in-out';
}
function onEnterGameMouseLeave() {
const enterGameBox = document.getElementById('enterGame');
enterGameBox.style.transform = 'scale(1)';
enterGameBox.style.backgroundColor = '#00FF00';
enterGameBox.style.borderRadius = '0';
enterGameBox.style.transition = 'all 0.5s ease-in-out';
}
let menuLink = document.querySelector('.menuLink');
let menuText = document.querySelector('.menuText');
let DeskTopInstructions = document.getElementById("desktopInstructions");
if(menuText) {
menuText.textContent = `This Mod Made by SUPER T R A S H`
}
let skinColorHolder = document.getElementById('skinColorHolder');
newContainer.appendChild(newCheckbox);
newContainer.appendChild(newLabel);
firstCheckbox.parentNode.insertBefore(newContainer, firstCheckbox);
newCheckbox.addEventListener('change', function() {
if (this.checked) {
document.getElementById('promoImgHolder').style.display = "block";
} else {
document.getElementById('promoImgHolder').style.display = "none";
}
});
$('#joinPartyButton').css({'right': '10%',
'left': '70%',
'text-align': 'center',
'bottom': '48px',
'font-size': '24px',
'top': 'unset'});
$('#gameName').css({'color': '#20ace8',
'text-shadow': '0 1px 0 rgba(255, 255, 255, 0), 0 2px 0
rgba(255, 255, 255, 0), 0 3px 0 rgba(255, 255, 255, 0), 0 4px 0 rgba(255, 255, 255,
0), 0 5px 0 rgba(255, 255, 255, 0), 0 6px 0 rgba(255, 255, 255, 0), 0 7px 0
rgba(255, 255, 255, 0), 0 8px 0 rgba(255, 255, 255, 0), 0 9px 0 rgba(255, 255, 255,
0)',
'text-align': 'center',
'font-size': '156px',
'margin-bottom': '-30px'});
$("#killCounter").css({'bottom': '75px'});
const miniMenu = document.createElement("div");
miniMenu.textContent = "Hello!";
miniMenu.style.position = "fixed";
miniMenu.style.top = "-100px";
miniMenu.style.left = "50%";
miniMenu.style.transform = "translateX(-50%)";
miniMenu.style.backgroundColor = "rgba(51, 51, 51, 0)";
miniMenu.style.color = "rgb(51, 51, 51)";
miniMenu.style.padding = "20px";
miniMenu.style.fontSize = "20px";
miniMenu.style.borderRadius = "10px";
miniMenu.style.transition = "top 1s, opacity 1s";
miniMenu.style.zIndex = "9999";
document.body.appendChild(miniMenu);
$("#killCounter").hide();
setTimeout(() => {
miniMenu.style.top = "0";
miniMenu.style.opacity = "1";
}, 500);
setTimeout(() => {
miniMenu.style.opacity = "0";
setTimeout(() => {
miniMenu.remove();
}, 1000);
}, 3000);
const miniMenu2W = document.createElement("div");
miniMenu2W.textContent = "U Best!";
miniMenu2W.style.position = "fixed";
miniMenu2W.style.top = "-100px";
miniMenu2W.style.left = "50%";
miniMenu2W.style.transform = "translateX(-50%)";
miniMenu2W.style.backgroundColor = "rgba(51, 51, 51, 0)";
miniMenu2W.style.color = "rgb(51, 51, 51)";
miniMenu2W.style.padding = "20px";
miniMenu2W.style.fontSize = "20px";
miniMenu2W.style.borderRadius = "10px";
miniMenu2W.style.transition = "top 1s, opacity 1s";
miniMenu2W.style.zIndex = "9999";
document.body.appendChild(miniMenu2W);
setTimeout(() => {
miniMenu2W.style.top = "25px";
miniMenu2W.style.opacity = "1";
}, 1500);
setTimeout(() => {
miniMenu2W.style.top = "0";
miniMenu2W.style.opacity = "1";
}, 3000);
setTimeout(() => {
miniMenu2W.style.opacity = "0";
setTimeout(() => {
miniMenu2W.remove();
}, 1000);
}, 5000);
if (document.querySelector("#customAudioPlayer")) return;
var audioFiles = [
{
url:
"https://cdn.discordapp.com/attachments/1062441866416619653/1069324203297362040/
Barren_Gates_-_Obey_NCS_Release.mp3",
title: "Obey NCS",
},
{
url:
"https://cdn.discordapp.com/attachments/1062441866416619653/1069323837608570941/
Clarx_-_Zig_Zag_NCS_Release.mp3",
title: "Zig Zag NCS",
},
{
url: "https://mp3uk.net/mp3/files/camila-cabello-shameless-speed-up-
mp3.mp3",
title: "Shameless NightCore",
},
{
url: "https://cdn.muzyet.net/?
h=JGraYpdVSDsfzqI6llpTKMlEiImFeJbLMMCCdCz_6oBSV99ikBBdVB61Y4O5JTP21hJcoINim8I-
f5B7bS_2kiJK42OQFn1KHMmijcklVC_XPI_YmW0\\",
title: "VTZE ARCHIVE MONTAGEM",
},
{
url: "https://ncs.io/track/download/ca453e1c-3c56-488f-854a-d022e46c7ebf",
title: "Slippy & Blosso Horizon",
},
{
url:
"https://cdn.discordapp.com/attachments/1062441866416619653/1069300879708135524/
Anixto_-_Ride_Or_Die_NCS_Release.mp3",
title: "Ride Or Die NCS",
},
{
url:
"https://cdn.discordapp.com/attachments/1062441866416619653/1069324799903531128/
MP3DL.CC_Rival_-_Throne_-_ft._Neoni_NCS_Release-256k.mp3",
title: "Throne NCS",
},
{
url:
"https://cdn.discordapp.com/attachments/905994516719345664/918544988965568562/
Dirty_Palm_-_Ropes_feat._Chandler_Jewels_NCS10_Release.mp3",
title: "Ropes NCS",
},
{
url:
"https://cdn.discordapp.com/attachments/905994516719345664/918546211584213023/
Jonth_Tom_Wilson_Facading_MAGNUS_Jagsy_Vosai_RudeLies__Domastic_-
_Heartless_NCS10_Release.mp3",
title: "Heartless NCS",
},
{
url:
"https://cdn.discordapp.com/attachments/905873563490328626/920005714481672212/
Anikdote_-_Turn_It_Up_NCS_Release.mp3",
title: "Turn It Up NCS",
},
{
url:
"https://cdn.discordapp.com/attachments/905873563490328626/920006439999778856/
Unknown_Brain_-_MATAFAKA_feat._Marvin_Divine_NCS_Release.mp3",
title: "MATAFKA NCS",
},
{
url:
"https://cdn.discordapp.com/attachments/905994516719345664/918910823290769458/
koven_never_have_i_felt_this_ncs_release_gqEQ_nIByoK-gucZcxBO.mp3",
title: "Never Have I Felt This NCS",
},
{
url:
"https://cdn.discordapp.com/attachments/905994516719345664/925144953611505714/
Rebel_Scum__Dani_King__Centrix_-_Calm_Before_The_Storm_NCS_Release.mp3",
title: "Calm Before The Storm NCS",
},
];
var currentIndex = 0;
var audio = new Audio(audioFiles[currentIndex].url);
audio.preload = "auto";
audio.volume = 1;
var repeat = false;
var shuffled = false;
function playNext() {
if (shuffled) {
currentIndex = Math.floor(Math.random() * audioFiles.length);
} else if (!repeat) {
currentIndex = (currentIndex + 1) % audioFiles.length;
}
audio.src = audioFiles[currentIndex].url;
audio.play();
playButton.textContent = "Pause";
playButton.style.background = "red";
var trackButtons = document.querySelectorAll(".track-button");
trackButtons.forEach(function (trackButton, index) {
if (index === currentIndex) {
trackButton.classList.add("active");
} else {
trackButton.classList.remove("active");
}
});
}
function formatDuration(duration) {
var minutes = Math.floor(duration / 60);
var seconds = Math.floor(duration % 60);
return minutes + ":" + (seconds < 10 ? "0" : "") + seconds;
}
audio.addEventListener("ended", playNext);
audio.addEventListener("timeupdate", function () {
durationDisplay.textContent =
formatDuration(audio.currentTime) + "/" + formatDuration(audio.duration);
});
var player = document.createElement("div");
player.id = "customAudioPlayer";
player.style =
"position:fixed;top:20%;left:5px;z-
index:10001;background:transparent;padding:20px;border-
radius:10px;width:300px;color:#fff;box-shadow:0px 0px 20px 5px
rgba(0,0,0,0);display:none;flex-direction:column;align-items:center;";
var playButton = document.createElement("button");
playButton.textContent = "Play";
playButton.style =
"margin-top:10px;width:100%;padding:10px;border:none;border-
radius:5px;background-color:green;color:white;cursor:pointer;";
playButton.onclick = function () {
if (audio.paused) {
audio.play();
this.textContent = "Pause";
this.style.background = "red";
} else {
audio.pause();
this.textContent = "Play";
this.style.background = "green";
}
};
let musicV;
player.appendChild(playButton);
var nextButton = document.createElement("button");
nextButton.textContent = "Next";
nextButton.style =
"margin-top:10px;width:100%;padding:10px;border:none;border-
radius:5px;background-color:white;color:black;cursor:pointer;";
nextButton.onclick = playNext;
player.appendChild(nextButton);
var shuffleRepeatContainer = document.createElement("div");
shuffleRepeatContainer.style =
"display:flex;justify-content:space-between;width:100%;margin-top:10px;";
player.appendChild(shuffleRepeatContainer);
var shuffleButton = document.createElement("button");
shuffleButton.textContent = "Shuffle: Off";
shuffleButton.style =
"padding:10px;border:none;border-radius:5px;background-
color:black;color:white;cursor:pointer;width:48%;";
shuffleButton.onclick = function () {
shuffled = !shuffled;
this.textContent = shuffled ? "Shuffle: On" : "Shuffle: Off";
};
shuffleRepeatContainer.appendChild(shuffleButton);
var repeatButton = document.createElement("button");
repeatButton.textContent = "Repeat: Off";
repeatButton.style =
"padding:10px;border:none;border-radius:5px;background-
color:black;color:white;cursor:pointer;width:48%;";
repeatButton.onclick = function () {
repeat = !repeat;
this.textContent = repeat ? "Repeat: On" : "Repeat: Off";
};
shuffleRepeatContainer.appendChild(repeatButton);
var durationDisplay = document.createElement("div");
durationDisplay.style = "margin-top:10px;text-align:center;";
player.appendChild(durationDisplay);
var trackList = document.createElement("div");
trackList.style =
"overflow:auto;max-height:150px;margin-top:20px;border:1px solid #fff;border-
radius:10px;padding:5px;";
audioFiles.forEach(function (track, index) {
var trackButton = document.createElement("button");
trackButton.textContent = track.title;
trackButton.classList.add("track-button");
trackButton.style =
"padding:5px;border:none;border-radius:5px;background-
color:black;color:white;cursor:pointer;width:100%;text-align:left;margin-top:5px;";
trackButton.onclick = function () {
currentIndex = index;
audio.src = track.url;
audio.play();
playButton.textContent = "Pause";
playButton.style.background = "red";
trackButtons.forEach(function (trackButton, i) {
if (i === currentIndex) {
trackButton.classList.add("active");
} else {
trackButton.classList.remove("active");
}
});
};
trackList.appendChild(trackButton);
});
player.appendChild(trackList);
var activeButtonStyle = document.createElement("style");
activeButtonStyle.innerHTML = ".track-button.active{background-color:green;}";
document.head.appendChild(activeButtonStyle);
var madeByLabel = document.createElement("div");
madeByLabel.style = "margin-top:auto;text-align:center;";
player.appendChild(madeByLabel);
document.body.appendChild(player);
document.addEventListener("keydown", function (e) {
if (e.key === "`" && document.activeElement.id.toLowerCase() !== "chatbox") {
player.style.display = player.style.display === "none" ? "flex" : "none";
}
});
$("#chatButton").remove();
document.querySelector("#joinPartyButton").remove();
document.querySelector("#pre-content-container").remove();
document.getElementById("loadingText").style.color = `rgb(51, 51, 51)`;
//document.getElementById("mainMenu").style.backgroundImage =
"url('https://cdn.discordapp.com/attachments/958988020349014016/1206184581162598400
/Untitled5_20240211141610.png?
ex=65db15ed&is=65c8a0ed&hm=28dcf76dd00c5c7282bd6591b2340f0905fc554fed548080ff4aef1d
5520df53&')";
$("#mapDisplay").css({background: `url('https://i.imgur.com/fgFsQJp.png')`});
document.getElementById("storeHolder").style = "height: 410px; width: 450px;"
let antiSync = false;
let topInfoHolder = true;
let myObjectHealth = "#5f9ea0";
let enemyObjectHealth = "#ff6363";
let Fo = -1;
let second = -1;
let highestArr = [];
let highestMs = -1;
let averageArr = [];
let averageMs = -1;
let damageTextColor = "#fff";
let healTextColor = "#8ecc51";
let preplaceDelay = {
killObject: -1,
gatherAnimation: -1,
total: function() {
return (new Date() - Math.abs(Math.trunc(this.killObject -
this.gatherAnimation)));
},
}
let autoPushLine = "#fff";
let useHack = true;
let log = console.log;
let testMode = window.location.hostname == "127.0.0.1";
const buttonL = document.querySelector("#leaderboardButton");
const nameInputElement = document.getElementById("nameInput");
if (nameInputElement) {
nameInputElement.style.color = "#333";
}
buttonL.addEventListener('click', function () {
$("#menuChatDiv").toggle();
$("#menuDiv").hide();
});
document.getElementById('promoImgHolder').style.display = "none";
document.getElementById('promoImgHolder').innerHTML =
`
<style>
#linksContainer2 { background: #ccc; border-top: 5px solid; border-image: linear-
gradient(to right,#333,#333) 1 1 0 0; height: 18px; top: 0%; color: #333;
transition: 0.3s;
} #linksContainer2:hover { background: #ccc; box-shadow: 0 0 20px #333;
} #top-wrap-right { color: #333;
} .check-box {transform: scale(1.1);
} .inParty {display: none;
} input[type="checkbox"] { position: relative; appearance: none; width: 33px;
height: 15.5px; border-radius: 50px; box-shadow: inset 0 0 5px rgba(41, 41, 41,
0.8); cursor: pointer; top: 7.5px; transition: 0.7s;
} input:checked[type="checkbox"] { background: rgba(51, 51, 51);
} input[type="checkbox"]::after { position: absolute; content: ""; width: 15.5px;
height: 15.5px; top: 0; left: 0; background: #fff; border-radius: 50%; box-shadow:
0 0 5px rgba(0, 0, 0, 0.2); transform: scale(1.1); transition: 0.7s;
} input:checked[type="checkbox"]::after { left: 50%;
} .menuCard { background-color: #181818; border-top: 5px solid; border-image:
linear-gradient(to right,#333,#303030) 1 0 0 0; color: #333; margin-top:0px;
border-radius: 0px; border-bottom: 0px solid red; transition: all 1s; transform:
scale(1); box-shadow: 0px 0px #333; transform: translateX(0px);
} .menuCard.active { transform: translateX(0px);
} #adCard { display: none;
} #adCard { display: none;
} #promoImgHolder { overflow-y: scroll; -ms-overflow-style: none; scrollbar-
width: none; height: 90px; max-height: 90px; }
</div><br>
`
document.getElementById("enterGame").addEventListener("click", autohide);
function autohide() {
$("#ot-sdk-btn-floating").hide();
}
$('#subConfirmationElement').click( () => {
try { window.follmoo(); } catch(e){};
localStorage["moofoll"] = "1"; localStorage["moofol"] = "1";
});
$("#gameName").css({
color: "#333",
"text-shadow": "0 1px 0 #181818, 0 2px 0 #181818, 0 3px 0 #181818, 0 4px 0
#181818, 0 5px 0 #181818, 0 6px 0 #181818, 0 7px 0 #181818, 0 8px 0 #181818, 0 9px
0 #181818, rgba(0, 0, 0, 0.4) 1px 1px 40px",
"text-align": "center",
"font-size": "156px",
"margin-bottom": "-30px",
});
$('#linksContainer2').remove();
function getEl(id) {
return document.getElementById(id);
}
let firstConfig = [];
let streamerMode = false;
const HTML = {
newLine: function(amount) {
let text = ``;
for (let i = 0; i < amount; i++) {
text += `<br>`;
}
return text;
},
line: function() {
return `<hr>`;
},
text: function(id, value, size, length) {
return `<input type = "text" id = ${id} size = ${size} value = ${value}
maxlength = ${length}>`;
},
checkBox: function(id, name, checked, rl) {
return `${rl ? name + ` ` : ``}<input type = "checkbox" ${checked ?
`checked` : ``} id = ${id}>${rl ? `` : ` ` + name}`;
},
button: function(id, name, onclick, classs) {
return `<button class = ${classs} id = ${id} onclick = ${onclick}>$
{name}</button>`;
},
select: function(id, selects) {
let text = `<select id = ${id}>`;
selects.forEach((e,i)=>{
text += `<option value = ${e.value} ${e.selected ? ` selected` : ``}>$
{e.name}</option>`;
if (i == selects.length - 1) {
text += `</select>`;
}
}
);
return text;
},
modChange: function(id, selects) {
console.log("test");
},
mod: function(id, selects) {
let text = `<select id = ${id}>`;
selects.forEach((e,i)=>{
text += `<option value = ${e.value + "C"}>${e.name}</option>`;
if (i == selects.length - 1) {
text += `</select> `;
}
if (i == 0) {
firstConfig.push(e.value + "C");
}
}
);
selects.forEach((e,i)=>{
text += `<input type = "checkbox" ${e.checked ? `checked` : ``} id = $
{e.value} style = "${i == 0 ? "display: inline-block;" : "display: none;"}">`;
}
);
return text;
},
hotkey: function(id, value, size, length) {
return `<input type = "text" id = ${id} size = ${size} value = ${value}
maxlength = ${length}><input type = "checkbox" checked id = ${id + "k"}>`;
},
};
function getTabId(el) {
return el.id == "tHome" ? "homeTab" : el.id == "t1" ? "miscTab" : el.id == "t2"
? "configTab" : el.id == "t3" ? "combatTab" : "homeTab";
}
let accEls = {
11: true,
19: true,
13: true,
18: true,
21: true
}
document.body.appendChild(overlay);
let overlayStyles = `
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0);
z-index: 999;
pointer-events: none;
transition: background-color 0.5s ease;
`;
overlay.setAttribute('style', overlayStyles);
});
});
HTML.startDiv({ style: "font-size: 30px; color: #ffffff", id:
"menuHeadLine4", class: "menuClass4" }, (html) => {
HTML.addDiv({ id: "menuRender", style: "display: block", class:
"menuC4", appendID: "menuHeadLine4" }, (html) => {
HTML.addDiv({ style: "font-size: 20px; color: #99ee99;
background-image:
url('https://media.discordapp.net/attachments/1055504047169347707/12069788178019779
16/EdZbgt0pisJYLTgmG9r9hhl_t5lkgTPRx_IinpR47a4.png?
ex=65ddf99e&is=65cb849e&hm=115b0cb3ef4fedfa691307a50ae4ae7eb1d559daa8b2f8f69e3c376a
7ed56e6d&=&format=webp&quality=lossless&width=320&height=320'); background-size:
20px 20px; background-repeat: no-repeat; padding-left: 25px;", appendID:
"menuRender" }, (html) => {
html.add(`Render: `);
html.newLine();
});
html.add(`Sync Type: `);
html.select({
id: "synctype", class: "Cselect", option: {
"Long": {
id: "longsync",
},
"Fast": {
id: "fastsync",
},
}
});
html.newLine();
html.add(`Type: `);
html.selectMenu({ id: "configsChanger6", class: "Cselect",
menu: configs6 });
html.newLine(2);
HTML.addDiv({ style: "font-size: 17px; color: #fff; background-
image:
url('https://media.discordapp.net/attachments/1055504047169347707/12072958281511076
34/lbnIQzE.png?
ex=65df20db&is=65ccabdb&hm=1d81a71c49db6d96d869e1fd36a4c1b8cf61ac9c77f91a8c5f17dd30
df59bf7c&=&format=webp&quality=lossless&width=320&height=320'); background-size:
20px 20px; background-repeat: no-repeat; padding-left: 25px;", appendID:
"menuRender" }, (html) => {
html.add(`Modes: `);
html.select({
id: "modstype", class: "Cselect", option: {
"Permision": {
id: "",
},
}
});
});
});
});
HTML.startDiv({ style: "font-size: 30px; color: #ffffff", id:
"menuHeadLine2", class: "menuClass2" }, (html) => {
HTML.addDiv({ id: "menuOther", class: "menuC2", appendID:
"menuHeadLine2" }, (html) => {
HTML.addDiv({ style: "font-size: 20px; color: #99ee99;
background-image:
url('https://media.discordapp.net/attachments/1055504047169347707/12069506404217077
76/meko_eaten_hat_in_moomoo_io__gift__by_alextox_shatox_dfptbvx-fullview.png?
ex=65dddf60&is=65cb6a60&hm=774ca1e9af2b472a9abf99b4ffba727cab694b08111df589a5715337
ec5c78ce&=&format=webp&quality=lossless&width=320&height=320'); background-size:
20px 20px; background-repeat: no-repeat; padding-left: 25px;", appendID:
"menuOther" }, (html) => {
html.add(`Misc: `);
html.newLine();
});
html.newLine();
html.add(`Auto Upgrade Type: `);
html.select({
id: "autoupDate", class: "Cselect", option: {
"Smart": {
id: "basic",
selected: true
},
"KH": {
id: "khup",
},
"SM": {
id: "smup",
},
}
});
html.newLine();
html.button({ class: "menuB", innerHTML: "TurnSpeed", onclick:
"window.toggleVisualTurn()" });
html.button({ class: "menuB", innerHTML: "AutoBot", onclick:
"window.AutoBot()" });
html.button({ class: "menuB", innerHTML: "Board", onclick:
"window.Leaderboard()" });
html.newLine(2);
HTML.addDiv({ style: "font-size: 17px; color: #fff; background-
image:
url('https://media.discordapp.net/attachments/1055504047169347707/12083056622121861
54/latest.png?
ex=65e2cd57&is=65d05857&hm=51ccab99264611a4cdf8c96eeb89a7ee1b632329cdc9d032c01a07f3
8fbcd977&=&format=webp&quality=lossless&width=320&height=320'); background-size:
20px 20px; background-repeat: no-repeat; padding-left: 25px;", appendID:
"menuOther" }, (html) => {
html.add(`Defense: `);
html.select({
id: "defensemode", class: "Cselect", option: {
"Emp": {
id: "empmode",
selected: true
},
"Soldier": {
id: "soldiermode",
},
}
});
});
});
});
HTML.startDiv({ style: "font-size: 30px; color: #ffffff", id:
"menuHeadLine3", class: "menuClass3" }, (html) => {
HTML.addDiv({ id: "menuvisual", style: "display: block", class:
"menuC3", appendID: "menuHeadLine3" }, (html) => {
HTML.addDiv({ style: "font-size: 20px; color: #99ee99;
background-image:
url('https://media.discordapp.net/attachments/1055504047169347707/12069500451659530
84/250.png?
ex=65ddded2&is=65cb69d2&hm=a46e062d9d8786074e53ac88733c8376389cd89131f03d44fb74cc84
0795cf13&=&format=webp&quality=lossless&width=312&height=312'); background-size:
20px 20px; background-repeat: no-repeat; padding-left: 25px;", appendID:
"menuvisual" }, (html) => {
html.add(`Visual: `);
html.newLine();
});
html.add(`Time Type: `);
html.select({
id: "timeType", class: "Cselect", option: {
"Morning": {
id: "morningt",
},
"Day": {
id: "daytt",
selected: true
},
"AfterNoon": {
id: "afternoont",
},
"Evening": {
id: "eveningt",
},
"Night": {
id: "nightt",
},
}
});
html.newLine();
html.add(`Visual Type: `);
html.select({
id: "visualType", class: "Cselect", option: {
"Ae86": {
id: "aevisuals",
selected: true
},
"FZ": {
id: "fz",
},
}
});
html.newLine();
html.add(`Player: `);
html.selectMenu({ id: "configsChanger4", class: "Cselect",
menu: configs4 });
html.newLine();
html.add(`Just: `);
html.selectMenu({ id: "configsChanger5", class: "Cselect",
menu: configs5 });
html.newLine();
});
});
let trueM = true;
let Soldier = 6;
let AntiBull = false;
let bultect = false;
let instaType = true;
let crossHair = false;
let plaguemask = true;
let PrePlaceCount = 0;
let menuChatDiv = document.createElement("div");
menuChatDiv.id = "menuChatDiv";
document.body.appendChild(menuChatDiv);
HTML.set("menuChatDiv");
HTML.setStyle(`
position: absolute;
display: none;
left: 20px;
top: 20px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0);
`);
HTML.resetHTML();
HTML.setCSS(`
.chDiv {
color: #fff;
padding: 10px;
width: 300px;
height: 160px;
background-color: rgba(34, 34, 34, 0.5);
font-family: "Courier New", monospace;
border-radius: 15px;
box-shadow: -5px -5px 15px rgba(255, 255, 255, 0.1),
5px 5px 15px rgba(0, 0, 0, 0.35);
transition: all 3s ease-in-out;
}
.chMainDiv {
font-family: "Ubuntu";
font-size: 16px;
max-height: 165px;
overflow-y: scroll;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
overflow-x: hidden;
scrollbar-width: thin;
scrollbar-color: rgba(255, 255, 255, 0.5) rgba(255, 255, 255, 0.1);
border-radius: 10px;
}
.chMainDiv::-webkit-scrollbar {
width: 8px;
}
.chMainDiv::-webkit-scrollbar-thumb {
background-color: rgba(255, 255, 255, 0.5);
border-radius: 10px;
}
.chMainDiv::-webkit-scrollbar-thumb:hover {
background-color: rgba(255, 255, 255, 0.7);
}
.chMainBox {
position: absolute;
left: 10px;
bottom: 10px;
width: 380px;
height: 25px;
background-color: rgba(255, 255, 255, 0.1);
border-radius: 16px;
color: rgba(255, 255, 255, 0.75);
font-family: "Courier New", monospace;
font-size: 12px;
border: none;
outline: none;
}
`);
HTML.startDiv({ id: "mChDiv", class: "chDiv" }, (html) => {
HTML.addDiv({ id: "mChMain", class: "chMainDiv", appendID: "mChDiv"
}, (html) => {
});
});
let menuChats = getEl("mChMain");
let menuCBFocus = false;
let menuChCounts = 0;
function addChatLog(e, c, d, v) {
HTML.set("menuChatDiv");
let chatLogs = document.getElementById("mChMain");
const now = new Date();
const hours = now.getHours();
const minutes = now.getMinutes();
const ampm = hours >= 12 ? 'PM' : 'AM';
const formattedHours = (hours % 12 || 12).toString();
const formattedMinutes = minutes.toString().padStart(2, '0');
let time = `${formattedHours}:${formattedMinutes} ${ampm}`;
let a = document.createElement('div');
a.className = 'chatEntry';
chatLogs.appendChild(a);
chatLogs.scrollTop = chatLogs.scrollHeight;
}
let mStatus = document.createElement("div");
mStatus.id = "status";
getEl("gameUI").appendChild(mStatus);
HTML.set("status");
HTML.resetHTML();
HTML.setCSS(`
.sizing {
font-size: 15px;
display: block;
position: absolute;
color: #ddd;
font-family: 'Hammersmith One';
bottom: 155px;
left: 20px;
}
.sizingTime {
font-size: 15px;
display: block;
position: absolute;
color: #ddd;
font-family: 'Hammersmith One';
top: 77px;
right: 270px;
}
.sizingInfo {
font-size: 15px;
display: block;
position: absolute;
color: #ddd;
font-family: 'Hammersmith One', sans-serif;
bottom: 168px;
right: 20px;
background-color: rgba(0, 0, 0, 0.25);
padding: 5px;
border-radius: 4px;
}
.sizingInfo2 {
font-size: 15px;
display: block;
position: absolute;
color: #ddd;
font-family: 'Hammersmith One', sans-serif;
bottom: 130px;
right: 20px;
background-color: rgba(0, 0, 0, 0.25);
padding: 5px;
border-radius: 4px;
}
.mod {
font-size: 15px;
display: inline-block;
}
.modTime {
font-size: 15px;
display: inline-block;
}
.modInfo {
font-size: 15px;
display: inline-block;
}
.modInfo2 {
font-size: 15px;
display: inline-block;
}
`);
HTML.startDiv({ id: "happymodTime", class: "sizingTime" }, (html) => {
HTML.addDiv({ id: "Time", class: "modInfo", appendID:
"happymodTime" }, (html) => {
});
});
HTML.startDiv({ id: "happymodInfo", class: "sizingInfo" }, (html) => {
HTML.addDiv({ id: "InfoAll", class: "modInfo", appendID:
"happymodInfo" }, (html) => {
});
});
HTML.startDiv({ id: "happymodInfo2", class: "sizingInfo2" }, (html) =>
{
HTML.addDiv({ id: "fpstimer", class: "modInfo2", appendID:
"happymodInfo2" }, (html) => {
});
});
HTML.startDiv({ id: "happymod", class: "sizing" }, (html) => {
HTML.addDiv({ id: "Music", class: "mod", appendID: "happymod" },
(html) => {
});
html.newLine();
HTML.addDiv({ id: "pingFps", class: "mod", appendID: "happymod" },
(html) => {
});
html.newLine();
HTML.addDiv({ id: "packetStatus", class: "mod", appendID:
"happymod" }, (html) => {
html.add("None");
});
});
let openMenu = false;
let WS = undefined;
let socketID = undefined;
let secPacket = 0;
let secMax = 110;
let secTime = 1000;
let firstSend = {
sec: false
};
let game = {
tick: 0,
tickQueue: [],
tickBase: function(set, tick) {
if (this.tickQueue[this.tick + tick]) {
this.tickQueue[this.tick + tick].push(set);
} else {
this.tickQueue[this.tick + tick] = [set];
}
},
tickRate: (1000 / config.serverUpdateRate),
tickSpeed: 0,
lastTick: performance.now()
};
setInterval(() => {
secPacket = 0;
}, 1000);
let modConsole = [];
let dontSend = false;
let fpsTimer = {
last: 0,
time: 0,
ltime: 0
}
let lastMoveDir = undefined;
let lastsp = ["cc", 1, "__proto__"];
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;
let data = new Uint8Array(message);
let parsed = window.msgpack.decode(data);
let type = parsed[0];
data = parsed[1];
if (type == "6") {
if (data[0]) {
let tmpString;
data[0] = data[0].slice(0, 30);
}
} else if (type == "L") {
data[0] = data[0] + (String.fromCharCode(0).repeat(7));
data[0] = data[0].slice(0, 7);
} else if (type == "M") {
data[0].name = (data[0].name == "" ? "unknown" :
data[0].name);
data[0].moofoll = true;
data[0].skin = data[0].skin == 10 ? "__proto__" :
data[0].skin;
lastsp = [data[0].name, data[0].moofoll, data[0].skin];
} else if (type == "D") {
if ((my.lastDir == data[0]) || [null,
undefined].includes(data[0])) {
dontSend = true;
} else {
my.lastDir = data[0];
}
} else if (type == "d") {
if (!data[2]) {
dontSend = true;
} else {
if (![null, undefined].includes(data[1])) {
my.lastDir = data[1];
}
}
} else if (type == "K") {
if (!data[1]) {
dontSend = true;
}
} else if (type == "S") {
instaC.wait = !instaC.wait;
dontSend = true;
} else if (type == "a") {
if (data[1]) {
if (player.moveDir == data[0]) {
dontSend = true;
player.randDIff = Math.random * Math.PI * 2;
}
player.moveDir = data[0];
} else {
dontSend = true;
}
}
if (!dontSend) {
let binary = window.msgpack.encode([type, data]);
this.nsend(binary);
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,
Y: remProjectile,
2: allianceNotification,
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);
}
}
}
Math.lerpAngle = function(value1, value2, amount) {
let difference = Math.abs(value2 - value1);
if (difference > Math.PI) {
if (value1 > value2) {
value2 += Math.PI * 2;
} else {
value1 += Math.PI * 2;
}
}
let value = value2 + ((value1 - value2) * amount);
if (value >= 0 && value <= Math.PI * 2) return value;
return value % (Math.PI * 2);
};
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;
};
let allChats = [];
let ais = [];
let players = [];
let alliances = [];
let alliancePlayers = [];
let allianceNotifications = [];
let gameObjects = [];
let projectiles = [];
let deadPlayers = [];
let breakObjects = [];
let player;
let playerSID;
let tmpObj;
let enemy = [];
let nears = [];
let near = [];
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: {}
}
this.update = function(delta) {
if (this.life) {
this.life -= delta;
this.y -= this.speed * delta;
this.scale += this.scaleSpeed * delta;
if (this.scale >= this.maxScale) {
this.scale = this.maxScale;
this.scaleSpeed *= -1;
} else if (this.scale <= this.startScale) {
this.scale = this.startScale;
this.scaleSpeed = 0;
}
if (this.life <= 0) {
this.life = 0;
}
}
};
// AI MANAGER:
constructor(ais, AI, players, items, objectManager, config, UTILS,
scoreCallback, server) {
// AI TYPES:
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]
}];
// SPAWN AI:
this.spawn = function (x, y, dir, index) {
let tmpObj = ais.find((tmp) => !tmp.active);
if (!tmpObj) {
tmpObj = new AI(ais.length, objectManager, players,
items, UTILS, config, scoreCallback, server);
ais.push(tmpObj);
}
tmpObj.init(x, y, dir, index, this.aiTypes[index]);
return tmpObj;
};
}
};
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);
this.init = function(x, y, dir, index, data) {
this.x = x;
this.y = y;
this.xVel = 0;
this.yVel = 0;
this.zIndex = 0;
this.dir = dir;
this.dirPlus = 0;
this.index = index;
this.src = data.src;
if (data.name) this.name = data.name;
this.weightM = data.weightM;
this.speed = data.speed;
this.killScore = data.killScore;
this.turnSpeed = data.turnSpeed;
this.scale = data.scale;
this.maxHealth = data.health;
this.leapForce = data.leapForce;
this.health = this.maxHealth;
this.chargePlayer = data.chargePlayer;
this.viewRange = data.viewRange;
this.drop = data.drop;
this.dmg = data.dmg;
this.hostile = data.hostile;
this.dontRun = data.dontRun;
this.hitRange = data.hitRange;
this.hitDelay = data.hitDelay;
this.hitScare = data.hitScare;
this.spriteMlt = data.spriteMlt;
this.nameScale = data.nameScale;
this.colDmg = data.colDmg;
this.noTrap = data.noTrap;
this.spawnDelay = data.spawnDelay;
this.hitWait = 0;
this.waitCount = 1000;
this.moveCount = 0;
this.targetDir = 0;
this.active = true;
this.alive = true;
this.runFrom = null;
this.chargeTarget = null;
this.dmgOverTime = {};
};
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.tails = {};
for (let i = 0; i < accessories.length; ++i) {
if (accessories[i].price <= 0)
this.tails[accessories[i].id] = 1;
}
this.skins = {};
for (let i = 0; i < hats.length; ++i) {
if (hats[i].price <= 0)
this.skins[hats[i].id] = 1;
}
this.points = 0;
this.dt = 0;
this.hidden = false;
this.itemCounts = {};
this.isPlayer = true;
this.pps = 0;
this.moveDir = undefined;
this.randDIff = Math.random * Math.PI * 2;
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.circle = false;
this.circleRad = 200;
this.cAngle = 0;
this.spawn = function(moofoll) {
this.attacked = false;
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.maxShameCount = 0;
this.deathDir = Math.random() * Math.PI * 2;
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 = 4;
};
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;
plaguemask = true;
setTimeout(() => {
plaguemask = false;
}, 1000);
} else if(this.poisonTimer >= 0) {
plaguemask = false;
}
};
this.update = function(delta) {
if (this.alive) {
if (this.health != this.healthMov) {
this.health < this.healthMov ? (this.healthMov -=
2) : (this.healthMov += 2);
if (Math.abs(this.health - this.healthMov) < 2)
this.healthMov = this.health;
};
if (this.shameCount != this.shameMov) this.shameCount <
this.shameMov ? (this.shameMov -= .1) : (this.shameMov += .1),
Math.abs(this.shameCount - this.shameMov) < .1 && (this.shameMov =
this.shameCount);
}
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;
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(didHit, index) {
this.animTime = this.animSpeed =
items.weapons[index].speed;
this.targetAngle = (didHit ? -config.hitAngle : -Math.PI);
tmpRatio = 0;
animIndex = 0;
};
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() {
if (this.oldHealth < this.health) {
if (this.hitTime) {
let timeSinceHit = Date.now() - this.hitTime;
this.lastHit = game.tick;
this.hitTime = 0;
if (timeSinceHit < 120) {
this.shameCount++;
} else {
this.shameCount = Math.max(0, this.shameCount -
2);
}
}
} else if (this.oldHealth > this.health) {
this.hitTime = Date.now();
}
};
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] - game.tickRate);
if (this == player) {
if (configs3.WeaponGrinder) {
for (let i = 0; i < Math.PI * 2; i +=
Math.PI / 2) {
checkPlace(player.getItemType(22),
i);
}
}
}
if (this.reloads[this.primaryIndex] < 1 ||
this.reloads[this.weaponIndex] < 1) {
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 ? 50 :
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;
}
}
};
}
};
let hatElement = document.getElementById("hatdisp22");
hatElement.onclick = function() {
storeBuy(22, 0);
};
let hatElement2 = document.getElementById("hatdisp7");
hatElement2.onclick = function() {
storeBuy(7, 0);
};
let hatElement3 = document.getElementById("hatdisp6");
hatElement3.onclick = function() {
storeBuy(6, 0);
};
let hatElement4 = document.getElementById("hatdisp40");
hatElement4.onclick = function() {
storeBuy(40, 0);
};
let hatElement5 = document.getElementById("hatdisp21");
hatElement5.onclick = function() {
storeBuy(21, 0);
};
let hatElement6 = document.getElementById("hatdisp12");
hatElement5.onclick = function() {
storeBuy(12, 0);
};
let hatElement7 = document.getElementById("hatdisp56");
hatElement5.onclick = function() {
storeBuy(56, 0);
};
let accElement = document.getElementById("accdisp19");
accElement.onclick = function() {
storeBuy(19, 1);
};
let accElement1 = document.getElementById("accdisp18");
accElement1.onclick = function() {
storeBuy(18, 1);
};
let accElement2 = document.getElementById("accdisp21");
accElement2.onclick = function() {
storeBuy(21, 1);
};
function sendUpgrade(index) {
player.reloads[index] = 0;
packet("H", index);
}
function storeEquip(id, index) {
packet("c", 0, id, index);
}
function storeBuy(id, index) {
packet("c", 1, id, index);
}
function buyEquip(id, index) {
let nID = player.skins[6] ? Soldier : 0;
if (player.alive && inGame) {
if (index == 0) {
if (player.skins[id]) {
if (player.latestSkin != id) {
packet("c", 0, id, 0);
}
} else {
if (configs.autoBuyEquip) {
let find = findID(hats, id);
if (find) {
if (player.points >= find.price) {
packet("c", 1, id, 0);
packet("c", 0, id, 0);
} else {
if (player.latestSkin != nID) {
packet("c", 0, nID, 0);
}
}
} else {
if (player.latestSkin != nID) {
packet("c", 0, nID, 0);
}
}
} else {
if (player.latestSkin != nID) {
packet("c", 0, nID, 0);
}
}
}
} else if (index == 1) {
if (player.tails[id]) {
if (player.latestTail != id) {
packet("c", 0, id, 1);
}
} else {
if (configs.autoBuyEquip) {
let find = findID(accessories, id);
if (find) {
if (player.points >= find.price) {
packet("c", 1, id, 1);
packet("c", 0, id, 1);
} else {
if (player.latestTail != 0) {
packet("c", 0, 0, 1);
}
}
} else {
if (player.latestTail != 0) {
packet("c", 0, 0, 1);
}
}
} else {
if (player.latestTail != 0) {
packet("c", 0, 0, 1);
}
}
}
}
}
}
function selectToBuild(index, wpn) {
packet("G", index, wpn);
}
function selectWeapon(index, isPlace) {
if (!isPlace) {
player.weaponCode = index;
}
packet("G", index, 1);
}
function sendAutoGather() {
packet("K", 1, 1);
}
function sendAtck(id, angle) {
packet("d", id, angle, 1);
}
function toRadian(angle) {
let fixedAngle = (angle % 360) * (Math.PI / 180);
return fixedAngle < 0 ? (2 * Math.PI + fixedAngle) : fixedAngle;
}
function getDist(e, t) {
try {
return Math.hypot((t.y2 || t.y) - (e.y2 || e.y), (t.x2 || t.x)
- (e.x2 || e.x));
} catch (e) {
return Infinity;
}
}
function getDir(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;
}
}
function sortFromSmallest(arr, func) {
func = typeof func == "function" ? func : (obj) => {
return obj
};
return arr.sort((two, one) => (func(two)) - func(one));
}
function getCloseBuildings() {
let buildings = [];
let addedBefore = {};
let filteredBuildings = objectManager.getGridArrays(player.x,
player.y, 200);
for (var x = 0; x < filteredBuildings.length; ++x) {
for (var y = 0; y < filteredBuildings[x].length; ++y) {
if (filteredBuildings[x][y].active) {
buildings.push(filteredBuildings[x][y]);
}
}
}
return buildings;
}
function quadSpikeBreak(user, item) {
try {
let angles = [];
let possibleOnes = [];
for (let angle = 0; angle < 72; angle++) {
angles.push(toRadian(angle * 5));
}
let buildings_ = sortFromSmallest(gameObjects.filter(t =>
t.active && t.sid != player.inTrap.sid && getDist(player, t) <= 150), (a)=>{
return getDist(player, a);
});
let last = null;
for (let angle of angles) {
let position = player.buildItemPosition(item, angle);
let possibleToPlace = true;
if (18 != item.id && position.y >= config.mapScale / 2 -
config.riverWidth / 2 && position.y <= config.mapScale / 2 + config.riverWidth / 2)
{
possibleToPlace = false;
} else if(last && getDist(last, position) < item.scale +
(last.blocker ? last.blocker : last.getScale(0.6, last.isItem))){
possibleToPlace = false;
} else {
for (let building of buildings_) {
let range = building.blocker ? building.blocker :
building.getScale(0.6, building.isItem);
if (getDist(building, position) < item.scale +
range) {
possibleToPlace = false;
last = building;
break;
}
}
}
if (possibleToPlace) {
possibleOnes.push(angle);
}
}
return possibleOnes;
} catch (e) {
}
}
function getPlaceablePositions(user, item) {
try {
let angles = [];
let possibleOnes = [];
for (let angle = 0; angle < 72; angle++) {
angles.push(toRadian(angle * 5));
}
let buildings_ = [];
if (!window.isMohMoh) {
buildings_ = sortFromSmallest(gameObjects.filter(t =>
t.active && getDist(player, t) <= 150), (a)=>{
return getDist(player, a);
});
}
let last = null;
for (let angle of angles) {
let position = player.buildItemPosition(item, angle);
let possibleToPlace = true;
if (18 != item.id && position.y >= config.mapScale / 2 -
config.riverWidth / 2 && position.y <= config.mapScale / 2 + config.riverWidth / 2)
{
possibleToPlace = false;
} else if(last && getDist(last, position) < item.scale +
(last.blocker ? last.blocker : last.getScale(0.6, last.isItem))){
possibleToPlace = false;
} else if (true) {
for (let building of buildings_) {
let range = building.blocker ? building.blocker :
building.getScale(0.6, building.isItem);
if (getDist(building, position) < item.scale +
range) {
possibleToPlace = false;
last = building;
break;
}
}
}
if (possibleToPlace) {
possibleOnes.push(angle);
}
}
return possibleOnes;
} catch (e) {
}
}
let firstCheckPlaceForntiBUg = false;
function simplePlace(id, radian) {
checkPlace(id, radian);
};
this.autoPlace = function () {
try {
if (configs.autoPlace) {
const nearEnemyDist2 = near.dist2;
const trap1 = gameObjects
.filter((e) => e.trap && e.active)
.sort((a, b) => UTILS.getDist(a, near, 0, 2) -
UTILS.getDist(b, near, 0, 2))
.find((trap) => {
const trapDist = Math.hypot(trap.y - near.y2,
trap.x - near.x2);
return (
trap !== player &&
(player.sid === trap.owner.sid ||
findAllianceBySid(trap.owner.sid)) &&
trapDist <= 50
);
});
if (trap1 && nearEnemyDist2 <= 160) {
const trapX = trap1.x;
const trapY = trap1.y;
const circleRadius = 102;
const numPositions = 64;
for (let i = 0; i < numPositions; i++) {
const angle = (2 * Math.PI * i) /
numPositions;
const offsetX = trapX + circleRadius *
Math.cos(angle);
const offsetY = trapY + circleRadius *
Math.sin(angle);
const position = [offsetX, offsetY];
const distToPlayer = Math.hypot(position[0]
- player.x2, position[1] - player.y2);
if (
!
placedSpikePositions.has(JSON.stringify(position)) &&
isPositionValid(position) &&
distToPlayer <= 87
) {
const angleToPlace =
Math.atan2(position[1] - player.y2, position[0] - player.x2);
checkPlace(2, angleToPlace);
placedSpikePositions.add(JSON.stringify(position));
}
}
} else if (!trap1 && nearEnemyDist2 <= 206) {
placedSpikePositions.clear();
const maxTrapsToPlace = 3;
const trapRadius = 50;
const trapPositions =
calculatePossibleTrapPositions(player.x2, player.y2, trapRadius);
let trapsPlaced = 0;
for (const position of trapPositions) {
if (
trapsPlaced < maxTrapsToPlace &&
!
placedTrapPositions.has(JSON.stringify(position)) &&
isPositionValid(position)
) {
checkPlace(4, ...position);
placedTrapPositions.add(JSON.stringify(position));
trapsPlaced++;
checkPlace(2, near.aim2);
}
}
}
}
} catch (e) {}
};
this.replacer = function (findObj) {
const trap1 = gameObjects
.filter((e) => e.trap && e.active)
.sort((a, b) => UTILS.getDist(a, near, 0, 2) -
UTILS.getDist(b, near, 0, 2))
.find((trap) => {
const trapDist = Math.hypot(trap.y - near.y2, trap.x -
near.x2);
return (
trap !== player &&
(player.sid === trap.owner.sid ||
findAllianceBySid(trap.owner.sid)) &&
trapDist <= 50
);
});
if (!findObj || !configs.autoReplace) return;
if (!inGame) return;
if (this.antiTrapped) return;
if (configs3.WeaponGrinder && objDst <=
items.weapons[player.weaponIndex].range + player.scale) return;
let objDst = UTILS.getDist(findObj, player, 0, 2);
let objAim = UTILS.getDirect(findObj, player, 0, 2);
if (objDst <= 400 && near.dist2 <= 400) {
if (near.dist2 < 250) {
for(let i = 0; i < Math.PI*2;i += Math.PI/9){
checkPlace(2, near.aim2 + i);
}
} else {
for(let i = 0; i < Math.PI*2;i += Math.PI/9){
checkPlace(4, near.aim2 + i);
}
}
this.replaced = true;
}
};
}
};
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.syncHit = true;
this.changeType = function(type) {
this.wait = false;
this.isTrue = true;
my.autoAim = true;
buyEquip(18, 1);
game.tickBase(() => {
if (type == "rev") {
selectWeapon(player.weapons[1]);
buyEquip(53, 0);
sendAutoGather();
game.tickBase(() => {
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 1);
}, 1);
} else if (type == "nobull") {
selectWeapon(player.weapons[0]);
buyEquip(6, 0);
sendAutoGather();
game.tickBase(() => {
if (near.skinIndex == 22) {
buyEquip(6, 0);
} else {
buyEquip(53, 0);
}
selectWeapon(player.weapons[1]);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 1);
}, 1);
} else if (type == "normal") {
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
sendAutoGather();
game.tickBase(() => {
selectWeapon(player.weapons[1]);
buyEquip(53, 0);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 1);
}, 1);
} else {
setTimeout(() => {
this.isTrue = false;
my.autoAim = false;
}, 70);
}
}, 1);
};
this.SyncHitType = function () {
this.isTrue = true;
my.autoAim = true;
selectWeapon(player.weapons[0]);
buyEquip(Wings, 1);
buyEquip(7, 0);
sendAutoGather();
game.tickBase(() => {
if (player.reloads[53] == 0) {
selectWeapon(player.weapons[0]);
buyEquip(Wings, 1);
buyEquip(6, 0);
game.tickBase(() => {
buyEquip(6, 0);
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 1);
} else {
buyEquip(6, 0);
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}
}, 1);
};
this.spikeTickType = function () {
this.isTrue = true;
my.autoAim = true;
selectWeapon(player.weapons[0]);
buyEquip(Wings, 1);
buyEquip(7, 0);
sendAutoGather();
game.tickBase(() => {
if (player.reloads[53] == 0) {
selectWeapon(player.weapons[0]);
buyEquip(Wings, 1);
buyEquip(53, 0);
game.tickBase(() => {
buyEquip(6, 0);
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 1);
} else {
buyEquip(6, 0);
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}
}, 1);
};
this.syncTry = function() {
if (player.weapons[1] == 15) {
if (getEl("synctype").value == "longsync") {
this.isTrue = true;
my.autoAim = true;
buyEquip(29, 0);
game.tickBase(() => {
buyEquip(1, 0);
}, 1);
game.tickBase(() => {
buyEquip(53, 0);
}, 2);
game.tickBase(() => {
instaC.isTrue = true;
selectWeapon(player.weapons[1]);
buyEquip(18, 1);
if(player.skins[20]) {
buyEquip(20, 0);
} else {
buyEquip(1, 0);
}
sendAutoGather();
game.tickBase(() => {
if(player.skins[20]) {
buyEquip(20, 0);
} else {
buyEquip(1, 0);
}
selectWeapon(player.weapons[0]);
my.autoAim = false;
instaC.isTrue = false;
this.isTrue = false;
sendAutoGather();
}, 1);
}, 4);
} else {
this.isTrue = true;
my.autoAim = true;
buyEquip(53, 0);
game.tickBase(() => {
instaC.isTrue = true;
selectWeapon(player.weapons[1]);
buyEquip(18, 1);
sendAutoGather();
game.tickBase(() => {
selectWeapon(player.weapons[0]);
my.autoAim = false;
instaC.isTrue = false;
this.isTrue = false;
sendAutoGather();
}, 1);
}, 2);
}
}
};
this.counterType = function() {
this.isTrue = true;
my.autoAim = true;
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
buyEquip(Wings, 1);
sendAutoGather();
game.tickBase(() => {
buyEquip(7, 0);
if (player.reloads[53] == 0) {
buyEquip(53, 0);
selectWeapon(player.weapons[0]);
buyEquip(53, 0);
buyEquip(Wings, 1);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 1);
} else {
buyEquip(7, 0);
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}
}, 1);
};
this.bowInsta = function(type) {
this.isTrue = true;
my.autoAim = true;
selectWeapon(player.weapons[1]);
sendAutoGather();
sendUpgrade(38);
buyEquip(53, 0);
buyEquip(19, 1);
game.tickBase(() => {
sendUpgrade(12);
selectWeapon(player.weapons[1]);
buyEquip(1, 0);
buyEquip(19, 1);
game.tickBase(() => {
sendUpgrade(15);
selectWeapon(player.weapons[1]);
buyEquip(1, 0);
buyEquip(19, 1);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 1);
}, 1);
}, 1);
};
this.spikeTickType = function() {
this.isTrue = true;
my.autoAim = true;
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
buyEquip(Wings, 1);
sendAutoGather();
game.tickBase(() => {
buyEquip(7, 0);
selectWeapon(player.weapons[0]);
buyEquip(53, 0);
buyEquip(53, 0);
buyEquip(Wings, 1);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
buyEquip(Soldier, 0);
}, 3);
}, 1);
},
this.perfCheck = function(pl, nr) {
if(nr.weaponIndex == 7) {
Soldier = 26;
} else {
Soldier = 6
}
if (nr.weaponIndex == 11 && UTILS.getAngleDist(nr.aim2 +
Math.PI, nr.d2) <= config.shieldAngle) return false;
if (![9, 12, 13, 15].includes(player.weapons[1])) return
true;
let pjs = {
x: nr.x2 + (70 * Math.cos(nr.aim2 + Math.PI)),
y: nr.y2 + (70 * Math.sin(nr.aim2 + Math.PI))
};
if (UTILS.lineInRect(pl.x2 - pl.scale, pl.y2 - pl.scale,
pl.x2 + pl.scale, pl.y2 + pl.scale, pjs.x, pjs.y, pjs.x, pjs.y)) {
return true;
}
let finds = ais.filter(tmp => tmp.visible).find((tmp) => {
if (UTILS.lineInRect(tmp.x2 - tmp.scale, tmp.y2 -
tmp.scale, tmp.x2 + tmp.scale, tmp.y2 + tmp.scale, pjs.x, pjs.y, pjs.x, pjs.y)) {
return true;
}
});
if (finds) return false;
finds = gameObjects.filter(tmp => tmp.active).find((tmp) =>
{
let tmpScale = tmp.getScale();
if (!tmp.ignoreCollision && UTILS.lineInRect(tmp.x -
tmpScale, tmp.y - tmpScale, tmp.x + tmpScale, tmp.y + tmpScale, pjs.x, pjs.y,
pjs.x, pjs.y)) {
return true;
}
});
if (finds) return false;
return true;
}
}
};
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(3);
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 tmpList = [];
let UTILS = new Utils();
let items = new Items();
let objectManager = new Objectmanager(GameObject, gameObjects, UTILS,
config);
let store = new Store();
let hats = store.hats;
let accessories = store.accessories;
let projectileManager = new ProjectileManager(Projectile, projectiles,
players, ais, objectManager, items, config, UTILS);
let aiManager = new AiManager(ais, AI, players, items, null, config,
UTILS);
let textManager = new Textmanager();
let traps = new Traps(UTILS, items);
let instaC = new Instakill();
let autoBuy = new Autobuy([40, 15, 31, 6, 7], [11, 21]);
let autoUpgrade = new Autoupgrade();
let lastDeath;
let minimapData;
let mapMarker = {};
let mapPings = [];
let tmpPing;
let breakTrackers = [];
let pathFindTest = 0;
let grid = [];
let pathFind = {
active: true,
grid: 8,
scale: 40,
x: 14400,
y: 14400,
chaseNear: false,
array: [],
lastX: this.grid / 2,
lastY: this.grid / 2
};
function sendChat(message) {
packet("6", message.slice(0, 30));
}
let runAtNextTick = [];
function checkProjectileHolder(x, y, dir, range, speed, indx, layer,
sid) {
let weaponIndx = indx == 0 ? 9 : indx == 2 ? 12 : indx == 3 ? 13 :
indx == 5 && 15;
let projOffset = config.playerScale * 2;
let projXY = {
x: indx == 1 ? x : x - projOffset * Math.cos(dir),
y: indx == 1 ? y : y - projOffset * Math.sin(dir),
};
let nearPlayer = players.filter((e) => e.visible &&
UTILS.getDist(projXY, e, 0, 2) <= e.scale).sort(function(a, b) {
return UTILS.getDist(projXY, a, 0, 2) - UTILS.getDist(projXY,
b, 0, 2);
})[0];
if (nearPlayer) {
if (indx == 1) {
nearPlayer.shooting[53] = 1;
} else {
nearPlayer.shootIndex = weaponIndx;
nearPlayer.shooting[1] = 1;
antiProj(nearPlayer, dir, range, speed, indx, weaponIndx);
}
}
}
let projectileCount = 0;
let Tail = 11;
let tails;
let Wings = 0;
function antiProj(tmpObj, dir, range, speed, index, weaponIndex) {
if (!tmpObj.isTeam(player)) {
tmpDir = UTILS.getDirect(player, tmpObj, 2, 2);
if (UTILS.getAngleDist(tmpDir, dir) <= 0.2) {
tmpObj.bowThreat[weaponIndex]++;
if (index == 5) {
projectileCount++;
}
setTimeout(() => {
tmpObj.bowThreat[weaponIndex]--;
if (index == 5) {
projectileCount--;
}
}, range / speed);
if (tmpObj.bowThreat[9] >= 1 && (tmpObj.bowThreat[12] >= 1
|| tmpObj.bowThreat[15] >= 1)) {
place(1, tmpObj.aim2);
my.anti0Tick = 4;
if (!my.antiSync) {
io.send("6", "sync is homo");
antiSyncHealing(4);
}
} else {
if (projectileCount >= 2) {
place(1, tmpObj.aim2);
my.anti0Tick = 4;
if (!my.antiSync) {
io.send("6", "sync is homo");
antiSyncHealing(4);
}
}
}
}
}
}
function showItemInfo(item, isWeapon, isStoreItem) {
if (player && item) {
UTILS.removeAllChildren(itemInfoHolder);
itemInfoHolder.classList.add("visible");
itemInfoHolder.remove();
UTILS.generateElement({
id: "itemInfoName",
text: UTILS.capitalizeFirst(item.name),
parent: itemInfoHolder
});
UTILS.generateElement({
id: "itemInfoDesc",
text: item.desc,
parent: itemInfoHolder
});
if (isStoreItem) {
} 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();
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) {
buyEquip(Wings, 1);
buyEquip(7, 0);
clicks.left = true;
} else if (e.button == 1) {
clicks.middle = true;
} else if (e.button == 2) {
buyEquip(Wings, 1);
buyEquip(40, 0);
clicks.right = true;
}
}
}
mals.addEventListener("mouseup", UTILS.checkTrusted(mouseUp));
function mouseUp(e) {
if (attackState != 0) {
attackState = 0;
if (e.button == 0) {
buyEquip(Wings, 1);
buyEquip(7, 0);
clicks.left = false;
} else if (e.button == 1) {
clicks.middle = false;
my.autoAim = false;
} else if (e.button == 2) {
buyEquip(Wings, 1);
buyEquip(40, 0);
clicks.right = false;
}
}
}
mals.addEventListener("wheel", wheel, false);
function wheel(e) {
if(configs6.Zoom) {
if(e.deltaY > 0){
maxScreenHeight *= 1.05;
maxScreenWidth *= 1.05;
} else {
maxScreenHeight /= 1.05;
maxScreenWidth /= 1.05;
}
resize();
}
}
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 isNearPlayer() {
return near.dist2 <= items.weapons[player.weapons[0]].range +
near.scale * 1.8 && !traps.inTrap;
}
function getAttackDir(debug) {
if (debug) {
if (!player)
return "0";
if(configs4.RandomDir && !clicks.left && !my.autoAim && !
traps.inTrap && !player.lockDir && !clicks.right) {
if((enemy.length && near.dist2 <=
items.weapons[player.weapons[0]].range + near.scale + 50 && (configs3.AutoBullSpam
|| config.autobot)) || (player.reloads[player.weapons[1]] != 0 && player.weapons[1]
&& player.weapons[1] != 10)) {
getdir();
} else {
lastDir = "getSafeDir()";
}
} else if (my.autoAim || (isNearPlayer() && clicks.left &&
player.reloads[player.weapons[0]] == 0)) {
if((configs4.RandomDir) && clicks.left) {
lastDir = "getSafeDir()";
} else {
lastDir = configs3.WeaponGrinder ? "getSafeDir()" :
enemy.length ? my.revAim ? "(near.aim2 + Math.PI)" : "near.aim2" : "getSafeDir()";
}
} else if (clicks.right && player.reloads[player.weapons[1] ==
10 ? player.weapons[1] : player.weapons[0]] == 0) {
lastDir = "getSafeDir()";
} else if (traps.inTrap && !AntiBull && !clicks.left && !
clicks.right && player.reloads[traps.notFast() ? player.weapons[1] :
player.weapons[0]] == 0) {
lastDir = "traps.aim";
} else if (!player.lockDir) {
if (((configs4.RandomDir && !traps.inTrap && enemy.length)
&& !clicks.left && !clicks.right) || (configs2.TrapAim && traps.inTrap && !
clicks.left && !clicks.right && !clicks.middle)) return "undefined";
lastDir = "getSafeDir()";
}
if(noDirMy) {
if(!clicks.left && !my.autoAim && !traps.inTrap && !
player.lockDir && !clicks.right) {
} else {
return lastDir;
}
} else {
return lastDir;
}
} else {
if (!player)
return 0;
if(configs4.RandomDir && !clicks.left && !clicks.right && !
my.autoAim && !traps.inTrap && !player.lockDir) {
if((enemy.length && near.dist2 <=
items.weapons[player.weapons[0]].range + near.scale + 50 && (configs3.AutoBullSpam
|| config.autobot)) || (player.reloads[player.weapons[1]] != 0 && player.weapons[1]
&& player.weapons[1] != 10)) {
getdir();
} else {
lastDir = getSafeDir();
}
} else if (my.autoAim || (isNearPlayer() && clicks.left &&
player.reloads[player.weapons[0]] == 0)) {
if(configs4.RandomDir && clicks.left) {
lastDir = getSafeDir();
} else {
lastDir = configs3.WeaponGrinder ? getSafeDir() :
enemy.length ? my.revAim ? (near.aim2 + Math.PI) : near.aim2 : getSafeDir();
}
} else if (clicks.right && player.reloads[player.weapons[1] ==
10 ? player.weapons[1] : player.weapons[0]] == 0) {
lastDir = getSafeDir();
} else if (traps.inTrap && !AntiBull && !clicks.left && !
clicks.right && player.reloads[traps.notFast() ? player.weapons[1] :
player.weapons[0]] == 0) {
lastDir = traps.aim;
} else if (!player.lockDir) {
if (((configs4.RandomDir && !traps.inTrap && enemy.length)
&& !clicks.left && !clicks.right) || (configs2.TrapAim && traps.inTrap && !
clicks.left && !clicks.right && !clicks.middle)) return undefined;
lastDir = getSafeDir();
}
if(noDirMy) {
if(!clicks.left && !my.autoAim && !traps.inTrap && !
player.lockDir && !clicks.right) {
} else {
return lastDir || 0;
}
} else {
return lastDir || 0;
}
}
}
function getdir() {
lastDir = Math.random() * Math.PI * 2;
}
function getVisualDir() {
if (!player)
return 0;
if(configs4.RandomDir && !clicks.left && enemy.length && !
my.autoAim && !traps.inTrap && !player.lockDir && !clicks.right) {
if((enemy.length && near.dist2 <=
items.weapons[player.weapons[0]].range + near.scale + 50 && (configs3.AutoBullSpam
|| config.autobot)) || (player.reloads[player.weapons[1]] != 0 && player.weapons[1]
&& player.weapons[1] != 10)) {
getdir();
} else {
lastDir = getSafeDir();
}
} else if (my.autoAim || (isNearPlayer() && clicks.left &&
player.reloads[player.weapons[0]] == 0)) {
if(configs4.RandomDir && clicks.left) {
lastDir = getSafeDir();
} else {
lastDir = configs3.WeaponGrinder ? getSafeDir() :
enemy.length ? my.revAim ? (near.aim2 + Math.PI) : near.aim2 : getSafeDir();
}
} else if (clicks.right && player.reloads[player.weapons[1] == 10 ?
player.weapons[1] : player.weapons[0]] == 0) {
lastDir = getSafeDir();
} else if (traps.inTrap && !AntiBull && !clicks.left && !
clicks.right && player.reloads[traps.notFast() ? player.weapons[1] :
player.weapons[0]] == 0) {
lastDir = traps.aim;
} else if (!player.lockDir) {
if(configs2.TrapAim && traps.inTrap && !clicks.left && !
clicks.right && !clicks.middle) {
} else {
lastDir = getSafeDir();
}
}
if(noDirMy) {
if(!clicks.left && !my.autoAim && !traps.inTrap && !
player.lockDir && !clicks.right) {
} else {
return lastDir || 0;
}
} else {
return lastDir || 0;
}
}
function keysActive() {
return (allianceMenu.style.display != "block" &&
chatHolder.style.display != "block" &&
!menuCBFocus);
}
let noDirMy = false;
let StoreB = document.getElementById('storeButton');
$("#menuDiv").hide();
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) {
$("#menuChatDiv").hide();
$("#menuDiv").toggle();
} else if(keyNum == 82 && player.reloads[53] == 0 &&
player.reloads[player.weapons[0]] == 0 && player.reloads[player.weapons[1]] == 0 &&
!instaC.isTrue) {
instaType = false;
instaC.can = true;
game.tickBase(() => {
instaType = true;
instaC.can = false;
}, 2);
} else if(keyNum == 191) {
window.zoomvis();
} else if(keyNum == 188 && player.reloads[53] == 0 &&
player.reloads[player.weapons[0]] == 0 && player.reloads[player.weapons[1]] == 0 &&
!instaC.isTrue) {
instaC.bowInsta();
} else if(keyNum == 71) {
crossHair = crossHair ? false : true;
} else if(keyNum == 80 && configs.showDir) {
noDirMy = noDirMy ? false : true;
} else if (keyNum == 69) {
sendAutoGather();
} else if (keyNum == 222) {
instaC.testMovement();
} 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 == "q") {
io.send("6", "")
setTimeout(() => {
io.send("6", "")
}, 1000);
} else if (event.key == "v") {
io.send("6", "")
} else if (event.key == "f") {
io.send("6", "")
} else if (event.key == "h") {
io.send("6", "")
} else if (event.key == "y") {
io.send("6", "")
} else if (event.key == "z") {
mills.place = !mills.place;
}
}
}
}
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();
}
}
}
}
}
window.addEventListener("keyup", UTILS.checkTrusted(keyUp));
function sendMoveDir() {
let newMoveDir = getMoveDir();
if (lastMoveDir == undefined || newMoveDir == undefined ||
Math.abs(newMoveDir - lastMoveDir) > 0.3) {
if (!my.autoPush && (!config.autobot || !enemy.length)) {
packet("a", newMoveDir, 1);
}
lastMoveDir = newMoveDir;
player.randDIff = Math.random * Math.PI * 2;
}
}
function bindEvents() { }
bindEvents();
function chechPathColl(tmp) {
return ((player.scale + tmp.getScale()) / (player.maxSpeed *
items.weapons[player.weaponIndex].spdMult)) + (tmp.dmg && !tmp.isTeamObject(player)
? 35 : 0);
return tmp.colDiv == 0.5 ? (tmp.scale * tmp.colDiv) :
!tmp.isTeamObject(player) && tmp.dmg ? (tmp.scale +
player.scale) :
tmp.isTeamObject(player) && tmp.trap ? 0 : tmp.scale;
}
function checkObject() {
let checkColl = gameObjects.filter(tmp => player.canSee(tmp) &&
tmp.active);
for (let y = 0; y < pathFind.grid; y++) {
grid[y] = [];
for (let x = 0; x < pathFind.grid; x++) {
let tmpXY = {
x: (player.x2 - (pathFind.scale / 2)) +
((pathFind.scale / pathFind.grid) * x),
y: (player.y2 - (pathFind.scale / 2)) +
((pathFind.scale / pathFind.grid) * y)
}
if (UTILS.getDist(pathFind.chaseNear ? near : pathFind,
tmpXY, pathFind.chaseNear ? 2 : 0, 0) <= (pathFind.chaseNear ? 35 : 60)) {
pathFind.lastX = x;
pathFind.lastY = y;
grid[y][x] = 0;
continue;
}
let find = checkColl.find(tmp => UTILS.getDist(tmp, tmpXY,
0, 0) <= chechPathColl(tmp));
if (find) {
if (find.trap) {
grid[y][x] = 0;
continue;
}
grid[y][x] = 1;
} else {
grid[y][x] = 0;
}
}
}
}
function toFancyTimeFormat(time) {
let minutes = ~~((time % 3600) / 60);
let seconds = ~~time % 60;
if (seconds <= 9) seconds = `0${seconds}`;
return `${minutes}:${seconds}`;
}
function Pathfinder() {
pathFind.scale = (config.maxScreenWidth / 2) * 1.3;
if (!traps.inTrap && (pathFind.chaseNear ? enemy.length : true)) {
if (near.dist2 <= items.weapons[player.weapons[0]].range) {
packet("a", undefined, 1);
} else {
createPath();
easystar.setGrid(grid);
easystar.setAcceptableTiles([0]);
easystar.enableDiagonals();
easystar.findPath((grid[0].length / 2), (grid.length / 2),
pathFind.lastX, pathFind.lastY, function (path) {
if (path === null) {
pathFind.array = [];
if (near.dist2 <=
items.weapons[player.weapons[0]].range) {
packet("a", undefined, 1);
} else {
packet("a", near.aim2, 1);
}
} else {
pathFind.array = path;
if (pathFind.array.length > 1) {
let tmpXY = {
x: (player.x2 - (pathFind.scale / 2)) +
((pathFind.scale / pathFind.grid) * path[1].x),
y: (player.y2 - (pathFind.scale / 2)) +
((pathFind.scale / pathFind.grid) * path[1].y)
}
packet("a", UTILS.getDirect(tmpXY, player, 0,
2), 1);
}
}
});
easystar.calculate();
}
}
}
class AutoPush {
socket = null;
return theta;
};
this.socket.send("33", angle);
};
constructor(socket) {
this.socket = socket;
}
}
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 secondSocket() {
let time = Date.now();
const e = time - second;
window.pingTime = e;
}
const Qt = document.getElementById("pingDisplay")
var lastPing = -1;
var maxPing = NaN;
var minPing = NaN;
var pingCount = 0;
var doAutoQ = false;
function pingSocketResponse() {
let pingTime = window.pingTime;
pingCount++;
if (pingTime > ms.max || isNaN(ms.max)) {
ms.max = pingTime;
}
if (pingTime < ms.min || isNaN(ms.min)) {
ms.min = pingTime;
}
if (pingTime >= 140) {
doAutoQ = true;
} else {
doAutoQ = false;
}
}
function pingSocket() {
lastPing = Date.now();
io.send('0');
}
var fisrtloadez = false;
function setupGame(yourSID) {
keys = {};
macro = {};
playerSID = yourSID;
attackState = 0;
inGame = true;
fisrtloadez = true;
packet("d", 0, getAttackDir(), 1);
my.ageInsta = true;
if (firstSetup) {
firstSetup = false;
gameObjects.length = 0;
}
}
function addPlayer(data, isYou) {
let tmpPlayer = findPlayerByID(data[0]);
if (!tmpPlayer) {
tmpPlayer = new Player(data[0], data[1], config, UTILS,
projectileManager,
objectManager, players, ais, items,
hats, accessories);
players.push(tmpPlayer);
if (data[1] != playerSID) {
addChatLog("Encountered " + data[2], "#23BD86", "",
"#23BD86");
}
} else {
if (data[1] != playerSID) {
addChatLog("Encountered " + data[2], "#23BD86", "",
"#23BD86");
}
}
tmpPlayer.spawn(isYou ? true : null);
tmpPlayer.visible = false;
tmpPlayer.oldPos = {
x2: undefined,
y2: undefined
};
tmpPlayer.x2 = undefined;
tmpPlayer.y2 = undefined;
tmpPlayer.x3 = undefined;
tmpPlayer.y3 = undefined;
tmpPlayer.setData(data);
if (isYou) {
if (!player) {
window.prepareUI(tmpPlayer);
}
player = tmpPlayer;
camX = player.x;
camY = player.y;
my.lastDir = 0;
updateItems();
updateAge();
updateItemCountDisplay();
if (player.skins[7]) {
my.reSync = true;
}
}
}
function removePlayer(id) {
for (let i = 0; i < players.length; i++) {
if (players[i].id == id) {
let tmpPlayer = players[i];
addChatLog(tmpPlayer.name + " has left", "red", "", "red");
players.splice(i, 1);
break;
}
}
}
var newHatImgs = {
7: "https://i.imgur.com/vAOzlyY.png",
15: "https://i.imgur.com/YRQ8Ybq.png",
//11: "https://i.imgur.com/yfqME8H.png",
//12: "https://i.imgur.com/VSUId2s.png",
40: "https://i.imgur.com/Xzmg27N.png",
//26: "https://i.imgur.com/I0xGtyZ.png",
//6: "https://i.imgur.com/vM9Ri8g.png",
};
var newAccImgs = {
//18: "https://i.imgur.com/0rmN7L9.png",
21: "https://i.imgur.com/4ddZert.png",
};
var newWeaponImgs = {
"great_hammer_1":
"https://cdn.discordapp.com/attachments/952594150879006841/1077259072413368330/76_2
0230220114828.png",
"great_hammer_1_g":
"https://cdn.discordapp.com/attachments/952594150879006841/1077259072790863892/76_2
0230220114742.png",
"great_hammer_1_d":
"https://cdn.discordapp.com/attachments/952594150879006841/1077259073147392171/
Fg93gj3.png",
"great_hammer_1_r":
"https://cdn.discordapp.com/attachments/952594150879006841/1077259073835237466/76_2
0230220114918.png",
//"samurai_1": "https://i.imgur.com/mbDE77n.png",
// "samurai_1_g":
"https://cdn.discordapp.com/attachments/967213871267971072/1030852038948552724/
image.png",
};
/* function killObject(sid) {
let findObj = findObjectBySid(sid);
objectManager.disableBySid(sid);
let n = findObj;
if (n && cdf(player, n) < 200) {
if (nears.length) {
let enemy = near;
let A = player;
let dist = cdf(A, enemy);
let dir = caf(A, enemy);
let dir2 = caf(player, dir + toR(180));//this dir can works
to laggy players
let ignore = [0, 0];
let place = function(t, f) {
checkPlace(t, f);
}
if (dist < 500) {
for(let i = 0; i != 2; i++) {
if (dist < 200) {
for(let i = 0; i < Math.PI; i +=
toR(items.list[A.items[2]].scale)) {
let placed;
if (ignore[0]) {
placed = false;
ignore[0]--;
} else {
place(2, (dir || dir2) + i) && (toD(i)
< items.list[A.items[2]].scale && (ignore[1] =
Math.ceil(items.list[A.items[2]].scale / toD(Math.PI / 12))), placed = true);
}
placed && (ignore[0] =
Math.ceil(items.list[A.items[2]].scale / toD(Math.PI / 12)));
if (!placed || UTILS.getAngleDist(dir + i,
dir - i) > toR(items.list[A.items[2]].scale)) {
if (ignore[1]) {
ignore[1]--;
} else {
place(2, dir - i) && (ignore[1] =
Math.ceil(items.list[A.items[2]].scale / toD(Math.PI / 12)))
}
}
}
place(4, toR(toD(dir) - 180));
} else {
let ignore = 0;
if (ignore) {
ignore--;
} else {
for(let i = 0; i < Math.PI/2; i +=
Math.PI / 3) {
checkPlace(4, dir + i) && (ignore =
Math.ceil(50 / Math.PI / 6));
}
}
}
}
}
}
}
}*/
function killObject(sid) {
let findObj = findObjectBySid(sid);
objectManager.disableBySid(sid);
if (player) {
for (let i = 0; i < breakObjects.length; i++) {
if (breakObjects[i].sid == sid) {
breakObjects.splice(i, 1);
break;
}
}
if (!player.canSee(findObj)) {
breakTrackers.push({x: findObj.x, y: findObj.y});
}
if (breakTrackers.length > 8) {
breakTrackers.shift();
}
traps.replacer(findObj);
}
}
function killObjects(sid) {
if (player) objectManager.removeAllItems(sid);
}
function fgdo(a, b) {
return Math.sqrt(Math.pow((b.y - a.y), 2) + Math.pow((b.x - a.x),
2));
}
let ticks = {
tick: 0,
delay: 0,
time: [],
manage: [],
};
function setTickout(doo, timeout) {
if (!ticks.manage[ticks.tick + timeout]) {
ticks.manage[ticks.tick + timeout] = [doo];
} else {
ticks.manage[ticks.tick + timeout].push(doo);
}
}
function doNextTick(doo) {
waitTicks.push(doo);
}
let waitTicks = [];
let nEy;
let placeableSpikes = [];
let placeableTraps = [];
let placeableSpikesPREDICTS = [];
let autos = {
insta: {
todo: false,
wait: false,
count: 4,
shame: 5
},
bull: false,
antibull: 0,
reloaded: false,
stopspin: true
}
let autoQ = false;
function updatePlayers(data) {
game.tick++;
enemy = [];
nears = [];
near = [];
game.tickSpeed = performance.now() - game.lastTick;
game.lastTick = performance.now();
ticks.tick++;
ticks.time.push(Date.now() - ticks.delay <= 50 || Date.now() -
ticks.delay >= 175 ? "lag" : 1);
if (ticks.tick % 10 === 0) {
ticks.time = [];
antiSync = false;
}
if (ticks.tick % 300 === 0) {
ms.max = window.pingTime;
ms.min = window.pingTime;
players.forEach((tmp) => {
tmp.maxShameCount = 0;
})
}
ticks.delay = Date.now();
players.forEach((tmp) => {
tmp.forcePos = !tmp.visible;
tmp.visible = false;
});
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;
if (tmpObj == player) {
healer();
}
}
nEy = tmpObj;
if (tmpObj == player) {
if (gameObjects.length) {
gameObjects.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(700) || 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 = gameObjects.filter(e => e.trap &&
e.active && UTILS.getDist(e, tmpObj, 0, 2) <= (tmpObj.scale + e.getScale() + 5)
&& !e.isTeamObject(tmpObj)).sort(function(a, b) {
return UTILS.getDist(a, tmpObj, 0, 2) -
UTILS.getDist(b, tmpObj, 0, 2);
})[0];
if (nearTrap && instaType) {
traps.dist = UTILS.getDist(nearTrap, tmpObj, 0,
2);
traps.aim = UTILS.getDirect(nearTrap, tmpObj,
0, 2);
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 (waitTicks.length) {
waitTicks.forEach((ajaj) => {
ajaj();
}
);
waitTicks = [];
}
if (runAtNextTick.length) {
runAtNextTick.forEach((tmp) => {
checkProjectileHolder(...tmp);
}
);
runAtNextTick = [];
}
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, 50, 0.18, 500, num2,
healTextColor);
}
if (num > 0) {
textManager.showText(pos.x, pos.y, 50, 0.18, 500, num,
damageTextColor);
}
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) {
if (player && player.alive){
placeableSpikes = getPlaceablePositions(player,
items.list[player.items[2]]);
placeableTraps = player.items[4] == 15 ?
getPlaceablePositions(player, items.list[player.items[4]]) : [];
}
});
advHeal = [];
}
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(player.empAnti) {
player.empAnti = false;
}
if (player.soldierAnti) {
player.soldierAnti = false;
}
if (enemy.length) {
if (player.canEmpAnti) {
player.canEmpAnti = false;
if (near.dist2 <= 300) {
if (near.reloads[53] == 0 && !
my.safePrimary(near) && !my.safeSecondary(near)) {
player.empAnti = true;
player.soldierAnti = false;
} else {
player.empAnti = false;
player.soldierAnti = true;
}
} else {
player.empAnti = false;
player.soldierAnti = true;
}
} else {
player.empAnti = false;
player.soldierAnti = true;
}
let prehit = gameObjects.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.dist2 <=
items.weapons[player.weapons[0]].range + player.scale * 1.8) {
buyEquip(Wings, 1)
instaC.canSpikeTick = true;
}
}
let antiSpikeTick = gameObjects.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.dist2 <= items.weapons[5].range +
near.scale * 1.8) {
my.anti0Tick = 1;
player.chat.count = 2000;
}
}
}
if((game.tick - near.bullTick) % 9 == 0 && near.skinIndex
== 7) {
addChatLog("Bulltick detected: " + near.name + "[" +
near.sid + "]", "#40E0D0", "", "#40E0D0");
bultect = true;
game.tickBase(() => {
bultect = false;
}, 1)
}
if ((near.skinIndex != 26 && near.skinIndex != 6 &&
(((near.shameCount > 2 && player.weapons[1] != 10) || (player.weapons[1] == 10 &&
(near.shameCount > 0)))) || (near.shameCount > 4 && player.weapons[1] != 10)) &&
(configs3.AutoInsta || config.autobot) && player.reloads[53] == 0 && (trueM ?
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 || (trueM &&
Math.floor(Math.random() * 2) == 0) || bultect) && ((trueM && near.shameCount >=
near.maxShameCount) || (trueM && true)) && !instaC.isTrue && !my.waitHit &&
player.reloads[player.weapons[0]] == 0 && player.reloads[player.weapons[1]] == 0 &&
instaC.perfCheck(player, near)) {
instaC.can = true;
} else if (instaType){
instaC.can = false;
}
selectWeapon(player.weapons[fastSpeed]);
}
}
}
} else {
my.reloaded = 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 && !AntiBull) {
if (player.weaponIndex != player.weapons[1] ||
player.buildIndex > -1) {
if(near.skinIndex != 26 &&
(configs3.AutoBullSpam || config.autobot) && player.reloads[player.weapons[1]] == 0
&& (!my.autoPush || near.dist2 < 95) && !clicks.middle && !clicks.left && !
clicks.right && !instaC.isTrue && near.dist2 <=
(items.weapons[player.weapons[0]].range + near.scale * 1.8) && !traps.inTrap) {
selectWeapon(player.weapons[0]);
} else {
selectWeapon(player.weapons[1]);
}
}
}
}
}
if (player.skins[40]) {
if (!player.tails[21]) {
autoBuy = new Autobuy([40, 15, 31, 6, 7, 53, 11,
22, 12, 21, 1], [11, 21]);
} else if(player.tails[18]){
autoBuy = new Autobuy([40, 15, 31, 6, 7, 53, 11,
22, 12, 21, 26, 56], [11, 21, 18, 19]);
} else {
autoBuy = new Autobuy([40, 15, 31, 6, 7, 53, 11,
22, 12], [11, 21, 18]);
}
}
tails = 11;
Wings = 21;
if (!instaC.isTrue && !traps.inTrap && !traps.replaced) {
traps.autoPlace();
}
if(configs2.AutoSync && enemy.length) {
if(near.skinIndex != 6 && player.reloads[53] == 0 && !
my.waitHit && !instaC.isTrue && !my.autoAim && player.reloads[player.weapons[1]] ==
0) {
io.send("6", ".f");
}
}
if (configs.autoPlace && traps.inTrap) {
traps.AutoPlaceTrap();
}
if (!instaC.isTrue && configs.autoPlace) {
game.tickBase(() => {
traps.ReTrap();
}, 1);
}
turretR = player.reloads[53] == 0 ? "1" : "0";
if(window.pingTime >= 120) {
io.send("6", "Ping: " + window.pingTime);
}
if (!macro.q && !macro.f && !macro.v && !macro.h && !
macro.n) {
packet("D", getAttackDir());
}
let bullTick = function() {
if (my.anti0Tick > 0) {
buyEquip(6, 0);
} else if(!AntiBull){
if (clicks.left || clicks.right) {
if (clicks.left) {
buyEquip(player.reloads[player.weapons[0]]
== 0 ? configs3.WeaponGrinder ? 40 : 7 : player.empAnti ? 22 : player.soldierAnti ?
Soldier : Soldier, 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 : 7, 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((near.dist2 <= 250) ? 21 : 11);
} else {
if (player.empAnti) {
buyEquip(player.empAnti ? 22 : 7, 0);
} else {
buyEquip(7, 0);
}
if(near.dist2 <= 250) {
buyEquip(player.empAnti ? 22 : Soldier,
0);
buyEquip(21, 1);
}else {
buyEquip(11, 1);
}
}
} else {
if (player.empAnti) {
buyEquip(player.empAnti ? 22 : 7, 0);
} else {
buyEquip(7, 0);
if(near.dist2 < 250) {
buyEquip(21, 1);
} else {
buyEquip(tails, 1);
}
}
}
}
}
let hatChanger = function() {
if (my.anti0Tick > 0) {
buyEquip(6, 0);
} else {
if (clicks.left || clicks.right) {
if (clicks.right) {
buyEquip(Wings, 1)
}else {
buyEquip(Wings, 1);
}
if (clicks.left) {
buyEquip(player.reloads[player.weapons[0]]
== 0 ? configs3.WeaponGrinder ? 40 : 7 : player.empAnti ? 22 : player.soldierAnti ?
Soldier : Soldier, 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 : Soldier, 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((near.dist2 <= 250) ? 21 : 11);
} else {
if(near.dist2 <= 250) {
buyEquip(player.empAnti ? 22 : Soldier,
0);
buyEquip(21, 1);
}else {
buyEquip(22, 0);
buyEquip(11, 1);
}
}
} else {
if(player.empAnti) {
buyEquip(player.empAnti ? 22 : Soldier, 0);
}else {
if ((player.empAnti || player.soldierAnti)
&& !configs2.InvisMode) {
if(enemy.length && near.dist2 <=
items.weapons[player.weapons[0]].range + near.scale + 50 && (configs3.AutoBullSpam
|| config.autobot) && player.reloads[player.weapons[0]] == 0 &&
player.reloads[player.weapons[1]] == 0) {
buyEquip(7, 0);
} else if(near.dist2 <= 250 &&
enemy.length) {
if(near.dist2 < 250) {
buyEquip(21, 1);
}
buyEquip(player.empAnti ? 22 :
Soldier, 0);
} else {
biomeGear(1);
}
} else {
if(configs2.InvisMode) {
if(enemy.length && near.dist2 <=
items.weapons[player.weapons[0]].range + near.scale + 50 && (configs3.AutoBullSpam
|| config.autobot) && player.reloads[player.weapons[0]] == 0 &&
player.reloads[player.weapons[1]] == 0) {
buyEquip(7, 0);
} else if(near.dist2 <= 350 &&
enemy.length) {
if(near.dist2 < 250) {
buyEquip(21, 1);
}
buyEquip(player.empAnti ? 22 :
Soldier, 0);
} else if(!enemy.length) {
if(player.moveDir == undefined)
{
if(player.health < 100 &&
(near.dist2 >= 270 || !enemy.length)) {
healer();
buyEquip(Soldier, 0);
}else {
buyEquip(56, 0);
}
} else {
biomeGear(1);
}
}else {
if(player.health < 100 &&
(near.dist2 >= 270 || !enemy.length)) {
healer();
buyEquip(player.empAnti ?
22 : Soldier, 0);
}else {
if(near.dist2 >= 270 &&
enemy.length && player.moveDir != undefined) {
buyEquip(Soldier, 0);
} else if(player.moveDir ==
undefined) {
buyEquip(56, 0);
} else {
buyEquip(Soldier, 0);
}
}
}
} else {
biomeGear(1);
}
}
}
}
}
}
let BullHats = function() {
if(!my.waitHit) {
if(player.skinIndex == 40 || player.skinIndex ==
53) {
buyEquip(Soldier, 0);
} else if(player.reloads[player.weapons[0]] == 0) {
if(plaguemask) {
buyEquip(21, 0);
} else {
buyEquip(plaguemask ? 21 : 7, 0);
}
}
} else {
buyEquip(7, 0);
}
}
let accChanger = function() {
if (clicks.left || clicks.right || autos.bull) {
if (clicks.right) {
buyEquip(near.dist2 < 250 ? Wings : Wings, 1)
} else {
buyEquip(Wings, 1);
}
} else {
if(!traps.inTrap) {
if(near.dist2 < 250 && enemy.lenth) {
buyEquip(Wings, 1);
} else if(near.dist2 > 250 || !enemy.length){
buyEquip(tails, 1);
}
}
}
}
if (storeMenu.style.display != "block" && !instaC.isTrue &&
!instaC.ticking) {
if ((near.dist2 >
items.weapons[player.weapons[0]].range + near.scale * 1.8 || !enemy.length) &&
player.health === 100 && ((player.shameCount > 0 || player.shameCount > 5) &&
player.skinIndex != 45) || my.reSync) {
bullTick();
} else {
if(AntiBull && player && player.alive &&
player.shameCount < 5) {
if(near.dist2 <= 250) {
selectWeapon(player.weapons[0]);
if(player.skinIndex == 53) {
buyEquip(6, 0);
buyEquip(11, 1);
} else {
buyEquip(11, 0);
buyEquip(21, 1);
}
}else {
buyEquip(Soldier, 0);
buyEquip(tails, 1);
}
} else {
if (near.skinIndex != 26 &&
player.reloads[player.weapons[1]] == 0 && (configs3.AutoBullSpam || config.autobot)
&& (!my.autoPush || near.dist2 < 95) && !clicks.middle && !clicks.left && !
clicks.right && !instaC.isTrue && near.dist2 <=
items.weapons[player.weapons[0]].range + near.scale * 1.8 && !traps.inTrap) {
BullHats();
}else {
hatChanger();
accChanger();
}
}
}
}
}
if(config.autobot) {
autobot();
}
if (configs.autoPush && enemy.length && near.dist2 < 450 && !
traps.inTrap && !clicks.right && !instaC.ticking) {
autoPush();
} else {
if (my.autoPush) {
my.autoPush = false;
packet("a", lastMoveDir || undefined, 1);
}
}
}
if (!my.autoPush && pathFind.active) {
//Pathfinder();
}
if (botSkts.length) {
botSkts.forEach((bots) => {
if (true) {
bots[0].ssend("player", player, near, botIDS);
}
});
}
}
function updateLeaderboard(data) {
lastLeaderboardData = data;
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) ?
"#99ee99" : "#9c9c9c") + "; font-family: Pratt Pro; font-size: 16px;", //0.6
text: /*tmpC + ". " + */ (data[i + 1] != "" ?
data[i + 1] + " - " + " [" + data[i] + "]" : "unknown")
}),
UTILS.generateElement({
class: "leaderScore",
style: "font-size: 16px;",
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 gatherAnimation(sid, didHit, index) {
tmpObj = findPlayerBySID(sid);
if (tmpObj) {
tmpObj.startAnim(didHit, index);
tmpObj.gatherIndex = index;
tmpObj.gathering = 1;
if(nears.filter(near => near.gathering).length>=2) {
io.send("6", "sync detect test");
antiSync = true;
game.tickBase(() => {
antiSync = false;
}, 1);
}
if (didHit) {
let tmpObjects = objectManager.hitObj;
objectManager.hitObj = [];
tmpObj = findPlayerBySID(sid);
game.tickBase(() => {
let val = items.weapons[index].dmg *
(config.weaponVariants[tmpObj[(index < 9 ? "prima" : "seconda") +
"ryVariant"]].val) * (items.weapons[index].sDmg || 1) * (tmpObj.skinIndex == 40 ?
3.3 : 1);
tmpObjects.forEach((healthy) => {
healthy.healthMov = healthy.health - val / 2;
healthy.health -= val;
if(healthy.health <= items.weapons[index].dmg*2 &&
near.length && near.dist2 <= 600 && UTILS.getDist(healthy, player, 0, 2) <= 300) {
game.tickBase(() => {
setTimeout(() => {
place(near.dist2<140?4:2,
UTILS.getDirect(healthy, player, 0, 2));
for(let i = toR(-60); i < toR(60); i +=
toR(30)) {
place(((near.dist2<180||
near.dist2>350)?4:2), UTILS.getDirect(healthy, player, 0, 2) + i);
}
}, (items.weapons[tmpObj.weaponIndex].speed
- 1000/9 - (ms.max - ms.avg) + ms.avg/3))
}, 2)
}
if (configs4.Rainbow) {
let h, s, l;
let color = (() => {
const randomInt = (min, max) => {
return Math.floor(Math.random() * (max
- min + 1)) + min;
};
h = randomInt(0, 360);
s = randomInt(42, 98);
l = randomInt(40, 90);
})();
function hslToHex(h, s, l) {
l /= 100;
const a = s * Math.min(l, 1 - l) / 100;
const f = n => {
const k = (n + h / 30) % 12;
const color = l - a *
Math.max(Math.min(k - 3, 9 - k, 1), -1);
return Math.round(255 *
color).toString(16).padStart(2, '0'); // convert to Hex and prefix "0" if needed
};
return `#${f(0)}${f(8)}${f(4)}`;
}
// console.log(hslToHex(h, s, l));
showDamageText(healthy.x, healthy.y, val,
hslToHex(h, s, l));
}
});
}, 1)
}
}
}
function showDamageText(x, y, value, color) {
textManager.showText(x, y, 30, 0.15, 550, Math.round(value),
color);
}
if (index == "points") {
if (configs.autoBuy) {
autoBuy.hat();
autoBuy.acc();
}
} else if (index == "kills") {
if (configs.killChat) {
let killChatMessage = getKillChatMessage(value);
sendChat(killChatMessage);
setTimeout(() => {
sendChat("DETERMINATION +1");
}, 800);
}
}
}
}
if (kills <= 1) {
return "First blood!";
} else if (kills <= 2) {
return "Double kill!";
} else if (kills <= 3) {
return "Triple kill!";
} else if (kills <= 4) {
return "Quadruple kill!";
} else if (kills <= 5) {
return "Penta kill!";
} else if (kills <= 6) {
return "Unnatural!";
} else if (kills <= 7) {
return "Amazing :0!";
} else if (kills <= 8) {
return "SuperHuman!";
} else if (kills <= 9) {
return "DemiGod?!";
} else if (kills <= 10) {
return "Insanity!";
} else if (kills <= 11) {
return "ArcAngel!";
} else if (kills <= 12) {
return "Enemy has been slain!";
} else if (kills <= 13) {
return "Enemy down!";
} else if (kills <= 14) {
return "Enemy has been eliminated!";
} else if (kills <= 15) {
return "Unnstopable!";
} else if (kills <= 16) {
return "Commander!";
} else if (kills <= 17) {
return "Godlike!";
} else if (kills <= 18) {
return "Unbeaten!";
} else if (kills <= 19) {
return "OverPowered!";
} else if (kills <= 20) {
return "Impossible?!";
} else if (kills <= 21) {
return "Not human!";
} else if (kills <= 22) {
return "Beyond Time!";
} else if (kills <= 23) {
return "God Mode!";
} else if (kills <= 24) {
return "Matter itself!";
} else if (kills <= 25) {
return "AntiSpiral!";
} else if (kills <= 26) {
return "Anti Death!";
} else if (kills <= 27) {
return "Anti God!";
} else if (kills <= 28) {
return "Anti Royal!";
} else if (kills <= 29) {
return "Anti Time!";
} else if (kills <= 30) {
return "Anti Sauron!";
} else {
items.projectiles[items.weapons[obj.weaponIndex].projectile], mainContext);
}
}
ctxt.fillStyle = "#ececec";
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);
if (obj.buildIndex < 0 && items.weapons[10].aboveHand) {
renderTool(items.weapons[10], config.weaponVariants[1].src ||
"", obj.scale, 0, ctxt);
if (items.weapons[obj.weaponIndex].projectile != undefined && !
items.weapons[obj.weaponIndex].hideProjectile) {
renderProjectile(obj.scale, 0,
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);
}
renderCircle(0, 0, obj.scale, ctxt);
renderSkin2(48, ctxt, null, obj)
}
function renderPlayer(obj, ctxt) {
ctxt = ctxt || mainContext;
ctxt.lineWidth = outlineWidth;
ctxt.lineJoin = "miter";
if (true) {
ctxt.shadowColor = `rgba(0, 0, 0, 0.5)`;
ctxt.shadowBlur = 10;
ctxt.shadowOffsetY = 5;
}
if(true) {
ctxt.shadowBlur = 10;
}
ctxt.strokeStyle = darkOutlineColor;
let handAngle = (Math.PI / 4) *
(items.weapons[obj.weaponIndex].armS || 1);
let oHandAngle = (obj.buildIndex < 0) ?
(items.weapons[obj.weaponIndex].hndS || 1) : 1;
let oHandDist = (obj.buildIndex < 0) ?
(items.weapons[obj.weaponIndex].hndD || 1) : 1;
let katanaMusket = (obj == player && obj.weapons[0] == 3 &&
obj.weapons[1] == 15);
if (obj.tailIndex > 0) {
renderTail(obj.tailIndex, ctxt, obj);
}
if (obj.buildIndex < 0 && !
items.weapons[obj.weaponIndex].aboveHand) {
renderTool(items.weapons[katanaMusket ? 4 : obj.weaponIndex],
config.weaponVariants[obj.weaponVariant].src, obj.scale, 0, ctxt);
if (items.weapons[obj.weaponIndex].projectile != undefined && !
items.weapons[obj.weaponIndex].hideProjectile) {
renderProjectile(obj.scale, 0,
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);
if (obj.buildIndex < 0 && items.weapons[obj.weaponIndex].aboveHand)
{
renderTool(items.weapons[obj.weaponIndex],
config.weaponVariants[obj.weaponVariant].src, obj.scale, 0, ctxt);
if (items.weapons[obj.weaponIndex].projectile != undefined && !
items.weapons[obj.weaponIndex].hideProjectile) {
renderProjectile(obj.scale, 0,
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);
}
renderCircle(0, 0, obj.scale, ctxt);
if (obj.skinIndex > 0) {
ctxt.rotate(Math.PI / 2);
renderSkin(obj.skinIndex, ctxt, null, obj);
}
}
var skinSprites2 = {};
var skinPointers2 = {};
function renderSkin2(index, ctxt, parentSkin, owner) {
tmpSkin = skinSprites2[index];
if (!tmpSkin) {
var tmpImage = new Image();
tmpImage.onload = function() {
this.isLoaded = true;
this.onload = null;
};
tmpImage.src = getTexturePackImg(index, "hat");
skinSprites2[index] = tmpImage;
tmpSkin = tmpImage;
}
var tmpObj = parentSkin||skinPointers2[index];
if (!tmpObj) {
for (var i = 0; i < hats.length; ++i) {
if (hats[i].id == index) {
tmpObj = hats[i];
break;
}
}
skinPointers2[index] = tmpObj;
}
if (tmpSkin.isLoaded)
ctxt.drawImage(tmpSkin, -tmpObj.scale/2, -tmpObj.scale/2,
tmpObj.scale, tmpObj.scale);
if (!parentSkin && tmpObj.topSprite) {
ctxt.save();
ctxt.rotate(owner.skinRot);
renderSkin2(index + "_top", ctxt, tmpObj, owner);
ctxt.restore();
}
}
let skinSprites = {};
let skinPointers = {};
let tmpSkin;
function renderSkin(index, ctxt, parentSkin, owner) {
tmpSkin = skinSprites[index];
if (!tmpSkin) {
let tmpImage = new Image();
tmpImage.onload = function() {
this.isLoaded = true;
this.onload = null;
};
tmpImage.src = getTexturePackImg(index, "hat");
skinSprites[index] = tmpImage;
tmpSkin = tmpImage;
}
let tmpObj = parentSkin || skinPointers[index];
if (!tmpObj) {
for (let i = 0; i < hats.length; ++i) {
if (hats[i].id == index) {
tmpObj = hats[i];
break;
}
}
skinPointers[index] = tmpObj;
}
if (tmpSkin.isLoaded)
ctxt.drawImage(tmpSkin, -tmpObj.scale / 2, -tmpObj.scale / 2,
tmpObj.scale, tmpObj.scale);
if (!parentSkin && tmpObj.topSprite) {
ctxt.save();
ctxt.rotate(owner.skinRot);
renderSkin(index + "_top", ctxt, tmpObj, owner);
ctxt.restore();
}
}
let accessSprites = {};
let accessPointers = {};
function renderTail(index, ctxt, owner) {
tmpSkin = accessSprites[index];
if (!tmpSkin) {
let tmpImage = new Image();
tmpImage.onload = function() {
this.isLoaded = true;
this.onload = null;
};
tmpImage.src = getTexturePackImg(index, "acc");
accessSprites[index] = tmpImage;
tmpSkin = tmpImage;
}
let tmpObj = accessPointers[index];
if (!tmpObj) {
for (let i = 0; i < accessories.length; ++i) {
if (accessories[i].id == index) {
tmpObj = accessories[i];
break;
}
}
accessPointers[index] = tmpObj;
}
if (tmpSkin.isLoaded) {
ctxt.save();
ctxt.translate(-20 - (tmpObj.xOff || 0), 0);
if (tmpObj.spin)
ctxt.rotate(owner.skinRot);
ctxt.drawImage(tmpSkin, -(tmpObj.scale / 2), -(tmpObj.scale /
2), tmpObj.scale, tmpObj.scale);
ctxt.restore();
}
}
var accessSprites2 = {};
var accessPointers2 = {};
function renderTail2(index, ctxt, owner) {
tmpSkin = accessSprites[index];
if (!tmpSkin) {
let tmpImage = new Image();
tmpImage.onload = function() {
this.isLoaded = true;
this.onload = null;
};
tmpImage.src = getTexturePackImg(index, "acc");
accessSprites[index] = tmpImage;
tmpSkin = tmpImage;
}
var tmpObj = accessPointers2[index];
if (!tmpObj) {
for (var i = 0; i < accessories.length; ++i) {
if (accessories[i].id == index) {
tmpObj = accessories[i];
break;
}
}
accessPointers2[index] = tmpObj;
}
if (tmpSkin.isLoaded) {
ctxt.save();
ctxt.translate(-20 - (tmpObj.xOff||0), 0);
if (tmpObj.spin)
ctxt.rotate(owner.skinRot);
ctxt.drawImage(tmpSkin, -(tmpObj.scale/2), -(tmpObj.scale/2),
tmpObj.scale, tmpObj.scale);
ctxt.restore();
}
}
let toolSprites = {};
function renderTool(obj, variant, x, y, ctxt) {
let tmpSrc = obj.src + (variant || "");
let tmpSprite = toolSprites[tmpSrc];
if (!tmpSprite) {
tmpSprite = new Image();
tmpSprite.onload = function() {
this.isLoaded = true;
}
tmpSprite.src = getTexturePackImg(tmpSrc, "weapons");
toolSprites[tmpSrc] = tmpSprite;
}
if (tmpSprite.isLoaded)
ctxt.drawImage(tmpSprite, x + obj.xOff - (obj.length / 2), y +
obj.yOff - (obj.width / 2), obj.length, obj.width);
}
function renderProjectiles(layer, xOffset, yOffset) {
for (let i = 0; i < projectiles.length; i++) {
tmpObj = projectiles[i];
if (tmpObj.active && tmpObj.layer == layer && tmpObj.inWindow)
{
tmpObj.update(delta);
if (tmpObj.active && isOnScreen(tmpObj.x - xOffset,
tmpObj.y - yOffset, tmpObj.scale)) {
mainContext.save();
mainContext.translate(tmpObj.x - xOffset, tmpObj.y -
yOffset);
mainContext.rotate(tmpObj.dir);
renderProjectile(0, 0, tmpObj, mainContext, 1);
mainContext.restore();
}
}
};
}
let projectileSprites = {};
function renderProjectile(x, y, obj, ctxt, debug) {
if (obj.src) {
let tmpSrc = items.projectiles[obj.indx].src;
let tmpSprite = projectileSprites[tmpSrc];
if (!tmpSprite) {
tmpSprite = new Image();
tmpSprite.onload = function() {
this.isLoaded = true;
}
tmpSprite.src = "https://moomoo.io/img/weapons/" + tmpSrc +
".png";
projectileSprites[tmpSrc] = tmpSprite;
}
if (tmpSprite.isLoaded)
ctxt.drawImage(tmpSprite, x - (obj.scale / 2), y -
(obj.scale / 2), obj.scale, obj.scale);
} else if (obj.indx == 1) {
ctxt.fillStyle = "#939393";
renderCircle(x, y, obj.scale, ctxt);
}
}
let aiSprites = {};
function renderAI(obj, ctxt) {
let tmpIndx = obj.index;
let tmpSprite = aiSprites[tmpIndx];
if (!tmpSprite) {
let tmpImg = new Image();
tmpImg.onload = function() {
this.isLoaded = true;
this.onload = null;
};
tmpImg.src = "https://moomoo.io/img/animals/" + obj.src +
".png";
tmpSprite = tmpImg;
aiSprites[tmpIndx] = tmpSprite;
}
if (tmpSprite.isLoaded) {
let tmpScale = obj.scale * 1.2 * (obj.spriteMlt || 1);
ctxt.drawImage(tmpSprite, -tmpScale, -tmpScale, tmpScale * 2,
tmpScale * 2);
}
}
function renderWaterBodies(xOffset, yOffset, ctxt, padding) {
let tmpW = config.riverWidth + padding;
let tmpY = (config.mapScale / 2) - yOffset - (tmpW / 2);
if (tmpY < maxScreenHeight && tmpY + tmpW > 0) {
ctxt.fillRect(0, tmpY, maxScreenWidth, tmpW);
}
}
let gameObjectSprites = {};
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 blurScale = 15;
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 = UTILS.randInt(5, 7);
tmpContext.globalAlpha = 0.8;
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.shadowBlur = null;
tmpContext.shadowColor = null;
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 ? "#6a64af" : "#c15555";
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.shadowBlur = null;
tmpContext.shadowColor = null;
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;
}
let itemSprites = [];
function getItemSprite(obj, asIcon) {
let e = obj;
let R = player;
let clr = R && e.owner && (e.owner.sid).constructor == Number &&
e.owner.sid != R.sid,
use = true && false && true,
ID = e.id + (!use && clr ? 50 : 0);
let tmpSprite = itemSprites[ID];
if (!tmpSprite || asIcon) {
let blurScale = !asIcon && isNight ? 15 : 0;
let tmpCanvas = document.createElement("canvas");
let reScale = ((!asIcon && obj.name == "windmill") ?
items.list[4].scale : obj.scale);
tmpCanvas.width = tmpCanvas.height = (reScale * 2.5) +
outlineWidth + (items.list[obj.id].spritePadding || 0) + blurScale;
if (config.useWebGl) {
let gl = tmpCanvas.getContext("webgl");
gl.clearColor(0, 0, 0, 0);
gl.clear(gl.COLOR_BUFFER_BIT);
function getRgb(r, g, b) {
return [r / 255, g / 255, b / 255].join(", ");
}
let max = 100;
for (let i = 0; i < max; i++) {
let radian = (Math.PI * (i / (max / 2)));
render(`
precision mediump float;
attribute vec2 vertex;
void main(void) {
gl_Position = vec4(vertex, 0, 1);
}
`, `
precision mediump float;
void main(void) {
gl_FragColor = vec4(${getRgb(...hexToRgb("#fff"))},
1);
}
`, [
0 + (Math.cos(radian) * 0.5), 0 + (Math.sin(radian)
* 0.5),
0, 0,
], gl.LINE_LOOP);
}
} else {
let tmpContext = tmpCanvas.getContext("2d");
tmpContext.translate((tmpCanvas.width / 2),
(tmpCanvas.height / 2));
tmpContext.rotate(asIcon ? 0 : (Math.PI / 2));
tmpContext.strokeStyle = outlineColor;
tmpContext.lineWidth = outlineWidth * (asIcon ?
(tmpCanvas.width / 81) : 1);
if (obj.name == "apple") {
tmpContext.fillStyle = "#c15555";
renderCircle(0, 0, obj.scale, tmpContext);
tmpContext.fillStyle = "#89a54c";
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 = "#cca861";
renderCircle(0, 0, obj.scale, tmpContext);
tmpContext.fillStyle = "#937c4b";
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 = "#f4f3ac";
renderCircle(0, 0, obj.scale, tmpContext);
tmpContext.fillStyle = "#c3c28b";
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") ?
"#83898e" : (obj.name == "wood wall") ?
"#a5974c" : "#939393";
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 = "#c9b758";
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, obj.scale, tmpContext),
tmpContext.fillStyle = "#c9b758",
renderRectCircle(0, 0, 1.5 * obj.scale, 29, 4,
tmpContext),
tmpContext.fillStyle = "#a5974c",
renderCircle(0, 0, .5 * obj.scale, 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[ID] = tmpSprite;
}
return tmpSprite;
}
function getItemSprite2(obj, tmpX, tmpY) {
let tmpContext = mainContext;
let reScale = (obj.name == "windmill" ? items.list[4].scale :
obj.scale);
tmpContext.save();
tmpContext.translate(tmpX, tmpY);
tmpContext.rotate(obj.dir);
tmpContext.strokeStyle = outlineColor;
tmpContext.lineWidth = outlineWidth;
if (obj.name == "apple") {
tmpContext.fillStyle = "#c15555";
renderCircle(0, 0, obj.scale, tmpContext);
tmpContext.fillStyle = "#89a54c";
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 = "#cca861";
renderCircle(0, 0, obj.scale, tmpContext);
tmpContext.fillStyle = "#937c4b";
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 = "#f4f3ac";
renderCircle(0, 0, obj.scale, tmpContext);
tmpContext.fillStyle = "#c3c28b";
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") ?
"#83898e" : (obj.name == "wood wall") ?
"#a5974c" : "#939393";
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 = "#c9b758";
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);
}
tmpContext.restore();
}
let objSprites = [];
function getObjSprite(obj) {
let tmpSprite = objSprites[obj.id];
if (!tmpSprite) {
let blurScale = 0;
let tmpCanvas = document.createElement("canvas");
tmpCanvas.width = tmpCanvas.height = obj.scale * 2.5 +
outlineWidth + (items.list[obj.id].spritePadding || 0) + blurScale;
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 = "#cc5151";
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 = "#cc5151";
renderStar(tmpContext, 3, obj.scale * 0.65, obj.scale *
0.65);
tmpContext.fill();
}
tmpSprite = tmpCanvas;
objSprites[obj.id] = tmpSprite;
}
return tmpSprite;
}
function getMarkSprite(obj, tmpContext, tmpX, tmpY) {
tmpContext.lineWidth = outlineWidth;
tmpContext.globalAlpha = 1;
tmpContext.strokeStyle = outlineColor;
tmpContext.save();
tmpContext.translate(tmpX, tmpY);
tmpContext.rotate(obj.dir);
if (obj.name == "wood wall" || obj.name == "stone wall" || obj.name
== "castle wall") {
let sides = obj.name == "castle wall" ? 4 : 3;
renderHealthStar(tmpContext, sides, obj.scale * 1.1, obj.scale
* 1.1);
tmpContext.stroke();
} else if (obj.name == "spikes" || obj.name == "greater spikes" ||
obj.name == "poison spikes" || obj.name == "spinning spikes") {
let tmpScale = obj.scale * 0.6;
renderHealthStar(tmpContext, obj.name == "spikes" ? 5 : 6,
obj.scale, tmpScale);
tmpContext.stroke();
} else if (obj.name == "windmill" || obj.name == "faster windmill"
|| obj.name == "power mill") {
renderHealthCircle(0, 0, obj.scale, tmpContext, false, true);
} else if (obj.name == "mine") {
renderHealthStar(tmpContext, 3, obj.scale, obj.scale);
tmpContext.stroke();
} else if (obj.name == "sapling") {
let tmpScale = obj.scale * 0.7;
renderHealthStar(tmpContext, 7, obj.scale, tmpScale);
tmpContext.stroke();
} else if (obj.name == "pit trap") {
renderHealthStar(tmpContext, 3, obj.scale * 1.1, obj.scale *
1.1);
tmpContext.stroke();
} else if (obj.name == "boost pad") {
renderHealthRect(0, 0, obj.scale * 2, obj.scale * 2,
tmpContext, false, true);
} else if (obj.name == "turret") {
renderHealthCircle(0, 0, obj.scale, tmpContext, false, true);
} else if (obj.name == "platform") {
renderHealthRect(0, 0, obj.scale * 2, obj.scale * 2,
tmpContext, false, true);
} else if (obj.name == "healing pad") {
renderHealthRect(0, 0, obj.scale * 2, obj.scale * 2,
tmpContext, false, true);
} else if (obj.name == "spawn pad") {
renderHealthRect(0, 0, obj.scale * 2, obj.scale * 2,
tmpContext, false, true);
} else if (obj.name == "blocker") {
renderHealthCircle(0, 0, obj.scale, tmpContext, false, true);
} else if (obj.name == "teleporter") {
renderHealthCircle(0, 0, obj.scale, tmpContext, false, true);
}
tmpContext.restore();
}
function isOnScreen(x, y, s) {
return (x + s >= 0 && x - s <= maxScreenWidth && y + s >= 0 && (y,
s,
maxScreenHeight));
}
function markObject22(tmpObj, tmpX, tmpY) {
yen(tmpObj, mainContext, tmpX, tmpY);
}
function markObject(tmpObj, tmpX, tmpY) {
getMarkSprite(tmpObj, mainContext, tmpX, tmpY);
}
function yen(obj, tmpContext, tmpX, tmpY) {
tmpContext.lineWidth = outlineWidthRender;
tmpContext.globalAlpha = 1;
tmpContext.strokeStyle = outlineColorRender;
tmpContext.save();
tmpContext.translate(tmpX, tmpY);
tmpContext.rotate(obj.dir);
if (obj.name == "wood wall" || obj.name == "stone wall" || obj.name
== "castle wall") {
let sides = obj.name == "castle wall" ? 4 : 3;
renderHealthStar(tmpContext, sides, obj.scale * 1.1, obj.scale
* 1.1);
tmpContext.stroke();
} else if (obj.name == "spikes" || obj.name == "greater spikes" ||
obj.name == "poison spikes" || obj.name == "spinning spikes") {
let tmpScale = obj.scale * 0.6;
renderHealthStar(tmpContext, obj.name == "spikes" ? 5 : 6,
obj.scale, tmpScale);
tmpContext.stroke();
} else if (obj.name == "windmill" || obj.name == "faster windmill"
|| obj.name == "power mill") {
renderHealthCircle(0, 0, obj.scale, tmpContext, false, true);
} else if (obj.name == "mine") {
renderHealthStar(tmpContext, 3, obj.scale, obj.scale);
tmpContext.stroke();
} else if (obj.name == "sapling") {
let tmpScale = obj.scale * 0.7;
renderHealthStar(tmpContext, 7, obj.scale, tmpScale);
tmpContext.stroke();
} else if (obj.name == "pit trap") {
renderHealthStar(tmpContext, 3, obj.scale * 1.1, obj.scale *
1.1);
tmpContext.stroke();
} else if (obj.name == "boost pad") {
renderHealthRect(0, 0, obj.scale * 2, obj.scale * 2,
tmpContext, false, true);
} else if (obj.name == "turret") {
renderHealthCircle(0, 0, obj.scale, tmpContext, false, true);
} else if (obj.name == "platform") {
renderHealthRect(0, 0, obj.scale * 2, obj.scale * 2,
tmpContext, false, true);
} else if (obj.name == "healing pad") {
renderHealthRect(0, 0, obj.scale * 2, obj.scale * 2,
tmpContext, false, true);
} else if (obj.name == "spawn pad") {
renderHealthRect(0, 0, obj.scale * 2, obj.scale * 2,
tmpContext, false, true);
} else if (obj.name == "blocker") {
renderHealthCircle(0, 0, obj.scale, tmpContext, false, true);
} else if (obj.name == "teleporter") {
renderHealthCircle(0, 0, obj.scale, tmpContext, false, true);
}
tmpContext.restore();
}
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("#fff", config.mapPingScale);
mapPings.push(tmpPing);
}
tmpPing.init(x, y);
}
function updateMapMarker() {
mapMarker.x = player.x;
mapMarker.y = player.y;
}
let Pt = [];
window.isAlly = function(id){
for(let i = 0;i < Pt.length;i+=2){
if(id == Pt[i]){
return true;
}
}
}
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 = "#ff0000";
if (breakTrackers.length) {
mapContext.fillStyle = "#abcdef";
mapContext.font = "34px Hammersmith One";
mapContext.textBaseline = "middle";
mapContext.textAlign = "center";
for (let i = 0; i < breakTrackers.length;) {
mapContext.fillText("!", (breakTrackers[i].x /
config.mapScale) * mapDisplay.width,
(breakTrackers[i].y /
config.mapScale) * mapDisplay.height);
i += 2;
}
}
mapContext.globalAlpha = 1;
mapContext.fillStyle = "#fff";
renderCircle((player.x / config.mapScale) * mapDisplay.width,
(player.y / config.mapScale) * mapDisplay.height,
7, mapContext, true);
mapContext.fillStyle = "rgba(255,255,255,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 Hammersmith One";
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 Hammersmith One";
mapContext.textBaseline = "middle";
mapContext.textAlign = "center";
mapContext.fillText("x", (mapMarker.x / config.mapScale) *
mapDisplay.width,
(mapMarker.y / config.mapScale) *
mapDisplay.height);
}
}
}
let crossHairs = [
"https://cdn.discordapp.com/attachments/1001384433078779927/1149285738412769300/
newawwddd.png",
"https://cdn.discordapp.com/attachments/1001384433078779927/1149285168780165170/100
px-Crosshairs_Red.png"
];
let crossHairSprites = {};
let iconSprites = {
crown: new Image(),
skull: new Image()
};
function loadIcons() {
iconSprites.crown.onload = function() {
this.isLoaded = true;
};
iconSprites.crown.src = "./../img/icons/crown.png";
iconSprites.skull.onload = function() {
this.isLoaded = true;
};
iconSprites.skull.src = "./../img/icons/skull.png";
for (let i = 0; i < crossHairs.length; ++i) {
let tmpSprite = new Image();
tmpSprite.onload = function() {
this.isLoaded = true;
};
tmpSprite.src = crossHairs[i];
crossHairSprites[i] = tmpSprite;
}
}
loadIcons();
function updateGame() {
if (config.resetRender) {
mainContext.clearRect(0, 0, gameCanvas.width,
gameCanvas.height);
mainContext.beginPath();
}
if (true) {
if (player) {
if (false) {
camX = player.x;
camY = player.y;
} else {
let tmpDist = UTILS.getDistance(camX, camY, player.x,
player.y);
let tmpDir = UTILS.getDirection(player.x, player.y,
camX, camY);
let camSpd = Math.min(tmpDist * 0.01 * delta, tmpDist);
if (tmpDist > 0.05) {
camX += camSpd * Math.cos(tmpDir);
camY += camSpd * Math.sin(tmpDir);
} else {
camX = player.x;
camY = player.y;
}
}
} else {
camX = config.mapScale / 2;
camY = config.mapScale / 2;
}
let lastTime = now - (1000 / config.serverUpdateRate);
let tmpDiff;
for (let i = 0; i < players.length + ais.length; ++i) {
tmpObj = players[i] || ais[i - players.length];
if (tmpObj && tmpObj.visible) {
if (tmpObj.forcePos) {
tmpObj.x = tmpObj.x2;
tmpObj.y = tmpObj.y2;
tmpObj.dir = tmpObj.d2;
} else {
let total = tmpObj.t2 - tmpObj.t1;
let fraction = lastTime - tmpObj.t1;
let ratio = (fraction / total);
let rate = 170;
tmpObj.dt += delta;
let tmpRate = Math.min(1.7, tmpObj.dt / rate);
tmpDiff = (tmpObj.x2 - tmpObj.x1);
tmpObj.x = tmpObj.x1 + (tmpDiff * tmpRate);
tmpDiff = (tmpObj.y2 - tmpObj.y1);
tmpObj.y = tmpObj.y1 + (tmpDiff * tmpRate);
if (config.anotherVisual) {
tmpObj.dir = Math.lerpAngle(tmpObj.d2,
tmpObj.d1, Math.min(1.2, ratio));
} else {
tmpObj.dir = Math.lerpAngle(tmpObj.d2,
tmpObj.d1, Math.min(1.2, ratio));
}
}
}
}
let xOffset = camX - (maxScreenWidth / 2);
let yOffset = camY - (maxScreenHeight / 2);
//render
if (config.snowBiomeTop - yOffset <= 0 && config.mapScale -
config.snowBiomeTop - yOffset >= maxScreenHeight) {
mainContext.fillStyle = "#b6db66";
mainContext.fillRect(0, 0, maxScreenWidth,
maxScreenHeight);
} else if (config.mapScale - config.snowBiomeTop - yOffset <=
0) {
mainContext.fillStyle = "#dbc666";
mainContext.fillRect(0, 0, maxScreenWidth,
maxScreenHeight);
} else if (config.snowBiomeTop - yOffset >= maxScreenHeight) {
mainContext.fillStyle = "#fff";
mainContext.fillRect(0, 0, maxScreenWidth,
maxScreenHeight);
} else if (config.snowBiomeTop - yOffset >= 0) {
mainContext.fillStyle = "#fff";
mainContext.fillRect(0, 0, maxScreenWidth,
config.snowBiomeTop - yOffset);
mainContext.fillStyle = "#b6db66";
mainContext.fillRect(0, config.snowBiomeTop - yOffset,
maxScreenWidth,
maxScreenHeight - (config.snowBiomeTop
- yOffset));
} else {
mainContext.fillStyle = "#b6db66";
mainContext.fillRect(0, 0, maxScreenWidth,
(config.mapScale - config.snowBiomeTop
- yOffset));
mainContext.fillStyle = "#dbc666";
mainContext.fillRect(0, (config.mapScale -
config.snowBiomeTop - yOffset), maxScreenWidth,
maxScreenHeight - (config.mapScale -
config.snowBiomeTop - yOffset));
}
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);
}
if(configs5.Grid) {
mainContext.lineWidth = 4; //Visuals
mainContext.strokeStyle = "#000";
mainContext.globalAlpha = 0.06;
} else {
mainContext.lineWidth = 0; //Visuals
mainContext.strokeStyle = "#000";
mainContext.globalAlpha = 0;
}
for (let x = -camX; x < maxScreenWidth; x += maxScreenHeight /
18) {
if (x > 0) {
mainContext.moveTo(x, 0);
mainContext.lineTo(x, maxScreenHeight);
}
}
for (let y = -camY; y < maxScreenHeight; y += maxScreenHeight /
18) {
if (y > 0) {
mainContext.moveTo(0, y);
mainContext.lineTo(maxScreenWidth, y);
}
}
mainContext.stroke();
if (player) {
if (lastDeath) {
mainContext.globalAlpha = 1;
mainContext.fillStyle = "#fc5553";
mainContext.font = "100px Hammersmith One";
mainContext.textBaseline = "middle";
mainContext.textAlign = "center";
mainContext.fillText("O", lastDeath.x - xOffset,
lastDeath.y - yOffset);
}
}
mainContext.globalAlpha = 1;
mainContext.strokeStyle = outlineColor;
renderDeadPlayers(xOffset, yOffset);
mainContext.globalAlpha = 1;
mainContext.strokeStyle = outlineColor;
renderGameObjects(-1, xOffset, yOffset);
mainContext.globalAlpha = 1;
mainContext.lineWidth = outlineWidth;
renderProjectiles(0, xOffset, yOffset);
renderPlayers(xOffset, yOffset, 0);
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();
}
}
renderGameObjects(0, xOffset, yOffset);
renderProjectiles(1, xOffset, yOffset);
renderGameObjects(1, xOffset, yOffset);
renderPlayers(xOffset, yOffset, 1);
renderGameObjects(2, xOffset, yOffset);
renderGameObjects(3, xOffset, yOffset);
mainContext.fillStyle = "#000";
mainContext.globalAlpha = 0.2;
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;
if(getEl("timeType").value == "eveningt") {
mainContext.fillStyle = "rgba(0, 0, 70, 0.50)";
mainContext.fillRect(0, 0, maxScreenWidth,
maxScreenHeight);
} else if(getEl("timeType").value == "nightt") {
mainContext.fillStyle = "rgba(0, 0, 70, 0.60)";
mainContext.fillRect(0, 0, maxScreenWidth,
maxScreenHeight);
} else if(getEl("timeType").value == "morningt") {
mainContext.fillStyle = "rgba(0, 0, 70, 0.30)";
mainContext.fillRect(0, 0, maxScreenWidth,
maxScreenHeight);
} else if(getEl("timeType").value == "afternoont") {
mainContext.fillStyle = "rgba(0, 0, 70, 0.40)";
mainContext.fillRect(0, 0, maxScreenWidth,
maxScreenHeight);
} else if(getEl("visualType").value == "aevisuals") {
mainContext.fillStyle = "rgba(0, 0, 70, 0.35)";
mainContext.fillRect(0, 0, maxScreenWidth,
maxScreenHeight);
} else if(getEl("visualType").value == "fz") {
mainContext.fillStyle = "rgba(0, 0, 70, 0.35)";
mainContext.fillRect(0, 0, maxScreenWidth,
maxScreenHeight);
} else {
mainContext.fillStyle = "rgba(20, 0, 70, 0.45)";
mainContext.fillRect(0, 0, maxScreenWidth,
maxScreenHeight);
mainContext.fillStyle = "rgba(0, 5, 0, 0.15)";
mainContext.fillRect(0, 0, maxScreenWidth,
maxScreenHeight);
mainContext.fillStyle = "rgba(255, 255, 255, 0.025)";
mainContext.fillRect(0, 0, maxScreenWidth,
maxScreenHeight);
}
mainContext.strokeStyle = darkOutlineColor;
mainContext.globalAlpha = 1;
let shame = true;
for (let i = 0; i < players.length + ais.length; ++i) {
tmpObj = players[i] || ais[i - players.length];
if (tmpObj.visible) {
mainContext.strokeStyle = darkOutlineColor;
if (tmpObj.skinIndex != 10 || (tmpObj == player) ||
(tmpObj.team && tmpObj.team == player.team)) {
let tmpText = "";
if(configs5.Shame) {
shame = true;
}else {
shame = false;
}
if(getEl("visualType").value == "aevisuals") {
tmpText = (tmpObj.team ? "[" + tmpObj.team + "]
" : "") + tmpObj.name;
}
if (getEl("visualType").value == "fz") {
tmpText = (tmpObj.team ? "[" + tmpObj.team + "]
" : "") + ("[" + tmpObj.primaryIndex + "/" + tmpObj.secondaryIndex + "/" +
tmpObj.maxShameCount + "] ") + tmpObj.name;
}
if (tmpText != "") {
if(tmpObj.isPlayer) {
mainContext.font = (tmpObj.nameScale||30) +
"px Hammersmith One";
mainContext.fillStyle = "#fff";
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);
}
if (tmpObj.isLeader &&
iconSprites["crown"].isLoaded) {
var tmpS = config.crownIconScale;
var 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) {
var tmpS = config.crownIconScale;
var 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 && crossHair && near ==
tmpObj && (crossHair ? crossHairSprites[1].isLoaded : crossHairSprites[0].isLoaded)
&& enemy.length) {
let tmpS = tmpObj.scale * 2.2;
mainContext.drawImage((crossHair ?
crossHairSprites[1] : crossHairSprites[0]), tmpObj.x - xOffset - tmpS / 2, tmpObj.y
- yOffset - tmpS / 2, tmpS, tmpS);
}
if(tmpObj.isPlayer && shame) {
// mainContext.font = (tmpObj.nameScale
|| 30) + "px Hammersmith One";
var textColor;
mainContext.font = (tmpObj.nameScale || 30)
+ "px Hammersmith One";
mainContext.fillStyle = 'red';
mainContext.strokeStyle = 'black';
mainContext.textBaseline = "middle";
mainContext.textAlign = "center";
mainContext.lineWidth = tmpObj.nameScale ?
11 : 8;
mainContext.lineJoin = "round";
var tmpS = config.crownIconScale;
var tmpX = tmpObj.x - xOffset - (tmpS/2) +
(mainContext.measureText(tmpText).width / 2) + config.crownPad + 15;
mainContext.strokeText(tmpObj.shameCount,
tmpX, tmpObj.y - yOffset - tmpObj.scale - config.nameY);
mainContext.fillText(tmpObj.shameCount,
tmpX, tmpObj.y - yOffset - tmpObj.scale - config.nameY);
}
tmpText = "";
}
if (tmpObj.isPlayer) {
mainContext.lineCap = "round";
mainContext.strokeStyle = "#581845";
mainContext.lineWidth = 8
mainContext.beginPath();
mainContext.moveTo(0, 0);
mainContext.lineTo(0, - tmpObj.scale);
mainContext.lineTo(- tmpObj.scale, -
tmpObj.scale);
mainContext.stroke();
mainContext.strokeStyle = "transparent";
}
if ((tmpObj !== player || tmpObj.team !==
player.team) && tmpObj.isPlayer && configs6.Tracers) {
let center = {
x: screenWidth / 2,
y: screenHeight / 2,
};
let alpha = Math.min(1, (UTILS.getDistance(0,
0, player.x - tmpObj.x, (player.y - tmpObj.y) * (16 / 9)) * 100) /
(config.maxScreenHeight / 2) / center.y);
let dist = center.y * alpha;
let tmpX = dist *
Math.cos(UTILS.getDirect(tmpObj, player, 0, 0));
let tmpY = dist *
Math.sin(UTILS.getDirect(tmpObj, player, 0, 0));
mainContext.save();
mainContext.translate((player.x - xOffset) +
tmpX, (player.y - yOffset) + tmpY);
mainContext.rotate(tmpObj.aim2 + Math.PI / 2);
let by = 255 - (tmpObj.sid * 2);
mainContext.fillStyle = tmpObj === player ||
(tmpObj.team && tmpObj.team === player.team) ? "rgba(142, 204, 81, 1)" : `rgb($
{by}, ${by}, ${by})`;
mainContext.globalAlpha = alpha;
let renderTracer = function(s, ctx) {
ctx = ctx || mainContext;
let h = s * (Math.sqrt(3) / 2);
ctx.beginPath();
ctx.moveTo(0, -h / 1.5);
ctx.lineTo(-s / 2, h / 2);
ctx.lineTo(s / 2, h / 2);
ctx.lineTo(0, -h / 1.5);
ctx.fill();
ctx.closePath();
}
renderTracer(25, mainContext);
mainContext.restore();
}
let render = {
x: tmpObj.x2 - xOffset,
y: tmpObj.y2 - yOffset
};
if (tmpObj.health) {
mainContext.globalAlpha = 1;
mainContext.font = "20px Hammersmith One";
mainContext.fillStyle = "#fff";
mainContext.strokeStyle = darkOutlineColor;
mainContext.textBaseline = "middle";
mainContext.textAlign = "center";
mainContext.lineWidth = 8;
mainContext.lineJoin = "round";
if(getEl("visualType").value == "fz" &&
tmpObj.isPlayer) {
// HEALTH HOLDER:
var tmpWidth = config.healthBarWidth;
mainContext.fillStyle = darkOutlineColor;
mainContext.roundRect(tmpObj.x - xOffset -
config.healthBarWidth - config.healthBarPad,
(tmpObj.y - yOffset +
tmpObj.scale) + config.nameY, (config.healthBarWidth * 2) +
(config.healthBarPad
* 2), 17, 11); // 11
mainContext.fill();
// HEALTH BAR:
mainContext.fillStyle = (tmpObj==player||
(tmpObj.team&&tmpObj.team==player.team))? "#8ecc51" : "#cc5151";
mainContext.roundRect(tmpObj.x - xOffset -
config.healthBarWidth,
(tmpObj.y - yOffset +
tmpObj.scale) + config.nameY + config.healthBarPad,
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
};
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
turret: (2500 - tmpObj.reloads[53])
/ 2500
};
mainContext.fillStyle =
tmpObj.isTeamObject(player) ? "#fff" : "#F05C5B";
mainContext.textBaseline = "middle";
mainContext.textAlign = "center";
mainContext.lineWidth = 0;
mainContext.lineJoin = "round";
mainContext.strokeStyle = darkOutlineColor;
mainContext.lineWidth = 5;
mainContext.strokeText(tmpObj.owner.sid,
tmpObj.x - xOffset, tmpObj.y - yOffset + 32.6);
mainContext.fillText(tmpObj.owner.sid,
tmpObj.x - xOffset, tmpObj.y - yOffset + 32.6);
}
}
}
});
mainContext.restore();
if (layer == 0) {
if (placeVisible.length) {
placeVisible.forEach((places) => {
tmpX = places.x - xOffset;
tmpY = places.y - yOffset;
markObject(places, tmpX, tmpY);
});
}
}
}
function drawArrow(xOffset, yOffset, x, y, arrowWidth, color,
angle, lineWidth) {
mainContext.save()
mainContext.translate(x - xOffset, y - yOffset)
mainContext.rotate(Math.PI / 4)
mainContext.rotate(angle)
mainContext.globalAlpha = 1
mainContext.strokeStyle = color
mainContext.lineCap = "round"
mainContext.lineWidth = lineWidth
mainContext.beginPath()
mainContext.moveTo(-arrowWidth, -arrowWidth)
mainContext.lineTo(arrowWidth, -arrowWidth)
mainContext.lineTo(arrowWidth, arrowWidth)
mainContext.stroke()
mainContext.closePath()
mainContext.restore()
}
if (player) {
// AUTOPUSH LINE:
if (my.autoPush) {
mainContext.lineWidth = 5;
mainContext.globalAlpha = 1;
mainContext.beginPath();
mainContext.strokeStyle = autoPushLine;
mainContext.moveTo(player.x - xOffset, player.y -
yOffset);
mainContext.lineTo(my.pushData.x2 - xOffset,
my.pushData.y2 - yOffset);
mainContext.lineTo(my.pushData.x - xOffset,
my.pushData.y - yOffset);
mainContext.stroke();
}
}
mainContext.globalAlpha = 1;
textManager.update(delta, mainContext, xOffset, yOffset);
for (var i = 0; i < players.length; ++i) {
tmpObj = players[i];
if (tmpObj.visible && tmpObj.chatCountdown > 0) {
tmpObj.chatCountdown -= delta;
if (tmpObj.chatCountdown <= 0)
tmpObj.chatCountdown = 0;
mainContext.font = "24px Hammersmith One";
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 + 17;
mainContext.fillStyle = "#FFFFFF";
setTimeout(() => {
mainContext.fillStyle = "#FFE000";
}, 100);
mainContext.roundRect(tmpX-tmpW/2, tmpY-tmpH/2, tmpW,
tmpH, 6);
mainContext.fill();
mainContext.fillStyle = "#000000";
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,
1e999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999);
};
})();
let ms = {
avg: 0,
max: 0,
min: 0,
delay: 0
}
function doUpdate() {
const now2 = new Date();
const hours = now2.getHours();
const minutes = now2.getMinutes();
const secondsFor = now2.getSeconds();
fpsTimer.time++;
updateGame();
rAF(doUpdate);
getEl("fpstimer").innerHTML = `Frames: $
{UTILS.round(fpsTimer.ltime, 10)}`;
getEl("InfoAll").innerHTML = "PrePlace: " + PrePlaceCount;
if(configs5.Info) {
getEl("Time").innerHTML = time;
getEl("Music").innerHTML = `Music: ` + musicV;
getEl("pingFps").innerHTML = `Ping: ${window.pingTime}ms`;
getEl("packetStatus").innerHTML = "Packet: " + secPacket;
}else {
getEl("Time").innerHTML = ` `;
getEl("Music").innerHTML = ` `;
getEl("pingFps").innerHTML = `⠀`;
if(configs5.Packet) {
getEl("packetStatus").innerHTML = "Packet: " + secPacket;
} else {
getEl("packetStatus").innerHTML = "⠀";
}
}
}
prepareMenuBackground();
doUpdate();
let changeDays = {};
window.debug = function() {
my.waitHit = 0;
my.autoAim = false;
instaC.isTrue = false;
traps.inTrap = false;
itemSprites = [];
objSprites = [];
gameObjectSprites = [];
};
window.startGrind = function() {
if (configs3.WeaponGrinder) {
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.toggleBotsCircle = function() {
player.circle = !player.circle;
};
window.AutoBot = function() {
config.autobot = !config.autobot;
};
window.zoomvis = function() {
zoomVision();
};
window.Leaderboard = function() {
$("#topInfoHolder").toggle();
if(topInfoHolder) {
topInfoHolder = false;
$("#storeButton").css({'right': '140px'});
$("#allianceButton").css({'right': '80px'});
$("#leaderboardButton").css({'right': '20px'});
$(".sizingTime").css({'right': '200px', 'top': '25px'});
} else {
topInfoHolder = true;
$("#storeButton").css({'right': '390px'});
$("#allianceButton").css({'right': '330px'});
$("#leaderboardButton").css({'right': '270px'});
$(".sizingTime").css({'right': '270px', 'top': '80px'});
}
};
let myVariable = true;
window.FpsBoost = function() {
myVariable = !myVariable;
if(myVariable) {
document.getElementById("woodDisplay").style.display = "none";
document.getElementById("stoneDisplay").style.display = "none";
document.getElementById("foodDisplay").style.display = "none";
$("#killCounter").css({'bottom': '75px'});
} else {
document.getElementById("woodDisplay").style.display = "block";
document.getElementById("stoneDisplay").style.display =
"block";
document.getElementById("foodDisplay").style.display = "block";
$("#killCounter").css({'bottom': '240px'});
}
};
window.toggleVisual = function() {
config.anotherVisual = !config.anotherVisual;
gameObjects.forEach((tmp) => {
if (tmp.active) {
tmp.dir = tmp.lastDir;
}
});
};
window.toggleVisualTurn = function() {
config.anotherVisualTurn = !config.anotherVisualTurn;
};
window.prepareUI = function(tmpObj) {
resize();
UTILS.removeAllChildren(actionBar);
for (let i = 0; i < (items.weapons.length + items.list.length); +
+i) {
(function(i) {
UTILS.generateElement({
id: "actionBarItem" + i,
class: "actionBarItem",
style: "display:none",
onmouseout: function() {
showItemInfo();
},
parent: actionBar
});
})(i);
}
for (let i = 0; i < (items.list.length + items.weapons.length); +
+i) {
(function(i) {
let tmpCanvas = document.createElement("canvas");
tmpCanvas.width = tmpCanvas.height = 66;
let tmpContext = tmpCanvas.getContext("2d");
tmpContext.translate((tmpCanvas.width / 2),
(tmpCanvas.height / 2));
tmpContext.imageSmoothingEnabled = false;
tmpContext.webkitImageSmoothingEnabled = false;
tmpContext.mozImageSmoothingEnabled = false;
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 noname = "unknown";
let name = data + "";
name = name.slice(0, config.maxNameLength);
name = name.replace(/[^\w:\(\)\/? -]+/gmi, " ");
name = name.replace(/[^\x00-\x7F]/g, " ");
name = name.trim();
let isProfane = false;
let convertedName = name.toLowerCase().replace(/\s/g,
"").replace(/1/g, "i").replace(/0/g, "o").replace(/5/g, "s");
if (name.length > 0 && !isProfane) {
noname = name;
}
return noname;
}
};
window.toggleNight();
},
webgl_test: () => {
return;
let canvas = document.createElement("canvas");
canvas.id = "WEBGL";
canvas.width = canvas.height = 300;
canvas.style = `
position: relative;
bottom: 70%;
left: 70%;
pointer-events: none;
`;
let fat = document.createElement("div");
fat.id = "faku";
fat.width = fat.height = 300;
fat.style = `
position: relative;
bottom: 70%;
left: 70%;
pointer-events: none;
font-size: 20px;
`;
fat.innerHTML = "Webgl Test Rendering";
let gl = canvas.getContext("webgl");
if (!gl) {
alert("urbad");
return;
}
document.body.append(canvas);
document.body.append(fat);
log(gl);
gl.clearColor(0, 0, 0, 0.2);
gl.clear(gl.COLOR_BUFFER_BIT);
let buffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
function render(vs, fs, vertice, type) {
let vShader = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(vShader, vs);
gl.compileShader(vShader);
gl.getShaderParameter(vShader, gl.COMPILE_STATUS);
let fShader = gl.createShader(gl.FRAGMENT_SHADER);
gl.shaderSource(fShader, fs);
gl.compileShader(fShader);
gl.getShaderParameter(fShader, gl.COMPILE_STATUS);
let program = gl.createProgram();
gl.attachShader(program, vShader);
gl.attachShader(program, fShader);
gl.linkProgram(program);
gl.getProgramParameter(program, gl.LINK_STATUS);
gl.useProgram(program);
let vertex = gl.getAttribLocation(program, "vertex");
gl.enableVertexAttribArray(vertex);
gl.vertexAttribPointer(vertex, 2, gl.FLOAT, false, 0, 0);
let vertices = vertice.length / 2;
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertice),
gl.DYNAMIC_DRAW);
gl.drawArrays(type, 0, vertices);
}
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(", ");
}
let max = 50;
for (let i = 0; i < max; i++) {
let radian = (Math.PI * (i / (max / 2)));
render(`
precision mediump float;
attribute vec2 vertex;
void main(void) {
gl_Position = vec4(vertex, 0, 1);
}
`, `
precision mediump float;
void main(void) {
gl_FragColor = vec4(${getRgb(...hexToRgb("#cc5151"))}, 1);
}
`, [
0 + (Math.cos(radian) * 0.5), 0 + (Math.sin(radian) * 0.5),
0, 0,
], gl.LINE_LOOP);
}
}
};
if (codes) {
for (let code in codes) {
let func = codes[code];
typeof func === "function" && func();
}
window.enableHack = function() {
if (!useHack) {
useHack = true;
codes.main();
}
};
}
}(1);
//window.devicePixelRatio = 0.2;
//selectSkinColor(4);
document.getElementById("woodDisplay").remove();
document.getElementById("stoneDisplay").remove();
document.getElementById("foodDisplay").remove();