Skip to content

Commit

Permalink
Boost/Stun
Browse files Browse the repository at this point in the history
  • Loading branch information
NotBlue-Dev committed Aug 25, 2021
1 parent 9c97011 commit cdaa5c1
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 20 deletions.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"ip":"localhost","pseudo":"GLACIER-","files":[{"name":"goal","file":"goal.tact","intens":1,"dur":1,"state":true},{"name":"wall","file":"wall.tact","intens":1,"dur":1,"state":true},{"name":"grab","file":"grab.tact","intens":2,"dur":1,"state":true},{"name":"shield","file":"shield.tact","intens":1,"dur":1,"state":true},{"name":"stun","file":"stun.tact","intens":1,"dur":1,"state":true},{"name":"heart","file":"heart.tact","intens":4,"dur":1,"state":true},{"name":"boost","file":"boost.tact","intens":3,"dur":1,"state":false,"lock":true},{"name":"break","file":"break.tact","intens":1,"dur":1,"state":false,"lock":true},{"name":"stunned","file":"stunned.tact","intens":1,"dur":1,"state":false,"lock":true}]}
{"ip":"localhost","pseudo":"L-A-","files":[{"name":"goal","file":"goal.tact","intens":1,"dur":1,"state":true},{"name":"wall","file":"wall.tact","intens":1,"dur":1,"state":true},{"name":"grab","file":"grab.tact","intens":2,"dur":1,"state":true},{"name":"shield","file":"shield.tact","intens":1,"dur":1,"state":true},{"name":"stun","file":"stun.tact","intens":1,"dur":1,"state":false,"lock":true},{"name":"heart","file":"heart.tact","intens":4,"dur":1,"state":true},{"name":"boost","file":"boost.tact","intens":3,"dur":1,"state":false,"lock":true},{"name":"break","file":"break.tact","intens":1,"dur":1,"state":false,"lock":true},{"name":"stunned","file":"stunned.tact","intens":1,"dur":1,"state":true,"lock":false}]}
77 changes: 60 additions & 17 deletions js/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ let playerid;
let orangepoints;
let bluepoints;
let stun = false;
let stuns;
let stunned = false;
let teamlen;
let lastVel = 0;
let block = false;
let boost = false;
let end = false;
let statuss;
let checks;
let tempVeloc;
let tempVelocMax;
let pyVeloc;
let Ti;

