Message
Message
if(!endpoints.length){
endpoints.push(map.getCentreNode());
}
let currentNode;
while(openSet.length){
currentNode = openSet.remove(0)
if(endpoints.some((goal) => goal.x == currentNode.x && goal.y ==
currentNode.y)){
break;
}
//recontruct path
if(!endpoints.some((goal) => goal.x == currentNode.x && goal.y ==
currentNode.y)){
currentNode = map.getLowest('h');
}
let output = [];
while(currentNode.parent){
let nextNode = currentNode.parent;
let d = Math.round(Math.atan2(nextNode.y - currentNode.y, nextNode.x -
currentNode.x) / Math.PI * 4);
if(d < 0){d+=8};
output.push(d);
currentNode = nextNode;
}
output = new Uint8Array(output.reverse()).buffer;
self.postMessage(output, [output]);
}
//approximate hypot
function fastHypot(a, b){
const c = Math.SQRT2-1;
a = Math.abs(a);
b = Math.abs(b);
if(a > b){
let temp = a;
a = b;
b = temp;
}
return (c * a) + b
}
//pathfinding instance
class WorkerAStar{
constructor(size = 750, resolution = 5){
//setup essential variables
this.size = size;
this.res = resolution;
this.prevPos = {};
this.prevPath = [];//might change
//setup worker
this.blob = new Blob([
WorkerCode
], {
type: "application/javascript"
})
this.url = URL.createObjectURL(this.blob);
this.worker = new Worker(this.url);
this.worker.url = this.url;
//message receiving
this.worker.onmessage = (msg) => {
this.attemptFulfil(new Uint8Array(msg.data));
}
//error handling
this.worker.onerror = (err) => {
throw err;
}
this.initiateCanvas();
//test canvas
var canvasMap = document.createElement("CANVAS");
canvasMap.id = 'canvasMap';
document.body.append(canvasMap);
canvasMap.style.zIndex = "-1";
canvasMap.style =
this.mapWriter = canvasMap.getContext("2d");
canvasMap.width = Math.ceil(this.size * 2 / this.res) + 1;
canvasMap.height = Math.ceil(this.size * 2 / this.res) + 1;
}
//attempts to recieve a message
attemptFulfil(msg, depth = 0){
if(this.resolve){
//relay message onward
this.resolve(msg);
this.resolve = null;
}else{
//allow 5 attempts to recieve
if(depth < 5){
setTimeout(() => {
//could have just passed function as param, but this is more
"consistent"
this.attemptFulfil(msg, depth + 1);
}, 0);
}else{
console.error("Unexpected Message from Worker at ", this);
}
}
}
initiateCanvas(){
this.width = Math.ceil(this.size * 2 / this.res) + 1;
if(this.canvas){
this.canvas.width = this.width;
this.canvas.height = this.width;
}else{
this.canvas = new OffscreenCanvas(this.width, this.width);
this.ctx = this.canvas.getContext("2d");
}
}
setBuildings(buildings){
this.buildings = buildings;
}
setSpeed(spd){
this.estimatedSpeed = spd;
}
setPos(x, y){
this.x = x;
this.y = y;
}
clearPath(){
this.prevPath = [];
}
if(obj.dmg){
r += 30;
}
r += 18;
this.ctx.beginPath();
this.ctx.arc(x, y, r / this.res, 0, Circle);
this.ctx.fill();
}
}
this.ctx.fillStyle = "#0000FF";
for(let goal of positions){
this.ctx.fillRect(Math.round(goal.x), Math.round(goal.y), 1, 1);
}
this.mapWriter.clearRect(0, 0, this.width, this.width);
this.mapWriter.drawImage(this.canvas, 0, 0);
let bitmap = await createImageBitmap(this.canvas, 0, 0, this.width,
this.width);
this.worker.postMessage(bitmap, [bitmap]);
this.initiateCanvas();
let data = await this.response();
const xTable = [-1, -1, 0, 1, 1, 1, 0, -1];
const yTable = [0, -1, -1, -1, 0, 1, 1, 1];
if(!append){
this.prevPath = [];
}
let currPos = {
x: this.prevPos.x,
y: this.prevPos.y,
};
let displayPos = {
x: Math.floor(this.width/2),
y: Math.floor(this.width/2),
}
for(let i = 0;i < data.length;i++){
this.mapWriter
currPos = {
x: currPos.x + xTable[data[i]] * this.res,
y: currPos.y + yTable[data[i]] * this.res,
}
displayPos = {
x: displayPos.x + xTable[data[i]],
y: displayPos.y + yTable[data[i]],
}
this.mapWriter.fillRect(displayPos.x, displayPos.y, 1, 1);
this.prevPath.unshift(currPos);
}
return;
}
async pathTo(positions){
//fix positions
if(!(positions instanceof Array)){
positions = [positions];
}
if(this.prevGoal?.length == positions.length && this.prevGoal.every((elem,
i) => elem.x == positions[i].x && elem.y == positions[i].y)){
let path = this.getPath();
if(path){
if(path.dist < this.estimatedSpeed / this.res * 5){
this.initCalc(positions, true);
}
return path;
}
}
await this.initCalc(positions);
return this.getPath();
}
}
var Pathfinder = new WorkerAStar();
Pathfinder.setSpeed(500 / 9);
class Tachyon{
constructor(pathfinder){
this.pathfinder = pathfinder;
this.goal = {
pathing: false,
type: null,
entity: null,
pos: {
x: null,
y: null,
},
}
this.waypoints = {
death: {
x: null,
y: null,
},
quick: {
x: null,
y: null,
},
}
}
setWaypoint(name, pos){
if(pos.x && pos.y){
this.waypoints[name] = {
x: pos.x,
y: pos.y,
}
}
}
drawWaypointMap(mapCtx, canvas){
mapCtx.font = "Otp Jaguar.";
mapCtx.textBaseline = "middle";
mapCtx.textAlign = "center";
for(let tag in this.waypoints){
if(tag == "death"){
mapCtx.fillStyle = "#E44";
}else if(tag == "quick"){
mapCtx.fillStyle = "#44E";
}else{
mapCtx.fillStyle = "#00ffff";
}
if(this.waypoints[tag].x && this.waypoints[tag].y){
mapCtx.fillText("x", this.waypoints[tag].x / 14400 * canvas.width,
this.waypoints[tag].y / 14400 * canvas.height);
}
}
mapCtx.strokeStyle = "#4E4";
if(this.goal.type == "xpos"){
mapCtx.beginPath();
mapCtx.moveTo(this.goal.pos.x / 14400 * canvas.width, 0);
mapCtx.lineTo(this.goal.pos.x / 14400 * canvas.width, canvas.height);
mapCtx.stroke();
}else if(this.goal.type == "ypos"){
mapCtx.beginPath();
mapCtx.moveTo(0, this.goal.pos.y / 14400 * canvas.height);
mapCtx.lineTo(canvas.width, this.goal.pos.y / 14400 * canvas.height);
mapCtx.stroke();
}else if(this.goal.pos.x && this.goal.pos.y){
mapCtx.fillStyle = "#4E4";
mapCtx.fillText("x", this.goal.pos.x / 14400 * canvas.width,
this.goal.pos.y / 14400 * canvas.height);
}
}
drawWaypoints(ctx, theta){
//waypoints
for(let tag in this.waypoints){
if(tag == "death"){
ctx.strokeStyle = "#E44";
}else if(tag == "quick"){
ctx.strokeStyle = "#44E";
}else{
ctx.strokeStyle = "#00ffff";
}
if(this.waypoints[tag].x && this.waypoints[tag].y){
ctx.save();
ctx.translate(this.waypoints[tag].x, this.waypoints[tag].y);
ctx.rotate(theta);
ctx.globalAlpha = 0.6;
ctx.lineWidth = 8;
for(let i = 0;i < 4;i++){
//spinning thing
ctx.rotate(i * Math.PI / 2);
ctx.beginPath();
ctx.arc(0, 0, 50, 0, Math.PI / 4);
ctx.stroke();
}
//pulsing thing
ctx.lineWidth = 6;
ctx.globalAlpha = Math.min(0.4, 1 - Math.pow(Math.sin(theta / 2),
2) / 1.2);
ctx.beginPath();
ctx.arc(0, 0, 50 + Math.max(0, Math.tan(theta / 2)), 0, Math.PI *
2);
ctx.stroke();
ctx.restore();
}
}
//goal
ctx.strokeStyle = "#4F4";
ctx.lineWidth = 10;
ctx.globalAlpha = 0.8;
if(this.goal.type == "xpos"){
ctx.beginPath();
ctx.moveTo(this.goal.pos.x, 0);
ctx.lineTo(this.goal.pos.x, 14400);
ctx.stroke();
}else if(this.goal.type == "ypos"){
ctx.beginPath();
ctx.moveTo(0, this.goal.pos.y);
ctx.lineTo(14400, this.goal.pos.y);
ctx.stroke();
}else if(this.goal.pos.x && this.goal.pos.y){
ctx.save();
ctx.translate(this.goal.pos.x, this.goal.pos.y);
ctx.beginPath();
ctx.arc(0, 0, 10, 0, Math.PI * 2)
ctx.stroke();
ctx.beginPath();
ctx.rotate(theta / 3);
let r = Math.cos(theta) * 10;
for(let i = 0;i < 3;i++){
ctx.rotate(Math.PI * 2 / 3);
ctx.moveTo(60 + r, 0);
ctx.lineTo(120 + r, -20);
ctx.lineTo(100 + r, 0);
ctx.lineTo(120 + r, 20);
ctx.closePath();
}
ctx.stroke();
ctx.restore();
}
}
setSelf(self){
this.self = self;
}
setSend(sender){
this.send = sender;
}
//ideas: https://github.com/cabaletta/baritone/blob/master/USAGE.md
/**Current Commands
* path
* stop
* goal
* <goal/goto> x [Number: x position]
* <goal/goto> y [Number: y position]
* <goal/goto> [x: Number] [y: Number]
* waypoint set [name: String]
* waypoint del [name: String]
* waypoint goto [name: String]
* follow player <[ID/Name: Any]/all(default)>
* follow animal <[ID/Name: Any]/all(default)>
* wander
**Planned Commands
* multigoal [wp1: String] ...
* find [id: Number]
* find [name: String] [owner(optional): Number]
*/
abort(){
this.goal.pathing = false;
}
updateChat(txt, ownerID){
//handle commands here
if(ownerID != this.self.sid){
return;
}
if(args[0] == "path"){
//start pathfinding(assuming there is a goal)
if(this.goal.type){
this.goal.pathing = true;
this.pathfinder.clearPath();
console.log('ez')
}
}else if(args[0] == "stop"){
if(this.goal.pathing){
this.goal.pathing = false;
this.pathfinder.clearPath();
this.send("33", null);
}
}else if(args[0] == "goal" || args[0] == "goto"){
if(isNaN(parseInt(args[1]))){
if(args[1] == "x"){
let pos = parseInt(args[2]);
if(pos >= 0 && pos <= 14400){
this.goal.pathing = args[0] == "goto";
this.goal.type = "xpos";
this.goal.pos.x = pos;
}
}else if(args[1] == "y"){
let pos = parseInt(args[2]);
if(pos >= 0 && pos <= 14400){
this.goal.pathing = args[0] == "goto";
this.goal.type = "ypos";
this.goal.pos.y = pos;
}
}else if(args[0] == "goal" && !args[1]){
this.goal.type = "pos";
this.goal.pos.x = this.self.x;
this.goal.pos.y = this.self.y;
}
}else{
let xPos = parseInt(args[1]);
let yPos = parseInt(args[2]);
if(xPos >= 0 && xPos <= 14400 && yPos >= 0 && yPos <= 14400){
this.goal.pathing = args[0] == "goto";
this.goal.type = "pos";
this.goal.pos.x = xPos;
this.goal.pos.y = yPos;
}
}
}else if(args[0] == "thisway" || args[0] == "project"){
let amt = parseInt(args[1]);
let dir = parseFloat(args[2]) || this.self.dir;
if(!isNaN(amt) && this.self.x && this.self.y && this.self.dir){
this.goal.type = "pos";
this.goal.pos.x = Math.max(0, Math.min(14400, this.self.x +
Math.cos(dir) * amt));
this.goal.pos.y = Math.max(0, Math.min(14400, this.self.y +
Math.sin(dir) * amt));
}
}else if(args[0] == "follow" || args[0] == "flw"){
if(args[1] == "player" || args[1] == "ply"){
this.goal.pathing = true;
this.goal.type = "player";
if(args[2]){
this.goal.entity = args.slice(2).join(" ");
}else{
this.goal.entity = -1;
}
}else if(args[1] == "team"){
//follow team
this.goal.pathing = true;
this.goal.type = "team";
}else if(args[1] == "animal"){
this.goal.pathing = true;
this.goal.type = "animal";
if(args[2]){
this.goal.entity = args[2];
}else{
this.goal.entity = -1;
}
}
}else if(args[0] == "find" || args[0] == "fnd"){
}else if(args[0] == "waypoint" || args[0] == "wp"){
if(args[1] == "set"){
if(Boolean(args[2]) && !this.waypoints[args[2]]){
this.waypoints[args[2]] = {
x: this.self.x,
y: this.self.y,
}
}
}else if(args[1] == "del"){
//waypoint del [name: String]
delete this.waypoints[args[2]];
}else if(args[1] == "goto"){
//waypoint goto [name: String]
if(this.waypoints[args[2]]?.x && this.waypoints[args[2]]?.y){
this.goal.pathing = true;
this.goal.type = "pos";
this.goal.pos.x = this.waypoints[args[2]].x;
this.goal.pos.y = this.waypoints[args[2]].y;
}
}
}else if(args[0] == "wander" || args[0] == "wnd"){
this.goal.pathing = true;
this.goal.type = "wander";
this.goal.pos.x = Math.random() * 14400;
this.goal.pos.y = Math.random() * 14400;
}
}
//determines if we are Syncing goal
reachedGoal(){
if(this.goal.type == "xpos"){
return Math.abs(this.self.x - this.goal.pos.x) <
this.pathfinder.estimatedSpeed;
}else if(this.goal.type == "ypos"){
return Math.abs(this.self.y - this.goal.pos.y) <
this.pathfinder.estimatedSpeed;
}else if(this.goal.type == "pos" || this.goal.type == "wander"){
return Math.hypot(this.self.x - this.goal.pos.x, this.self.y -
this.goal.pos.y) < this.pathfinder.estimatedSpeed;
}
}
async updatePlayers(players){
if(this.goal.pathing){
let finalGoal;
if(this.goal.type == "xpos"){
//go towards x position
finalGoal = [];
for(let i = -this.pathfinder.size; i <= this.pathfinder.size; i++){
finalGoal.push({
x: this.goal.pos.x,
y: this.self.y + i * this.pathfinder.res,
})
}
}else if(this.goal.type == "ypos"){
//go towards y position
finalGoal = [];
for(let i = -this.pathfinder.size; i <= this.pathfinder.size;i +=
3){
finalGoal.push({
x: this.self.x + i * this.pathfinder.res,
y: this.goal.pos.y,
})
}
}else if(this.goal.type == "pos" || this.goal.type == "wander"){
//simple go towards position
finalGoal = {
x: this.goal.pos.x,
y: this.goal.pos.y,
};
}else if(this.goal.type == "player"){
//do pathfinding for following player
if(this.goal.entity === -1){
finalGoal = [];
for(let player of players){
if(player.visible && player.sid != this.self.sid){
finalGoal.push(player)
}
}
if(!finalGoal.length){
finalGoal = null;
}
}else{
for(let player of players){
if(player.visible && player.sid != this.self.sid &&
(player.sid == this.goal.entity || player.name == this.goal.entity)){
finalGoal = player;
break;
}
}
}
}else if(this.goal.type == "team"){
//follow teammates
finalGoal = [];
for(let player of players){
if(player.team == this.self.team && player.sid !=
this.self.sid){
finalGoal.push(player)
}
}
if(!finalGoal.length || !this.self.team){
finalGoal = null;
}
}
if(finalGoal){
if(this.reachedGoal()){
if(this.goal.type == "wander"){
this.goal.pos.x = Math.random() * 14400;
this.goal.pos.y = Math.random() * 14400;
}else{
this.goal.pathing = false;
}
this.pathfinder.clearPath();
this.send("33", null);
}else{
let path = await Pathfinder.pathTo(finalGoal);
if(path){
this.send("33", path.ang);
}else{
this.send("33", null);
}
}
}
}
}
async updateAnimals(animals){
if(this.goal.type == "animal" && this.goal.pathing){
let finalGoal;
if(this.goal.entity === -1){
finalGoal = [];
for(let animal of animals){
if(animal.visible && animal.sid != this.self.sid){
finalGoal.push(animal)
}
}
if(!finalGoal.length){
finalGoal = null;
}
}else{
for(let animal of animals){
if(animal.visible && (animal.sid == this.goal.entity ||
animal.name == this.goal.entity)){
finalGoal = animal;
break;
}
}
}
if(this.reachedGoal()){
this.pathfinder.clearPath();
this.goal.pathing = false;
this.send("33", null);
}else if(finalGoal){
let path = await this.pathfinder.pathTo(finalGoal);
if(path){
this.send("33", path.ang);
}else{
this.send("33", null);
}
}
}
}
async addBuilding(obj){
await new Promise((resolve) => {
let id = setInterval(() => {
if(!this.pathfinder.resolve){
resolve();
clearInterval(id);
}
})
})
let path = this.pathfinder.getPath();
let dist = path?.dist + this.pathfinder.estimatedSpeed /
this.pathfinder.res + 3;
dist = Math.min(this.pathfinder.prevPath.length - 1, Math.trunc(dist));
if(dist){
for(let i = dist; i >= 0; i--){
let point = this.pathfinder.prevPath[i];
if(Math.hypot(point.x - obj.x, point.y - obj.y) < obj.scale + 30){
this.pathfinder.prevPath = this.pathfinder.prevPath.slice(i);
break;
}
}
}
}
}
var Tach = new Tachyon(Pathfinder);
let nameColor = "#7F7FFF";
let enemyNameColor = "#7F7FFF";
let reloadBarColor = "#7F7FFF";
let healthBarColor = "#7F7FFF";
let shameBarColor = "#7F7FFF";
let enemyHealthBarColor = "#7F7FFF";
let damageTextColor = "#7F7FFF";
let healTextColor = "#7F7FFF";
let myObjectHealth = "#7F7FFF";
let enemyObjectHealth = "#7F7FFF";
let autoPushLine = "#7F7FFF";
document.addEventListener("keydown", function(event) {
if (event.keyCode === 9) {
const chatHolder = document.getElementById("menuChatDiv");
if (chatHolder) {
const currentDisplay = chatHolder.style.display;
chatHolder.style.display = currentDisplay === "none" ? "block" :
"none";
}
}
});
document.addEventListener("keydown", function(event) {
if (event.keyCode === 192) {
const chatHolder = document.getElementById("gameUI");
if (chatHolder) {
const currentDisplay = chatHolder.style.display;
chatHolder.style.display = currentDisplay === "none" ? "block" :
"none";
}
}
});
document.addEventListener("keydown", function(event) {
if (event.keyCode === 99) {
const chatHolder = document.getElementById("gameCanvas");
if (chatHolder) {
const currentDisplay = chatHolder.style.display;
chatHolder.style.display = currentDisplay === "none" ? "block" :
"none";
}
}
});
function getRandomRGBColor() {
const r = Math.floor(Math.random() * 256);
const g = Math.floor(Math.random() * 256);
const b = Math.floor(Math.random() * 256);
return `rgb(${r}, ${g}, ${b})`;
}
function getRandomBrightRGBColor() {
const r = Math.floor(Math.random() * 128) + 128; // Red component (between 128
and 255)
const g = Math.floor(Math.random() * 128) + 128; // grey component (between 128
and 255)
const b = Math.floor(Math.random() * 128) + 128; // red component (between 128
and 255)
return `rgb(${r}, ${g}, ${b})`;
}
function getRandomRainbowishColor() {
const hue = Math.floor(Math.random() * 360); // Random hue between 0 and 360
(for the entire color spectrum)
const saturation = '100%'; // Full saturation for vibrant colors
const lightness = '50%'; // Balanced lightness
return `hsl(${hue}, ${saturation}, ${lightness})`;
}
setInterval(() => window.follmoo && follmoo(), 10);
window.location.native_resolution = true;
var autoreloadloop;
var autoreloadenough = 0;
autoreloadloop = setInterval(function() {
if (autoreloadenough < 200) {
if (document.getElementById("loadingText").innerHTML == `disconnected<a
href="javascript:window.location.href=window.location.href"
class="ytLink">reload</a>`) {
document.title = "Reloading";
clearInterval(autoreloadloop);
setTimeout(function() { document.title = "Moo Moo"; }, 1000)
location.reload();
}
autoreloadenough++;
}
else if (autoreloadenough >= 300) {
clearInterval(autoreloadloop);
document.title = "Reloaded";
setTimeout(function() { document.title = "Moo Moo"; }, 1000)
}
}, 50);
let useHack = true;
let log = console.log;
let testMode = window.location.hostname == "127.0.0.1";
let imueheua = false;
let circleScale = 1.5
let namechanger = false;
let inantiantibull = false;
let spin = {
degree: 45,
toggle: false,
angle: 0
}
function getRandomRGBColor() {
const r = Math.floor(Math.random() * 256);
const g = Math.floor(Math.random() * 256);
const b = Math.floor(Math.random() * 256);
return `rgb(${r}, ${g}, ${b})`;
}
add(code) {
if (!this.element) return undefined;
this.element.innerHTML += code;
};
newLine(amount) {
let result = `<br>`;
if (amount > 0) {
result = ``;
for (let i = 0; i < amount; i++) {
result += `<br>`;
}
}
this.add(result);
};
checkBox(setting) {
let newCheck = `<input type="checkbox"`;
setting.id && (newCheck += ` id="${setting.id}"`);
setting.style && (newCheck += ` style="${setting.style}"`);
setting.class && (newCheck += ` class="${setting.class}"`);
setting.checked && (newCheck += ` checked`);
setting.onclick && (newCheck += ` onclick="${setting.onclick}"`);
newCheck += `>`;
this.add(newCheck);
};
text(setting) {
let newText = `<input type="text"`;
setting.id && (newText += ` id="${setting.id}"`);
setting.style && (newText += ` style="${setting.style}"`);
setting.class && (newText += ` class="${setting.class}"`);
setting.size && (newText += ` size="${setting.size}"`);
setting.maxLength && (newText += ` maxLength="${setting.maxLength}"`);
setting.value && (newText += ` value="${setting.value}"`);
setting.placeHolder && (newText += ` placeHolder="$
{setting.placeHolder.replace(/\s/g, " ")}"`);
newText += ` style="background-color: grey;">`;
this.add(newText);
}
select(setting) {
let newSelect = `<select`;
setting.id && (newSelect += ` id="${setting.id}"`);
setting.style && (newSelect += ` style="${setting.style}"`);
setting.class && (newSelect += ` class="${setting.class}"`);
newSelect += ` style="background-color: #00ffff; color: #000; padding: 10px;
cursor: pointer;">`;
newSelect += `</select>`;
this.add(newSelect);
}
button(setting) {
let newButton = `<div`; // Buton yerine bir <div> elementi kullanıyoruz
setting.id && (newButton += ` id="${setting.id}"`);
setting.class && (newButton += ` class="${setting.class}"`);
setting.onclick && (newButton += ` onclick="${setting.onclick}"`);
newButton += ` style="background-color: #00ffff; color: #000; padding: 10px;
cursor: pointer;">`;
setting.innerHTML && (newButton += setting.innerHTML);
newButton += `</div>`; // <div> elementini kapatıyoruz
this.add(newButton);
}
selectMenu(setting) {
let newSelect = `<select`;
if (!setting.id) {
alert("Please provide an id.");
return;
}
window[setting.id + "Func"] = function () { };
setting.id && (newSelect += ` id="${setting.id}"`);
setting.style && (newSelect += ` style="${setting.style}"`);
setting.class && (newSelect += ` class="${setting.class}"`);
newSelect += ` onchange="window.${setting.id + "Func"}()"`;
newSelect += `>`;
let last;
let i = 0;
for (let options in setting.menu) {
newSelect += `<option value="${"option_" + options}" id="${"O_" +
options}"`;
setting.menu[options] && (newSelect += ` checked`);
newSelect += ` style="color: ${setting.menu[options] ? "#000" : ""};
background: ${setting.menu[options] ? "#8ecc51" : ""};">${options}</option>`;
i++;
}
newSelect += `</select>`;
this.add(newSelect);
i = 0;
for (let options in setting.menu) {
window[options + "Func"] = function () {
setting.menu[options] = getEl("check_" + options).checked ? true :
false;
saveVal(options, setting.menu[options]);
getEl("O_" + options).style.color = setting.menu[options] ?
"#000" : "";
getEl("O_" + options).style.background = setting.menu[options] ?
"#8ecc51" : "";
};
this.checkBox({
id: "check_" + options,
style: `display: ${i == 0 ? "inline-block" : "none"}; background-
color: lightcoral;`,
class: "checkB",
onclick: `window.${options + "Func"}()`,
checked: setting.menu[options]
});
i++;
}
last = "check_" + getEl(setting.id).value.split("_")[1];
window[setting.id + "Func"] = function () {
getEl(last).style.display = "none";
last = "check_" + getEl(setting.id).value.split("_")[1];
getEl(last).style.display = "inline-block";
getEl(setting.id).style.color = setting.menu[last.split("_")[1]] ?
"#8ecc51" : "";
};
};
};
class Html {
constructor() {
this.element = null;
this.action = null;
this.divElement = null;
this.startDiv = function(setting, func) {
let newDiv = document.createElement("div");
setting.id && (newDiv.id = setting.id);
setting.style && (newDiv.style = setting.style);
setting.class && (newDiv.className = setting.class);
this.element.appendChild(newDiv);
this.divElement = newDiv;
let addRes = new HtmlAction(newDiv);
typeof func == "function" && func(addRes);
};
this.addDiv = function(setting, func) {
let newDiv = document.createElement("div");
setting.id && (newDiv.id = setting.id);
setting.style && (newDiv.style = setting.style);
setting.class && (newDiv.className = setting.class);
setting.appendID &&
getEl(setting.appendID).appendChild(newDiv);
this.divElement = newDiv;
let addRes = new HtmlAction(newDiv);
typeof func == "function" && func(addRes);
};
};
set(id) {
this.element = getEl(id);
this.action = new HtmlAction(this.element);
};
resetHTML(text) {
if (text) {
this.element.innerHTML = ``;
} else {
this.element.innerHTML = ``;
}
};
setStyle(style) {
this.element.style = style;
};
setCSS(style) {
this.action.add(`<style>` + style + `</style>`);
};
};
let HTML = new Html();
.menuB {
text-align: center;
background-color: rgb(25, 25, 25);
color: #00ffff;
border-radius: 4px;
border: 2px solid #000;
cursor: pointer;
margin-bottom: 5px;
opacity: 0.9
}
.menuC {
display: none;
font-family: "Hammersmith One";
font-size: 12px;
max-height: 180px;
overflow-y: auto;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: rgba(0, 0, 0, 0.0);
border-radius: 6px;
margin-bottom: 5px;
opacity: 0.9
}
.menuB:hover {
border: 2px solid #00ffff;
}
.menuB:active {
color: rgb(25, 25, 25);
background-color: rgb(200, 200, 200);
}
.customText {
color: #000;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
border: 2px solid #000;
}
.customText:focus {
background-color: yellow;
}
.checkB {
position: relative;
top: 2px;
accent-color: #888;
cursor: pointer;
}
.Cselect {
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background-color: rgb(75, 75, 75);
color: #00ffff;
border: 1px solid #000;
}
#menuChanger {
position: absolute;
right: 10px;
top: 10px;
background-color: rgba(0, 0, 0, 0);
color: #00ffff;
border: none;
cursor: pointer;
}
#menuChanger:hover {
color: #000;
}
::-webkit-scrollbar {
width: 0; /* Skryje vertikální scrollbar na WebKit prohlížečích */
}
`);
HTML.startDiv({ id: "menuHeadLine", class: "menuClass" }, (html) => {
html.add(`<span style="font-size: 40%;">Mod Set Menu:</span>`);
html.button({ id: "menuChanger", class: "material-icons", innerHTML: `sync`,
onclick: "window.changeMenu()" });
HTML.addDiv({ id: "menuButtons", style: "display: block; overflow-y: visible;",
class: "menuC", appendID: "menuHeadLine" }, (html) => {
function addChatLog(e, c, d, v) {
HTML.set("menuChatDiv");
let chatLogs = document.getElementById("mChMain");
const now = new Date();
const hours = now.getHours();
const minutes = now.getMinutes();
const ampm = hours >= 12 ? 'PM' : 'AM';
const formattedHours = (hours % 12 || 12).toString();
const formattedMinutes = minutes.toString().padStart(2, '0');
let time = `${formattedHours}:${formattedMinutes} ${ampm}`;
let a = document.createElement('div');
a.className = 'chatEntry';
chatLogs.appendChild(a);
chatLogs.scrollTop = chatLogs.scrollHeight;
}
let menuIndex = 0;
let menus = ["menuMain", "menuConfig", "menuOther"];
window.changeMenu = function() {
getEl(menus[menuIndex % menus.length]).style.display = "none";
menuIndex++;
getEl(menus[menuIndex % menus.length]).style.display = "block";
};
let mStatus = document.createElement("div");
mStatus.id = "status";
getEl("gameUI").appendChild(mStatus);
HTML.set("status");
HTML.setStyle(`
display: block;
position: absolute;
color: #ddd;
font: 15px Hammersmith One;
bottom: 215px;
left: 20px;
`);
HTML.resetHTML();
HTML.setCSS(`
.sizing {
font-size: 15px;
}
.mod {
font-size: 15px;
display: inline-block;
}
`);
HTML.startDiv({ id: "uehmod", class: "sizing" }, (html) => {
html.add(`Ping: `);
HTML.addDiv({ id: "pingFps", class: "mod", appendID: "uehmod" },
(html) => {
html.add("None");
});
html.newLine();
html.add(`Packet: `);
HTML.addDiv({ id: "packetStatus", class: "mod", appendID:
"uehmod" }, (html) => {
html.add("None");
});
});
/*function modLog() {
let logs = [];
for (let i = 0; i < arguments.length; i++) {
logs.push(arguments[i]);
}
getEl("modLog").innerHTML = logs;
}*/
let openMenu = false;
let WS = undefined;
let socketID = undefined;
let useWasd = false;
let secPacket = 0;
let secMax = 110;
let secTime = 1000;
let firstSend = {
sec: false
};
let game = {
tick: 0,
tickQueue: [],
tickBase: function(set, tick) {
if (this.tickQueue[this.tick + tick]) {
this.tickQueue[this.tick + tick].push(set);
} else {
this.tickQueue[this.tick + tick] = [set];
}
},
tickRate: (1000 / config.serverUpdateRate),
tickSpeed: 0,
lastTick: performance.now()
};
let modConsole = [];
let dontSend = false;
let fpsTimer = {
last: 0,
time: 0,
ltime: 0
}
let lastMoveDir = undefined;
let lastsp = ["cc", 1, "__proto__"];
WebSocket.prototype.nsend = WebSocket.prototype.send;
WebSocket.prototype.send = function(message) {
if (!WS) {
WS = this;
WS.addEventListener("message", function(msg) {
getMessage(msg);
});
WS.addEventListener("close", (event) => {
if (event.code == 4001) {
window.location.reload();
}
});
}
if (WS == this) {
dontSend = false;
// EXTRACT DATA ARRAY:
let data = new Uint8Array(message);
let parsed = window.msgpack.decode(data);
let type = parsed[0];
data = parsed[1];
// SEND MESSAGE:
if (type == "6") {
if (data[0]) {
// ANTI PROFANITY:
let profanity = [/*"cunt", "whore", "fuck", "shit",
"faggot", "nigger", "nigga", "dick", "vagina", "minge", "cock", "rape", "cum",
"sex", "tits", "penis", "clit", "pussy", "meatcurtain", "jizz", "prune", "douche",
"wanker", "damn", "bitch", "dick", "fag", "bastard", */];
let tmpString;
profanity.forEach((profany) => {
if (data[0].indexOf(profany) > -1) {
tmpString = "";
for (let i = 0; i < profany.length; ++i) {
if (i == 1) {
tmpString += String.fromCharCode(0);
}
tmpString += profany[i];
}
let re = new RegExp(profany, "g");
data[0] = data[0].replace(re, tmpString);
}
});
data[0] = data[0].slice(0, 30);
}
} else if (type == "L") {
data[0] = data[0] + (String.fromCharCode(0).repeat(7));
data[0] = data[0].slice(0, 7);
} else if (type == "M") {
data[0].name = data[0].name == "" ? "unknown" :
data[0].name;
data[0].moofoll = true;
data[0].skin = data[0].skin == 10 ? "__proto__" :
data[0].skin;
lastsp = [data[0].name, data[0].moofoll, data[0].skin];
} else if (type == "D") {
if ((my.lastDir == data[0]) || [null,
undefined].includes(data[0])) {
dontSend = true;
} else {
my.lastDir = data[0];
}
} else if (type == "d") {
if (!data[2]) {
dontSend = true;
} else {
if (![null, undefined].includes(data[1])) {
my.lastDir = data[1];
}
}
} else if (type == "K") {
if (!data[1]) {
dontSend = true;
}
} else if (type == "14") {
instaC.wait = !instaC.wait;
dontSend = true;
} else if (type == "a") {
if (data[1]) {
if (player.moveDir == data[0]) {
dontSend = true;
}
player.moveDir = data[0];
} else {
dontSend = true;
}
}
if (!dontSend) {
let binary = window.msgpack.encode([type, data]);
this.nsend(binary);
// START COUNT:
if (!firstSend.sec) {
firstSend.sec = true;
setTimeout(() => {
firstSend.sec = false;
secPacket = 0;
}, secTime);
}
secPacket++;
}
} else {
this.nsend(message);
}
}
function packet(type) {
// EXTRACT DATA ARRAY:
let data = Array.prototype.slice.call(arguments, 1);
// SEND MESSAGE:
let binary = window.msgpack.encode([type, data]);
WS.send(binary);
}
function origPacket(type) {
// EXTRACT DATA ARRAY:
let data = Array.prototype.slice.call(arguments, 1);
// SEND MESSAGE:
let binary = window.msgpack.encode([type, data]);
WS.nsend(binary);
}
window.leave = function() {
origPacket("kys", {
"frvr is so bad": true,
"sidney is too good": true,
"dev are too weak": true,
});
};
let io = {
send: packet
};
function getMessage(message) {
let data = new Uint8Array(message.data);
let parsed = window.msgpack.decode(data);
let type = parsed[0];
data = parsed[1];
let events = {
A: setInitData,
C: setupGame,
D: addPlayer,
E: removePlayer,
a: updatePlayers,
G: updateLeaderboard,
H: loadGameObject,
I: loadAI,
J: animateAI,
K: gatherAnimation,
L: wiggleGameObject,
M: shootTurret,
N: updatePlayerValue,
O: updateHealth,
P: killPlayer,
Q: killObject,
R: killObjects,
S: updateItemCounts,
T: updateAge,
U: updateUpgrades,
V: updateItems,
X: addProjectile,
Y: remProjectile,
2: allianceNotification,
3: setPlayerTeam,
4: setAlliancePlayers,
5: updateStoreItems,
6: receiveChat,
7: updateMinimap,
8: showText,
9: pingMap,
};
if (type == "io-init") {
socketID = data[0];
} else {
if (events[type]) {
events[type].apply(undefined, data);
}
}
}
Math.lerpAngle = function(value1, value2, amount) {
let difference = Math.abs(value2 - value1);
if (difference > Math.PI) {
if (value1 > value2) {
value2 += Math.PI * 2;
} else {
value1 += Math.PI * 2;
}
}
let value = value2 + ((value1 - value2) * amount);
if (value >= 0 && value <= Math.PI * 2) return value;
return value % (Math.PI * 2);
};
// REOUNDED RECTANGLE:
CanvasRenderingContext2D.prototype.roundRect = function(x, y, w, h, r)
{
if (w < 2 * r) r = w / 2;
if (h < 2 * r) r = h / 2;
if (r < 0)
r = 0;
this.beginPath();
this.moveTo(x + r, y);
this.arcTo(x + w, y, x + w, y + h, r);
this.arcTo(x + w, y + h, x, y + h, r);
this.arcTo(x, y + h, x, y, r);
this.arcTo(x, y, x + w, y, r);
this.closePath();
return this;
};
let allChats = [];
let ais = [];
let players = [];
let alliances = [];
let alliancePlayers = [];
let allianceNotifications = [];
let gameObjects = [];
let projectiles = [];
let deadPlayers = [];
let breakObjects = [];
let player;
let playerSID;
let tmpObj;
let enemy = [];
let Syncs = [];
let Sync = [];
let my = {
reloaded: false,
waitHit: 0,
autoAim: false,
revAim: false,
ageInsta: true,
reSync: true,
bullTick: 0,
anti0Tick: 0,
antiSync: true,
safePrimary: function(tmpObj) {
return [0, 8].includes(tmpObj.primaryIndex);
},
safeSecondary: function(tmpObj) {
return [10, 11, 14].includes(tmpObj.secondaryIndex);
},
lastDir: 0,
autoPush: false,
pushData: {}
}
function findID(tmpObj, tmp) {
return tmpObj.find((THIS) => THIS.id == tmp);
}
function findSID(tmpObj, tmp) {
return tmpObj.find((THIS) => THIS.sid == tmp);
}
function findPlayerByID(id) {
return findID(players, id);
}
function findPlayerBySID(sid) {
return findSID(players, sid);
}
function findAIBySID(sid) {
return findSID(ais, sid);
}
function findObjectBySid(sid) {
return findSID(gameObjects, sid);
}
function findProjectileBySid(sid) {
return findSID(gameObjects, sid);
}
let gameName = getEl("gameName");
let adCard = getEl("adCard");
let promoImageHolder = getEl("promoImgHolder");
promoImageHolder.remove();
let chatButton = getEl("chatButton");
chatButton.remove();
let gameCanvas = getEl("gameCanvas");
let mainContext = gameCanvas.getContext("2d");
let mapDisplay = getEl("mapDisplay");
let mapContext = mapDisplay.getContext("2d");
mapDisplay.width = 300;
mapDisplay.height = 300;
let storeMenu = getEl("storeMenu");
let storeHolder = getEl("storeHolder");
let upgradeHolder = getEl("upgradeHolder");
let upgradeCounter = getEl("upgradeCounter");
let chatBox = getEl("chatBox");
chatBox.autocomplete = "off";
chatBox.style.textAlign = "center";
chatBox.style.width = "18em";
let chatHolder = getEl("chatHolder");
let actionBar = getEl("actionBar");
let leaderboardData = getEl("leaderboardData");
let itemInfoHolder = getEl("itemInfoHolder");
let menuCardHolder = getEl("menuCardHolder");
let mainMenu = getEl("mainMenu");
let diedText = getEl("diedText");
let screenWidth;
let screenHeight;
let maxScreenWidth = config.maxScreenWidth;
let maxScreenHeight = config.maxScreenHeight;
let pixelDensity = 1;
let delta;
let now;
let lastUpdate = performance.now();
let camX;
let camY;
let tmpDir;
let mouseX = 0;
let mouseY = 0;
let allianceMenu = getEl("allianceMenu");
let waterMult = 1;
let waterPlus = 0;
let outlineColor = "#525252";
let darkOutlineColor = "#3d3f42";
let outlineWidth = 5.5;
let isNight = false;
let firstSetup = true;
let keys = {};
let moveKeys = {
87: [0, -1],
38: [0, -1],
83: [0, 1],
40: [0, 1],
65: [-1, 0],
37: [-1, 0],
68: [1, 0],
39: [1, 0],
};
function resetMoveDir() {
keys = {};
io.send("e");
}
let attackState = 0;
let inGame = false;
let macro = {};
let mills = {
place: 0,
placeSpawnPads: 0
};
let lastDir;
let lastLeaderboardData = [];
// ON LOAD:
let inWindow = true;
window.onblur = function() {
inWindow = false;
};
window.onfocus = function() {
inWindow = true;
if (player && player.alive) {
resetMoveDir();
}
};
let placeVisible = [];
let profanityList = [/*"cunt", "whore", "fuck", "shit", "faggot",
"nigger",
"nigga", "dick", "vagina", "minge", "cock",
"rape", "cum", "sex",
"tits", "penis", "clit", "pussy", "meatcurtain",
"jizz", "prune",
"douche", "wanker", "damn", "bitch", "dick",
"fag", "bastard"*/];
/** CLASS CODES */
class Utils {
constructor() {
// MATH UTILS:
let mathABS = Math.abs,
mathCOS = Math.cos,
mathSIN = Math.sin,
mathPOW = Math.pow,
mathSQRT = Math.sqrt,
mathATAN2 = Math.atan2,
mathPI = Math.PI;
let _this = this;
// GLOBAL UTILS:
this.round = function(n, v) {
return Math.round(n * v) / v;
};
this.toRad = function(angle) {
return angle * (mathPI / 180);
};
this.toAng = function(radian) {
return radian / (mathPI / 180);
};
this.randInt = function(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
};
this.randFloat = function(min, max) {
return Math.random() * (max - min + 1) + min;
};
this.lerp = function(value1, value2, amount) {
return value1 + (value2 - value1) * amount;
};
this.decel = function(val, cel) {
if (val > 0)
val = Math.max(0, val - cel);
else if (val < 0)
val = Math.min(0, val + cel);
return val;
};
this.getDistance = function(x1, y1, x2, y2) {
return mathSQRT((x2 -= x1) * x2 + (y2 -= y1) * y2);
};
this.getDist = function(tmp1, tmp2, type1, type2) {
let tmpXY1 = {
x: type1 == 0 ? tmp1.x : type1 == 1 ? tmp1.x1 : type1
== 2 ? tmp1.x2 : type1 == 3 && tmp1.x3,
y: type1 == 0 ? tmp1.y : type1 == 1 ? tmp1.y1 : type1
== 2 ? tmp1.y2 : type1 == 3 && tmp1.y3,
};
let tmpXY2 = {
x: type2 == 0 ? tmp2.x : type2 == 1 ? tmp2.x1 : type2
== 2 ? tmp2.x2 : type2 == 3 && tmp2.x3,
y: type2 == 0 ? tmp2.y : type2 == 1 ? tmp2.y1 : type2
== 2 ? tmp2.y2 : type2 == 3 && tmp2.y3,
};
return mathSQRT((tmpXY2.x -= tmpXY1.x) * tmpXY2.x +
(tmpXY2.y -= tmpXY1.y) * tmpXY2.y);
};
this.getDirection = function(x1, y1, x2, y2) {
return mathATAN2(y1 - y2, x1 - x2);
};
this.getDirect = function(tmp1, tmp2, type1, type2) {
let tmpXY1 = {
x: type1 == 0 ? tmp1.x : type1 == 1 ? tmp1.x1 : type1
== 2 ? tmp1.x2 : type1 == 3 && tmp1.x3,
y: type1 == 0 ? tmp1.y : type1 == 1 ? tmp1.y1 : type1
== 2 ? tmp1.y2 : type1 == 3 && tmp1.y3,
};
let tmpXY2 = {
x: type2 == 0 ? tmp2.x : type2 == 1 ? tmp2.x1 : type2
== 2 ? tmp2.x2 : type2 == 3 && tmp2.x3,
y: type2 == 0 ? tmp2.y : type2 == 1 ? tmp2.y1 : type2
== 2 ? tmp2.y2 : type2 == 3 && tmp2.y3,
};
return mathATAN2(tmpXY1.y - tmpXY2.y, tmpXY1.x - tmpXY2.x);
};
this.getAngleDist = function(a, b) {
let p = mathABS(b - a) % (mathPI * 2);
return (p > mathPI ? (mathPI * 2) - p : p);
};
this.isNumber = function(n) {
return (typeof n == "number" && !isNaN(n) && isFinite(n));
};
this.isString = function(s) {
return (s && typeof s == "string");
};
this.kFormat = function(num) {
return num > 999 ? (num / 1000).toFixed(1) + "k" : num;
};
this.sFormat = function(num) {
let fixs = [
{ num: 1e3, string: "k" },
{ num: 1e6, string: "m" },
{ num: 1e9, string: "b" },
{ num: 1e12, string: "q" }
].reverse();
let sp = fixs.find(v => num >= v.num);
if (!sp) return num;
return (num / sp.num).toFixed(1) + sp.string;
};
this.capitalizeFirst = function(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
};
this.fixTo = function(n, v) {
return parseFloat(n.toFixed(v));
};
this.sortByPoints = function(a, b) {
return parseFloat(b.points) - parseFloat(a.points);
};
this.lineInRect = function(recX, recY, recX2, recY2, x1, y1,
x2, y2) {
let minX = x1;
let maxX = x2;
if (x1 > x2) {
minX = x2;
maxX = x1;
}
if (maxX > recX2)
maxX = recX2;
if (minX < recX)
minX = recX;
if (minX > maxX)
return false;
let minY = y1;
let maxY = y2;
let dx = x2 - x1;
if (Math.abs(dx) > 0.0000001) {
let a = (y2 - y1) / dx;
let b = y1 - a * x1;
minY = a * minX + b;
maxY = a * maxX + b;
}
if (minY > maxY) {
let tmp = maxY;
maxY = minY;
minY = tmp;
}
if (maxY > recY2)
maxY = recY2;
if (minY < recY)
minY = recY;
if (minY > maxY)
return false;
return true;
};
this.containsPoint = function(element, x, y) {
let bounds = element.getBoundingClientRect();
let left = bounds.left + window.scrollX;
let top = bounds.top + window.scrollY;
let width = bounds.width;
let height = bounds.height;
let insideHorizontal = x > left && x < left + width;
let insideVertical = y > top && y < top + height;
return insideHorizontal && insideVertical;
};
this.mousifyTouchEvent = function(event) {
let touch = event.changedTouches[0];
event.screenX = touch.screenX;
event.screenY = touch.screenY;
event.clientX = touch.clientX;
event.clientY = touch.clientY;
event.pageX = touch.pageX;
event.pageY = touch.pageY;
};
this.hookTouchEvents = function(element, skipPrevent) {
let preventDefault = !skipPrevent;
let isHovering = false;
// let passive = window.Modernizr.passiveeventlisteners ?
{passive: true} : false;
let passive = false;
element.addEventListener("touchstart",
this.checkTrusted(touchStart), passive);
element.addEventListener("touchmove",
this.checkTrusted(touchMove), passive);
element.addEventListener("touchend",
this.checkTrusted(touchEnd), passive);
element.addEventListener("touchcancel",
this.checkTrusted(touchEnd), passive);
element.addEventListener("touchleave",
this.checkTrusted(touchEnd), passive);
function touchStart(e) {
_this.mousifyTouchEvent(e);
window.setUsingTouch(true);
if (preventDefault) {
e.preventDefault();
e.stopPropagation();
}
if (element.onmouseover)
element.onmouseover(e);
isHovering = true;
}
function touchMove(e) {
_this.mousifyTouchEvent(e);
window.setUsingTouch(true);
if (preventDefault) {
e.preventDefault();
e.stopPropagation();
}
if (_this.containsPoint(element, e.pageX, e.pageY)) {
if (!isHovering) {
if (element.onmouseover)
element.onmouseover(e);
isHovering = true;
}
} else {
if (isHovering) {
if (element.onmouseout)
element.onmouseout(e);
isHovering = false;
}
}
}
function touchEnd(e) {
_this.mousifyTouchEvent(e);
window.setUsingTouch(true);
if (preventDefault) {
e.preventDefault();
e.stopPropagation();
}
if (isHovering) {
if (element.onclick)
element.onclick(e);
if (element.onmouseout)
element.onmouseout(e);
isHovering = false;
}
}
};
this.removeAllChildren = function(element) {
while (element.hasChildNodes()) {
element.removeChild(element.lastChild);
}
};
this.generateElement = function(config) {
let element = document.createElement(config.tag || "div");
function bind(configValue, elementValue) {
if (config[configValue])
element[elementValue] = config[configValue];
}
bind("text", "textContent");
bind("html", "innerHTML");
bind("class", "className");
for (let key in config) {
switch (key) {
case "tag":
case "text":
case "html":
case "class":
case "style":
case "hookTouch":
case "parent":
case "children":
continue;
default:
break;
}
element[key] = config[key];
}
if (element.onclick)
element.onclick = this.checkTrusted(element.onclick);
if (element.onmouseover)
element.onmouseover =
this.checkTrusted(element.onmouseover);
if (element.onmouseout)
element.onmouseout =
this.checkTrusted(element.onmouseout);
if (config.style) {
element.style.cssText = config.style;
}
if (config.hookTouch) {
this.hookTouchEvents(element);
}
if (config.parent) {
config.parent.appendChild(element);
}
if (config.children) {
for (let i = 0; i < config.children.length; i++) {
element.appendChild(config.children[i]);
}
}
return element;
};
this.checkTrusted = function(callback) {
return function(ev) {
if (ev && ev instanceof Event && (ev && typeof
ev.isTrusted == "boolean" ? ev.isTrusted : true)) {
callback(ev);
} else {
//console.error("Event is not trusted.", ev);
}
};
};
this.randomString = function(length) {
let text = "";
let possible =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (let i = 0; i < length; i++) {
text += possible.charAt(Math.floor(Math.random() *
possible.length));
}
return text;
};
this.countInArray = function(array, val) {
let count = 0;
for (let i = 0; i < array.length; i++) {
if (array[i] === val) count++;
}
return count;
};
this.hexToRgb = function(hex) {
return hex.slice(1).match(/.{1,2}/g).map(g => parseInt(g,
16));
};
this.getRgb = function(r, g, b) {
return [r / 255, g / 255, b / 255].join(", ");
};
}
};
class Animtext {
constructor() {
this.init = function(x, y, scale, speed, life, text, color) {
this.x = x;
this.y = y;
this.color = color;
this.scale = scale;
this.startScale = this.scale;
this.maxScale = scale * 1.5;
this.scaleSpeed = 0.7;
this.speed = speed;
this.life = life;
this.text = text;
this.acc = 1;
this.alpha = 0;
this.maxLife = life;
this.ranX = UTILS.randFloat(-1, 1);
};
// UPDATE:
this.update = function(delta) {
if (this.life) {
this.life -= delta;
if (config.anotherVisual) {
this.y -= this.speed * delta * this.acc;
this.acc -= delta / (this.maxLife / 2.5);
if (this.life <= 200) {
if (this.alpha > 0) {
this.alpha = Math.max(0, this.alpha -
(delta / 300));
}
} else {
if (this.alpha < 1) {
this.alpha = Math.min(1, this.alpha +
(delta / 100));
}
}
this.x += this.ranX;
} else {
this.y -= this.speed * delta;
}
this.scale += this.scaleSpeed * delta;
if (this.scale >= this.maxScale) {
this.scale = this.maxScale;
this.scaleSpeed *= -1;
} else if (this.scale <= this.startScale) {
this.scale = this.startScale;
this.scaleSpeed = 0;
}
if (this.life <= 0) {
this.life = 0;
}
}
};
this.render = function(ctxt, xOff, yOff) {
ctxt.lineWidth = 10;
ctxt.fillStyle = this.color;
ctxt.font = this.scale + "px " + (config.anotherVisual ?
"Hammersmith One" : "Ubuntu");
if (config.anotherVisual) {
ctxt.globalAlpha = this.alpha;
ctxt.strokeStyle = darkOutlineColor;
ctxt.strokeText(this.text, this.x - xOff, this.y -
yOff);
}
ctxt.fillText(this.text, this.x - xOff, this.y - yOff);
ctxt.globalAlpha = 1;
};
}
};
class Textmanager {
constructor() {
this.texts = [];
this.stack = [];
this.update = function(delta, ctxt, xOff, yOff) {
ctxt.textBaseline = "middle";
ctxt.textAlign = "center";
for (let i = 0; i < this.texts.length; ++i) {
if (this.texts[i].life) {
this.texts[i].update(delta);
this.texts[i].render(ctxt, xOff, yOff);
}
}
};
this.showText = function(x, y, scale, speed, life, text, color)
{
let tmpText;
for (let i = 0; i < this.texts.length; ++i) {
if (!this.texts[i].life) {
tmpText = this.texts[i];
break;
}
}
if (!tmpText) {
tmpText = new Animtext();
this.texts.push(tmpText);
}
tmpText.init(x, y, scale, speed, life, text, color);
};
}
}
class GameObject {
constructor(sid) {
this.sid = sid;
this.init = function(x, y, dir, scale, type, data, owner) {
data = data || {};
this.sentTo = {};
this.gridLocations = [];
this.active = true;
this.alive = true;
this.doUpdate = data.doUpdate;
this.x = x;
this.y = y;
if (config.anotherVisual) {
this.dir = dir + Math.PI;
} else {
this.dir = dir;
}
this.lastDir = dir;
this.xWiggle = 0;
this.yWiggle = 0;
this.visScale = scale;
this.scale = scale;
this.type = type;
this.id = data.id;
this.owner = owner;
this.name = data.name;
this.isItem = (this.id != undefined);
this.group = data.group;
this.maxHealth = data.health;
this.health = this.maxHealth;
this.healthMov = (this.group != undefined && this.group.layer == 4) ? 0 : 300;
this.layer = (this.group != undefined) ? this.group.layer : ((this.type == 0) ? 3 :
((this.type == 2) ? 0 : ((this.type == 4) ? -1 : 2)));
if (this.name === "Clown Hat") {
this.isItem = false;
this.healthMov = 300;
}
this.colDiv = data.colDiv || 1;
this.blocker = data.blocker;
this.ignoreCollision = data.ignoreCollision;
this.dontGather = data.dontGather;
this.hideFromEnemy = data.hideFromEnemy;
this.friction = data.friction;
this.projDmg = data.projDmg;
this.dmg = data.dmg;
this.pDmg = data.pDmg;
this.pps = data.pps;
this.zIndex = data.zIndex || 0;
this.turnSpeed = data.turnSpeed;
this.req = data.req;
this.trap = data.trap;
this.healCol = data.healCol;
this.teleport = data.teleport;
this.boostSpeed = data.boostSpeed;
this.projectile = data.projectile;
this.shootRange = data.shootRange;
this.shootRate = data.shootRate;
this.shootCount = this.shootRate;
this.spawnPoint = data.spawnPoint;
this.onSync = null;
this.breakObj = false;
this.alpha = data.alpha || 1;
this.maxAlpha = data.alpha || 1;
this.damaged = 0;
};
this.changeHealth = function(amount, doer) {
this.health += amount;
return (this.health <= 0);
};
this.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);
};
this.visibleToPlayer = function(player) {
return !(this.hideFromEnemy) || (this.owner && (this.owner
== player ||
if (damageTakenFromSpecificItems) {
spamQKey();
}
}
function spamQKey() {
for (let i = 0; i < 5; i++) {
simulateKeyPress('Q');
}
}
function simulateKeyPress(key) {
console.log(key + " tuşuna basılıyor");
}
this.update = function(delta) {
if (this.alive) {
if (this.health != this.healthMov) {
this.health < this.healthMov ? (this.healthMov -= 300) :
(this.healthMov += 300);
if (Math.abs(this.health - this.healthMov) < 300) this.healthMov =
this.health;
}
if (this.shameCount != this.shameMov) {
this.shameCount < this.shameMov ? (this.shameMov -= 0.1) :
(this.shameMov += 0.1);
if (Math.abs(this.shameCount - this.shameMov) < 0.1) this.shameMov =
this.shameCount;
}
}
if (this.sid == playerSID) {
this.circleRad = parseInt(getEl("circleRad").value) || 0;
this.circleRadSpd = parseFloat(getEl("radSpeed").value) || 0;
this.cAngle += this.circleRadSpd;
}
let gear = {
skin: findID(hats, this.skinIndex),
tail: findID(accessories, this.tailIndex)
}
let spdMult = ((this.buildIndex >= 0) ? 0.5 : 1) *
(items.weapons[this.weaponIndex].spdMult || 1) * (gear.skin ? (gear.skin.spdMult ||
1) : 1) * (gear.tail ? (gear.tail.spdMult || 1) : 1) * (this.y <=
config.snowBiomeTop ? ((gear.skin && gear.skin.coldM) ? 1 : config.snowSpeed) : 1)
* this.slowMult;
if ((this.health - this.healthMov) >= 10 && gear.skin && gear.skin.name === "Bull
Helmet") {
const soldierHelmet = findID(hats, "Soldier Helmet");
if (soldierHelmet) {
this.skinIndex = soldierHelmet.id;
}
} else {
if (!(gear.skin && gear.skin.name === "Bull Helmet")) {
this.maxSpeed = spdMult;
}
}
//* [@id="upgradeItem7"] = daggers
//* [@id="upgradeItem6"] = bat
//* [@id="upgradeItem5"] = polearm
//* [@id="upgradeItem3"] = short sword
//* [@id="upgradeItem4"] = katana
//* [@id="upgradeItem10"] = hammer
//* [@id="upgradeItem12"] = crassbow
//* [@id="upgradeItem31"] = trap
//* [@id="upgradeItem32"] = boost
//* [@id="upgradeItem25"] = spinning spikes
let vurusSayaci = 0;
let topluOyuncuSayaci = 0;
const opponentUpgradeItem = document.querySelector('#upgradeItem5') ||
document.querySelector('#upgradeItem3') || document.querySelector('#upgradeItem15')
|| document.querySelector('#upgradeItem13');
if (opponentUpgradeItem &&
(opponentUpgradeItem.id === 'upgradeItem3' || opponentUpgradeItem.id ===
'upgradeItem5' || opponentUpgradeItem.id === 'upgradeItem10') &&
(this.maxHealth < this.health)) {
vurusSayaci++;
if (vurusSayaci >= 2) {
const artisSuresi = 1 * 60 * 1000;
this.healthRegen *= 5;
setTimeout(() => {
this.healthRegen /= 5;
vurusSayaci = 0;
topluOyuncuSayaci = 0;
}, artisSuresi);
}
}
if (opponentUpgradeItem &&
(opponentUpgradeItem.id === 'upgradeItem3' || opponentUpgradeItem.id ===
'upgradeItem5' || opponentUpgradeItem.id === 'upgradeItem32' ||
opponentUpgradeItem.id === 'upgradeItem10' || opponentUpgradeItem.id ===
'upgradeItem6' )) {
topluOyuncuSayaci++;
if (topluOyuncuSayaci > 1) {
this.healthRegen *= 6;
setTimeout(() => {
this.healthRegen /= 6;
}, 1 * 60 * 1000);
}
}
const upgradeItem32 = document.querySelector('#upgradeItem32');
if (upgradeItem32) {
this.healthRegen *= 20;
const intervalId = setInterval(() => {
if (this.maxHealth >= this.health) {
this.healthRegen /= 20;
clearInterval(intervalId);
}
}, 1);
}
const upgradeItem4 = document.querySelector('#upgradeItem4');
const upgradeItem25 = document.querySelector('#upgradeItem25');
if (upgradeItem4 && upgradeItem25) {
if (this.maxHealth < this.health) {
this.healthRegen *= 10;
const intervalId = setInterval(() => {
if (this.maxHealth >= this.health) {
this.healthRegen /= 5;
clearInterval(intervalId);
}
}, 1);
}
const upgradeItem7 = document.querySelector('#upgradeItem7');
if (upgradeItem7) {
const slowDownInterval = setInterval(() => {
if (this.maxHealth < this.health) {
this.healthRegen /= 2;
} else {
this.healthRegen *= 2;
clearInterval(slowDownInterval);
}
}, 1);
}
}
};
let tmpRatio = 0;
let animIndex = 0;
this.animate = function(delta) {
if (this.animTime > 0) {
this.animTime -= delta;
if (this.animTime <= 0) {
this.animTime = 0;
this.dirPlus = 0;
tmpRatio = 0;
animIndex = 0;
} else {
if (animIndex == 0) {
tmpRatio += delta / (this.animSpeed *
config.hitReturnRatio);
this.dirPlus = UTILS.lerp(0, this.targetAngle,
Math.min(1, tmpRatio));
if (tmpRatio >= 1) {
tmpRatio = 1;
animIndex = 1;
}
} else {
tmpRatio -= delta / (this.animSpeed * (1 -
config.hitReturnRatio));
this.dirPlus = UTILS.lerp(0, this.targetAngle,
Math.max(0, tmpRatio));
}
}
}
};
// GATHER ANIMATION:
this.startAnim = function(didHit, index) {
this.animTime = this.animSpeed =
items.weapons[index].speed;
this.targetAngle = (didHit ? -config.hitAngle : -Math.PI);
tmpRatio = 0;
animIndex = 0;
};
// CAN SEE:
this.canSee = function(other) {
if (!other) return false;
let dx = Math.abs(other.x - this.x) - other.scale;
let dy = Math.abs(other.y - this.y) - other.scale;
return dx <= (config.maxScreenWidth / 2) * 1.3 && dy <=
(config.maxScreenHeight / 2) * 1.3;
};
// SHAME SYSTEM:
this.judgeShame = function() {
if (this.oldHealth < this.health) {
if (this.hitTime) {
let timeSinceHit = Date.now() - this.hitTime;
this.lastHit = game.tick;
this.hitTime = 0;
if (timeSinceHit < 120) {
this.shameCount++;
} else {
this.shameCount = Math.max(0, this.shameCount -
2);
}
}
} else if (this.oldHealth > this.health) {
this.hitTime = Date.now();
}
};
this.addShameTimer = function() {
this.shameCount = 0;
this.shameTimer = 30;
let interval = setInterval(() => {
this.shameTimer--;
if (this.shameTimer <= 0) {
clearInterval(interval);
}
}, 1000);
};
this.isTeam = function(tmpObj) {
return (this == tmpObj || (this.team && this.team ==
tmpObj.team));
};
this.findAllianceBySid = function(sid) {
return this.team ? alliancePlayers.find((THIS) => THIS ===
sid) : null;
};
this.checkCanInsta = function(nobull) {
let totally = 0;
if (this.alive && inGame) {
let primary = {
weapon: this.weapons[0],
variant: this.primaryVariant,
dmg: this.weapons[0] == undefined ? 0 :
items.weapons[this.weapons[0]].dmg,
};
let secondary = {
weapon: this.weapons[1],
variant: this.secondaryVariant,
dmg: this.weapons[1] == undefined ? 0 :
items.weapons[this.weapons[1]].Pdmg,
};
let bull = this.skins[7] && !nobull ? 1.5 : 1;
let pV = primary.variant != undefined ?
config.weaponVariants[primary.variant].val : 1;
if (primary.weapon != undefined &&
this.reloads[primary.weapon] == 0) {
totally += primary.dmg * pV * bull;
}
if (secondary.weapon != undefined &&
this.reloads[secondary.weapon] == 0) {
totally += secondary.dmg;
}
if (this.skins[53] && this.reloads[53] <=
(player.weapons[1] == 10 ? 0 : game.tickRate) && Sync.skinIndex != 22) {
totally += 25;
}
totally *= Sync.skinIndex == 0 ? 0 : 1;
return totally;
}
return 0;
};
// UPDATE WEAPON RELOAD:
this.manageReload = function() {
if (this.shooting[53]) {
this.shooting[53] = 0;
this.reloads[53] = (2500 - game.tickRate);
} else {
if (this.reloads[53] > 0) {
this.reloads[53] = Math.max(0, this.reloads[53] -
game.tickRate);
}
}
if (this.gathering || this.shooting[1]) {
if (this.gathering) {
this.gathering = 0;
this.reloads[this.gatherIndex] =
(items.weapons[this.gatherIndex].speed * (this.skinIndex == 20 ? 0.78 : 1));
this.attacked = true;
}
if (this.shooting[1]) {
this.shooting[1] = 0;
this.reloads[this.shootIndex] =
(items.weapons[this.shootIndex].speed * (this.skinIndex == 20 ? 0.78 : 1));
this.attacked = true;
}
} else {
this.attacked = false;
if (this.buildIndex < 0) {
if (this.reloads[this.weaponIndex] > 0) {
this.reloads[this.weaponIndex] = Math.max(0,
this.reloads[this.weaponIndex] - game.tickRate);
if (this == player) {
if (getEl("weaponGrind").checked) {
for (let i = 0; i < Math.PI * 2; i +=
Math.PI / 2) {
checkPlace(player.getItemType(22),
i);
}
}
}
if (this.reloads[this.primaryIndex] == 0 &&
this.reloads[this.weaponIndex] == 0) {
this.antiBull++;
game.tickBase(() => {
this.antiBull = 0;
}, 1);
}
}
}
}
};
this.addDamageThreat = function(tmpObj) {
let primary = {
weapon: this.primaryIndex,
variant: this.primaryVariant
};
primary.dmg = primary.weapon == undefined ? 45 :
items.weapons[primary.weapon].dmg;
let secondary = {
weapon: this.secondaryIndex,
variant: this.secondaryVariant
};
secondary.dmg = secondary.weapon == undefined ? 50 :
items.weapons[secondary.weapon].Pdmg;
let bull = 1.5;
let pV = primary.variant != undefined ?
config.weaponVariants[primary.variant].val : 1.18;
let sV = secondary.variant != undefined ? [9, 12, 13,
15].includes(secondary.weapon) ? 1 : config.weaponVariants[secondary.variant].val :
1.18;
if (primary.weapon == undefined ? true :
this.reloads[primary.weapon] == 0) {
this.damageThreat += primary.dmg * pV * bull;
}
if (secondary.weapon == undefined ? true :
this.reloads[secondary.weapon] == 0) {
this.damageThreat += secondary.dmg * sV;
}
if (this.reloads[53] <= game.tickRate) {
this.damageThreat += 25;
}
this.damageThreat *= tmpObj.skinIndex == 6 ? 0.75 : 1;
if (!this.isTeam(tmpObj)) {
if (this.dist2 <= 300) {
tmpObj.damageThreat += this.damageThreat;
}
}
};
}
};
function sendUpgrade(index) {
player.reloads[index] = 0;
packet("H", index);
}
function storeEquip(id, index) {
packet("c", 0, id, index);
}
function storeBuy(id, index) {
packet("c", 1, id, index);
}
function buyEquip(id, index) {
let nID = player.skins[6] ? 6 : 0;
if (player.alive && inGame) {
if (index == 0) {
if (player.skins[id]) {
if (player.latestSkin != id) {
packet("c", 0, id, 0);
}
} else {
if (configs.autoBuyEquip) {
let find = findID(hats, id);
if (find) {
if (player.points >= find.price) {
//setTimeout(()=>{
packet("c", 1, id, 0);
//setTimeout(()=>{
packet("c", 0, id, 0);
//}, 120);
//}, 120);
} else {
if (player.latestSkin != nID) {
packet("c", 0, nID, 0);
}
}
} else {
if (player.latestSkin != nID) {
packet("c", 0, nID, 0);
}
}
} else {
if (player.latestSkin != nID) {
packet("c", 0, nID, 0);
}
}
}
} else if (index == 1) {
if (useWasd && (id != 11 && id != 0)) {
if (player.latestTail != 0) {
packet("c", 0, 0, 1);
}
return;
}
if (player.tails[id]) {
if (player.latestTail != id) {
packet("c", 0, id, 1);
}
} else {
if (configs.autoBuyEquip) {
let find = findID(accessories, id);
if (find) {
if (player.points >= find.price) {
packet("c", 1, id, 1);
// setTimeout(()=>{
packet("c", 0, id, 1);
//}, 120);
} else {
if (player.latestTail != 0) {
packet("c", 0, 0, 1);
}
}
} else {
if (player.latestTail != 0) {
packet("c", 0, 0, 1);
}
}
} else {
if (player.latestTail != 0) {
packet("c", 0, 0, 1);
}
}
}
}
}
}
function selectToBuild(index, wpn) {
packet("G", index, wpn);
}
function selectWeapon(index, isPlace) {
if (!isPlace) {
player.weaponCode = index;
}
packet("G", index, 1);
}
function sendAutoGather() {
packet("K", 1, 1);
}
function sendAtck(id, angle) {
packet("d", id, angle, 1);
}
function toRadian(angle) {
let fixedAngle = (angle % 360) * (Math.PI / 180);
return fixedAngle < 0 ? (2 * Math.PI + fixedAngle) : fixedAngle;
}
function place(id, rad, rmd) {
try {
if (id == undefined) return;
let item = items.list[player.items[id]];
let tmpS = player.scale + item.scale + (item.placeOffset || 0);
let tmpX = player.x2 + tmpS * Math.cos(rad);
let tmpY = player.y2 + tmpS * Math.sin(rad);
if (id === 0 || testMode || (player.alive && inGame &&
player.itemCounts[item.group.id] == undefined ? true :
player.itemCounts[item.group.id] < (config.isSandbox ? id === 3 || id === 5 ? 299 :
99 : item.group.limit ? item.group.limit : 99))) {
selectToBuild(player.items[id]);
sendAtck(1, rad);
selectWeapon(player.weaponCode, 1);
if (rmd && getEl("placeVis").checked) {
placeVisible.push({
x: tmpX,
y: tmpY,
name: item.name,
scale: item.scale,
dir: rad
});
game.tickBase(() => {
placeVisible.shift();
}, 1)
}
}
} catch (e) { }
}
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;
}
}
// GET DIRECTION
function getDir(e, t) {
try {
return Math.atan2((t.y2 || t.y) - (e.y2 || e.y), (t.x2 || t.x)
- (e.x2 || e.x));
} catch (e) {
return 0;
}
}
if (
!
placedSpikePositions.has(JSON.stringify(position)) &&
isPositionValid(position) &&
distToPlayer <= 87
) {
const angleToPlace = Math.atan2(position[1]
- player.y2, position[0] - player.x2);
checkPlace(2, angleToPlace);
placedSpikePositions.add(JSON.stringify(position));
}
}
} else if (!trap1 && Sync.dist2 <= 206) {
placedSpikePositions.clear();
const maxTrapsToPlace = 3;
const trapRadius = 50;
const trapPositions =
calculatePossibleTrapPositions(player.x2, player.y2, trapRadius);
let trapsPlaced = 0;
placedTrapPositions.add(JSON.stringify(position));
trapsPlaced++;
}
}
}
} catch (e) {}
};
function calculatePerfectAngle(x1, y1, x2, y2) {
return Math.atan2(y2 - y1, x2 - x1);
}
function isObjectBroken(object) {
const healthThreshold = 20;
return object.health < healthThreshold;
}
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 ((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]);
}
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: Sync.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) {
return lastDir;
} else {
if (!player)
return 0;
return lastDir || 0;
}
}
function getVisualDir() {
if (!player)
return 0;
return lastDir || 0;
}
if (game.tick % 3 == 0) {
if (mills.place) {
let plcAng = 1.25;
for (let i = -plcAng; i <= plcAng; i += plcAng) {
checkPlace(3, UTILS.getDirect(player.oldPos,
player, 2, 2) + i);
}
} else {
if (mills.placeSpawnPads) {
for (let i = 0; i < Math.PI * 2; i += Math.PI /
2) {
checkPlace(
player.getItemType(20),
UTILS.getDirect(player.oldPos, player,
2, 2) + i
);
}
}
}
}
if (instaC.can) {
instaC.changeType("rev");
}
if (instaC.canCounter) {
instaC.canCounter = false;
if (player.reloads[player.weapons[0]] == 0 && !
instaC.isTrue) {
instaC.counterType();
}
}
if (instaC.canSpikeTick) {
instaC.canSpikeTick = false;
if (instaC.revTick) {
instaC.revTick = false;
if (
[1, 2, 3, 4, 5, 6].includes(player.weapons[0])
&&
player.reloads[player.weapons[1]] == 0 &&
!instaC.isTrue
) {
instaC.changeType("rev");
}
} else {
if (
[1, 2, 3, 4, 5, 6].includes(player.weapons[0])
&&
player.reloads[player.weapons[0]] == 0 &&
!instaC.isTrue
) {
instaC.spikeTickType();
if (instaC.syncHit) {
// Add your logic for syncHit here if
needed
}
}
}
}
let turretEmp = 0;
let inbullspam = false;
let waitTicks = [];
let anti0Tick = 0;
let syncCount = 0;
let doEmpAntiInsta = false;
let plagueCount = 0;
//idk plague mask thingy
if (document.getElementById("bullspam").checked) {
function changeHat(value) {
io.send('6', "!Plague Mask ");
if (anti0Tick > 0) {
buyEquip(6, 0);
} else {
buyEquip(plagueCount ? 7 : 21, 0);
if (player.reloads[player.weapons[0]] == 0) {
if (turretEmp > 0 || doEmpAntiInsta) {
buyEquip(26, 0);
} else {
buyEquip(6, 0);
}
}
}
}
}
if (!clicks.middle && (clicks.left || clicks.right) && !
instaC.isTrue) {
if ((player.weaponIndex != (clicks.right &&
player.weapons[1] == 10 ? player.weapons[1] : player.weapons[0])) ||
player.buildIndex > -1) {
selectWeapon(clicks.right && player.weapons[1] ==
10 ? player.weapons[1] : player.weapons[0]);
}
if (player.reloads[clicks.right && player.weapons[1] ==
10 ? player.weapons[1] : player.weapons[0]] == 0 && !my.waitHit) {
sendAutoGather();
my.waitHit = 1;
game.tickBase(() => {
sendAutoGather();
my.waitHit = 0;
}, 1);
}
}
if (useWasd && !clicks.left && !clicks.right && !
instaC.isTrue && Sync.dist2 <= (items.weapons[player.weapons[0]].range + Sync.scale
* 1.8) && !traps.inTrap) {
if ((player.weaponIndex != player.weapons[0]) ||
player.buildIndex > -1) {
selectWeapon(player.weapons[0]);
}
if (player.reloads[player.weapons[0]] == 0 && !
my.waitHit) {
sendAutoGather();
my.waitHit = 1;
game.tickBase(() => {
sendAutoGather();
my.waitHit = 0;
}, 1);
}
}
if (traps.inTrap) {
if (!clicks.left && !clicks.right && !instaC.isTrue) {
if (player.weaponIndex != (traps.notFast() ?
player.weapons[1] : player.weapons[0]) || player.buildIndex > -1) {
selectWeapon(traps.notFast() ?
player.weapons[1] : player.weapons[0]);
}
if (player.reloads[traps.notFast() ?
player.weapons[1] : player.weapons[0]] == 0 && !my.waitHit) {
sendAutoGather();
my.waitHit = 1;
game.tickBase(() => {
sendAutoGather();
my.waitHit = 0;
}, 1);
}
}
}
if (clicks.middle && !traps.inTrap) {
if (!instaC.isTrue && player.reloads[player.weapons[1]]
== 0) {
if (my.ageInsta && player.weapons[0] != 4 &&
player.weapons[1] == 9 && player.age >= 9 && enemy.length) {
instaC.bowMovement();
} else {
instaC.rangeType();
}
}
}
if (macro.t && !traps.inTrap) {
if (!instaC.isTrue && player.reloads[player.weapons[0]]
== 0 && (player.weapons[1] == 15 ? (player.reloads[player.weapons[1]] == 0) : true)
&& (player.weapons[0] == 5 || (player.weapons[0] == 4 && player.weapons[1] == 15)))
{
instaC[(player.weapons[0] == 4 && player.weapons[1]
== 15) ? "kmTickMovement" : "tickMovement"]();
}
}
if (macro["."] && !traps.inTrap) {
if (!instaC.isTrue && player.reloads[player.weapons[0]]
== 0 && ([9, 12, 13, 15].includes(player.weapons[1]) ?
(player.reloads[player.weapons[1]] == 0) : true)) {
instaC.boostTickMovement();
}
}
if (player.weapons[1] && !clicks.left && !clicks.right && !
traps.inTrap && !instaC.isTrue && !(useWasd && Sync.dist2 <=
items.weapons[player.weapons[0]].range + Sync.scale * 1.8)) {
if (player.reloads[player.weapons[0]] == 0 &&
player.reloads[player.weapons[1]] == 0) {
if (!my.reloaded) {
my.reloaded = true;
let fastSpeed =
items.weapons[player.weapons[0]].spdMult < items.weapons[player.weapons[1]].spdMult
? 1 : 0;
if (player.weaponIndex !=
player.weapons[fastSpeed] || player.buildIndex > -1) {
selectWeapon(player.weapons[fastSpeed]);
}
}
} else {
my.reloaded = false;
if (player.reloads[player.weapons[0]] > 0) {
if (player.weaponIndex != player.weapons[0] ||
player.buildIndex > -1) {
selectWeapon(player.weapons[0]);
}
} else if (player.reloads[player.weapons[0]] == 0
&& player.reloads[player.weapons[1]] > 0) {
if (player.weaponIndex != player.weapons[1] ||
player.buildIndex > -1) {
selectWeapon(player.weapons[1]);
}
}
}
}
if (!instaC.isTrue && !traps.inTrap && !traps.replaced) {
traps.autoPlace();
}
if (!macro.q && !macro.f && !macro.v && !macro.h && !
macro.n) {
packet("D", getAttackDir());
}
let hatChanger = function() {
if (my.anti0Tick > 0) {
buyEquip(6, 0);
} else {
if (clicks.left || clicks.right) {
if ((player.shameCount > 0 && (game.tick -
player.bullTick) % 7 == 0 && player.skinIndex != 45) || my.reSync) {
buyEquip(7, 0);
buyEquip(18, 1);
} else {
if (clicks.left) {
buyEquip(player.reloads[player.weapons[0]] == 0 ? getEl("weaponGrind").checked ? 40
: 7 : player.empAnti ? 6 : player.soldierAnti ? 26 : (getEl("antiBullType").value
== "abreload" && Sync.antiBull > 0) ? 11 : Sync.dist2 <= 300 ?
(getEl("antiBullType").value == "abalway" && Sync.reloads[Sync.primaryIndex] ==
0) ? 11 : 6 : biomeGear(1, 1), 0);
} else if (clicks.right) {
buyEquip(player.reloads[clicks.right &&
player.weapons[1] == 10 ? player.weapons[1] : player.weapons[0]] == 0 ? 40 :
player.empAnti ? 6 : player.soldierAnti ? 26 : (getEl("antiBullType").value ==
"abreload" && Sync.antiBull > 0) ? 11 : Sync.dist2 <= 300 ?
(getEl("antiBullType").value == "abalway" && Sync.reloads[Sync.primaryIndex] ==
0) ? 11 : 6 : biomeGear(1, 1), 0);
}
}
} else if (traps.inTrap) {
if (traps.info.health <=
items.weapons[player.weaponIndex].dmg ? false : (player.reloads[player.weapons[1]
== 10 ? player.weapons[1] : player.weapons[0]] == 0)) {
buyEquip(40, 0);
// Barbarian hat
if (Sync.dist2 > 300 && (!
player.reloads[player.weapons[1] == 10 ? player.weapons[1] : player.weapons[0]] ==
0)) {
buyEquip(26, 0);
}
}
else {
if ((player.shameCount > 0 && (game.tick -
player.bullTick) % config.serverUpdateRate === 0 && player.skinIndex != 45) ||
my.reSync) {
buyEquip(7, 0);
buyEquip(13, 1);
} else {
buyEquip((player.empAnti || Sync.dist2
> 300 || !enemy.length) ? 6 : 26, 0);
}
}
} else {
if (player.empAnti || player.soldierAnti) {
buyEquip(player.empAnti ? 6 : 26, 0);
} else {
if ((player.shameCount > 0 && (game.tick -
player.bullTick) % config.serverUpdateRate === 0 && player.skinIndex != 45) ||
my.reSync) {
buyEquip(7, 0);
buyEquip(13, 1);
} else {
if (Sync.dist2 <= 300) {
objectManager.hitObj = [];
game.tickBase(() => {
tmpObj = findPlayerBySID(sid);
let val = items.weapons[index].dmg *
(config.weaponVariants[tmpObj[(index < 9 ? "prima" : "seconda") +
"ryVariant"]].val) * (items.weapons[index].sDmg || 1) * (tmpObj.skinIndex == 40 ?
3.3 : 1);
tmpObjects.forEach((healthy) => {
healthy.healthMov = healthy.health - val / 2;
healthy.health -= val;
let h, s, l;
let color = (() => {
const randomInt = (min, max) => {
return Math.floor(Math.random() * (max -
min + 1)) + min;
};
h = randomInt(0, 360);
s = randomInt(42, 98);
l = randomInt(40, 90);
})();
function hslToHex(h, s, l) {
l /= 100;
const a = s * Math.min(l, 1 - l) / 100;
const f = n => {
const k = (n + h / 30) % 12;
const color = l - a * Math.max(Math.min(k -
3, 9 - k, 1), -1);
return Math.round(255 *
color).toString(16).padStart(2, '0'); // convert to Hex and prefix "0" if needed
};
return `#${f(0)}${f(8)}${f(4)}`;
}
console.log(hslToHex(h, s, l));
(healthy.x, healthy.y, val, hslToHex(h, s, l));
});
}, 1);
}
}
}
function showDamageText(x, y, value, color) {
textManager.showText(x, y, 30, 0.15, 550, Math.round(value),
color);
}
function wiggleGameObject(dir, sid) {
tmpObj = findObjectBySid(sid);
if (tmpObj) {
tmpObj.xWiggle += config.gatherWiggle * Math.cos(dir);
tmpObj.yWiggle += config.gatherWiggle * Math.sin(dir);
if (tmpObj.health) {
objectManager.hitObj.push(tmpObj);
}
}
}
function shootTurret(sid, dir) {
tmpObj = findObjectBySid(sid);
if (tmpObj) {
if (config.anotherVisual) {
tmpObj.lastDir = dir;
} else {
tmpObj.dir = dir;
}
tmpObj.xWiggle += config.gatherWiggle * Math.cos(dir +
Math.PI);
tmpObj.yWiggle += config.gatherWiggle * Math.sin(dir +
Math.PI);
}
}
function randomizePhrases2() {
const phrases = ['Jaguar Type.'];
return phrases[Math.floor(Math.random() * phrases.length)];
}
function updatePlayerValue(index, value, updateView) {
if (player) {
player[index] = value;
if (index == "points") {
if (configs.autoBuy) {
autoBuy.hat();
autoBuy.acc();
}
} else if (index == "kills") {
if (configs.killChat) {
let killChatMessage = getKillChatMessage(value);
sendChat(killChatMessage);
setTimeout(() => {
sendChat("Auto GG - Jaguar Mod.");
}, 1000);
}
}
}
}
function getKillChatMessage(kills) {
let baseKillCount = Math.floor(kills / 10) * 10;
if (kills <= 1) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 2) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 3) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 4) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 5) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 6) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 7) {
return "Auto GG - Jaguar Mod.";
} else if (kills <= 8) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 9) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 10) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 11) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 12) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 13) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 14) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 15) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 16) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 17) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 18) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 19) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 20) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 21) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 22) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 23) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 24) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 25) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 26) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 27) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 28) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 29) {
return "Auto GG - Jaguar Mod";
} else if (kills <= 30) {
return "Auto GG - Jaguar Mod";
} else {
let additionalInfo = "x" + (Math.floor(kills / 10) - 1);
return
}
}
function updateItems(data, wpn) {
if (data) {
if (wpn) {
player.weapons = data;
player.primaryIndex = player.weapons[0];
player.secondaryIndex = player.weapons[1];
if (!instaC.isTrue) {
selectWeapon(player.weapons[0]);
}
} else {
player.items = data;
}
}
for (let i = 0; i < items.list.length; i++) {
let tmpI = items.weapons.length + i;
getEl("actionBarItem" + tmpI).style.display =
player.items.indexOf(items.list[i].id) >= 0 ? "inline-block" : "none";
}
for (let i = 0; i < items.weapons.length; i++) {
getEl("actionBarItem" + i).style.display =
player.weapons[items.weapons[i].type] == items.weapons[i].id ? "inline-block" :
"none";
}
let kms = player.weapons[0] == 3 && player.weapons[1] == 15;
if (kms) {
getEl("actionBarItem3").style.display = "none";
getEl("actionBarItem4").style.display = "inline-block";
}
}
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));
}
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);
}
}
}
// SHOW ALLIANCE MENU:
function allianceNotification(sid, name) {
let findBotSID = findSID(bots, sid);
if (findBotSID) { }
}
function setPlayerTeam(team, isOwner) {
if (player) {
player.team = team;
player.isOwner = isOwner;
if (team == null)
alliancePlayers = [];
}
}
function setAlliancePlayers(data) {
alliancePlayers = data;
}
function updateStoreItems(type, id, index) {
if (index) {
if (!type)
player.tails[id] = 1;
else {
player.latestTail = id;
}
} else {
if (!type)
player.skins[id] = 1,
id == 7 && (my.reSync = true); // testing perfect
bulltick...
else {
player.latestSkin = id;
}
}
}
function receiveChat(sid, message) {
let tmpPlayer = findPlayerBySID(sid);
let countDown = 0;
let coolDownForAI = false;
addChatLog(message, "#7F7FFF", tmpPlayer.name + "[" + tmpPlayer.sid
+ "]:", tmpPlayer == player || (tmpPlayer.team && tmpPlayer.team == player.team) ?
"#7F7FFF" : "#7F7FFF");
if (document.getElementById("aichatbot").checked && tmpPlayer.sid !
== player.sid && !coolDownForAI) {
countDown++;
coolDownForAI = true;
const msg = tmpPlayer.chatMessage;
const apiUrl =
`https://lollo.andorrturtle.repl.co/get_response`;
console.log(apiUrl);
request.setRequestHeader('Content-Type', 'application/json');
request.onreadystatechange = function () {
if (request.readyState == 4 && request.status == 200) {
const data = JSON.parse(request.responseText);
let ai_response = data.cnt;
var responseParts = [];
var lololol = 5000; // İlk zaman aşımı değerini 5000 milisaniye (5 saniye) olarak
ayarlayın
// TAIL/CAPE:
renderTail2(13, ctxt, obj);
items.projectiles[items.weapons[obj.weaponIndex].projectile], mainContext);
}
}
// HANDS:
ctxt.fillStyle = "#7F7FFF";
renderCircle(obj.scale * Math.cos(handAngle), (obj.scale *
Math.sin(handAngle)), 14);
renderCircle((obj.scale * oHandDist) * Math.cos(-handAngle *
oHandAngle),
(obj.scale * oHandDist) * Math.sin(-handAngle *
oHandAngle), 14);
items.projectiles[items.weapons[obj.weaponIndex].projectile], mainContext);
}
}
// 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) {
renderTail(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);
renderSkin(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 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:
let accessSprites = {};
let accessPointers = {};
function renderTail(index, ctxt, owner) {
tmpSkin = accessSprites[index];
if (!tmpSkin) {
let tmpImage = new Image();
tmpImage.onload = function() {
this.isLoaded = true;
this.onload = null;
};
tmpImage.src = "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();
}
}
// RENDER NORMAL TAIL
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 = {};
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 = "#7F7FFF";
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 = 15;
let tmpCanvas = document.createElement("canvas");
tmpCanvas.width = tmpCanvas.height = (obj.scale * 2.1) +
outlineWidth;
let tmpContext = tmpCanvas.getContext('2d');
tmpContext.translate((tmpCanvas.width / 2), (tmpCanvas.height /
2));
tmpContext.rotate(UTILS.randFloat(0, Math.PI));
tmpContext.strokeStyle = outlineColor;
tmpContext.lineWidth = outlineWidth;
if (isNight) {
tmpContext.shadowBlur = blurScale;
tmpContext.shadowColor = `rgba(0, 0, 0, ${obj.alpha})`;
}
if (obj.type == 0) {
let tmpScale;
let tmpCount = UTILS.randInt(5, 7);
tmpContext.globalAlpha = isNight ? 0.6 : 0.8;
for (let i = 0; i < 2; ++i) {
tmpScale = tmpObj.scale * (!i?1:0.5);
renderStar(tmpContext, tmpCount, tmpScale, tmpScale *
0.7);
tmpContext.fillStyle = !biomeID?(!
i?"#7F7FFF":"#7F7FFF"):(!i?"#7F7FFF":"#7F7FFF");
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 = "#7F7FFF";
renderStar(tmpContext, 6, obj.scale * 0.3, obj.scale *
0.71);
tmpContext.fill();
tmpContext.stroke();
//tmpContext.shadowBlur = null;
//tmpContext.shadowColor = null;
tmpContext.fillStyle = "#7F7FFF";
renderCircle(0, 0, obj.scale * 0.55, tmpContext);
tmpContext.fillStyle = "#7F7FFF";
renderCircle(0, 0, obj.scale * 0.3, tmpContext, true);
} else {
renderBlob(tmpContext, 6, tmpObj.scale, tmpObj.scale *
0.7);
tmpContext.fillStyle = biomeID?"#7F7FFF":"#7F7FFF";
tmpContext.fill();
tmpContext.stroke();
//tmpContext.shadowBlur = null;
//tmpContext.shadowColor = null;
tmpContext.fillStyle = biomeID?"#7F7FFF":"#7F7FFF";
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?"#7F7FFF":"#7F7FFF"):"#7F7FFF";
renderStar(tmpContext, 3, obj.scale, obj.scale);
tmpContext.fill();
tmpContext.stroke();
tmpContext.shadowBlur = null;
tmpContext.shadowColor = null;
tmpContext.fillStyle = (obj.type==2)?
(biomeID==2?"#7F7FFF":"#7F7FFF"):"#7F7FFF";
renderStar(tmpContext, 3, obj.scale * 0.55, obj.scale *
0.65);
tmpContext.fill();
}
tmpSprite = tmpCanvas;
gameObjectSprites[tmpIndex] = tmpSprite;
}
return tmpSprite;
}
function hexToRgb(hex) {
return hex.slice(1).match(/.{1,2}/g).map(g =>
parseInt(g, 16));
}
function getRgb(r, g, b) {
return [r / 255, g / 255, b / 255].join(", ");
}
maxScreenHeight));
}
/* function markObject(tmpObj, tmpX, tmpY) {
getMarkSprite(tmpObj, mainContext, tmpX, tmpY);
}*/
function markObject(tmpObj, tmpX, tmpY) {
yen(mainContext, tmpX, tmpY);
}
function yen(context, x, y) {
context.fillStyle = "rgba(0, 255, 255, 0.2)";
context.beginPath();
context.arc(x, y, 55, 0, Math.PI * 2); // Adjust the circle size
context.fill();
context.closePath();
context.globalAlpha = 1;
}
// 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("#00ffff", 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 = "#00ffff";
if (breakTrackers.length) {
mapContext.fillStyle = "#abcdef";
mapContext.font = "Otp Jaguar.";
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 = "#00ffff";
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 = "#782F44";
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 = "Otp Jaguar.";
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 = "#00ffff";
mapContext.font = "Otp Jaguar.";
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://www.google.com/url?sa=i&url=https%3A%2F
%2Fen.m.wikipedia.org%2Fwiki%2FFile
%3ACrosshairs_Red.svg&psig=AOvVaw0RDyLxZiYkZNB07EGOinJl&ust=1700405758186000&source
=images&cd=vfe&opi=89978449&ved=0CBIQjRxqFwoTCICW5ZrnzYIDFQAAAAAdAAAAABAE",
"https://www.google.com/url?sa=i&url=https%3A%2F
%2Fen.m.wikipedia.org%2Fwiki%2FFile
%3ACrosshairs_Red.svg&psig=AOvVaw0RDyLxZiYkZNB07EGOinJl&ust=1700405758186000&source
=images&cd=vfe&opi=89978449&ved=0CBIQjRxqFwoTCICW5ZrnzYIDFQAAAAAdAAAAABAE"
];
if (player) {
let targetCamX = player.x + ((1920 / 2) / 30);
let targetCamY = player.y + ((1920 / 2) / 30);
camX += (targetCamX - camX) * damping;
camY += (targetCamY - camY) * damping;
} else {
camX = config.mapScale / 2;
camY = config.mapScale / 2;
}
// ...
mainContext.fillStyle = "white";
mainContext.font = "bold 12px Arial";
mainContext.save();
mainContext.translate(midX, midY);
const dx = tmpObj.x - player.x;
const dy = tmpObj.y - player.y;
const angle = Math.atan2(dy, dx);
mainContext.rotate(angle - Math.PI /
2);
mainContext.rotate(-Math.PI / 2);
mainContext.fillText(playerName, 0, 0);
mainContext.restore();
mainContext.shadowColor =
"transparent";
mainContext.shadowBlur = 1;
}
}
if (isNight) {
if (tmpObj === player && tmpObj.team ===
player.team && tmpObj.enemy === player.enemy) {
mainContext.beginPath();
mainContext.lineWidth =
maxScreenWidth / 640;
var startAngle = 0;
var endAngle = Math.PI * 2;
mainContext.arc(player.x - xOffset,
player.y - yOffset, items.weapons[player.weaponIndex].range, startAngle, endAngle);
mainContext.strokeStyle = "rgba(0, 0,
0, 1)"; // Průsvitně černý obrys, intenzita 0.5
mainContext.fillStyle = "rgba(0, 0, 0,
0)"; // Průsvitně černá barva, úplně průhledná
// 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:
const healthBarColor = isNight
? (tmpObj == player || (tmpObj.team &&
tmpObj.team == player.team))
? "rgba(142, 204, 81, 0.6)"
: "rgba(204, 81, 81, 0.6)"
: (tmpObj == player || (tmpObj.team &&
tmpObj.team == player.team))
? "rgba(142, 204, 81, 1)"// Adjust day mode
color for player/team
: "rgba(204, 81, 81, 1)"; // Adjust day mode
color for enemy
mainContext.fillStyle = healthBarColor;
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 (isNight) {
// Reload bars for the player
if (tmpObj.isPlayer && tmpObj.sid ===
player.sid) {
mainContext.globalAlpha = 1;
if (getEl("visualType").value == "") {
let reloads = {
primary: (tmpObj.primaryIndex
== undefined ? 1 : ((items.weapons[tmpObj.primaryIndex].speed -
tmpObj.reloads[tmpObj.primaryIndex]) / items.weapons[tmpObj.primaryIndex].speed)),
secondary:
(tmpObj.secondaryIndex == undefined ? 1 :
((items.weapons[tmpObj.secondaryIndex].speed -
tmpObj.reloads[tmpObj.secondaryIndex]) /
items.weapons[tmpObj.secondaryIndex].speed)),
turret: (2500 -
tmpObj.reloads[53]) / 2500
};
(config.healthBarWidth * (tmpObj.reloads[tmpObj.primaryIndex] /
items.weapons[tmpObj.primaryIndex].speed)), 17 - config.healthBarPad * 2, 7);
mainContext.fill();
}
mainContext.fillStyle = "rgba(95,
158, 160, 1)";
if (tmpObj.secondaryIndex ==
undefined ? false : (tmpObj.reloads[tmpObj.secondaryIndex] > 0)) {
// SECONDARY RELOAD BAR:
mainContext.roundRect(tmpObj.x
- xOffset + (config.healthBarWidth * ((items.weapons[tmpObj.secondaryIndex].speed -
tmpObj.reloads[tmpObj.secondaryIndex]) /
items.weapons[tmpObj.secondaryIndex].speed)),
(tmpObj.y
- yOffset + tmpObj.scale) + config.nameY + config.healthBarPad,
(config.healthBarWidth * (tmpObj.reloads[tmpObj.secondaryIndex] /
items.weapons[tmpObj.secondaryIndex].speed)), 17 - config.healthBarPad * 2, 7);
mainContext.fill();
}
if (tmpObj == player) {
// UNDER TEXT:
mainContext.globalAlpha = 1;
mainContext.font = "20px Hammersmith
One";
mainContext.fillStyle = "#00ffff";
mainContext.strokeStyle =
darkOutlineColor;
mainContext.textBaseline = "middle";
mainContext.textAlign = "center";
mainContext.lineWidth = 8;
mainContext.lineJoin = "round";
let text = [];
if (tmpObj == player) {
if (getEl("visualType").value ==
"ueh1") {
text = [tmpObj.oldSkinIndex,
tmpObj.skinIndex];
mainContext.strokeText("[" +
text.join(",") + "]", tmpObj.x - xOffset, tmpObj.y - yOffset + tmpObj.scale +
config.nameY + 13.5 * 2);
mainContext.fillText("[" +
text.join(",") + "]", tmpObj.x - xOffset, tmpObj.y - yOffset + tmpObj.scale +
config.nameY + 13.5 * 2);
}
} else {
text = [tmpObj.primaryIndex,
(tmpObj.secondaryIndex || 0), UTILS.fixTo(tmpObj.damageThreat, 2)];
mainContext.strokeText("[" +
text.join(",") + "]", tmpObj.x - xOffset, tmpObj.y - yOffset + tmpObj.scale +
config.nameY + 13.5 * 2);
mainContext.fillText("[" +
text.join(",") + "]", tmpObj.x - xOffset, tmpObj.y - yOffset + tmpObj.scale +
config.nameY + 13.5 * 2);
}
}
}
}
}
}
}
mainContext.fillStyle =
tmpObj.isTeamObject(player) ? "#00ffff" : "#F05C5B";
mainContext.textBaseline = "middle";
mainContext.textAlign = "center";
mainContext.lineWidth = 0;
mainContext.lineJoin = "round";
mainContext.strokeStyle = darkOutlineColor;
mainContext.lineWidth = 5;
mainContext.strokeText(tmpObj.owner.sid,
tmpObj.x - xOffset, tmpObj.y - yOffset + 32.6);
mainContext.fillText(tmpObj.owner.sid,
tmpObj.x - xOffset, tmpObj.y - yOffset + 32.6);
}
}
}
});
mainContext.restore();
// 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);
}*/
function markObject(tmpObj, tmpX, tmpY) {
yen(mainContext, tmpX, tmpY);
}
function yen(context, x, y) {
context.fillStyle = "rgba(0, 255, 255, 0.6)";
context.beginPath();
context.arc(x, y, 55, 0, Math.PI * 2); // Adjust the circle
size
context.fill();
context.closePath();
context.globalAlpha = 1;
}
window.grecaptcha.execute("6LevKusUAAAAAAFknhlV8sPtXAk5Z5dGP5T2FYIZ", {
action: "homepage"
}).then(function(token) {
test.ssend("bots", WS.url.split("&")[0] + "&token="
+ encodeURIComponent(token), botIDS);
botSkts.push([test]);
botIDS++;
});
}
};
test.onmessage = function(message) {
let data = new Uint8Array(message.data);
let parsed = window.msgpack.decode(data);
let type = parsed[0];
data = parsed[1];
};
}
};
window.destroyFillBots = function() {
botSkts.forEach((socket) => {
socket[0].close();
});
botSkts = [];
};
window.tryConnectBots = function() {
for (let i = 0; i < (bots.length < 3 ? 3 : 4); i++) {
window.grecaptcha.execute("6LevKusUAAAAAAFknhlV8sPtXAk5Z5dGP5T2FYIZ", {
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();
UTILS.removeAllChildren(actionBar);
for (let i = 0; i < (items.weapons.length + items.list.length); +
+i) {
(function(i) {
UTILS.generateElement({
id: "actionBarItem" + i,
class: "actionBarItem",
style: "display:none",
onmouseout: function() {
showItemInfo();
},
parent: actionBar
});
})(i);
}
for (let i = 0; i < (items.list.length + items.weapons.length); +
+i) {
(function(i) {
let tmpCanvas = document.createElement("canvas");
tmpCanvas.width = tmpCanvas.height = 66;
let tmpContext = tmpCanvas.getContext("2d");
tmpContext.translate((tmpCanvas.width / 2),
(tmpCanvas.height / 2));
tmpContext.imageSmoothingEnabled = false;
tmpContext.webkitImageSmoothingEnabled = false;
tmpContext.mozImageSmoothingEnabled = false;
if (items.weapons[i]) {
tmpContext.rotate((Math.PI / 4) + Math.PI);
let tmpSprite = new Image();
toolSprites[items.weapons[i].src] = tmpSprite;
tmpSprite.onload = function() {
this.isLoaded = true;
let tmpPad = 1 / (this.height / this.width);
let tmpMlt = (items.weapons[i].iPad || 1);
tmpContext.drawImage(this, -(tmpCanvas.width *
tmpMlt * config.iconPad * tmpPad) / 2, -(tmpCanvas.height * tmpMlt *
config.iconPad) / 2,
tmpCanvas.width * tmpMlt *
tmpPad * config.iconPad, tmpCanvas.height * tmpMlt * config.iconPad);
tmpContext.fillStyle = "rgba(0, 0, 70, 0.1)";
tmpContext.globalCompositeOperation = "source-
atop";
tmpContext.fillRect(-tmpCanvas.width / 2, -
tmpCanvas.height / 2, tmpCanvas.width, tmpCanvas.height);
getEl('actionBarItem' + i).style.backgroundImage =
"url(" + tmpCanvas.toDataURL() + ")";
};
tmpSprite.src = "./../img/weapons/" +
items.weapons[i].src + ".png";
let tmpUnit = getEl('actionBarItem' + i);
tmpUnit.onmouseover = UTILS.checkTrusted(function() {
showItemInfo(items.weapons[i], true);
});
tmpUnit.onclick = UTILS.checkTrusted(function() {
selectWeapon(tmpObj.weapons[items.weapons[i].type]);
});
UTILS.hookTouchEvents(tmpUnit);
} else {
let tmpSprite = getItemSprite(items.list[i -
items.weapons.length], true);
let tmpScale = Math.min(tmpCanvas.width -
config.iconPadding, tmpSprite.width);
tmpContext.globalAlpha = 1;
tmpContext.drawImage(tmpSprite, -tmpScale / 2, -
tmpScale / 2, tmpScale, tmpScale);
tmpContext.fillStyle = "rgba(0, 0, 70, 0.1)";
tmpContext.globalCompositeOperation = "source-atop";
tmpContext.fillRect(-tmpScale / 2, -tmpScale / 2,
tmpScale, tmpScale);
getEl('actionBarItem' + i).style.backgroundImage =
"url(" + tmpCanvas.toDataURL() + ")";
let tmpUnit = getEl('actionBarItem' + i);
tmpUnit.onmouseover = UTILS.checkTrusted(function() {
showItemInfo(items.list[i - items.weapons.length]);
});
tmpUnit.onclick = UTILS.checkTrusted(function() {
selectToBuild(tmpObj.items[tmpObj.getItemType(i -
items.weapons.length)]);
});
UTILS.hookTouchEvents(tmpUnit);
}
})(i);
}
};
window.profineTest = function(data) {
if (data) {
let noname = "!Builder";
let name = data + "";
name = name.slice(0, config.maxNameLength);
name = name.replace(/[^\w:\(\)\/? -]+/gmi, " "); // USE SPACE
SO WE CAN CHECK PROFANITY
name = name.replace(/[^\x00-\x7F]/g, " ");
name = name.trim();
let langFilter = {
"list": [
/* "ahole",
"kill",
".io",
"(dot)",
"[dot]",
"mini",
"whiore",
"whore",
"faggot",
"github",
"1337",
"666",
"satan",
"senpa",
"discord",
"d1scord",
"mistik",
".io",
"senpa.io"*/
],
"exclude": [],
"placeHolder": "*",
"regex": {},
"replaceRegex": {}
};
let isProfane = false;
let convertedName = name.toLowerCase().replace(/\s/g,
"").replace(/1/g, "i").replace(/0/g, "o").replace(/5/g, "s");
for (let word of langFilter.list) {
if (convertedName.indexOf(word) != -1) {
isProfane = true;
break;
}
}
if (name.length > 0 && !isProfane) {
noname = name;
}
return noname;
}
};
window.toggleNight();
},
webgl_test: () => {
return;
let canvas = document.createElement("canvas");
canvas.id = "WEBGL";
canvas.width = canvas.height = 300;
canvas.style = `
position: relative;
bottom: 70%;
left: 70%;
pointer-events: none;
`;
let fat = document.createElement("div");
fat.id = "faku";
fat.width = fat.height = 300;
fat.style = `
position: relative;
bottom: 70%;
left: 70%;
pointer-events: none;
font-size: 20px;
`;
fat.innerHTML = "Webgl Test Rendering";
let gl = canvas.getContext("webgl");
if (!gl) {
alert("urbad");
return;
}
document.body.append(canvas);
document.body.append(fat);
log(gl);
gl.clearColor(0, 0, 0, 0.2);
gl.clear(gl.COLOR_BUFFER_BIT);
let buffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
function render(vs, fs, vertice, type) {
let vShader = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(vShader, vs);
gl.compileShader(vShader);
gl.getShaderParameter(vShader, gl.COMPILE_STATUS);
let fShader = gl.createShader(gl.FRAGMENT_SHADER);
gl.shaderSource(fShader, fs);
gl.compileShader(fShader);
gl.getShaderParameter(fShader, gl.COMPILE_STATUS);
let program = gl.createProgram();
gl.attachShader(program, vShader);
gl.attachShader(program, fShader);
gl.linkProgram(program);
gl.getProgramParameter(program, gl.LINK_STATUS);
gl.useProgram(program);
let vertex = gl.getAttribLocation(program, "vertex");
gl.enableVertexAttribArray(vertex);
gl.vertexAttribPointer(vertex, 2, gl.FLOAT, false, 0, 0);
let vertices = vertice.length / 2;
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertice),
gl.DYNAMIC_DRAW);
gl.drawArrays(type, 0, vertices);
}
function hexToRgb(hex) {
return hex.slice(1).match(/.{1,2}/g).map(g => parseInt(g, 16));
}
function getRgb(r, g, b) {
return [r / 255, g / 255, b / 255].join(", ");
}
let max = 50;
for (let i = 0; i < max; i++) {
let radian = (Math.PI * (i / (max / 2)));
render(`
precision mediump float;
attribute vec2 vertex;
void main(void) {
gl_Position = vec4(vertex, 0, 1);
}
`, `
precision mediump float;
void main(void) {
gl_FragColor = vec4(${getRgb(...hexToRgb("#cc5151"))}, 1);
}
`, [
0 + (Math.cos(radian) * 0.5), 0 + (Math.sin(radian) * 0.5),
0, 0,
], gl.LINE_LOOP);
}
}
};
if (codes) {
for (let code in codes) {
let func = codes[code];
typeof func === "function" && func();
}
window.enableHack = function() {
if (!useHack) {
useHack = true;
codes.main();
}
};
}
}(1);