commit 2c7df37f90b218eba5df7dc4a1075954f5e01d1e
parent 00cd583e3664a7d7fdf4748b37e837d3b4465251
Author: breadcat <breadcat@users.noreply.github.com>
Date: Wed, 5 Aug 2026 12:30:40 +0100
Add Tears of Guthix script
Diffstat:
4 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/machines/atlas.nix b/machines/atlas.nix
@@ -33,6 +33,7 @@
../scripts/scan-to-pdf.nix
../scripts/seedy.nix
../scripts/taudiobooker.nix
+ ../scripts/vidyaplace-tears.nix
../scripts/vidyaplace.nix
];
home-manager.users.${vars.user.username} = {pkgs, ...}: { imports = [
diff --git a/machines/ilias.nix b/machines/ilias.nix
@@ -48,6 +48,7 @@
../scripts/tank-log.nix
../scripts/tank-sort.nix
../scripts/taudiobooker.nix
+ ../scripts/vidyaplace-tears.nix
../scripts/watchedlist.nix
../scripts/youtube-id-rss.nix
];
diff --git a/machines/minerva.nix b/machines/minerva.nix
@@ -29,6 +29,7 @@
../scripts/ctimerename.nix
../scripts/duupmove.nix
../scripts/restic.nix
+ ../scripts/vidyaplace-tears.nix
../scripts/vidyaplace.nix
];
home-manager.users.${vars.user.username} = {pkgs, ...}: { imports = [
diff --git a/scripts/vidyaplace-tears.nix b/scripts/vidyaplace-tears.nix
@@ -0,0 +1,39 @@
+{ pkgs, ... }:
+
+{
+
+ environment.systemPackages = [
+ (pkgs.writeShellScriptBin "vidyaplace-tears" ''
+
+ # variables
+ player="''${1:-Calico}"
+
+ # process
+ printf "Player: %s\n" "$player"
+ ${pkgs.curl}/bin/curl -s "https://vidyaplace.org/api/highscores/player/$player" |
+ ${pkgs.jq}/bin/jq -r '
+ def format_number:
+ tostring
+ | if length <= 3 then .
+ else (.[0:length-3] | format_number) + "," + .[length-3:]
+ end;
+ def format_skill:
+ sub("_xp$"; "")
+ | split("_")
+ | map((.[0:1] | ascii_upcase) + .[1:])
+ | join(" ");
+ to_entries
+ | map(select(.key | test("_(xp)$")))
+ | sort_by(.value)
+ | .[0] as $lowest
+ | .[1] as $second
+ |
+ "Lowest skill: \($lowest.key | format_skill) (\($lowest.value | format_number) XP)",
+ "Second lowest skill: \($second.key | format_skill) (\($second.value | format_number) XP)",
+ "",
+ "Difference: \(($second.value - $lowest.value) | format_number) XP"
+ '
+ '')
+ ];
+
+}