let optHeart = {intensity: config.files[config.files.findIndex(x=>x.name === 'heart')].intens, duration: config.files[config.files.findIndex(x=>x.name === 'heart')].dur}
let optStunned = {intensity: config.files[config.files.findIndex(x=>x.name === 'stunned')].intens, duration: config.files[config.files.findIndex(x=>x.name === 'stunned')].dur}
Expand All @@ -22,6 +27,8 @@ let optGoal = {intensity: config.files[config.files.findIndex(x=>x.name === 'goa
let optShield = {intensity: config.files[config.files.findIndex(x=>x.name === 'shield')].intens, duration: config.files[config.files.findIndex(x=>x.name === 'shield')].dur}
let optWall = {intensity: config.files[config.files.findIndex(x=>x.name === 'wall')].intens, duration: config.files[config.files.findIndex(x=>x.name === 'wall')].dur}



function playId() {
//get player in json
axios.get(`http://${ip}:6721/session`).then(resp => {
Expand Down Expand Up @@ -56,14 +63,19 @@ function playId() {

}


playerid = resp.data.teams[team].players[index].playerid;
stuns = resp.data.teams[team].players[index].stats.stuns
orangepoints = resp.data.orange_points;
bluepoints = resp.data.blue_points;

pause = false;

if(team == 0) {
Ti = 1
} else {
Ti = 0
}

})
}

Expand Down Expand Up @@ -97,13 +109,13 @@ function request() {
}

//stunned ?

if(player.stunned == true && stun == false && options.stunned == true) {
stun = true;
console.log('stun')
if(player.stunned == true && stunned == false && options.stunned == true) {
stunned = true;
console.log('stunned')
tactJs.default.submitRegisteredWithScaleOption('stunned', optStunned)
setTimeout(() => {
stun = false;
stunned = false;
}, 3000);
}

Expand Down Expand Up @@ -142,16 +154,28 @@ function request() {

//stun smone ? #Broken#

// if(player.stats.stuns != stuns && options.stun == true) {
// stuns = player.stats.stuns;
// tactJs.default.submitRegisteredWithScaleOption('stun');
// }
if(options.stun != true && stun == false) {
stun = true;
playerPos = resp.data.teams[team].players[index].head.position
for(let i in resp.data.teams[Ti].players) {
EnemyPos = resp.data.teams[Ti].players[i].head.position
if((playerPos[0] >= EnemyPos[0]-1 && playerPos[0] <= EnemyPos[0]+1) && (playerPos[1] >= EnemyPos[1]-1 && playerPos[1] <= EnemyPos[1]+1) && (playerPos[2] >= EnemyPos[2]-1 && playerPos[2] <= EnemyPos[2]+1)) {
if(resp.data.teams[Ti].players[i].stunned) {
console.log('STUN')
}
}
}
setTimeout(() => {
stun = false;
}, 1000);
// tactJs.default.submitRegisteredWithScaleOption('stun');
}

//hit a wall ?

let velocity = resp.data.teams[team].players[index].velocity

let pyVeloc = Math.pow(velocity[0], 2) + Math.pow(velocity[1], 2)+ Math.pow(velocity[2], 2);
pyVeloc = Math.pow(velocity[0], 2) + Math.pow(velocity[1], 2)+ Math.pow(velocity[2], 2);

if((lastVel/2 > pyVeloc && lastVel > 24 && pyVeloc > 24) && (resp.data.teams[team].players[index].holding_left == "none")&&(resp.data.teams[team].players[index].holding_right == "none") && options.wall == true) {
tactJs.default.submitRegisteredWithScaleOption('wall', optWall);
Expand All @@ -161,6 +185,23 @@ function request() {

//Boost 6.56 24.95

if (tempVeloc > 25) tempVeloc = 25

if(!(pyVeloc >= 25) && (pyVeloc >= tempVeloc -0.12 && pyVeloc <= tempVeloc +0.12) && boost == false) {
boost = true;
console.log('boost 1 ')
setTimeout(() => {
boost = false;
}, 1100);
}

if(!(pyVeloc >= 25) && (pyVeloc >= tempVelocMax -0.12 && pyVeloc <= tempVelocMax +0.12) && boost == false) {
boost = true;
console.log('boost 2 ')
setTimeout(() => {
boost = false;
}, 1000);
}
}

request() //restart request
Expand All @@ -170,16 +211,13 @@ function request() {
if (error.response) {
if(error.response.status == 404) {
console.log('in Menu/Loading or invalid IP')
setTimeout(() => {

}, );
} else {
console.log(error.response.status)
}
} else if (error.request) {
console.log('Connection refused, game running ?');
} else {
console.log('Error', error.message);
console.log('Error', error);
}
}

Expand All @@ -189,4 +227,9 @@ function request() {
request()
}, 5000);
})
}
}

setInterval(() => {
tempVeloc = pyVeloc + 6.56
tempVelocMax = pyVeloc + 18.37
}, 1200)
2 changes: 1 addition & 1 deletion js/ipFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function find() {
prompt({
title: "Can't find IP, enter manually",
label: 'Enter Quest IP',
value: 'eg: 192.168.1.53',
value: '',
type: 'input'
})
.then((r) => {
Expand Down
3 changes: 2 additions & 1 deletion view/main/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ window.addEventListener('DOMContentLoaded', () => {

}
})();

})

let ipState = false;
Expand Down Expand Up @@ -139,7 +140,7 @@ function check(bool) {

setTimeout(() => {
ws.close()
}, 1000);
}, 3000);
}

setInterval(() => {
Expand Down

0 comments on commit cdaa5c1

Please sign in to comment.