Limit capped qualities to max. 70 CP

This commit is contained in:
Dotsent 2021-09-16 15:40:06 +02:00
parent cfeca13484
commit 9f7aaf7cde

View File

@ -8,7 +8,7 @@
// @name FallenLondon Enhancer // @name FallenLondon Enhancer
// @namespace https://forge.chapril.org/audrey/ // @namespace https://forge.chapril.org/audrey/
// @require https://forge.chapril.org/audrey/fallen_london_scripts/raw/branch/master/jquery/jquery-3.6.0.min.js // @require https://forge.chapril.org/audrey/fallen_london_scripts/raw/branch/master/jquery/jquery-3.6.0.min.js
// @version 0.1-rc1 // @version 0.1-rc2
// ==/UserScript== // ==/UserScript==
"use strict"; "use strict";
@ -203,12 +203,18 @@ function cleanup() {
} }
function display_stats_progress() { function display_stats_progress() {
const capped_qualities = ["Dangerous", "Persuasive", "Shadowy", "Watchful"];
$('ul.items--list li.sidebar-quality').each( function( index, element ){ $('ul.items--list li.sidebar-quality').each( function( index, element ){
bar = $( this ).find('div.progress-bar'); bar = $( this ).find('div.progress-bar');
percent = bar.find('span').prop('style').width.slice(0, -1); percent = bar.find('span').prop('style').width.slice(0, -1);
lvl = Number($( this ).find('span.item__value').text()); lvl = Number($( this ).find('span.item__value').text());
quality = $( this ).find('span.item__name').text();
target = lvl + 1; target = lvl + 1;
lvl_pts = Math.round(lvl * target / 2); lvl_pts = Math.round(lvl * target / 2);
if (capped_qualities.includes(quality) && target > 70) {
target = 70;
lvl_pts = 2485 + (lvl-70) * 70;
}
CP = Math.round(target * percent / 100); CP = Math.round(target * percent / 100);
points = Math.round(lvl_pts + CP); points = Math.round(lvl_pts + CP);
bar.html( bar.html() + '<span style="color:grey; font-size:75%;">' + points + ' (' + lvl_pts + '+' + CP + '/' + target + ')</span>' ); bar.html( bar.html() + '<span style="color:grey; font-size:75%;">' + points + ' (' + lvl_pts + '+' + CP + '/' + target + ')</span>' );