Skip to content

Commit

Permalink
Update idle.js
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanPaulLucien authored Jul 2, 2018
1 parent 7a072ef commit 5f7c587
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions idle.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,9 @@ var INJECT_wait_for_end = function() {
// Update GUI
gui.updateTask("Waiting " + Math.max(time_remaining, 0) + "s for round to end", false);
gui.updateStatus(true);
if (target_zone != -1)
if($J('#lvlupCheckbox').prop('checked')) {
gui.updateEstimatedTime(calculateTimeToNextLevel());
}
if (target_zone != -1 && $J('#lvlupCheckbox').prop('checked')) {
gui.updateEstimatedTime(calculateTimeToNextLevel());
}
gui.progressbar.SetValue(time_passed_ms/(resend_frequency*1000));

// Wait
Expand Down Expand Up @@ -709,7 +708,7 @@ function get_max_score(zone, round_duration) {

// Get the best zone available
function GetBestZone() {
var bestZone, highestDifficulty = maxProgress = -1;
var bestZone, highestDifficulty = -1, maxProgress = -1;

gui.updateTask('Getting best zone');

Expand All @@ -730,10 +729,19 @@ function GetBestZone() {
}
}

if(bestZone !== undefined) {
//console.log(`${window.gGame.m_State.m_PlanetData.state.name} - Zone ${bestZone[0]} Progress: ${window.gGame.m_State.m_Grid.m_Tiles[bestZone[0]].Info.progress} Difficulty: ${window.gGame.m_State.m_Grid.m_Tiles[bestZone[0]].Info.difficulty}`);
if(bestZone === undefined)
{
console.log("The best zone was not found. Or you freezed at planet selection");

}
return bestZone;
else
{
console.log(bestZone);
}
/* if(bestZone !== undefined) {
//console.log(`${window.gGame.m_State.m_PlanetData.state.name} - Zone ${bestZone[0]} Progress: ${window.gGame.m_State.m_Grid.m_Tiles[bestZone[0]].Info.progress} Difficulty: ${window.gGame.m_State.m_Grid.m_Tiles[bestZone[0]].Info.difficulty}`);
}*/
return bestZone
}

// Get the best planet available
Expand Down Expand Up @@ -885,11 +893,12 @@ function CheckSwitchBetterPlanet(difficulty_call) {
} else {
console.log("There's no planet better than the current one.");
}
// Hide the game
if($J('#animationsCheckbox').prop('checked'))
// Hide the game. Bug reason.
//$J('#animationsCheckbox').prop('checked', !animations_enabled);
/*if($J('#animationsCheckbox').prop('checked'))
{
INJECT_toggle_animations(!this.checked);
}
}*/
}

var INJECT_switch_planet = function(planet_id, callback) {
Expand Down Expand Up @@ -989,6 +998,7 @@ var INJECT_leave_planet = function(callback) {
}

var INJECT_join_planet = function(planet_id, success_callback, error_callback) {

if(typeof success_callback !== 'function')
success_callback = function() {};
if(typeof error_callback !== 'function')
Expand Down Expand Up @@ -1123,6 +1133,7 @@ var INJECT_init_planet_selection = function() {
gServer.JoinPlanet = function(planet_id, success_callback, error_callback) {
INJECT_join_planet(planet_id, success_callback, error_callback);
}
console.log('Joke ' + gServer.JoinPlanet);

// Update GUI
gui.updateStatus(false);
Expand All @@ -1136,8 +1147,12 @@ var INJECT_init = function() {

if (gGame.m_State instanceof CBattleSelectionState)
INJECT_init_battle_selection();
else if (gGame.m_State instanceof CPlanetSelectionState)
INJECT_init_planet_selection();
else if (gGame.m_State instanceof CPlanetSelectionState) {
var funcResult = INJECT_init_planet_selection();
if( funcResult === undefined) {
CheckSwitchBetterPlanet();
}
}
};

var INJECT_toggle_animations = function(enabled) {
Expand Down

1 comment on commit 5f7c587

@JeanPaulLucien
Copy link
Owner Author

@JeanPaulLucien JeanPaulLucien commented on 5f7c587 Jul 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fid ensingm2#84 was added

Please sign in to comment.