Talk:Strange Apparatus

From FFXI Wiki

Doctor Status Solver Shell Script

For those of you that have WSL/cygwin installed, this will solve for you. Save the below as doctor.sh and make it executable (e.g. chmod +x doctor.sh)
Usage: ./doctor.sh <first letter> <second letter> <third letter>

#!/bin/bash
doctor_status_array () 
{ 
    char_name=({a..z});
    for stuff in `seq 0 1 $((${#char_name[@]}-1))`;
    do
        echo ${char_name[$stuff]} - ${stuff};
    done
}
doctor_status_password () 
{ 
    if [[ $# -lt 3 ]]; then
        echo "separate the letters e.g. e m p" && return 1;
    fi && read -e -p 'Enter the zone number: ' zone;
    export digit=($@);
    declare -p digit;
    first_six=$(printf "%s\n" "`seq 0 1 $((${#digit[@]}-1))`" | while read these ; do doctor_status_array | grep ${digit[$these]}  ; done | while read letter dash num ; do echo $[$num + $zone] ; done);
    printf "%s\n" "${first_six}" | tr -d '\n';
    last_two=$(printf "%s\n" "${first_six}" | awk 'BEGIN {lastnum = 0} {lastnum += $1} END {print lastnum + '$zone'}');
    if [[ ${last_two} -ge 100 ]]; then
        echo -ne $last_two | grep -o '..$';
    else
        echo -ne $last_two;
    fi;
    echo
}
doctor_status_password "$@"


Example:

period@D5DZ5WT2 ~ $ chmod +x /tmp/doctor.sh 
period@D5DZ5WT2 ~ $ /tmp/doctor.sh e m p
Enter the zone number: 23
declare -ax digit=([0]="e" [1]="m" [2]="p")
27353823

-- 11:52, 16 November 2020‎ Empathy