commit 77bb12168f101a3011b014d07a7d18f8b83d8eac
parent e1de91a304aaa498f1b28c26dcfadb3454872e58
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Wed, 23 Sep 2020 12:22:04 +0200
rotmgmule: open mules in ROTMG exalt
Accounts are stored in ~/.local/share/rotmgmule/accounts.tsv. Why in TSV
format? Because who knows what characters the passwords will contain,
the only thing they can't have is tabs (I think).
Former-commit-id: 1013382f5255b57faa92df86e42bfb0347b18432
Diffstat:
4 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -13,3 +13,5 @@ bin/z
bin/lf
mpv/scripts/shared/sponsorblock.db*
karabiner/automatic_backups/
+rotmgmule/accounts.tsv
+scripts/rotmgmule
diff --git a/dot.map b/dot.map
@@ -3,6 +3,9 @@ bin: ~/.bin
# My scripts
scripts: ~/.scripts
+rotmgmule:
+- rotmgmule: ~/.scripts/rotmgmule
+- accounts.tsv: ~/.local/share/rotmgmule/accounts.tsv
# Config: utilities
compton: ~/.config/compton
diff --git a/rotmgmule/rotmgmule b/rotmgmule/rotmgmule
@@ -0,0 +1,21 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Term::Choose "choose";
+use MIME::Base64;
+
+my $exaltpath = "$ENV{HOME}/RealmOfTheMadGod/Production/RotMGExalt.app";
+my $accountfile = "$ENV{HOME}/.local/share/rotmgmule/accounts.tsv";
+
+open(accfile_h, "<", $accountfile) or die "Couldn't open the file $accountfile, $!";
+
+my %accounts;
+while(my $line = <accfile_h>) {
+ chomp $line;
+ my ($k, $v) = split("\t", $line);
+ $accounts{$k} = $v;
+}
+close(accfile_h);
+
+my $choice = choose([keys %accounts], { layout => 3 });
+system("open", "-n", $exaltpath, "--args", "'data:{platform:Deca,password:@{[encode_base64($accounts{$choice}, '')]},guid:@{[encode_base64($choice,'')]},env:4}'");
diff --git a/scripts/rotmgmule b/scripts/rotmgmule
@@ -0,0 +1 @@
+/Users/alex/.dotfiles/rotmgmule/rotmgmule+
\ No newline at end of file