Add "max level" button and overkill detection

* "max level" button to quickly fill in a card's max level
* "overkill" detection detects when you are feeding way more
  EXP than is necessary to max level a card.
This commit is contained in:
Donald Burr 2015-10-22 15:33:25 -07:00
parent 3ab33e8624
commit 0f07e6e475
2 changed files with 26 additions and 7 deletions

View file

@ -27,8 +27,6 @@
// * Card Level Calc: // * Card Level Calc:
// - account for 1.2x bonus when feeding cards of the same attribute // - account for 1.2x bonus when feeding cards of the same attribute
// - maybe also the super (1.5) and ultra (2.0) success bonuses too? // - maybe also the super (1.5) and ultra (2.0) success bonuses too?
// - detect "overkill" (i.e. feeding too much EXP to a card)
// - add "max level" button to automatically fill in the max level of the given type of card
// * Event Tracker: // * Event Tracker:
// - if time remaining < 24 don't put parenthesis around the hours/minutes/seconds display // - if time remaining < 24 don't put parenthesis around the hours/minutes/seconds display
// - @sifen_trackbot update code gets "stuck" sometimes - not sure if the problem // - @sifen_trackbot update code gets "stuck" sometimes - not sure if the problem
@ -173,7 +171,7 @@ function setup_ui_elements() {
disableTextInput: true disableTextInput: true
}); });
// set up buttons // set up buttons
[ "calculate-rank", "reset-rank", "calculate-gems", "reset-gems", "calculate-card", "reset-card", "start-stop-timer", "clear-timer" ].forEach(function(entry) { [ "calculate-rank", "reset-rank", "calculate-gems", "reset-gems", "card-max-level", "calculate-card", "reset-card", "start-stop-timer", "clear-timer" ].forEach(function(entry) {
var selector = "#button-" + entry; var selector = "#button-" + entry;
LOG(1, "setting up " + selector); LOG(1, "setting up " + selector);
$(selector).button(); $(selector).button();
@ -247,6 +245,9 @@ function setup_button_handlers() {
$("#button-reset-gems").click(function(evt) { $("#button-reset-gems").click(function(evt) {
reset_gems(); reset_gems();
}); });
$("#button-card-max-level").click(function(evt) {
card_set_max_level();
});
$("#button-calculate-card").click(function(evt) { $("#button-calculate-card").click(function(evt) {
calculate_card(); calculate_card();
}); });
@ -382,6 +383,18 @@ function handle_gem_mode_select() {
} }
} }
function card_set_max_level() {
var card_type = $("#card_rarity").val();
var level = 0;
switch (card_type) {
case "N": level = 40; break;
case "R": level = 60; break;
case "SR": level = 80; break;
case "UR": level = 100; break;
}
$("#card_desired_level").val(level);
}
function handle_card_mode_select() { function handle_card_mode_select() {
var mode = $(this).val(); var mode = $(this).val();
if (mode === "LEVEL") { if (mode === "LEVEL") {
@ -952,7 +965,12 @@ function calculate_card() {
} }
} }
level--; level--;
var resultString = sprintf("If you feed a %s card at level %d (with %d EXP) a total of %d EXP,<br />it will end up at level %d.%s", rarity, current_level, current_exp, exp_to_feed, level, level == get_level_cap(rarity) ? " (MAX LEVEL!)" : ""); var resultString = "";
if (exp_to_feed > exp_tally) {
resultString = sprintf("If you feed a %s card at level %d (with %d EXP) a total of %d EXP,<br />it will end up at level %d.%s<br />This is way overkill, you fed %d more EXP than was necessary.", rarity, current_level, current_exp, exp_to_feed, level, (level == get_level_cap(rarity) ? " (MAX LEVEL!)" : ""), exp_to_feed - exp_tally);
} else {
resultString = sprintf("If you feed a %s card at level %d (with %d EXP) a total of %d EXP,<br />it will end up at level %d.%s", rarity, current_level, current_exp, exp_to_feed, level, level == get_level_cap(rarity) ? " (MAX LEVEL!)" : "");
}
// output the result // output the result
$("#card-result-summary").html(resultString); $("#card-result-summary").html(resultString);
} }
@ -1022,8 +1040,8 @@ function run_timer() {
string += "<h1>EVENT IS OVER</h1>"; string += "<h1>EVENT IS OVER</h1>";
} }
$("#timer_output_area").html(string); $("#timer_output_area").html(string);
// @sifen_trackbot updates come out at 36 minutes past the hour, fetch them at 37 minutes to allow for some slop // @sifen_trackbot updates come out at 36 minutes past the hour, fetch them at 38 minutes to allow for some slop
if (minute(now) == 37 && second(now) == 0 || window.immediately_refresh_tier_cutoffs) { if (minute(now) == 38 && second(now) == 0 || window.immediately_refresh_tier_cutoffs) {
$("#tier_info_output_area").html("<h2>Updating tier cutoff data, please wait...</h2>"); $("#tier_info_output_area").html("<h2>Updating tier cutoff data, please wait...</h2>");
// dumb ass way to fetch and display @sifen_trackbot tier cutoff tweets hourly // dumb ass way to fetch and display @sifen_trackbot tier cutoff tweets hourly
// using this twitter fetcher: http://jasonmayes.com/projects/twitterApi/#sthash.budgYosd.dpbs // using this twitter fetcher: http://jasonmayes.com/projects/twitterApi/#sthash.budgYosd.dpbs

View file

@ -192,6 +192,7 @@
<div id="card-level-area"> <div id="card-level-area">
Desired level:&nbsp;&nbsp;&nbsp;<input type="text" readonly="true" size="5" id="card_desired_level" name="card_desired_level" placeholder="level" Desired level:&nbsp;&nbsp;&nbsp;<input type="text" readonly="true" size="5" id="card_desired_level" name="card_desired_level" placeholder="level"
value=""> value="">
<div id="button-card-max-level">Max</div>
</div> </div>
<div id="card-exp-area"> <div id="card-exp-area">
EXP:&nbsp;&nbsp;&nbsp;<input type="text" readonly="true" size="5" id="card_feed_exp" name="card_feed_exp" placeholder="exp" value=""> EXP:&nbsp;&nbsp;&nbsp;<input type="text" readonly="true" size="5" id="card_feed_exp" name="card_feed_exp" placeholder="exp" value="">