salien-script-js
Advanced tools
Comparing version 0.0.15 to 0.0.16
{ | ||
"name": "salien-script-js", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "A easy to install, run and update Node.js script for the Steam salien mini-game.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -205,5 +205,6 @@ /** | ||
const max = 180; | ||
const defaultAllowedFailures = 10; | ||
let nextHeal = Math.floor(new Date().getTime() / 1000) + Math.floor(Math.random() * (max - min + 1) + min); | ||
let allowedBossFails = 10; | ||
let allowedBossFails = defaultAllowedFailures; | ||
@@ -226,3 +227,3 @@ // eslint-disable-next-line no-constant-condition | ||
// eslint-disable-next-line no-underscore-dangle | ||
if (Number(report.___headers.get('x-eresult')[0]) !== 1) { | ||
if (Number(report.___headers.get('x-eresult')) !== 1 && Number(report.___headers.get('x-eresult')) !== 93) { | ||
allowedBossFails -= 1; | ||
@@ -235,2 +236,5 @@ | ||
// if we didn't get an error, reset the allowed failure count | ||
allowedBossFails = defaultAllowedFailures; | ||
if (!report.boss_status) { | ||
@@ -244,9 +248,20 @@ this.logger('@@ Boss -- Waiting...'); | ||
// TODO: support logging of boss_status and players | ||
// https://github.com/SteamDatabase/SalienCheat/blob/master/cheat.php#L203 | ||
if (report.boss_status.boss_players) { | ||
console.log(''); // eslint-disable-line no-console | ||
// TODO: format player name better so it doesn't screw up our neat output | ||
report.boss_status.boss_players.forEach(player => { | ||
let scoreCard = ` ${`${player.name}`.padEnd(30)}`; | ||
scoreCard += ` - HP: ${chalk.yellow(`${player.hp}`.padStart(6))} / ${`${player.max_hp}`.padStart(6)}`; | ||
scoreCard += ` - XP Gained: ${chalk.yellow(`${Number(player.xp_earned).toLocaleString()}`.padStart(12))}`; | ||
this.logger(scoreCard); | ||
}); | ||
console.log(''); // eslint-disable-line no-console | ||
} | ||
if (report.game_over) { | ||
this.logger('@@ Boss -- The battle is over!'); | ||
return; | ||
throw new SalienScriptRestart('Boss battle is over!'); | ||
} | ||
@@ -262,5 +277,5 @@ | ||
// TODO: this message could be far prettier | ||
let bossStatusMsg = `@@ Boss -- HP: ${Number(report.boss_status.boss_hp)}`; | ||
bossStatusMsg += `/${Number(report.boss_status.boss_max_hp)}`; | ||
let bossStatusMsg = `@@ Boss -- HP: ${Number(report.boss_status.boss_hp).toLocaleString()}`; | ||
bossStatusMsg += ` / ${Number(report.boss_status.boss_max_hp).toLocaleString()}`; | ||
bossStatusMsg += ` (${getPercentage(report.boss_status.boss_hp / report.boss_status.boss_max_hp)}%)`; | ||
bossStatusMsg += ` - Lasers: ${report.num_laser_uses}`; | ||
@@ -276,3 +291,9 @@ bossStatusMsg += ` - Team Heals: ${report.num_team_heals}`; | ||
async doGameLoop() { | ||
let leaveAttempts = 0; | ||
while (this.currentPlanetAndZone.id !== this.steamThinksPlanet) { | ||
if (leaveAttempts > 3) { | ||
throw new SalienScriptRestart('Unable to leave planet...'); | ||
} | ||
this.steamThinksPlanet = await this.leaveCurrentGame(this.currentPlanetAndZone.id); | ||
@@ -285,2 +306,4 @@ | ||
} | ||
leaveAttempts += 1; | ||
} | ||
@@ -287,0 +310,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44903
885