exilium.moe's script for Linux

The script takes a Wine prefix path as an argument.

#!/usr/bin/env bash
# Check if the prefix path is valid
if [[ $# -ne 1 ]]; then
  echo "Usage: $(basename $0) /path/to/wine/prefix"
  exit 1
elif [[ ! -e "$1/system.reg" ]]; then
  echo "Not a valid Wine prefix"
  exit 1
fi

# Look for PLayer.log
proton_path="/drive_c/users/steamuser/AppData/LocalLow/SunBorn/EXILIUM/Player.log"
wine_path="/drive_c/users/$USER/AppData/LocalLow/SunBorn/EXILIUM/Player.log"
if [[ -e "$1$proton_path" ]]; then
  log_path="$1$proton_path"
elif [[ -e "$1$wine_path" ]]; then
  log_path="$1$wine_path"
else
  echo "Log file not found"
  echo "Make sure it's the right prefix and that you've booted the game at least once"
  exit 1
fi

# Check that the user isn't a dork
user_id=$(grep 'key_token_now' $log_path | sed 's/.*uid":"\([a-zA-Z0-9=]*\).*/\1/')
if [[ -z $user_id ]]; then
  echo "No player data found"
  echo "Log into the game at least once, dork!"
  exit 1
fi

# Detect the server
server_url=$(grep -m 1 'gf2-zoneinfo' $log_path | sed 's/.*gf2-zoneinfo-\([a-z]*\).*/\1/')
if [[ $server_url == 'us' ]]; then
  server="dw"
elif [[ $server_url == 'intl' ]]; then
  server="hi"
elif [[ $server_url == 'asia' ]]; then
  server="ha"
elif [[ $server_url == 'jp' ]]; then
  server="hj"
elif [[ $server_url == 'kr' ]]; then
  server="hk"
else
  echo "Server not found!"
  echo "Please select a server [1-5] or press any other key to cancel"
  servers=("Darkwinter" "Haoplay (Global)" "Haoplay (Asia)" "Haoplay (JP)" "Haoplay (KR)")
  select servers in "${servers[@]}"
  do
    case $REPLY in
      1) echo "$servers"
      server="dw"
      break
      ;;
      2) echo "$servers"
      server="hi"
      break
      ;;
      3) echo "$servers"
      server="ha"
      break
      ;;
      4) echo "$servers"
      server="hj"
      break
      ;;
      5) echo "$servers"
      server="hk"
      break
      ;;
      *) exit 1
      ;;
    esac
  done 
fi

# Grab the token
token=$(grep 'key_token_now' $log_path | sed 's/.*key_token_now":"\([^"]*\).*/\1/')

echo "Copy the generated JSON and import your data in https://exilium.moe/import"
echo ""
echo "JSON:"
echo "{\"uid\":\"$user_id\",\"server\":\"$server\",\"token\":\"$token\"}"
Edit
Pub: 08 Feb 2025 05:20 UTC
Edit: 18 Mar 2025 19:12 UTC
Views: 132