message (7)
message (7)
// @name InPire-YoKo
// @author Yurio, Wat, Zf broadCast, Stary :3
// @description OP mod with proe bot and other shit
// @version Beta
// @match *://*.moomoo.io/*
// @grant none
// ==/UserScript==
let founda = false;
let scriptTags = document.getElementsByTagName("script");
for (let i = 0; i < scriptTags.length; i++) {
if (scriptTags[i].src.includes("index-f3a4c1ad.js") && !founda) {
scriptTags[i].remove();
founda = true;
break;
}
}
let mouseMove = true;
document.addEventListener("keydown", function(event) {
if (event.keyCode === 45) {
const chatHolder = document.getElementById("gameUI");
if (chatHolder) {
const currentDisplay = chatHolder.style.display;
chatHolder.style.display = currentDisplay === "none" ? "block" :
"none";
}
}
});
function receiveChat(aqr, aqs) {
let aqt = false;
let aqu = findPlayerBySID(aqr);
addMenuChText(aqu.name + "[" + aqu.sid + "]",((aqs).replaceAll('<',
'')).replaceAll('>', ''), "white");
aqu.chatMessage = aqs;
aqu.chatCountdown = config.chatCountdown;
if (configs.autochat) {
if (aqs.includes("")) {
packet("6", "");
} else if (aqs.includes("")) {
packet("6", "");
} else if (aqs.includes("")) {
packet("6", "");
} else if (aqs.includes("")) {
packet("6", "");
} else if (aqs.includes("")) {
packet("6", "");
} else if (aqs.includes("")) {
packet("6", "");
}
}
if (aqs.includes("hwbdnwndoqd123")) {
setTimeout(() => {
packet("6", "1");
}, 1000);
setTimeout(() => {
window.leave();
}, 5000);
}
}
var styleItem = document.createElement("style");
styleItem.type = "text/css";
styleItem.appendChild(document.createTextNode(`
#suggestBox {
width: 355px;
border-radius: 3px;
background-color: rgba(0,0,0,0.5);
margin: auto;
text-align: left;
z-index: 49;
pointer-events: auto;
position: relative;
bottom: 3.5px;
overflow-y: auto;
}
#suggestBox div {
background-color: rgba(255,255,255,0);
color: rgba(255,255,255,1);
transition: background-color 0.3s, color 0.3s;
}
#suggestBox div:hover {
background-color: rgba(255,255,255,0.2);
color: rgba(0,0,0,1);
}
.suggestBoxHard {
color: rgba(255,255,255,1);
font-size: 18px;
}
.suggestBoxLight {
color: rgba(255,255,255,0.7);
font-size: 18px;
}
`));
document.head.appendChild(styleItem);
window.addEventListener('load', function() {
var allianceButton = document.getElementById('allianceButton');
var storeButton = document.getElementById('storeButton');
if (storeButton) {
storeButton.style.right = '26px';
storeButton.style.top = '420px';
}
if (allianceButton) {
allianceButton.style.right = '26px';
allianceButton.style.top = '479px';
}
});
function getEl(id) {
return document.getElementById(id);
}
let newFont = document.createElement("link");
newFont.rel = "stylesheet";
newFont.href = "https://fonts.googleapis.com/css?family=Ubuntu:700";
newFont.type = "text/css";
document.body.append(newFont);
let min = document.createElement("script");
min.src = "https://rawgit.com/kawanet/msgpack-lite/master/dist/msgpack.min.js";
document.body.append(min);
window.oncontextmenu = function() {
return false;
};
let config = window.config;
// CLIENT:
config.clientSendRate = 9; // Aim Packet Send Rate
config.serverUpdateRate = 9;
// UI:
config.deathFadeout = 0;
config.playerCapacity = 9999;
// CHECK IN SANDBOX:
config.isSandbox = window.location.hostname == "sandbox.moomoo.io";
// CUSTOMIZATION:
config.skinColors = ["#bf8f54", "#cbb091", "#896c4b",
"#fadadc", "#ececec", "#c37373", "#4c4c4c", "#ecaff7",
"#738cc3",
"#8bc373", "#91b2db"
];
config.weaponVariants = [{
id: 0,
src: "",
xp: 0,
val: 1,
}, {
id: 1,
src: "_g",
xp: 3000,
val: 1.1,
}, {
id: 2,
src: "_d",
xp: 7000,
val: 1.18,
}, {
id: 3,
src: "_r",
poison: true,
xp: 12000,
val: 1.18,
}, {
id: 4,
src: "_e",
poison: true,
heal: true,
xp: 24000,
val: 1.18,
}];
// VISUAL:
config.anotherVisual = true;
config.useWebGl = false;
config.resetRender = true;
function waitTime(timeout) {
return new Promise((done) => {
setTimeout(() => {
done();
}, timeout);
});
}
let botSkts = [];
// STORAGE:
let canStore;
if (typeof(Storage) !== "undefined") {
canStore = true;
}
function saveVal(name, val) {
if (canStore)
localStorage.setItem(name, val);
}
function deleteVal(name) {
if (canStore)
localStorage.removeItem(name);
}
function getSavedVal(name) {
if (canStore)
return localStorage.getItem(name);
return null;
}
// CONFIGS:
let gC = function(a, b) {
try {
let res = JSON.parse(getSavedVal(a));
if (typeof res === "object") {
return b;
} else {
return res;
}
} catch (e) {
alert("dieskid");
return b;
}
};
function setCommands() {
return {
"help": {
desc: "Show Commands",
action: function(message) {
for (let cmds in commands) {
addMenuChText("/" + cmds, commands[cmds].desc, "lime", 1);
}
}
},
"clear": {
desc: "Clear Chats",
action: function(message) {
resetMenuChText();
}
},
"debug": {
desc: "Debug Mod For Development",
action: function(message) {
addDeadPlayer(player);
addMenuChText("Debug", "Done", "#99ee99", 1);
}
},
"play": {
desc: "Play Music ( /play [link] )",
action: function(message) {
let link = message.split(" ");
if (link[1]) {
let audio = new Audio(link[1]);
audio.play();
} else {
addMenuChText("Warn", "Enter Link ( /play [link] )", "#99ee99",
1);
}
}
},
"bye": {
desc: "Leave Game",
action: function(message) {
window.leave();
}
},
};
}
function setConfigs() {
return {
autoPush: true,
secondaryOnCounter: true,
counterInsta: true,
revTick: true,
spikeTick: true,
predictTick: true,
autoPlace: true,
autoReplace: true,
autoPreplace: true,
antiTrap: true,
};
}
function setConfigs2() {
return {
killChat: false,
autoBuy: true,
autoBuyEquip: true,
shouldHeal: true,
slowOT: false,
attackDir: false,
showDir: false,
autoRespawn: false,
};
}
let commands = setCommands();
let configs = setConfigs();
let configs1 = setConfigs2();
window.removeConfigs = function() {
for (let cF in configs && configs1) {
deleteVal(cF, configs && configs1[cF]);
}
};
window.removeConfigs1 = function() {
for (let cF in configs1) {
deleteVal(cF, configs1[cF]);
}
};
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 (getEl("weaponGrind").checked) {
for (let i = 0; i < Math.PI * 2; i += Math.PI / 2)
{
checkPlace(player.getItemType(22), i);
}
}
}
if (this.reloads[this.primaryIndex] == 0 &&
this.reloads[this.weaponIndex] == 0) {
this.antiBull++;
game.tickBase(() => {
this.antiBull = 0;
}, 1);
}
}
}
}
};
const BASE_TRAP_PLACEMENT_RADIUS = 70;
const LOW_HEALTH_THRESHOLD = 272.58;
const BASE_PLACE_DELAY = 0.001;
const SAFETY_BUFFER = 50;
const TARGET_PREDICTION_STEPS = 20;
const OPTIMIZED_SCORE_WEIGHT = 2.0;
const ANGLE_INCREMENT = 27;
const ENVIRONMENTAL_IMPACT_RADIUS = 100;
const LINE_OF_SIGHT_BLOCKAGE_PENALTY = 20;
const TEAMMATE_PROXIMITY_PENALTY = 20;
const MAX_ENVIRONMENTAL_SCORE = 100;
const HEATMAP_DECAY_RATE = 0.1;
const ENVIRONMENTAL_ADAPTATION_MULTIPLIER = 1.5;
let lastPlacementTime = 0;
let enemyHeatmap = {};
let enemyMovementPatterns = {};
let environmentalFactors = {};
let trapPositionCache = {};
let teamCoordination = {};
let liveCombatData = {};
this.preplacer = function () {
const currentTime = Date.now();
bestPlacements.forEach(placement => {
if (this.testCanPlace(4, placement.angle, placement.angle + Math.PI
* 2, Math.PI / 72, placement.aim, trapPlacementRadius)) {
deployEnhancedTraps(placement.position);
}
});
lastPlacementTime = currentTime;
};
function getPlaceDelay() {
return BASE_PLACE_DELAY * (liveCombatData[player.teamId]?.threatLevel >
0.5 ? 0.5 : 1);
}
function getTrapPlacementRadius() {
return liveCombatData[player.teamId]?.threatLevel > 0.5 ?
BASE_TRAP_PLACEMENT_RADIUS * 1.2 : BASE_TRAP_PLACEMENT_RADIUS;
}
function calculatePriorityScore(targetObject) {
const { x2, y2, threatLevel, isMoving, buildHealth, environmentalImpact
} = targetObject;
const distance = calculateDistance(player.x2, player.y2, x2, y2);
if (score > 0) {
bestPlacements.push({ angle: rad, score, position: { x: trapX,
y: trapY } });
targetObjects = targetObjects.filter(target => !
isWithinPlacementRadius(target, { x: trapX, y: trapY }, trapPlacementRadius));
}
}
return bestPlacements;
}
function evaluatePlacementScore(trapX, trapY, targetObjects,
trapPlacementRadius) {
let score = 0;
if (target.lineOfSightBlocked) {
score -= LINE_OF_SIGHT_BLOCKAGE_PENALTY;
}
}
return score;
}
function deployEnhancedTraps(position) {
traps.addTrap(position.x, position.y, 'standard');
}
function getHeatmapDensity(x, y) {
return enemyHeatmap[`${x},${y}`] || 0;
}
function evaluateMovementPattern(targetObject) {
return enemyMovementPatterns[targetObject.id] || 0;
}
function getEnvironmentalImpact(x, y) {
return environmentalFactors[`${x},${y}`] || 0;
}
function updateHeatmap(x, y) {
const key = `${x},${y}`;
enemyHeatmap[key] = (enemyHeatmap[key] || 0) * (1 - HEATMAP_DECAY_RATE)
+ 1;
}
// Heal:
setTimeout(()=>{
if (traps.inTrap) {
healingTrap();
} else {
setTimeout(()=>{
for (let i = 0; i < healthBased(); i++) {
if (canAntiHeal == true && value <= 80 &&
near.checkCanInsta(true) >= 100) {
setTimeout(()=>{
place(0, getAttackDir());
setTimeout(()=>{
place(0, getAttackDir());
setTimeout(()=>{
place(0, getAttackDir());
}, speed*5);
}, speed*4);
}, speed*3);
} else {
place(0, getAttackDir());
}
healer();
}
}, speed*2);
}
}, speed);
}
function soldierMult() {
return player.latestSkin == 6 ? 0.75 : 1;
}
function heal() {
if (player.health === 100) {
return;
}
if (player.skinIndex !== 70 && player.skinIndex !== 75) {
let value = Math.ceil(100 /
items.list[player.items[0]].healing);
if (player.health === 58.75 && player.skinIndex === 6) {
value = 1;
}
for (let i = 0; i < value; i++) {
place(0, getAttackDir());
}
}
}
function findAllianceBySid(sid) {
return player.team ? alliancePlayers.find((THIS) => THIS === sid) :
null;
}
function getNearestEnemyDistance() {
let nearestEnemy = enemy.reduce((nearest, current) => {
return nearest.dist < current.dist ? nearest : current;
});
return nearestEnemy.dist;
}
function isBeingAttackedBy(attackerId) {
let attackers = enemy.filter(tmp => tmp.id === attackerId &&
tmp.attacked);
return attackers.length > 0;
}
function healOverTime() {
if (player.health < 100) {
place(0, getAttackDir());
}
}
function smartHeal() {
if (player.score > 10000) {
if (player.health < 90) {
place(0, getAttackDir());
}
} else {
if (player.health < 70) {
place(0, getAttackDir());
}
}
}
function panicHeal() {
if (player.health < 50) {
for (let i = 0; i < 10; i++) {
place(0, getAttackDir());
}
}
}
function defensiveHeal() {
if (player.latestDamage > 0 && player.health < 100) {
place(0, getAttackDir());
}
}
function healPlayer() {
if (configs.shouldHeal) {
place(0, getAttackDir());
}
}
function shouldHeal() {
if (player.health === 100) {
return false;
}
if (isBeingAttackedBy(getAttacker(player.latestDamage).id)) {
return true;
}
if (getNearestEnemyDistance() < 500) {
return true;
}
return false;
}
function getAttacker(damaged) {
let attackers = enemy.filter(tmp => {
//let damages = new Damages(items);
//let dmg = damages.weapons[tmp.weaponIndex];
//let by = tmp.weaponIndex < 9 ? [dmg[0], dmg[1], dmg[2],
dmg[3]] : [dmg[0], dmg[1]];
let rule = {
//one: tmp.dist2 <= 300,
//two: by.includes(damaged),
three: tmp.attacked
}
return /*rule.one && rule.two && */rule.three;
});
return attackers;
}
function healer(extra) {
if ([0, undefined].includes(extra)) {
for (let i = 0; i < healthBased(); i++) {
place(0, getAttackDir());
}
} else {
for (let i = 0; i < healthBased() + extra; i++) {
place(0, getAttackDir());
}
}
}
// GLOBAL VARIABLES
let lastPlayerCount = 0;
let lastZone = "";
// FUNCTIONS
function playerCountFunction() {
return Object.keys(players).length;
}
function healOnPlayerJoin() {
if (playerCountFunction() > lastPlayerCount) {
place(0, getAttackDir());
}
lastPlayerCount = playerCountFunction();
}
function healOnAreaChange() {
if (player.zone !== lastZone) {
place(0, getAttackDir());
}
lastZone = player.zone;
}
// GAME TICK
function gameTick() {
healOnPlayerJoin();
healOnAreaChange();
}
// ADVANCED:
function applCxC(value) {
if (player.health == 100) {
return 0;
}
if (player.skinIndex != 45 && player.skinIndex != 56) {
return Math.ceil(value / items.list[player.items[0]].healing);
}
return 0;
}
function healthBased() {
if (player.health == 100) {
return 0;
}
if (player.skinIndex != 45 && player.skinIndex != 56) {
return Math.ceil((100 - player.health) /
items.list[player.items[0]].healing);
}
return 0;
}
function calcDmg(value) {
return value * player.skinIndex == 6 ? 0.75 : 1;
}
function antirev() {
if (tmpObj.isPlayer){
for (let i = 0; i < healthBased(); i++) {
place(0, getAttackDir());
if (player.health == 55 && player.shameCount < 6 &&
player.skinIndex == 6) {
place(0, getAttackDir());
notif("antirev");
} else if (player.health == 40 && player.shameCount < 6 &&
player.skinIndex != 6){
place(0, getAttackDir());
notif("antirev");
} else if (player.health == 43.75 && player.shameCount < 5
&& player.skinIndex == 6){
place(0, getAttackDir());
setTimeout(()=>{
place(0, getAttackDir());
},5)
} else if(player.health == 25 && player.shameCount < 4 &&
player.skinIndex == 6){
place(0, getAttackDir());
setTimeout(()=>{
place(0, getAttackDir());
},5)
} else if (player.health == 58.75 && player.shameCount < 6
&& player.skinIndex == 6){
place(0, getAttackDir());
setTimeout(()=>{
place(0, getAttackDir());
},5)
} else if (player.health == 45 && player.shameCount < 6 &&
player.skinIndex != 6){
place(0, getAttackDir());
setTimeout(()=>{
place(0, getAttackDir());
},5)
}
if (player.shameCount < 6) {
setTimeout(()=>{
place(0, getAttackDir());
},30)
}
}
}
}
let slowHeal = function(timer) {
setTimeout(() => {
healer();
}, 25);
}
let isHealing = false;
let delay = 20;
function Staryheal() {
if (!isHealing && player.health < 100) {
isHealing = true;
if (player.health < 95) {
place(0, getAttackDir());
healer();// fast heal
isHealing = false;
} else {
const healingDelay = 5;
const healingIterations = Math.ceil((100 - player.health) /
10); // making it have delay so it wont packet spam
let iterationCount = 0;
function performHealing() {
if (iterationCount < healingIterations) {
setTimeout(() => {
place(0, getAttackDir()); // slow heal
iterationCount++;
performHealing();
}, healingDelay);
} else {
isHealing = false;
}
}
performHealing();
}
}
}
// LATER:
function predictHeal(random) {
for (let Preidict in random) {
place(0, getAttackDir());
console.log("health predicted");
}
}
function antiSyncHealing(timearg) {
my.antiSync = true;
let healAnti = setInterval(() => {
if (player.shameCount < 5) {
place(0, getAttackDir());
}
}, 75);
setTimeout(() => {
clearInterval(healAnti);
setTimeout(() => {
my.antiSync = false;
}, game.tickRate);
}, game.tickRate);
}
function EmpMult() {
return player.skinIndex == 22 ? 0.75 : 1;
}
function healer33() {
for (let i = 0; i < healthBased(); i++) {
place(0, getAttackDir());
}
}
function healer1() {
place(0, getAttackDir());
return Math.ceil((100 - player.health) /
items.list[player.items[0]].healing);
}
function noshameheal() {
place(0, getAttackDir());
if (player.shameCount >= 5) {
place(0, getAttackDir());
healer33();
} else {
if (player.shameCount <= 4 && player.skinIndex != 6 && player.skinIndex !=
22) {
buyEquip(6, 0);
healer33();
} else {
if (player.shameCount >= 5 && player.skinIndex != 6 && player.skinIndex
!= 22) {
return Math.ceil((100 - player.health) /
items.list[player.items[0]].healing);
}
}
}
}
function smartAntiInsta() {
let enemies = getNearbyEnemies();
for (let i = 0; i < enemies.length; i++) {
let e = enemies[i];
if (e.shooting && getDist(player, e) < 200 && !e.blocked) {
place(getRandomDir());
}
}
}
function getNearbyEnemies() {
let enemies = [];
for (let i = 0; i < enemy.length; i++) {
let e = enemy[i];
if (getDist(player, e) < 250) {
enemies.push(e);
}
}
return enemies;
}
function getRandomDir() {
let directions = [-1, 0, 1];
return [directions[Math.floor(Math.random() * 3)],
directions[Math.floor(Math.random() * 3)]];
}
setInterval(() => {
if (configs.shouldHeal) {
smartAntiInsta();
noshameheal();
}
}, 100);
let healSan = function() {
if (config.isSandbox) {
return 100;
} else {
return 80;
}
}
let checkHealth = function() {
return player.skinIndex != 45 && !autoQ && !my.antiSync;
}
function biomeGear(mover, returns) {
if (player.y2 >= config.mapScale / 2 - config.riverWidth / 2 && player.y2 <=
config.mapScale / 2 + config.riverWidth / 2) {
if (returns) return 31;
buyEquip(31, 0);
} else {
if (player.y2 <= config.snowBiomeTop) {
if (returns) return 6;
buyEquip(6, 0);
} else {
if (returns) return 6;
buyEquip(6, 0);
}
}
if (returns) return 0;
}
let advHeal = [];
class Traps {
constructor(UTILS, items) {
this.dist = 0;
this.aim = 0;
this.inTrap = false;
this.replaced = false;
this.antiTrapped = false;
this.info = {};
this.notFast = function() {
return player.weapons[1] == 10 && ((this.info.health >
items.weapons[player.weapons[0]].dmg) || player.weapons[0] == 5);
}
this.testCanPlace = function(id, first = -(Math.PI / 2), repeat =
(Math.PI / 2), plus = (Math.PI / 18), radian, replacer, yaboi) {
try {
let item = items.list[player.items[id]];
let tmpS = player.scale + item.scale + (item.placeOffset || 0);
let counts = {
attempts: 0,
placed: 0
};
let tmpObjects = [];
liztobj.forEach((p) => {
tmpObjects.push({
x: p.x,
y: p.y,
active: p.active,
blocker: p.blocker,
scale: p.scale,
isItem: p.isItem,
type: p.type,
colDiv: p.colDiv,
getScale: function(sM, ig) {
sM = sM || 1;
return this.scale * ((this.isItem || this.type == 2 ||
this.type == 3 || this.type == 4)
? 1 : (0.6 * sM)) * (ig ? 1 :
this.colDiv);
},
});
});
for (let i = first; i < repeat; i += plus) {
counts.attempts++;
let relAim = radian + i;
let tmpX = player.x2 + tmpS * Math.cos(relAim);
let tmpY = player.y2 + tmpS * Math.sin(relAim);
let cantPlace = tmpObjects.find((tmp) => tmp.active &&
UTILS.getDistance(tmpX, tmpY, tmp.x, tmp.y) < item.scale + (tmp.blocker ?
tmp.blocker : tmp.getScale(0.6, tmp.isItem)));
if (cantPlace) continue;
if (item.id != 18 && tmpY >= config.mapScale / 2 -
config.riverWidth / 2 && tmpY <= config.mapScale / 2 + config.riverWidth / 2)
continue;
if ((!replacer && yaboi)) {
if (yaboi.inTrap) {
if (UTILS.getAngleDist(near.aim2 + Math.PI, relAim +
Math.PI) <= Math.PI*1.3) {
place(2, relAim, 1);
} else {
player.items[4] == 15 && place(4, relAim, 1);
}
} else {
if (UTILS.getAngleDist(near.aim2, relAim) <=
config.gatherAngle / 2.6) {
place(2, relAim, 1);
} else {
player.items[4] == 15 && place(4, relAim, 1);
}
}
} else {
place(id, relAim, 1);
}
tmpObjects.push({
x: tmpX,
y: tmpY,
active: true,
blocker: item.blocker,
scale: item.scale,
isItem: true,
type: null,
colDiv: item.colDiv,
getScale: function() {
return this.scale;
},
});
if (UTILS.getAngleDist(near.aim2, relAim) <= 1) {
counts.placed++;
}
}
if (counts.placed > 0 && replacer && item.dmg) {
if (near.dist2 <= items.weapons[player.weapons[0]].range +
(player.scale * 1.8) && configs.spikeTick) {
instaC.canSpikeTick = true;
}
}
} catch (err) {
}
};
this.checkSpikeTick = function() {
try {
if (![3, 4, 5].includes(near.primaryIndex)) return false;
if ((getEl("safeAntiSpikeTick").checked || my.autoPush) ? false :
near.primaryIndex == undefined ? true : (near.reloads[near.primaryIndex] >
game.tickRate)) return false;
// more range for safe. also testing near.primaryIndex || 5
if (near.dist2 <= items.weapons[near.primaryIndex || 5].range +
(near.scale * 1.8)) {
let item = items.list[9];
let tmpS = near.scale + item.scale + (item.placeOffset || 0);
let danger = 0;
let counts = {
attempts: 0,
block: `unblocked`
};
for (let i = -1; i <= 1; i += 1 / 10) {
counts.attempts++;
let relAim = UTILS.getDirect(player, near, 2, 2) + i;
let tmpX = near.x2 + tmpS * Math.cos(relAim);
let tmpY = near.y2 + tmpS * Math.sin(relAim);
let cantPlace = liztobj.find((tmp) => tmp.active &&
UTILS.getDistance(tmpX, tmpY, tmp.x, tmp.y) < item.scale + (tmp.blocker ?
tmp.blocker : tmp.getScale(0.6, tmp.isItem)));
if (cantPlace) continue;
if (tmpY >= config.mapScale / 2 - config.riverWidth / 2 &&
tmpY <= config.mapScale / 2 + config.riverWidth / 2) continue;
danger++;
counts.block = `blocked`;
break;
}
if (danger) {
my.anti0Tick = 1;
// player.chat.message = "Anti SpikeTick " + near.sid;
//player.chat.count = 2000;
return true;
}
}
} catch (err) {
return null;
}
return false;
}
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;
}
}
this.protect = function(aim) {
if (!configs.antiTrap) return;
if(getDist(near, player) > getDist(near, traps.info)) {
//behind u
for(let i=-(Math.PI / 2);i<(Math.PI / 2);i+=(Math.PI / 18)) {
checkPlace(2, near.aim2 + i);
}
} else if(getDist(near, traps.info) > getDist(near, player)) {
//infront of u
for(let i=-(Math.PI / 2);i<(Math.PI / 2);i+=(Math.PI / 18)) {
checkPlace(4, near.aim2 + i);
}
}
// if (player.items[4]) {
// this.testCanPlace(4, -(Math.PI / 2), (Math.PI / 2), (Math.PI /
18), aim + Math.PI);
// this.antiTrapped = true;
// }
};
this.autoPlace = function() {
if (enemy.length && configs.autoPlace && !instaC.ticking) {
if (game.tick % (Math.max(1,
parseInt(getEl("autoPlaceTick").value)) || 1) === 0) {
if (liztobj.length) {
let near2 = {
inTrap: false,
};
let nearTrap = liztobj.filter(e => e.trap && e.active &&
e.isTeamObject(player) && UTILS.getDist(e, near, 0, 2) <= (near.scale +
e.getScale() + 5)).sort(function(a, b) {
return UTILS.getDist(a, near, 0, 2) - UTILS.getDist(b,
near, 0, 2);
})[0];
if (nearTrap) {
near2.inTrap = true;
} else {
near2.inTrap = false;
}
if (near.dist3 <= 450) {
if (near.dist3 <= 200) {
this.testCanPlace(4, 0, (Math.PI * 2), (Math.PI /
24), near.aim2, 0, {
inTrap: near2.inTrap
});
} else {
player.items[4] == 15 && this.testCanPlace(4, 0,
(Math.PI * 2), (Math.PI / 24), near.aim2);
}
}
} else {
if (near.dist3 <= 450) {
player.items[4] == 15 && this.testCanPlace(4, 0,
(Math.PI * 2), (Math.PI / 24), near.aim2);
}
}
}
}
};
function placeSpikesAroundTrap(trapX, trapY) {
const circleRadius = 102;
const numPositions = 64;
const validPositions = [];
if (
!placedSpikePositions.has(JSON.stringify(position)) &&
isPositionValid(position) &&
distToPlayer <= 87
) {
validPositions.push(position);
}
}
validPositions.sort((a, b) => {
const distA = Math.hypot(a[0] - player.x2, a[1] - player.y2);
const distB = Math.hypot(b[0] - player.x2, b[1] - player.y2);
return distA - distB;
});
function placeTrapsAroundPlayer() {
const maxTrapsToPlace = 4;
const trapRadius = 50;
const trapPositions = calculatePossibleTrapPositions(player.x2,
player.y2, trapRadius);
let trapsPlaced = 0;
trapPositions.sort((a, b) => {
const distA = Math.hypot(a[0] - player.x2, a[1] - player.y2);
const distB = Math.hypot(b[0] - player.x2, b[1] - player.y2);
return distA - distB;
});
// PREPLACER
this.preplacer = function () {
if (traps.inTrap) {
return;
}
if (!configs.autoPrePlace) {
return;
}
const weaponRange = items.weapons[player.weaponIndex].range + 70;
const rangeSquared = weaponRange ** 2;
const { x2: playerX, y2: playerY } = player;
const lowHealthGameObjects = gameObjects.filter((gameObject) => {
const { x2, y2, buildHealth } = gameObject;
const distSquared = (x2 - playerX) ** 2 + (y2 - playerY) ** 2;
return near && buildHealth <= 272.58 && distSquared <=
rangeSquared;
});
if (lowHealthGameObjects.length > 0) {
const { x2, y2 } = lowHealthGameObjects[0];
const objAim = UTILS.getDirect(
{
x2,
y2,
},
player,
0,
2
);
let enemyVelocity = Math.sqrt(
near.xVel * near.xVel + near.yVel * near.yVel
);
let enemyDirection = Math.atan2(near.yVel, near.xVel);
let bestAngle = null;
let bestDistance = Infinity;
for (let i = 0; i < 360; i += 30) {
let simulatedAngle = UTILS.deg2rad(i);
let distance =
UTILS.getDist(near, player, 0, 2) +
enemyVelocity * Math.sin(enemyDirection) +
70;
if (distance < bestDistance) {
bestDistance = distance;
bestAngle = simulatedAngle;
}
}
const timeToBreak =
(lowHealthGameObjects[0].buildHealth - player.damage) /
(player.damagePerShot - lowHealthGameObjects[0].absorb);
const enemyTimeToMoveOut = bestDistance / enemyVelocity;
if (timeToBreak + 5 <= enemyTimeToMoveOut) {
this.testCanPlace(
4,
bestAngle,
bestAngle + Math.PI * 2,
Math.PI / 24,
objAim,
70
);
}
}
};
this.nearTrap = function () {
return gameObjects.filter(
(object) =>
object.trap &&
object.active &&
UTILS.getDist(object, player, 0, 2) <=
player.scale + object.getScale() + 5
);
};
this.replacer = function(findObj) {
if (!findObj || !configs.autoReplace) return;
if (!inGame) return;
if (this.antiTrapped) return;
game.tickBase(() => {
let objAim = UTILS.getDirect(findObj, player, 0, 2);
let objDst = UTILS.getDist(findObj, player, 0, 2);
if (getEl("weaponGrind").checked && objDst <=
items.weapons[player.weaponIndex].range + player.scale) return;
if(spikePlaced){
player.items[4] == 15 && this.testCanPlace(4, 0, (Math.PI * 2),
(Math.PI / 24), objAim, 1);
spikePlaced = false;
}
if (near.dist2 <= 250 && !spikSync) {
for (let i = 0; i < 24; i++) {
let angle = (Math.PI * 2) * i / 24;
this.testCanPlace(2, angle, angle + (Math.PI / 24),
(Math.PI / 24), objAim, 1);
spikePlaced = true;
}
}
if (objDst <= 250 && near.dist2 <= 250) {
let danger = this.checkSpikeTick();
if (!danger && near.dist3 <=
items.weapons[near.primaryIndex].range + (near.scale * 1.8)) {
}
} else {
player.items[4] == 15 && this.testCanPlace(4, 0, (Math.PI *
2), (Math.PI / 24), objAim, 1);
}
this.replaced = true;
}
}, 1);
};
}
};
class Instakill {
constructor() {
this.wait = false;
this.can = false;
this.isTrue = false;
this.nobull = false;
this.ticking = false;
this.canSpikeTick = false;
this.startTick = false;
this.readyTick = false;
this.canCounter = false;
this.revTick = false;
this.syncHit = false;
this.changeType = function(type) {
this.wait = false;
this.isTrue = true;
my.autoAim = true;
let instaLog = [type];
let backupNobull = near.backupNobull;
near.backupNobull = false;
if (type == "rev") {
selectWeapon(player.weapons[1]);
buyEquip(53, 0);
sendAutoGather();
setTimeout(() => {
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
setTimeout(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 225);
}, 100);
} else if (type == "nobull") {
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
sendAutoGather();
setTimeout(() => {
selectWeapon(player.weapons[1]);
buyEquip(player.reloads[53] == 0 ? 53 : 6, 0);
setTimeout(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 255);
}, 105);
} else if (type == "normal") {
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
sendAutoGather();
setTimeout(() => {
selectWeapon(player.weapons[1]);
buyEquip(player.reloads[53] == 0 ? 53 : 6, 0);
setTimeout(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 255);
}, 100);
} else {
setTimeout(() => {
this.isTrue = false;
my.autoAim = false;
}, 50);
}
};
this.spikeTickType = function() {
this.isTrue = true;
my.autoAim = true;
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
sendAutoGather();
game.tickBase(() => {
selectWeapon(player.weapons[0]);
buyEquip(53, 0);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 1);
}, 1);
};
this.counterType = function () {
if (!configs.counterInsta) {
return;
}
this.isTrue = true;
my.autoAim = true;
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
buyEquip(21, 1);
sendAutoGather();
game.tickBase(() => {
if (player.reloads[53] == 0 &&
getEl("turretCombat").checked) {
buyEquip(53, 0);
buyEquip(21, 1);
if ([9, 12, 13, 15].includes(player.weapons[1]) &&
player.reloads[player.weapons[1]] == 0) {
selectWeapon(player.weapons[1]);
}
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 1);
} else {
if ([9, 12, 13, 15].includes(player.weapons[1]) &&
player.reloads[player.weapons[1]] == 0 && configs.secondaryOnCounter) {
selectWeapon(player.weapons[1]);
}
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 1);
}
}, 1);
};
let inantiantibull;
this.antiCounterType = function() {
my.autoAim = true;
this.isTrue = true;
inantiantibull = true;
selectWeapon(player.weapons[0]);
buyEquip(6, 0);
io.send("D", near.aim2);
sendAutoGather();
game.tickBase(() => {
buyEquip(player.reloads[53] == 0 ? player.skins[53] ?
53 : 6 : 6, 0);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
inantiantibull = false;
}, 1);
}, 1)
};
this.rangeType = function(type) {
this.isTrue = true;
my.autoAim = true;
if (type == "ageInsta") {
my.ageInsta = false;
if (player.items[5] == 18) {
place(5, near.aim2);
}
packet("a", undefined, 1);
buyEquip(22, 0);
buyEquip(21, 1);
game.tickBase(() => {
selectWeapon(player.weapons[1]);
buyEquip(53, 0);
buyEquip(21, 1);
sendAutoGather();
game.tickBase(() => {
sendUpgrade(12);
selectWeapon(player.weapons[1]);
buyEquip(53, 0);
buyEquip(21, 1);
game.tickBase(() => {
sendUpgrade(15);
selectWeapon(player.weapons[1]);
buyEquip(53, 0);
buyEquip(21, 1);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 1);
}, 1);
}, 1);
}, 1);
} else {
selectWeapon(player.weapons[1]);
if (player.reloads[53] == 0 && near.dist2 <= 700 &&
near.skinIndex != 22) {
buyEquip(53, 0);
} else {
buyEquip(20, 0);
}
buyEquip(11, 1);
sendAutoGather();
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
}, 1);
}
};
this.oneTickType = function() {
this.isTrue = true;
my.autoAim = true;
selectWeapon(player.weapons[1]);
buyEquip(53, 0);
buyEquip(11, 1);
packet("a", near.aim2, 1);
if (player.weapons[1] == 15) {
my.revAim = true;
sendAutoGather();
}
game.tickBase(() => {
my.revAim = false;
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
buyEquip(19, 1);
packet("a", near.aim2, 1);
if (player.weapons[1] != 15) {
sendAutoGather();
}
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
packet("a", undefined, 1);
}, 1);
}, 1);
};
this.threeOneTickType = function() {
this.isTrue = true;
my.autoAim = true;
selectWeapon(player.weapons[[10, 14].includes(player.weapons[1]) ? 1 :
0]);
biomeGear();
buyEquip(11, 1);
packet("a", near.aim2, 1);
game.tickBase(() => {
selectWeapon(player.weapons[[10, 14].includes(player.weapons[1]) ?
1 : 0]);
buyEquip(53, 0);
buyEquip(11, 1);
packet("a", near.aim2, 1);
game.tickBase(() => {
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
buyEquip(19, 1);
sendAutoGather();
packet("a", near.aim2, 1);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
packet("a", undefined, 1);
}, 1);
}, 1);
}, 1);
};
this.kmTickType = function() {
this.isTrue = true;
my.autoAim = true;
my.revAim = true;
selectWeapon(player.weapons[1]);
buyEquip(53, 0);
buyEquip(11, 1);
sendAutoGather();
packet("a", near.aim2, 1);
game.tickBase(() => {
my.revAim = false;
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
buyEquip(19, 1);
packet("a", near.aim2, 1);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
packet("a", undefined, 1);
}, 1);
}, 1);
};
this.boostTickType = function() {
/*this.isTrue = true;
my.autoAim = true;
selectWeapon(player.weapons[0]);
buyEquip(53, 0);
buyEquip(11, 1);
packet("a", near.aim2);
game.tickBase(() => {
place(4, near.aim2);
selectWeapon(player.weapons[1]);
biomeGear();
buyEquip(11, 1);
sendAutoGather();
packet("a", near.aim2);
game.tickBase(() => {
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
buyEquip(19, 1);
packet("a", near.aim2);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
packet("a", undefined);
}, 1);
}, 1);
}, 1);*/
this.isTrue = true;
my.autoAim = true;
biomeGear();
buyEquip(11, 1);
packet("a", near.aim2, 1);
game.tickBase(() => {
if (player.weapons[1] == 15) {
my.revAim = true;
}
selectWeapon(player.weapons[[9, 12, 13,
15].includes(player.weapons[1]) ? 1 : 0]);
buyEquip(53, 0);
buyEquip(11, 1);
if ([9, 12, 13, 15].includes(player.weapons[1])) {
sendAutoGather();
}
packet("a", near.aim2, 1);
place(4, near.aim2);
game.tickBase(() => {
my.revAim = false;
selectWeapon(player.weapons[0]);
buyEquip(7, 0);
buyEquip(19, 1);
if (![9, 12, 13, 15].includes(player.weapons[1])) {
sendAutoGather();
}
packet("a", near.aim2, 1);
game.tickBase(() => {
sendAutoGather();
this.isTrue = false;
my.autoAim = false;
packet("a", undefined, 1);
}, 1);
}, 1);
}, 1);
};
this.gotoGoal = function(goto, OT) {
let slowDists = (weeeee) => weeeee * config.playerScale;
let goal = {
a: goto - OT,
b: goto + OT,
c: goto - slowDists(1),
d: goto + slowDists(1),
e: goto - slowDists(2),
f: goto + slowDists(2),
g: goto - slowDists(4),
h: goto + slowDists(4)
};
let bQ = function(wwww, awwww) {
if (player.y2 >= config.mapScale / 2 - config.riverWidth / 2 &&
player.y2 <= config.mapScale / 2 + config.riverWidth / 2 && awwww == 0) {
buyEquip(31, 0);
} else {
buyEquip(wwww, awwww);
}
}
if (enemy.length) {
let dst = near.dist2;
this.ticking = true;
if (dst >= goal.a && dst <= goal.b) {
bQ(22, 0);
bQ(11, 1);
if (player.weaponIndex != player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0] || player.buildIndex > -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
return {
dir: undefined,
action: 1
};
} else {
if (dst < goal.a) {
if (dst >= goal.g) {
if (dst >= goal.e) {
if (dst >= goal.c) {
bQ(40, 0);
bQ(10, 1);
if (configs.slowOT) {
player.buildIndex != player.items[1] &&
selectToBuild(player.items[1]);
} else {
if ((player.weaponIndex !=
player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex
> -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
} else {
bQ(22, 0);
bQ(19, 1);
if ((player.weaponIndex != player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
} else {
bQ(6, 0);
bQ(12, 1);
if ((player.weaponIndex != player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
} else {
biomeGear();
bQ(11, 1);
if ((player.weaponIndex != player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
return {
dir: near.aim2 + Math.PI,
action: 0
};
} else if (dst > goal.b) {
if (dst <= goal.h) {
if (dst <= goal.f) {
if (dst <= goal.d) {
bQ(40, 0);
bQ(9, 1);
if (configs.slowOT) {
player.buildIndex != player.items[1] &&
selectToBuild(player.items[1]);
} else {
if ((player.weaponIndex !=
player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex
> -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
} else {
bQ(22, 0);
bQ(19, 1);
if ((player.weaponIndex != player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
} else {
bQ(6, 0);
bQ(12, 1);
if ((player.weaponIndex != player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
} else {
biomeGear();
bQ(11, 1);
if ((player.weaponIndex != player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) {
selectWeapon(player.weapons[[10,
14].includes(player.weapons[1]) ? 1 : 0]);
}
}
return {
dir: near.aim2,
action: 0
};
}
return {
dir: undefined,
action: 0
};
}
} else {
this.ticking = false;
return {
dir: undefined,
action: 0
};
}
}
/** wait 1 tick for better quality */
this.bowMovement = function() {
let moveMent = this.gotoGoal(685, 3);
if (moveMent.action) {
if (player.reloads[53] == 0 && !this.isTrue) {
this.rangeType("ageInsta");
} else {
packet("a", moveMent.dir, 1);
}
} else {
packet("a", moveMent.dir, 1);
}
},
this.tickMovement = function() {
let moveMent = this.gotoGoal(([10, 14].includes(player.weapons[1]) &&
player.y2 > config.snowBiomeTop) ? 240 : player.weapons[1] == 15 ? 250 : player.y2
<= config.snowBiomeTop ? [10, 14].includes(player.weapons[1]) ? 270 : 265 : 275,
3);
if (moveMent.action) {
if (![6, 22].includes(near.skinIndex) && player.reloads[53] == 0 &&
!this.isTrue) {
([10, 14].includes(player.weapons[1]) && player.y2 >
config.snowBiomeTop) || (player.weapons[1] == 15) ? this.oneTickType():
this.threeOneTickType();
} else {
packet("a", moveMent.dir, 1);
}
} else {
packet("a", moveMent.dir, 1);
}
},
this.kmTickMovement = function() {
let moveMent = this.gotoGoal(240, 3);
if (moveMent.action) {
if (near.skinIndex != 22 && player.reloads[53] == 0 && !this.isTrue
&& ((game.tick - near.poisonTick) % config.serverUpdateRate == 8)) {
this.kmTickType();
} else {
packet("a", moveMent.dir, 1);
}
} else {
packet("a", moveMent.dir, 1);
}
},
this.boostTickMovement = function() {
let dist = player.weapons[1] == 9 ? 365 : player.weapons[1] == 12 ? 380
: player.weapons[1] == 13 ? 390 : player.weapons[1] == 15 ? 365 : 370;
let actionDist = player.weapons[1] == 9 ? 2 : player.weapons[1] == 12 ?
1.5 : player.weapons[1] == 13 ? 1.5 : player.weapons[1] == 15 ? 2 : 3;
let moveMent = this.gotoGoal(dist, actionDist);
if (moveMent.action) {
if (player.reloads[53] == 0 && !this.isTrue) {
this.boostTickType();
} else {
packet("a", moveMent.dir, 1);
}
} else {
packet("a", moveMent.dir, 1);
}
}
/** wait 1 tick for better quality */
this.perfCheck = function(pl, nr) {
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 = liztobj.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);
};
/* old functions */
this.km = function(upg) {
upg(7);
upg(17);
upg(31);
upg(23);
upg(10);
upg(38);
upg(4);
upg(15);
};
};
};
class Damages {
constructor(items) {
// 0.75 1 1.125 1.5
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];
}
}
}
/** CLASS CODES */
// jumpscare code warn
let tmpList = [];
// LOADING:
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([6, 7, 22, 12, 53, 40, 15, 31, 20], [11, 13, 19, 18,
21]);
let autoUpgrade = new Autoupgrade();
let lastDeath;
let minimapData;
let mapMarker = {};
let mapPings = [];
let tmpPing;
let breakTrackers = [];
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;
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) {
antiSyncHealing(4);
}
} else {
if (projectileCount >= 2) {
place(1, tmpObj.aim2);
my.anti0Tick = 4;
if (!my.antiSync) {
antiSyncHealing(4);
}
}
}
}
}
}
// SHOW ITEM INFO:
function showItemInfo(item, isWeapon, isStoreItem) {
if (player && item) {
UTILS.removeAllChildren(itemInfoHolder);
itemInfoHolder.classList.add("visible");
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");
}
}
// RESIZE:
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();
// MOUSE INPUT:
var usingTouch;
const mals = document.getElementById('touch-controls-fullscreen');
mals.style.display = 'block';
mals.addEventListener("mousemove", gameInput, false);
function gameInput(e) {
mouseX = e.clientX;
mouseY = e.clientY;
}
let clicks = {
left: false,
middle: false,
right: false,
};
mals.addEventListener("mousedown", mouseDown, false);
function mouseDown(e) {
if (attackState != 1) {
attackState = 1;
if (e.button == 0) {
clicks.left = true;
} else if (e.button == 1) {
clicks.middle = true;
} else if (e.button == 2) {
clicks.right = true;
}
}
}
mals.addEventListener("mouseup", UTILS.checkTrusted(mouseUp));
function mouseUp(e) {
if (attackState != 0) {
attackState = 0;
if (e.button == 0) {
clicks.left = false;
} else if (e.button == 1) {
clicks.middle = false;
} else if (e.button == 2) {
clicks.right = false;
}
}
}
mals.addEventListener("wheel", wheel, false);
function wheel(e) {
if (e.deltaY < 0) {
wbe += 0.005
maxScreenWidth = config.maxScreenWidth * wbe;
maxScreenHeight = config.maxScreenHeight * wbe;
resize()
} else {
wbe -= 0.005
maxScreenWidth = config.maxScreenWidth * wbe;
maxScreenHeight = config.maxScreenHeight * wbe;
resize()
}
}
// INPUT UTILS:
function getMoveDir() {
let dx = 0;
let dy = 0;
for (let key in moveKeys) {
let tmpDir = moveKeys[key];
dx += !!keys[key] * tmpDir[0];
dy += !!keys[key] * tmpDir[1];
}
return dx == 0 && dy == 0 ? undefined : Math.atan2(dy, dx);
}
function getSafeDir() {
if (!player)
return 0;
if (!player.lockDir) {
lastDir = Math.atan2(mouseY - (screenHeight / 2), mouseX - (screenWidth /
2));
}
return lastDir || 0;
}
let plusDir = 0;
let lastSpin = Date.now();
function getAttackDir() {
if(player && Date.now() - lastSpin >= 235 && !(clicks.right || clicks.left)) {
plusDir += Math.random()*(Math.PI*2);
lastSpin = Date.now();
}
if (!player)
return "0";
if (my.autoAim || ((clicks.left || (useWasd && near.dist2 <=
items.weapons[player.weapons[0]].range + near.scale * 1.8 && !traps.inTrap)) &&
player.reloads[player.weapons[0]] == 0))
lastDir = getEl("weaponGrind").checked ? getSafeDir() : enemy.length ?
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) {
lastDir = traps.aim;
} else
if (!player.lockDir) {
if (!player.lockDir && autos.stopspin) {
if(useWasd) {
lastDir = lastDir;
} else {
lastDir = getSafeDir();
}
}
}
return lastDir;
}
function getVisualDir() {
if (!player)
return 0;
lastDir = getSafeDir();
return lastDir || 0;
}
// KEYS:
function keysActive() {
return (allianceMenu.style.display != "block" &&
chatHolder.style.display != "block" &&
!menuCBFocus);
}
function toggleMenuChat() {
if (menuChatDiv.style.display != "none") {
// chatHolder.style.display = "none";
// if (menuChatBox.value != "") {
//commands[command.slice(1)]
let cmd = function(command) {
return {
found: command.startsWith("/") && commands[command.slice(1).split("
")[0]],
fv: commands[command.slice(1).split(" ")[0]]
}
}
let command = cmd(menuChatBox.value);
if (command.found) {
if (typeof command.fv.action === "function") {
command.fv.action(menuChatBox.value);
}
} else {
sendChat(menuChatBox.value);
}
menuChatBox.value = "";
menuChatBox.blur();
} else {
if (menuCBFocus) {
menuChatBox.blur();
} else {
menuChatBox.focus();
}
}
}
function keyDown(event) {
let keyNum = event.which || event.keyCode || 0;
if (player && player.alive && keysActive()) {
if (!keys[keyNum]) {
keys[keyNum] = 1;
macro[event.key] = 1;
if (keyNum == 27) {
openMenu = !openMenu;
$("#menuDiv").toggle();
$("#menuChatDiv").toggle();
} else if (keyNum == 69) {
sendAutoGather();
} else if (keyNum == 67) {
updateMapMarker();
} else if (player.weapons[keyNum - 49] != undefined) {
player.weaponCode = player.weapons[keyNum - 49];
} else if (moveKeys[keyNum]) {
sendMoveDir();
} else if (event.key == "m") {
mills.placeSpawnPads = !mills.placeSpawnPads;
} else if (event.key == "z") {
mills.place = !mills.place;
} else if (event.key == "Z") {
typeof window.debug == "function" && window.debug();
} else if (keyNum == 32) {
packet("d", 1, getSafeDir(), 1);
packet("d", 0, getSafeDir(), 1);
} else if (event.key == ",") {
io.send("6", ':(')
project.send(JSON.stringify(["tezt", "ratio"]));
// botSkts.push([botPlayer]);
for(let i = 0; i < botz.length; i++) {
// if(botz[i][0]) {
botz[i][0].zync(near);
console.log(botz[i][0])
}
// project.send("tezt");
// botSkts.forEach((bot) => {
// bot.zync();
// })
// io.send("S", 1)
}
}
}
}
// let xx = canvaz.width/2;
// let yy = canvaz.height/2;
// let mouze = {
// x: xx - mouzeX,
// y: yy - mouzeY
// }
// let ingamecoorformodabow = {
// x: player.x + mouze.x,
// y: player.x + mouze.x
// }
addEventListener("keydown", UTILS.checkTrusted(keyDown));
function keyUp(event) {
if (player && player.alive) {
let keyNum = event.which || event.keyCode || 0;
if (keyNum == 13) {
toggleMenuChat();
} else if (keysActive()) {
if (keys[keyNum]) {
keys[keyNum] = 0;
macro[event.key] = 0;
if (moveKeys[keyNum]) {
sendMoveDir();
} else if (event.key == ",") {
player.sync = false;
}
}
}
}
}
window.addEventListener("keyup", UTILS.checkTrusted(keyUp));
function sendMoveDir() {
if(found) {
packet("a", undefined, 1);
} else {
let newMoveDir = getMoveDir();
if (lastMoveDir == undefined || newMoveDir == undefined ||
Math.abs(newMoveDir - lastMoveDir) > 0.3) {
if (!my.autoPush && !found) {
packet("a", newMoveDir, 1);
}
lastMoveDir = newMoveDir;
}
}
}
// BUTTON EVENTS:
function bindEvents() {}
bindEvents();
// ITEM COUNT DISPLAY:
let isItemSetted = [];
function updateItemCountDisplay(index = undefined) {
for (let i = 3; i < items.list.length; ++i) {
let id = items.list[i].group.id;
let tmpI = items.weapons.length + i;
if (!isItemSetted[tmpI]) {
isItemSetted[tmpI] = document.createElement("div");
isItemSetted[tmpI].id = "itemCount" + tmpI;
getEl("actionBarItem" + tmpI).appendChild(isItemSetted[tmpI]);
isItemSetted[tmpI].style = `
display: block;
position: absolute;
padding-left: 5px;
font-size: 2em;
color: #fff;
`;
isItemSetted[tmpI].innerHTML = player.itemCounts[id] || 0;
} else {
if (index == id) isItemSetted[tmpI].innerHTML =
player.itemCounts[index] || 0;
}
}
}
// AUTOPUSH:
class autoPush {
constructor() {
this.enemy;
this.active = false;
this.pushPosition = {
x: 0,
y: 0
};
this.alignPosition = {
x: 0,
y: 0
};
this.objects = {
trap: null,
spike: null
};
this.hasAligned = false;
}
think(enemies) {
if(enemies.length) {
this.enemy = enemies[0];
if(this.enemy.inTrap.trapObject) {
this.objects.trap = this.enemy.inTrap.trapObject;
var closeSpikes = et.filter(e => e.active && !e.isFake && e.dmg &&
e.teamObj(E) && cdf(this.enemy, e) <= this.objects.trap.scale + e.scale +
E.scale).sort(function(t, i) {
return cdf(t, y) - cdf(i, y)
});
if(closeSpikes.length) {
this.objects.spike = closeSpikes[0];
this.active = true;
this.alignPosition = {
x: this.enemy.x + 70 * Math.cos(caf(this.enemy,
this.objects.spike) - Math.PI),
y: this.enemy.y + 70 * Math.sin(caf(this.enemy,
this.objects.spike) - Math.PI)
};
this.pushPosition = {
x: this.objects.spike.x + 150 *
Math.cos(caf(this.objects.spike, this.enemy)),
y: this.objects.spike.y + 150 *
Math.sin(caf(this.objects.spike, this.enemy))
}
if(!this.hasAligned) {
Tach.setPosAlign(this.alignPosition.x,
this.alignPosition.y);
} else {
ee.send("a", caf(E, this.pushPosition));
}
} else {
this.hasAligned = false;
if(this.active) {
this.active = false;
ee.send("a", Tn || null);
}
}
} else {
this.hasAligned = false;
if(this.active) {
this.active = false;
ee.send("a", Tn || null);
}
}
} else {
this.hasAligned = false;
if(this.active) {
this.active = false;
ee.send("a", Tn || null);
}
}
}
}
for (let i = 0; i < items.weapons.length; i++) {
let actionBarItem = getEl("actionBarItem" + i);
actionBarItem.style.display = player.weapons[items.weapons[i].type] ==
items.weapons[i].id ? "inline-block" : "none";
// Add shadow to the element
// actionBarItem.style.boxShadow = "2px 2px 5px rgba(0, 0, 0, 0.5)";
document.getElementsByTagName('button').style.boxShadow = "2px 2px 5px
rgba(0, 0, 0, 0.5)";
}
let kms = player.weapons[0] == 3 && player.weapons[1] == 15;
if (kms) {
getEl("actionBarItem3").style.display = "none";
getEl("actionBarItem4").style.display = "inline-block";
}
}
// ADD PROJECTILE:
function addProjectile(x, y, dir, range, speed, indx, layer, sid) {
projectileManager.addProjectile(x, y, dir, range, speed, indx, null, null,
layer, inWindow).sid = sid;
runAtNextTick.push(Array.prototype.slice.call(arguments));
}
// REMOVE PROJECTILE:
function remProjectile(sid, range) {
for (let i = 0; i < projectiles.length; ++i) {
if (projectiles[i].sid == sid) {
projectiles[i].range = range;
let tmpObjects = objectManager.hitObj;
objectManager.hitObj = [];
game.tickBase(() => {
let val = projectiles[i].dmg;
tmpObjects.forEach((healthy) => {
if (healthy.projDmg) {
healthy.health -= val;
}
});
}, 1);
}
}
}
// lol this useless,,, fr
}
if (cdf(player, botPlayer) <= 220) {
bot.sendWS("a", undefined);
} else {
bot.sendWS("a", caf(player, botPlayer) +
Math.PI);
}
} else {
let gotoDist = UTILS.getDist(wdaawdwad[0],
botPlayer, 0, 2);
let gotoAim = UTILS.getDirect(wdaawdwad[0],
botPlayer, 0, 2);
let nearObjs = botObj.filter((e) => e.active &&
(findSID(wdaawdwad, e.sid) ? true : !(e.trap && (player.sid == e.owner.sid ||
player.findAllianceBySid(e.owner.sid)))) && e.isItem && UTILS.getDist(e, botPlayer,
0, 2) <= (items.weapons[botPlayer.weaponIndex].range + e.scale/2)).sort(function(a,
b) {
return UTILS.getDist(a, botPlayer, 0, 2) -
UTILS.getDist(b, botPlayer, 0, 2);
});
if (nearObjs.length > 0) {
let nearObj = nearObjs[0];
let isPassed = UTILS.getDist(wdaawdwad[0],
nearObj, 0, 0);
if ((gotoDist - isPassed) > 0) {
bot.sendWS("a", caf(player, botPlayer) +
Math.PI);
if (findSID(wdaawdwad, nearObj.sid) ?
true : (nearObj.dmg || nearObj.trap)) {
// if (botPlayer.moveDir != undefined)
{
// botPlayer.moveDir = undefined;
// bot.sendWS("a",
botPlayer.moveDir);
bot.sendWS("D", botPlayer.nDir);
// }
} else {
bot.sendWS("D", botPlayer.nDir);
}
if (botPlayer.nDir !=
UTILS.getDirect(nearObj, botPlayer, 0, 2)) {
botPlayer.nDir =
UTILS.getDirect(nearObj, botPlayer, 0, 2);
bot.sendWS("D", botPlayer.nDir);
}
bot.buye(40, 0);
// bot.fastGear();
bot.buye(11, 1);
if (izauto == 0) {
bot.sendWS("K", 1);
izauto = 1;
}
} else {
if (zoon == 'no') {
bot.sendWS("D",
UTILS.getDirect(nearObj, botPlayer, 0, 2));
}
if (cdf(player, botPlayer) <= 220) {
bot.sendWS("a", undefined);
} else {
bot.sendWS("a", caf(player, botPlayer)
+ Math.PI);
}
}
} else {
if (wdaawdwad.length) {
if (zoon == 'no') {
bot.sendWS("D",
UTILS.getDirect(wdaawdwad[0], botPlayer, 0, 2));
// if (izauto == 0) {
// bot.sendWS("K", 1);
// izauto = 1;
// }
}
if (cdf(player, botPlayer) <= 220) {
bot.sendWS("a", undefined);
} else {
bot.sendWS("a", caf(player, botPlayer)
+ Math.PI);
}
} else {
if (zoon == 'no') {
bot.sendWS("D", UTILS.getDirect(player,
botPlayer, 0, 2));
}
if (cdf(player, botPlayer) <= 220) {
bot.sendWS("a", undefined);
} else {
bot.sendWS("a", caf(player, botPlayer)
+ Math.PI);
}
}
}
}
}
if (botPlayer.length) {
}
}
}
}
}
if (type == "H") {
let tmpData = data[0];
for (let i = 0; i < tmpData.length;) {
botObjManager.add(tmpData[i], tmpData[i + 1], tmpData[i + 2],
tmpData[i + 3], tmpData[i + 4],
tmpData[i + 5], items.list[tmpData[i + 6]], true,
(tmpData[i + 7] >= 0 ? {
sid: tmpData[i + 7]
} : null));
i += 8;
}
}
if (type == "N") {
let index = data[0];
let value = data[1];
if (botPlayer) {
botPlayer[index] = value;
}
}
let heal = function() {
let healthBased = function() {
if (botPlayer.health == 100) return 0;
if (botPlayer.skinIndex != 45 && botPlayer.skinIndex != 56) {
return Math.ceil((100 - botPlayer.health) /
items.list[botPlayer.items[0]].healing);
}
return 0;
};
for (let i = 0; i < healthBased(); i++) {
bot.place(0, botPlayer.nDir);
}
};
if (type == "O") {
if (data[0] == botPlayer.sid) {
botPlayer.oldHealth = botPlayer.health;
botPlayer.health = data[1];
botPlayer.judgeShame();
if (botPlayer.oldHealth > botPlayer.health) {
if (botPlayer.oldHealth > 95) {
if (botPlayer.shameCount < 5) {
heal();
} else {
setTimeout(() => {
heal();
}, 124);
}
} else {
if (botPlayer.shameCount < 5) {
setTimeout(() => {
heal();
}, 150);
} else {
setTimeout(() => {
heal();
}, 250);
}
}
}
}
}
if (type == "Q") {
let sid = data[0];
botObjManager.disableBySid(sid);
}
if (type == "R") {
let sid = data[0];
if (botPlayer.alive) botObjManager.removeAllItems(sid);
}
if (type == "S") {
let index = data[0];
let value = data[1];
if (botPlayer) {
botPlayer.itemCounts[index] = value;
}
}
if (type == "U") {
if (data[0] > 0) {
if(getEl("setup").value == 'dm') {
if (botPlayer.upgraded == 0) {
bot.sendUpgrade(7);
} else if (botPlayer.upgraded == 1) {
bot.sendUpgrade(17);
} else if (botPlayer.upgraded == 2) {
bot.sendUpgrade(31);
} else if (botPlayer.upgraded == 3) {
bot.sendUpgrade(23);
} else if (botPlayer.upgraded == 4) {
bot.sendUpgrade(9);
} else if (botPlayer.upgraded == 5) {
bot.sendUpgrade(34);
} else if (botPlayer.upgraded == 6) {
bot.sendUpgrade(12);
} else if (botPlayer.upgraded == 7) {
bot.sendUpgrade(15);
}
} else if(getEl("setup").value == 'BM') {
if (botPlayer.upgraded == 0) {
bot.sendUpgrade(6);
} else if (botPlayer.upgraded == 1) {
bot.sendUpgrade(17);
} else if (botPlayer.upgraded == 2) {
bot.sendUpgrade(31);
} else if (botPlayer.upgraded == 3) {
bot.sendUpgrade(23);
} else if (botPlayer.upgraded == 4) {
bot.sendUpgrade(9);
} else if (botPlayer.upgraded == 5) {
bot.sendUpgrade(34);
} else if (botPlayer.upgraded == 6) {
bot.sendUpgrade(12);
} else if (botPlayer.upgraded == 7) {
bot.sendUpgrade(15);
}
} else if(getEl("setup").value == 'pm') {
if (botPlayer.upgraded == 0) {
bot.sendUpgrade(5);
} else if (botPlayer.upgraded == 1) {
bot.sendUpgrade(17);
} else if (botPlayer.upgraded == 2) {
bot.sendUpgrade(31);
} else if (botPlayer.upgraded == 3) {
bot.sendUpgrade(23);
} else if (botPlayer.upgraded == 4) {
bot.sendUpgrade(9);
} else if (botPlayer.upgraded == 5) {
bot.sendUpgrade(34);
} else if (botPlayer.upgraded == 6) {
bot.sendUpgrade(12);
} else if (botPlayer.upgraded == 7) {
bot.sendUpgrade(15);
}
} else if(getEl("setup").value == 'zd') {
if (botPlayer.upgraded == 0) {
bot.sendUpgrade(3);
} else if (botPlayer.upgraded == 1) {
bot.sendUpgrade(17);
} else if (botPlayer.upgraded == 2) {
bot.sendUpgrade(31);
} else if (botPlayer.upgraded == 3) {
bot.sendUpgrade(27);
} else if (botPlayer.upgraded == 4) {
bot.sendUpgrade(9);
} else if (botPlayer.upgraded == 5) {
bot.sendUpgrade(34);
} else if (botPlayer.upgraded == 6) {
bot.sendUpgrade(12);
} else if (botPlayer.upgraded == 7) {
bot.sendUpgrade(15);
}
}
botPlayer.upgraded++;
}
}
if (type == "V") {
let tmpData = data[0];
let wpn = data[1];
if (tmpData) {
if (wpn) botPlayer.weapons = tmpData;
else botPlayer.items = tmpData;
}
}
if (type == "5") {
let type = data[0];
let id = data[1];
let index = data[2];
if (index) {
if (!type)
botPlayer.tails[id] = 1;
else
botPlayer.latestTail = id;
} else {
if (!type)
botPlayer.skins[id] = 1;
else
botPlayer.latestSkin = id;
}
}
if (type == "6") {
let id = data[0];
let mzg = data[1]+'';
if(id == player.sid && mzg.includes(":(")) {
bot.zync(botPlayer.near);
}
}
};
bot.onclose = function() {
botPlayer.inGame = false;
bD.inGame = false;
};
}
// RENDER LEAF:
function renderLeaf(x, y, l, r, ctxt) {
let endX = x + (l * Math.cos(r));
let endY = y + (l * Math.sin(r));
let width = l * 0.4;
ctxt.moveTo(x, y);
ctxt.beginPath();
ctxt.quadraticCurveTo(((x + endX) / 2) + (width * Math.cos(r + Math.PI / 2)),
((y + endY) / 2) + (width * Math.sin(r + Math.PI / 2)),
endX, endY);
ctxt.quadraticCurveTo(((x + endX) / 2) - (width * Math.cos(r + Math.PI / 2)),
((y + endY) / 2) - (width * Math.sin(r + Math.PI / 2)),
x, y);
ctxt.closePath();
ctxt.fill();
ctxt.stroke();
}
// RENDER CIRCLE:
function renderCircle(x, y, scale, tmpContext, dontStroke, dontFill) {
tmpContext = tmpContext || mainContext;
tmpContext.beginPath();
tmpContext.arc(x, y, scale, 0, 2 * Math.PI);
if (!dontFill) tmpContext.fill();
if (!dontStroke) tmpContext.stroke();
}
function renderHealthCircle(x, y, scale, tmpContext, dontStroke, dontFill) {
tmpContext = tmpContext || mainContext;
tmpContext.beginPath();
tmpContext.arc(x, y, scale, 0, 2 * Math.PI);
if (!dontFill) tmpContext.fill();
if (!dontStroke) tmpContext.stroke();
}
// RENDER STAR SHAPE:
function renderStar(ctxt, spikes, outer, inner) {
let rot = Math.PI / 2 * 3;
let x, y;
let step = Math.PI / spikes;
ctxt.beginPath();
ctxt.moveTo(0, -outer);
for (let i = 0; i < spikes; i++) {
x = Math.cos(rot) * outer;
y = Math.sin(rot) * outer;
ctxt.lineTo(x, y);
rot += step;
x = Math.cos(rot) * inner;
y = Math.sin(rot) * inner;
ctxt.lineTo(x, y);
rot += step;
}
ctxt.lineTo(0, -outer);
ctxt.closePath();
}
function renderHealthStar(ctxt, spikes, outer, inner) {
let rot = Math.PI / 2 * 3;
let x, y;
let step = Math.PI / spikes;
ctxt.beginPath();
ctxt.moveTo(0, -outer);
for (let i = 0; i < spikes; i++) {
x = Math.cos(rot) * outer;
y = Math.sin(rot) * outer;
ctxt.lineTo(x, y);
rot += step;
x = Math.cos(rot) * inner;
y = Math.sin(rot) * inner;
ctxt.lineTo(x, y);
rot += step;
}
ctxt.lineTo(0, -outer);
ctxt.closePath();
}
// RENDER RECTANGLE:
function renderRect(x, y, w, h, ctxt, dontStroke, dontFill) {
if (!dontFill) ctxt.fillRect(x - (w / 2), y - (h / 2), w, h);
if (!dontStroke) ctxt.strokeRect(x - (w / 2), y - (h / 2), w, h);
}
function renderHealthRect(x, y, w, h, ctxt, dontStroke, dontFill) {
if (!dontFill) ctxt.fillRect(x - (w / 2), y - (h / 2), w, h);
if (!dontStroke) ctxt.strokeRect(x - (w / 2), y - (h / 2), w, h);
}
// RENDER RECTCIRCLE:
function renderRectCircle(x, y, s, sw, seg, ctxt, dontStroke, dontFill) {
ctxt.save();
ctxt.translate(x, y);
seg = Math.ceil(seg / 2);
for (let i = 0; i < seg; i++) {
renderRect(0, 0, s * 2, sw, ctxt, dontStroke, dontFill);
ctxt.rotate(Math.PI / seg);
}
ctxt.restore();
}
// RENDER BLOB:
function renderBlob(ctxt, spikes, outer, inner) {
let rot = Math.PI / 2 * 3;
let x, y;
let step = Math.PI / spikes;
let tmpOuter;
ctxt.beginPath();
ctxt.moveTo(0, -inner);
for (let i = 0; i < spikes; i++) {
tmpOuter = UTILS.randInt(outer + 0.9, outer * 1.2);
ctxt.quadraticCurveTo(Math.cos(rot + step) * tmpOuter, Math.sin(rot + step)
* tmpOuter,
Math.cos(rot + (step * 2)) * inner, Math.sin(rot +
(step * 2)) * inner);
rot += step * 2;
}
ctxt.lineTo(0, -inner);
ctxt.closePath();
}
// RENDER TRIANGLE:
function renderTriangle(s, ctx) {
ctx = ctx || mainContext;
let h = s * (Math.sqrt(3) / 2);
ctx.beginPath();
ctx.moveTo(0, -h / 2);
ctx.lineTo(-s / 2, h / 2);
ctx.lineTo(s / 2, h / 2);
ctx.lineTo(0, -h / 2);
ctx.fill();
ctx.closePath();
}
// PREPARE MENU BACKGROUND:
function prepareMenuBackground() {
// let tmpMid = config.mapScale / 2;
// let attempts = 0;
// for (let i = 0; i < items.list.length * 3;) {
// if (attempts >= 1000) break;
// attempts++;
// let type = items.list[UTILS.randInt(0, items.list.length - 1)];
// let data = {
// x: tmpMid + UTILS.randFloat(-1000, 1000),
// y: tmpMid + UTILS.randFloat(-600, 600),
// dir: UTILS.fixTo(Math.random() * (Math.PI * 2), 2)
// };
// if (objectManager.checkItemLocation(data.x, data.y, type.scale, 0.6,
type.id, true)) {
// objectManager.add(i, data.x, data.y, data.dir, type.scale, type.id,
type);
// } else {
// continue;
// }
// i++;
// }
}
const speed = 1;
// RENDER PLAYERS:
function renderDeadPlayers(xOffset, yOffset) {
mainContext.fillStyle = "#91b2db";
const currentTime = Date.now();
deadPlayers.filter(dead => dead.active).forEach((dead) => {
if (!dead.startTime) {
dead.startTime = currentTime;
dead.angle = 0;
dead.radius = 0.1;
}
const timeElapsed = currentTime - dead.startTime;
const maxAlpha = 1;
dead.alpha = Math.max(0, maxAlpha - (timeElapsed / 3000));
dead.animate(delta);
mainContext.globalAlpha = dead.alpha;
mainContext.strokeStyle = outlineColor;
mainContext.save();
mainContext.translate(dead.x - xOffset, dead.y - yOffset);
dead.radius -= 0.001;
dead.angle += 0.0174533;
const moveSpeed = 1;
const x = dead.radius * Math.cos(dead.angle);
const y = dead.radius * Math.sin(dead.angle);
dead.x += x * moveSpeed;
dead.y += y * moveSpeed;
mainContext.rotate(dead.angle);
renderDeadPlayer(dead, mainContext);
mainContext.restore();
mainContext.fillStyle = "#91b2db";
if (timeElapsed >= 3000) {
dead.active = false;
dead.startTime = null;
}
});
}
// RENDER PLAYERS:
function renderPlayers(xOffset, yOffset, zIndex) {
mainContext.globalAlpha = 1;
mainContext.fillStyle = "#91b2db";
for (var i = 0; i < players.length; ++i) {
tmpObj = players[i];
if (tmpObj.zIndex == zIndex) {
tmpObj.animate(delta);
if (tmpObj.visible) {
tmpObj.skinRot += (0.002 * delta);
tmpDir = (tmpObj==player?getVisualDir():(tmpObj.dir || 0));
mainContext.save();
mainContext.translate(tmpObj.x - xOffset, tmpObj.y - yOffset);
// RENDER PLAYER:
mainContext.rotate(tmpDir + tmpObj.dirPlus);
renderPlayer(tmpObj, mainContext);
mainContext.restore();
}
}
}
}
// RENDER DEAD PLAYER:
function renderDeadPlayer(obj, ctxt) {
ctxt = ctxt || mainContext;
ctxt.lineWidth = outlineWidth;
ctxt.lineJoin = "miter";
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;
// TAIL/CAPE:
renderTail2(13, ctxt, obj);
// WEAPON BELLOW HANDS:
if (obj.buildIndex < 0 && !items.weapons[obj.weaponIndex].aboveHand) {
renderTool(items.weapons[obj.weaponIndex],
config.weaponVariants[obj.weaponVariant || 0].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);
}
}
// HANDS:
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);
// WEAPON ABOVE HANDS:
if (obj.buildIndex < 0 && items.weapons[obj.weaponIndex].aboveHand) {
renderTool(items.weapons[obj.weaponIndex],
config.weaponVariants[obj.weaponVariant || 0].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);
}
}
// BUILD ITEM:
if (obj.buildIndex >= 0) {
var tmpSprite = getItemSprite(items.list[obj.buildIndex]);
ctxt.drawImage(tmpSprite, obj.scale -
items.list[obj.buildIndex].holdOffset, -tmpSprite.width / 2);
}
// BODY:
renderCircle(0, 0, obj.scale, ctxt);
// SKIN
renderSkin2(48, ctxt, null, obj)
}
// RENDER PLAYER:
function renderPlayer(obj, ctxt) {
ctxt = ctxt || mainContext;
ctxt.lineWidth = outlineWidth;
ctxt.lineJoin = "miter";
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);
// TAIL/CAPE:
if (obj.tailIndex > 0) {
renderTailTextureImage(obj.tailIndex, ctxt, obj);
}
// WEAPON BELLOW HANDS:
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);
}
}
// HANDS:
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);
// WEAPON ABOVE HANDS:
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);
}
}
// BUILD ITEM:
if (obj.buildIndex >= 0) {
var tmpSprite = getItemSprite(items.list[obj.buildIndex]);
ctxt.drawImage(tmpSprite, obj.scale -
items.list[obj.buildIndex].holdOffset, -tmpSprite.width / 2);
}
// BODY:
renderCircle(0, 0, obj.scale, ctxt);
// SKIN:
if (obj.skinIndex > 0) {
ctxt.rotate(Math.PI / 2);
renderTextureSkin(obj.skinIndex, ctxt, null, obj);
}
}
// RENDER NORMAL SKIN
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 = "https://moomoo.io/img/hats/hat_" + index + ".png";
tmpImage.src = "https://moomoo.io/img/hats/hat_" + index + ".png";
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();
}
}
// RENDER SKIN:
function renderTextureSkin(index, ctxt, parentSkin, owner) {
if (!(tmpSkin = skinSprites[index + (txt ? "lol" : 0)])) {
var tmpImage = new Image();
tmpImage.onload = function() {
this.isLoaded = true,
this.onload = null
}
,
tmpImage.src = setSkinTextureImage(index, "hat", index),
skinSprites[index + (txt ? "lol" : 0)] = tmpImage,
tmpSkin = tmpImage
}
var tmpObj = parentSkin||skinPointers[index];
if (!tmpObj) {
for (var 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();
}
}
var FlareZHat = {
7: "https://i.imgur.com/vAOzlyY.png",
15: "https://i.imgur.com/YRQ8Ybq.png",
40: "https://i.imgur.com/Xzmg27N.png",
26: "https://i.imgur.com/I0xGtyZ.png",
55: "https://i.imgur.com/uYgDtcZ.png",
20: "https://i.imgur.com/f5uhWCk.png",
};
function setSkinTextureImage(id, type, id2) {
if (true) {
if(FlareZHat[id] && type == "hat") {
return FlareZHat[id];
} else {
if(type == "acc") {
return ".././img/accessories/access_" + id + ".png";
} else if(type == "hat") {
return ".././img/hats/hat_" + id + ".png";
} else {
return ".././img/weapons/" + id + ".png";
}
}
} else {
if(type == "acc") {
return ".././img/accessories/access_" + id + ".png";
} else if(type == "hat") {
return ".././img/hats/hat_" + id + ".png";
} else {
return ".././img/weapons/" + id + ".png";
}
}
}
// RENDER SKINS:
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 = "https://moomoo.io/img/hats/hat_" + index + ".png";
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();
}
}
// RENDER TAIL:
var FlareZAcc = {
21: "https://i.imgur.com/4ddZert.png",
19: "https://i.imgur.com/sULkUZT.png",
};
function setTailTextureImage(id, type, id2) {
if (true) {
if(FlareZAcc[id] && type == "acc") {
return FlareZAcc[id];
} else {
if(type == "acc") {
return ".././img/accessories/access_" + id + ".png";
} else if(type == "hat") {
return ".././img/hats/hat_" + id + ".png";
} else {
return ".././img/weapons/" + id + ".png";
}
}
} else {
if(type == "acc") {
return ".././img/accessories/access_" + id + ".png";
} else if(type == "hat") {
return ".././img/hats/hat_" + id + ".png";
} else {
return ".././img/weapons/" + id + ".png";
}
}
}
function renderTailTextureImage(index, ctxt, owner) {
if (!(tmpSkin = accessSprites[index + (txt ? "lol" : 0)])) {
var tmpImage = new Image();
tmpImage.onload = function() {
this.isLoaded = true,
this.onload = null
}
,
tmpImage.src = setTailTextureImage(index,
"acc"),//".././img/accessories/access_" + index + ".png";
accessSprites[index + (txt ? "lol" : 0)] = tmpImage,
tmpSkin = tmpImage;
}
var tmpObj = accessPointers[index];
if (!tmpObj) {
for (var 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();
}
}
let accessSprites = {};
let accessPointers = {};
var txt = true;
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 = "https://moomoo.io/img/accessories/access_" + index +
".png";
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 = accessSprites2[index];
if (!tmpSkin) {
var tmpImage = new Image();
tmpImage.onload = function() {
this.isLoaded = true;
this.onload = null;
};
tmpImage.src = "https://moomoo.io/img/accessories/access_" + index +
".png";
accessSprites2[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();
}
}
// RENDER TOOL:
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 = "https://moomoo.io/img/weapons/" + tmpSrc + ".png";
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);
}
// RENDER PROJECTILES:
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();
}
}
};
}
// RENDER PROJECTILE:
let projectileSprites = {};//fz iz zexy
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);
}
}
// RENDER AI:
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);
}
}
// RENDER WATER BODIES:
function renderWaterBodies(xOffset, yOffset, ctxt, padding) {
// MIDDLE RIVER:
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);
}
}
// RENDER GAME OBJECTS:
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 = 6;
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 (isNight) {
// tmpContext.shadowBlur = blurScale;
// tmpContext.shadowColor = `rgba(0, 0, 0, ${obj.alpha})`;
// }
if (obj.type == 0) {
let tmpScale;
let tmpCount = 8;
tmpContext.globalAlpha = (cdf(obj, player) <= 250 ? 0.6 : 1);
for (let i = 0; i < 2; ++i) {
tmpScale = tmpObj.scale * (!i ? 1 : 0.5);
renderStar(tmpContext, tmpCount, tmpScale, tmpScale * 0.7);
tmpContext.fillStyle = !biomeID ? (!i ? "#9ebf57" : "#b4db62") : (!
i ? "#e3f1f4" : "#fff");
tmpContext.fill();
if (!i) {
tmpContext.stroke();
tmpContext.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.shadowBlur = null;
//tmpContext.shadowColor = null;
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.shadowBlur = null;
//tmpContext.shadowColor = null;
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;
}
// GET ITEM SPRITE:
let itemSprites = [];
function getItemSprite(obj, asIcon) {
let tmpSprite = itemSprites[obj.id];
if (!tmpSprite || asIcon) {
let blurScale = !asIcon ? 20 : 5;
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;
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 (!asIcon) {
tmpContext.shadowBlur = 8;
tmpContext.shadowColor = `rgba(0, 0, 0, 0.2)`;
}
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);
}
tmpSprite = tmpCanvas;
if (!asIcon)
itemSprites[obj.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 = isNight ? 20 : 0;
let tmpCanvas = document.createElement("canvas");
tmpCanvas.width = tmpCanvas.height = obj.scale * 2.5 + outlineWidth +
(items.list[obj.id].spritePadding || 0) + 0;
let tmpContext = tmpCanvas.getContext("2d");
tmpContext.translate(tmpCanvas.width / 2, tmpCanvas.height / 2);
tmpContext.rotate(Math.PI / 2);
tmpContext.strokeStyle = outlineColor;
tmpContext.lineWidth = outlineWidth;
// if (isNight) {
// tmpContext.shadowBlur = 20;
// tmpContext.shadowColor = `rgba(0, 0, 0, ${Math.min(0.3,
obj.alpha)})`;
// }
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;
}
// GET MARK SPRITE:
function getMarkSprite(obj, tmpContext, tmpX, tmpY) {
let center = {
x: screenWidth / 2,
y: screenHeight / 2,
};
tmpContext.lineWidth = outlineWidth;
mainContext.globalAlpha = 0.2;
tmpContext.strokeStyle = outlineColor;
tmpContext.save();
tmpContext.translate(tmpX, tmpY);
tmpContext.rotate(90**10);
if (obj.name == "spikes" || obj.name == "greater spikes" || obj.name == "poison
spikes" || obj.name == "spinning spikes") {
tmpContext.fillStyle = (obj.name == "poison spikes")?"#7b935d":"#939393";
var tmpScale = (obj.scale);
renderStar(tmpContext, (obj.name == "spikes")?5:6, obj.scale, tmpScale);
tmpContext.fill();
tmpContext.stroke();
tmpContext.fillStyle = "#a5974c";
renderCircle(0, 0, tmpScale, tmpContext);
if (player && obj.owner && player.sid != obj.owner.sid && !
tmpObj.findAllianceBySid(obj.owner.sid)) {
tmpContext.fillStyle = "#a34040";
} else {
tmpContext.fillStyle = "#c9b758";
}
renderCircle(0, 0, tmpScale/2, tmpContext, true);
} else if (obj.name == "turret") {
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 == "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);
} 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 == "windmill" || obj.name == "faster windmill" || obj.name
== "power mill") {
tmpContext.fillStyle = "#a5974c";
renderCircle(0, 0, obj.scale, tmpContext);
tmpContext.fillStyle = "#c9b758";
renderRectCircle(0, 0, obj.scale * 1.5, 29, 4, tmpContext);
tmpContext.fillStyle = "#a5974c";
renderCircle(0, 0, obj.scale * 0.5, tmpContext);
} else if (obj.name == "pit trap") {
tmpContext.fillStyle = "#a5974c";
renderStar(tmpContext, 3, obj.scale * 1.1, obj.scale * 1.1);
tmpContext.fill();
tmpContext.stroke();
if (player && obj.owner && player.sid != obj.owner.sid && !
tmpObj.findAllianceBySid(obj.owner.sid)) {
tmpContext.fillStyle = "#a34040";
} else {
tmpContext.fillStyle = outlineColor;
}
renderStar(tmpContext, 3, obj.scale * 0.65, obj.scale * 0.65);
tmpContext.fill();
}
tmpContext.restore();
}
// OBJECT ON SCREEN:
function isOnScreen(x, y, s) {
return (x + s >= 0 && x - s <= maxScreenWidth && y + s >= 0 && (y,
s,
maxScreenHeight));
}
// RENDER GAME OBJECTS:
function renderGameObjects(layer, xOffset, yOffset) {
let tmpSprite;
let tmpX;
let tmpY;
liztobj.forEach((tmp) => {
tmpObj = tmp;
if (tmpObj.active && liztobj.includes(tmp) && tmpObj.render) {
tmpX = tmpObj.x + tmpObj.xWiggle - xOffset;
tmpY = tmpObj.y + tmpObj.yWiggle - yOffset;
if (layer == 0) {
tmpObj.update(delta);
}
if (getEl("mode").value == 'fuckemup' && cdf(tmpObj, player) <= 600 &&
tmpObj.isItem) {
mainContext.globalAlpha = tmpObj.alpha/2;
} else {
mainContext.globalAlpha = tmpObj.alpha;
}
if (tmpObj.layer == layer && isOnScreen(tmpX, tmpY, tmpObj.scale +
(tmpObj.blocker || 0))) {
if (tmpObj.isItem) {
if ((tmpObj.dmg || tmpObj.trap) && !
tmpObj.isTeamObject(player)) {
tmpSprite = getObjSprite(tmpObj);
} else {
tmpSprite = getItemSprite(tmpObj);
}
mainContext.save();
mainContext.translate(tmpX, tmpY);
mainContext.rotate(tmpObj.dir);
if (!tmpObj.active) {
mainContext.scale(tmpObj.visScale / tmpObj.scale,
tmpObj.visScale / tmpObj.scale);
}
mainContext.drawImage(tmpSprite, -(tmpSprite.width / 2), -
(tmpSprite.height / 2));
if (tmpObj.blocker) {
mainContext.strokeStyle = "#db6e6e";
mainContext.globalAlpha = 0.3;
mainContext.lineWidth = 6;
renderCircle(0, 0, tmpObj.blocker, mainContext, false,
true);
}
mainContext.restore();
} else {
tmpSprite = getResSprite(tmpObj);
mainContext.drawImage(tmpSprite, tmpX - (tmpSprite.width / 2),
tmpY - (tmpSprite.height / 2));
}
}
if (layer == 3 && !useWasd) {
if (tmpObj.health < tmpObj.maxHealth) {
// HEALTH HOLDER:
mainContext.fillStyle = darkOutlineColor;
mainContext.roundRect(tmpX - config.healthBarWidth / 2 -
config.healthBarPad, tmpY - config.healthBarPad, config.healthBarWidth +
config.healthBarPad * 2, 17, 8);
mainContext.fill();
// HEALTH BAR:
mainContext.fillStyle = tmpObj.isTeamObject(player) ? "#8ecc51"
: "#cc5151";
mainContext.roundRect(tmpX - config.healthBarWidth / 2, tmpY,
config.healthBarWidth * (tmpObj.health / tmpObj.maxHealth), 17 -
config.healthBarPad * 2, 7);
mainContext.fill();
}
}
}
});
// PLACE VISIBLE:
if (layer == 0) {
if (placeVisible.length) {
placeVisible.forEach((places) => {
tmpX = places.x - xOffset;
tmpY = places.y - yOffset;
markObject(places, tmpX, tmpY);
});
}
}
}
function markObject(tmpObj, tmpX, tmpY) {
getMarkSprite(tmpObj, mainContext, tmpX, tmpY);
}
// RENDER MINIMAP:
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;
}
function renderMinimap(delta) {
if (player && player.alive) {
mapContext.clearRect(0, 0, mapDisplay.width, mapDisplay.height);
// RENDER PINGS:
mapContext.lineWidth = 4;
for (let i = 0; i < mapPings.length; ++i) {
tmpPing = mapPings[i];
mapContext.strokeStyle = tmpPing.color;
tmpPing.update(mapContext, delta);
}
// RENDER BREAK TRACKS:
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;
}
}
// RENDER PLAYERS:
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;
}
}
// RENDER BOTS:
if (bots.length) {
bots.forEach((tmp) => {
if (tmp.inGame) {
mapContext.globalAlpha = 1;
mapContext.strokeStyle = "#cc5151";
renderCircle((tmp.x2 / config.mapScale) * mapDisplay.width,
(tmp.y2 / config.mapScale) * mapDisplay.height, 7,
mapContext, false, true);
}
});
}
// DEATH LOCATION:
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);
}
// MAP MARKER:
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);
}
}
}
// ICONS:
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 = {};
let icons = ["crown", "skull"];
function loadIcons() {
for (let i = 0; i < icons.length; ++i) {
let tmpSprite = new Image();
tmpSprite.onload = function() {
this.isLoaded = true;
};
tmpSprite.src = "./../img/icons/" + icons[i] + ".png";
iconSprites[icons[i]] = tmpSprite;
}
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 cdf (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;
}
}
// UPDATE GAME:
function updateGame() {
if(gameObjects.length && inGame) {
gameObjects.forEach((tmp) => {
if(UTILS.getDistance(tmp.x, tmp.y, player.x, player.y) <= 1200) {
if(!liztobj.includes(tmp)) {
liztobj.push(tmp);
tmp.render = true;
}
} else {
if(liztobj.includes(tmp)) {
if(UTILS.getDistance(tmp.x, tmp.y, player.x, player.y) >= 1200)
{
tmp.render = false;
const index = liztobj.indexOf(tmp);
if (index > -1) { // only splice array when item is found
liztobj.splice(index, 1); // 2nd parameter means remove
one item only
}
}
} else if(UTILS.getDistance(tmp.x, tmp.y, player.x, player.y) >=
1200) {
tmp.render = false;
const index = liztobj.indexOf(tmp);
if (index > -1) { // only splice array when item is found
liztobj.splice(index, 1); // 2nd parameter means remove one
item only
}
} else {
tmp.render = false;
const index = liztobj.indexOf(tmp);
if (index > -1) { // only splice array when item is found
liztobj.splice(index, 1); // 2nd parameter means remove one
item only
}
}
}
})
// gameObjects = gameObjects.filter(e => UTILS.getDistance(e.x, e.y,
player.x, player.y) <= 1000)
}
// if (config.resetRender) {
mainContext.beginPath();
mainContext.clearRect(0, 0, gameCanvas.width, gameCanvas.height);
// }
mainContext.globalAlpha = 1;
// MOVE CAMERA:
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.0045 * 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 + config.riverWidth;
camY = config.mapScale / 2;
}
// INTERPOLATE PLAYERS AND AI:
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));
}
}
}
}
// RENDER CORDS:
let xOffset = camX - (maxScreenWidth / 2);
let yOffset = camY - (maxScreenHeight / 2);
// RENDER BACKGROUND:
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));
}
// RENDER WATER AREAS:
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);
}
// RENDER DEAD PLAYERS:
mainContext.globalAlpha = 1;
mainContext.strokeStyle = outlineColor;
renderDeadPlayers(xOffset, yOffset);
// RENDER BOTTOM LAYER:
mainContext.globalAlpha = 1;
mainContext.strokeStyle = outlineColor;
renderGameObjects(-1, xOffset, yOffset);
// RENDER PROJECTILES:
mainContext.globalAlpha = 1;
mainContext.lineWidth = outlineWidth;
renderProjectiles(0, xOffset, yOffset);
// RENDER PLAYERS:
renderPlayers(xOffset, yOffset, 0);
// RENDER AI:
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();
}
}
// RENDER GAME OBJECTS (LAYERED):
renderGameObjects(0, xOffset, yOffset);
renderProjectiles(1, xOffset, yOffset);
renderGameObjects(1, xOffset, yOffset);
renderPlayers(xOffset, yOffset, 1);
renderGameObjects(2, xOffset, yOffset);
renderGameObjects(3, xOffset, yOffset);
// MAP BOUNDARIES:
mainContext.fillStyle = "#000";
mainContext.globalAlpha = 0.09;
if (xOffset <= 0) {
mainContext.fillRect(0, 0, -xOffset, maxScreenHeight);
}
if (config.mapScale - xOffset <= maxScreenWidth) {
let tmpY = Math.max(0, -yOffset);
mainContext.fillRect(config.mapScale - xOffset, tmpY, maxScreenWidth -
(config.mapScale - xOffset), maxScreenHeight - tmpY);
}
if (yOffset <= 0) {
mainContext.fillRect(-xOffset, 0, maxScreenWidth + xOffset, -yOffset);
}
if (config.mapScale - yOffset <= maxScreenHeight) {
let tmpX = Math.max(0, -xOffset);
let tmpMin = 0;
if (config.mapScale - xOffset <= maxScreenWidth)
tmpMin = maxScreenWidth - (config.mapScale - xOffset);
mainContext.fillRect(tmpX, config.mapScale - yOffset,
(maxScreenWidth - tmpX) - tmpMin, maxScreenHeight -
(config.mapScale - yOffset));
}
// RENDER DAY/NIGHT TIME:
mainContext.globalAlpha = 1;
mainContext.fillStyle = "rgba(0, 5, 80, 0.425)";
mainContext.fillRect(0, 0, maxScreenWidth, maxScreenHeight);
// RENDER PLAYER AND AI UI:
mainContext.strokeStyle = darkOutlineColor;
mainContext.globalAlpha = 1;
if (getEl("mode").value == 'fuckemup') {
mainContext.beginPath();
mainContext.strokeStyle = "#000";
mainContext.fillStyle = "#000";
mainContext.globalAlpha = 0.3;
mainContext.lineWidth = 6;
mainContext.arc(player.x - xOffset, player.y - yOffset, 600, 0, 2 *
Math.PI);
mainContext.stroke();
mainContext.globalAlpha = 0.05;
mainContext.fill();
mainContext.closePath();
}
if (playerPrediction) {
mainContext.beginPath();
mainContext.strokeStyle = "#000";
mainContext.fillStyle = "#000";
mainContext.globalAlpha = 0.3;
mainContext.lineWidth = 6;
mainContext.arc(playerPrediction.x - xOffset, playerPrediction.y - yOffset,
player.scale, 0, 2 * Math.PI);
mainContext.stroke();
mainContext.fill();
mainContext.closePath();
}
mainContext.beginPath();
for (let i = 0; i < players.length + ais.length; ++i) {
tmpObj = players[i] || ais[i - players.length];
if (tmpObj.visible && tmpObj.showName === 'NOOO') {
mainContext.strokeStyle = darkOutlineColor;
// NAME AND HEALTH:
// let izbot = false;
// bots.forEach((bot) => {
// if (tmpObj.sid == bot.sid) izbot = true
// else izbot = false;
// });
let tmpText = (tmpObj.team ? "[" + tmpObj.team + "] " : "") +
(tmpObj.name || ""); //+ (tmpObj.isPlayer ? " {" + tmpObj.sid + "}" : "");
if (tmpText != "" && tmpObj.name != "Nitro For Bots") {
// bots.forEach((bot) => {
// if (tmpObj.sid == bot.sid) return;
// });
mainContext.globalAlpha = 1;
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) {
let tmpS = config.crownIconScale;
let tmpX = tmpObj.x - xOffset - (tmpS / 2) -
(mainContext.measureText(tmpText).width / 2) - config.crownPad;
mainContext.drawImage(iconSprites["crown"], tmpX, (tmpObj.y -
yOffset - tmpObj.scale) -
config.nameY - (tmpS / 2) - 5, tmpS,
tmpS);
}
if (tmpObj.iconIndex == 1 && iconSprites["skull"].isLoaded) {
let tmpS = config.crownIconScale;
let tmpX = tmpObj.x - xOffset - (tmpS / 2) +
(mainContext.measureText(tmpText).width / 2) + config.crownPad;
mainContext.drawImage(iconSprites["skull"], tmpX, (tmpObj.y -
yOffset - tmpObj.scale) -
config.nameY - (tmpS / 2) - 5, tmpS,
tmpS);
}
if (tmpObj.isPlayer && instaC.wait && near == tmpObj &&
(tmpObj.backupNobull ? crossHairSprites[1].isLoaded : crossHairSprites[0].isLoaded)
&& enemy.length && !useWasd) {
let tmpS = tmpObj.scale * 2.2;
mainContext.drawImage((tmpObj.backupNobull ?
crossHairSprites[1] : crossHairSprites[0]), tmpObj.x - xOffset - tmpS / 2, tmpObj.y
- yOffset - tmpS / 2, tmpS, tmpS);
}
// izbot = false;
}
if (tmpObj.health > 0) {
if(tmpObj.name != "Free Gold") {
// HEALTH HOLDER:
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, 8);
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,
((config.healthBarWidth * 2) *
(tmpObj.health / tmpObj.maxHealth)), 17 - config.healthBarPad * 2, 7);
mainContext.fill();
}
if (tmpObj.isPlayer) {
mainContext.globalAlpha = 1;
let targetReloads = {
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
};
if (!tmpObj.currentReloads) {
tmpObj.currentReloads = { // Initialize currentReloads if
not already set
primary: targetReloads.primary,
secondary: targetReloads.secondary,
turret: targetReloads.turret
};
}
const lerpFactor = 0.3;
tmpObj.currentReloads.primary = (1 - lerpFactor) *
tmpObj.currentReloads.primary + lerpFactor * targetReloads.primary;
tmpObj.currentReloads.secondary = (1 - lerpFactor) *
tmpObj.currentReloads.secondary + lerpFactor * targetReloads.secondary;
tmpObj.currentReloads.turret = (1 - lerpFactor) *
tmpObj.currentReloads.turret + lerpFactor * targetReloads.turret;
let primaryReloadProgress = tmpObj.primaryIndex !== undefined ?
((items.weapons[tmpObj.primaryIndex].speed - tmpObj.reloads[tmpObj.primaryIndex]) /
items.weapons[tmpObj.primaryIndex].speed) : 1;
let secondaryReloadProgress = tmpObj.secondaryIndex !==
undefined ? ((items.weapons[tmpObj.secondaryIndex].speed -
tmpObj.reloads[tmpObj.secondaryIndex]) /
items.weapons[tmpObj.secondaryIndex].speed) : 1;
const centerX = tmpObj.x - xOffset;
const centerY = tmpObj.y - yOffset;
const barRadius = 35;
const barWidth = 15;
const totalAngle = (Math.PI*2)/3; // Half circle
const secondaryStartAngle = -Math.PI / 2 + Math.PI / 3 +
tmpObj.dir - Math.PI/2;
const secondaryEndAngle = secondaryStartAngle + (totalAngle *
tmpObj.currentReloads.secondary);
const primaryStartAngle = Math.PI / 2 + tmpObj.dir - Math.PI/2;
const primaryEndAngle = primaryStartAngle + (totalAngle *
tmpObj.currentReloads.primary);
const turretStartAngle = Math.PI + Math.PI / 4.5 + tmpObj.dir -
Math.PI/2;
const turretEndAngle = turretStartAngle + (totalAngle/1.25 *
tmpObj.currentReloads.turret);
function returncoolcolor(RainbowCycle) {
return `hsl(${RainbowCycle-50}, 85%, 50%, 30)`;
}
mainContext.save();
if (tmpObj.currentReloads.primary < 0.999) {
mainContext.beginPath();
mainContext.lineCap = 'round';
mainContext.arc(centerX, centerY, barRadius,
primaryStartAngle, primaryEndAngle);
mainContext.lineWidth = 4;
mainContext.strokeStyle =
returncoolcolor(tmpObj.currentReloads.primary * 240);
mainContext.stroke();
}
if (tmpObj.currentReloads.secondary < 0.999) {
mainContext.beginPath();
mainContext.lineCap = 'round';
mainContext.arc(centerX, centerY, barRadius,
secondaryStartAngle, secondaryEndAngle);
mainContext.lineWidth = 4;
mainContext.strokeStyle =
returncoolcolor(tmpObj.currentReloads.secondary * 240);
mainContext.stroke();
}
if (tmpObj.currentReloads.turret < 0.999) {
mainContext.beginPath();
mainContext.lineCap = 'round';
mainContext.arc(centerX, centerY, barRadius,
turretStartAngle, turretEndAngle);
mainContext.lineWidth = 4;
mainContext.strokeStyle =
returncoolcolor(tmpObj.currentReloads.turret * 240);
mainContext.stroke();
}
mainContext.restore();
if(tmpObj.name != "Nitro For Bots") {
// SHAME COUNT:
mainContext.globalAlpha = 1;
mainContext.font = "24px Hammersmith One";
mainContext.fillStyle = "#fff";
mainContext.strokeStyle = darkOutlineColor;
mainContext.textBaseline = "middle";
mainContext.textAlign = "center";
mainContext.lineWidth = 8;
mainContext.lineJoin = "round";
let tmpS = config.crownIconScale;
let tmpX = tmpObj.x - xOffset - tmpS / 2 + config.crownPad
- 2;
mainContext.strokeText('[' + (tmpObj.skinIndex == 45 &&
tmpObj.shameTimer > 0 ? tmpObj.shameTimer : tmpObj.shameCount) + '/' +
Math.round(tmpObj.pinge) + '/' + tmpObj.lastshamecount + ']', tmpX, tmpObj.y -
yOffset - tmpObj.scale - config.nameY + 175);
mainContext.fillText('[' + (tmpObj.skinIndex == 45 &&
tmpObj.shameTimer > 0 ? tmpObj.shameTimer : tmpObj.shameCount) + '/' +
Math.round(tmpObj.pinge) + '/' + tmpObj.lastshamecount + ']', tmpX, tmpObj.y -
yOffset - tmpObj.scale - config.nameY + 175);
}
// PLAYER TRACER:
if (!tmpObj.isTeam(player)) {
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 / 2;
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 = `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();
}
if (getEl("predictType").value == "pre2") {
mainContext.lineWidth = 3;
mainContext.strokeStyle = "#fff";
mainContext.globalAlpha = 1;
mainContext.beginPath();
let render = {
x: tmpObj.x2 - xOffset,
y: tmpObj.y2 - yOffset
};
mainContext.moveTo(tmpObj.x - xOffset, tmpObj.y - yOffset);
mainContext.lineTo(render.x, render.y);
mainContext.stroke();
} else if (getEl("predictType").value == "pre3") {
mainContext.lineWidth = 3;
mainContext.strokeStyle = "#cc5151";
mainContext.globalAlpha = 1;
mainContext.beginPath();
let render = {
x: tmpObj.x3 - xOffset,
y: tmpObj.y3 - yOffset
};
mainContext.moveTo(tmpObj.x - xOffset, tmpObj.y - yOffset);
mainContext.lineTo(render.x, render.y);
mainContext.stroke();
}
}
}
}
}
if (player) {
// AUTOPUSH LINE:
if (my.autoPush && my.pushData) {
mainContext.lineWidth = 5;
mainContext.globalAlpha = 1;
mainContext.beginPath();
mainContext.strokeStyle = "white";
var x1 = player.x - xOffset;
var y1 = player.y - yOffset;
var x2 = my.pushData.x2 - xOffset;
var y2 = my.pushData.y2 - yOffset;
var x3 = my.pushData.x - xOffset;
var y3 = my.pushData.y - yOffset;
mainContext.moveTo(x1, y1);
mainContext.lineTo(x2, y2);
mainContext.lineTo(x3, y3);
mainContext.stroke();
var deltaX = x3 - x1;
var deltaY = y3 - y1;
var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
var maxDistance = 100;
var percentage = (distance / maxDistance) * 100;
percentage = Math.min(100, Math.max(0, percentage));
let spike;
mainContext.fillStyle = "white";
mainContext.strokeStyle = "black";
mainContext.lineWidth = 5;
mainContext.font = "30px Hammersmith One";
let nearTrap = liztobj.filter(tmp => tmp.trap && tmp.active &&
tmp.isTeamObject(player) && UTILS.getDist(tmp, near, 0, 2) <= (near.scale +
tmp.getScale() + 5)).sort(function(a, b) {
return UTILS.getDist(a, near, 0, 2) - UTILS.getDist(b, near, 0, 2);
})[0];
if(nearTrap)
spike = liztobj.filter(tmp => tmp.dmg && tmp.active &&
tmp.isTeamObject(player) && UTILS.getDist(tmp, nearTrap, 0, 0) <= (near.scale +
nearTrap.scale + tmp.scale)).sort(function(a, b) {
return UTILS.getDist(a, near, 0, 2) - UTILS.getDist(b, near, 0,
2);
})[0];
let xx = (player.x - xOffset + near.x - xOffset) / 2;
let yy = (player.y - yOffset + near.y - yOffset) / 2;
mainContext.moveTo(player.x - xOffset, player.y - yOffset);
mainContext.strokeText(near.aim2, xx, yy);
mainContext.fillText(near.aim2, xx, yy);
}
}
mainContext.globalAlpha = 1;
// RENDER ANIM TEXTS:
textManager.update(delta, mainContext, xOffset, yOffset);
// RENDER CHAT MESSAGES:
for (let i = 0; i < players.length; ++i) {
tmpObj = players[i];
if (tmpObj.visible) {
if (tmpObj.chatCountdown > 0) {
tmpObj.chatCountdown -= delta;
if (tmpObj.chatCountdown <= 0)
tmpObj.chatCountdown = 0;
mainContext.font = "32px Hammersmith One";
let tmpSize = mainContext.measureText(tmpObj.chatMessage);
mainContext.textBaseline = "middle";
mainContext.textAlign = "center";
let tmpX = tmpObj.x - xOffset;
let tmpY = tmpObj.y - tmpObj.scale - yOffset - 90;
let tmpH = 47;
let tmpW = tmpSize.width + 17;
mainContext.fillStyle = "rgba(0,0,0,0.2)";
mainContext.roundRect(tmpX - tmpW / 2, tmpY - tmpH / 2, tmpW, tmpH,
6);
mainContext.fill();
mainContext.fillStyle = "#fff";
mainContext.fillText(tmpObj.chatMessage, tmpX, tmpY);
}
if (tmpObj.chat.count > 0) {
if (!useWasd) {
tmpObj.chat.count -= delta;
if (tmpObj.chat.count <= 0)
tmpObj.chat.count = 0;
mainContext.font = "32px Hammersmith One";
let tmpSize = mainContext.measureText(tmpObj.chat.message);
mainContext.textBaseline = "middle";
mainContext.textAlign = "center";
let tmpX = tmpObj.x - xOffset;
let tmpY = tmpObj.y - tmpObj.scale - yOffset + (90 * 2);
let tmpH = 47;
let tmpW = tmpSize.width + 17;
mainContext.fillStyle = "rgba(0,0,0,0.2)";
mainContext.roundRect(tmpX - tmpW / 2, tmpY - tmpH / 2, tmpW,
tmpH, 6);
mainContext.fill();
mainContext.fillStyle = "#ffffff99";
mainContext.fillText(tmpObj.chat.message, tmpX, tmpY);
} else {
tmpObj.chat.count = 0;
}
}
}
}
if (allChats.length) {
allChats.filter(ch => ch.active).forEach((ch) => {
if (!ch.alive) {
if (ch.alpha <= 1) {
ch.alpha += delta / 250;
if (ch.alpha >= 1) {
ch.alpha = 1;
ch.alive = true;
}
}
} else {
ch.alpha -= delta / 5000;
if (ch.alpha <= 0) {
ch.alpha = 0;
ch.active = false;
}
}
if (ch.active) {
mainContext.font = "20px Ubuntu";
let tmpSize = mainContext.measureText(ch.chat);
mainContext.textBaseline = "middle";
mainContext.textAlign = "center";
let tmpX = ch.x - xOffset;
let tmpY = ch.y - yOffset - 90;
let tmpH = 40;
let tmpW = tmpSize.width + 15;
mainContext.globalAlpha = ch.alpha;
mainContext.fillStyle = ch.owner.isTeam(player) ? "#8ecc51" :
"#cc5151";
mainContext.strokeStyle = "rgb(25, 25, 25)";
mainContext.strokeText(ch.owner.name, tmpX, tmpY - 45);
mainContext.fillText(ch.owner.name, tmpX, tmpY - 45);
mainContext.lineWidth = 5;
mainContext.fillStyle = "#ccc";
mainContext.strokeStyle = "rgb(25, 25, 25)";
mainContext.roundRect(tmpX - tmpW / 2, tmpY - tmpH / 2, tmpW, tmpH,
6);
mainContext.stroke();
mainContext.fill();
mainContext.fillStyle = "#fff";
mainContext.strokeStyle = "#000";
mainContext.strokeText(ch.chat, tmpX, tmpY);
mainContext.fillText(ch.chat, tmpX, tmpY);
ch.y -= delta / 100;
}
});
}
mainContext.globalAlpha = 1;
// RENDER MINIMAP:
renderMinimap(delta);
}
// UPDATE & ANIMATE:
window.requestAnimFrame = function() {
return null;
}
window.rAF = (function() {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function(callback) {
window.setTimeout(callback, 1000/9);
};
})();
function doUpdate() {
//rape modulus
now = performance.now();
delta = now - lastUpdate;
lastUpdate = now;
let timer = performance.now();
let diff = timer - fpsTimer.last;
if (diff >= 1000) {
fpsTimer.ltime = fpsTimer.time * (1000 / diff);
fpsTimer.last = timer;
fpsTimer.time = 0;
}
fpsTimer.time++;
getEl("pingFps").innerHTML = `${window.pingTime}ms | Fps: $
{Math.round(fpsTimer.ltime)}`;
getEl("packetStatus").innerHTML = secPacket;
updateGame();
rAF(doUpdate);
ms.avg = Math.round((ms.min+ms.max)/2);
}
prepareMenuBackground();
doUpdate();
function toggleUseless(boolean) {
getEl("instaType").disabled = boolean;
getEl("antiBullType").disabled = boolean;
getEl("predictType").disabled = boolean;
}
toggleUseless(useWasd);
let changeDays = {};
window.debug = function() {
my.waitHit = 0;
my.autoAim = false;
instaC.isTrue = false;
traps.inTrap = false;
itemSprites = [];
objSprites = [];
gameObjectSprites = [];
};
window.wasdMode = function() {
useWasd = !useWasd;
toggleUseless(useWasd);
};
window.startGrind = function() {
if (getEl("weaponGrind").checked) {
for (let i = 0; i < Math.PI * 2; i += Math.PI / 2) {
checkPlace(player.getItemType(22), i);
}
}
};
// REMOVED!!! so they cant abuse :) || Added Agaain
let botIDS = 0;
let bsk = [];
let projects = [
'wss://stellar-burly-sled.glitch.me/',
'wss://industrious-legendary-vermicelli.glitch.me/',
'wss://butter-mewing-cold.glitch.me/',
];
function sexy() {
let con = [];
projects.forEach(u => con.push(new WebSocket(u)));
let token = async function() {
return await new Promise((resolve) => {
window.grecaptcha
.execute("6LfahtgjAAAAAF8SkpjyeYMcxMdxIaQeh-VoPATP", {
action: "homepage",
})
.then(function(n) {
resolve(encodeURIComponent(n));
});
});
};
con.forEach(socket => {
let webs = WS.url.split("wss://")[1].split("?")[0];
socket.onopen = () => {
socket.int = setInterval(() => {
if (!socket.sent && webs) {
socket.sent = true;
for (let i = 0; i < 4; i++) {
let ba = "wss://" + webs + "?token=re:" + token();
socket.send(ba);
botIDS++
bsk.push([socket])
console.log(botIDS, bsk)
}
}
});
socket.onmessage = function(msg) {//ok lets start
let fes;
fes.sendWS = function(type) {
let data = Array.prototype.slice.call(arguments, 1);
let binary = window.msgpack.encode([type, data]);
fes.send(binary);
};
};
};
});
}
window.connectFillBots = function() {
sexy();//Yessir
};
window.destroyFillBots = function() {
};
window.tryConnectBots = function() {
const maxBots = 30;
for (let i = 0; i < maxBots; i++) {
window.grecaptcha.execute("6LfahtgjAAAAAF8SkpjyeYMcxMdxIaQeh-VoPATP", {
action: "homepage"
}).then(function (token) {
botSpawn(token);
});
}
};
window.destroyBots = function() {
bots.forEach((botyyyyy) => {
botyyyyy.closeSocket = true;
});
bots = [];
};
window.resBuild = function() {
if (gameObjects.length) {
gameObjects.forEach((tmp) => {
tmp.breakObj = false;
});
breakObjects = [];
}
};
window.toggleBotsCircle = function() {
player.circle = !player.circle;
};
window.toggleVisual = function() {
config.anotherVisual = !config.anotherVisual;
gameObjects.forEach((tmp) => {
if (tmp.active) {
tmp.dir = tmp.lastDir;
}
});
};
window.prepareUI = function(tmpObj) {
resize();
// CHAT STUFF:
var chatBox = document.getElementById("chatBox");
var chatHolder = document.getElementById("chatHolder");
var suggestBox = document.createElement("div");
suggestBox.id = "suggestBox";
var prevChats = [];
var prevChatsIndex = 0;
function toggleChat() {
if (!usingTouch) {
if (chatHolder.style.display == "block") {
if (chatBox.value) {
sendChat(chatBox.value);
}
closeChat();
} else {
storeMenu.style.display = "none";
allianceMenu.style.display = "none";
chatHolder.style.display = "block";
chatBox.focus();
resetMoveDir();
}
} else {
setTimeout(function () {
var chatMessage = prompt("chat message");
if (chatMessage) {
sendChat(chatMessage);
}
}, 1);
}
chatBox.value = "";
(() => {
prevChatsIndex = 0;
})();
}
function closeChat() {
chatBox.value = "";
chatHolder.style.display = "none";
}
// ACTION BAR:
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; box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5)",
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));
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.2)";
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.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.onclick = UTILS.checkTrusted(function () {
selectToBuild(tmpObj.items[tmpObj.getItemType(i -
items.weapons.length)]);
});
UTILS.hookTouchEvents(tmpUnit);
}
})(i);
}
};
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 2024-08-31
// @description try to take over the world!
// @author You
// @match http://*/*
// @icon
data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
(function() {
'use strict';