Skip to content

Commit

Permalink
[userscript] Add specific error message to FF strings to indicate the…
Browse files Browse the repository at this point in the history
… user should visit the gym page

Credits to Valisana [3079313]

Signed-off-by: tiksan <[email protected]>
  • Loading branch information
dssecret committed Oct 25, 2024
1 parent eead931 commit 95e0c15
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion docs/userscripts/estimate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Estimate Userscript
The estimation userscript is a free alternative to other services (such as BSP and TSC) pulling data from Tornium to show user stats on Torn directly.

.. warning::
This userscript is in active development, so the userscript's features listed here may change in the near future. This documentation was last updated for v0.3.8-2.
This userscript is in active development, so the userscript's features listed here may change in the near future. This documentation was last updated for v0.3.8-3.

Installation Instruction
------------------------
Expand All @@ -26,6 +26,9 @@ Depending on the page, the userscript will make an API call to Tornium's servers
.. note ::
Tornium's estimation userscript does not require you to sign into Tornium with an API key, but some user data (and therefore estimates) may not be up-to-date without using an API key to update the user's data.
.. note ::
If you have a fair fight value of "GYM", you'll need to visit the Gym page in-game for the userscript to update its local-only copy of your stats to calculate the fair fight.
Supported Pages
---------------
#. User profile: shows exact estimate and value from stat database with FFs
Expand Down
10 changes: 5 additions & 5 deletions userscripts/tornium-estimate.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name Tornium Estimation
// @namespace https://tornium.com
// @version 0.3.8-2
// @version 0.3.8-3
// @copyright GPLv3
// @author tiksan [2383326]
// @match https://www.torn.com/profiles.php*
Expand Down Expand Up @@ -293,7 +293,7 @@ async function getOneStat(tid) {
return;
}

let ffString = "";
let ffString = "GYM";
if (userStatScore !== null) {
ffString = (1 + ((8 / 3) * userEstimate.stat_score) / userStatScore).toFixed(2);
}
Expand All @@ -312,7 +312,7 @@ async function getOneStat(tid) {
return;
}

let ffString = "";
let ffString = "GYM";
if (userStatScore !== null) {
ffString = (1 + ((8 / 3) * userStats.stat_score) / userStatScore).toFixed(2);
}
Expand Down Expand Up @@ -393,7 +393,7 @@ async function getOneStat(tid) {
return;
}

let ffString = "";
let ffString = "GYM";
if (userStatScore !== null) {
ffString = (1 + ((8 / 3) * userEstimate.stat_score) / userStatScore).toFixed(2);
}
Expand Down Expand Up @@ -443,7 +443,7 @@ async function getOneStat(tid) {
let ffString = (1 + ((8 / 3) * userEstimate.stat_score) / userStatScore).toFixed(2);
$(`#tornium-estimate-${userID}`).text(`${ffString}x`);
} else {
$(`#tornium-estimate-${userID}`).text("ERR");
$(`#tornium-estimate-${userID}`).text("GYM");
}
});
}
Expand Down

0 comments on commit 95e0c15

Please sign in to comment.