From 165ab812f07f91de733a8afe42c2809a21e35e1e Mon Sep 17 00:00:00 2001 From: Rebekah Rowe Date: Tue, 18 Jun 2024 15:53:58 -0400 Subject: [PATCH] Implimented a golang variant of the tooling, now fully in one app. Nov 16, 2023 --- convert-time.js | 57 ---- get-curtime.js | 6 - get-time.sh | 66 ---- go.mod | 3 + gojump.sh | 2 + list-completed-tiers.sh | 42 --- list-random-midtier.sh | 2 - list-random.sh | 2 - list-tier.sh | 58 ---- list-tiers.sh | 41 --- list-uncompleted-random-midtier.sh | 2 - list-uncompleted-random.sh | 2 - list-uncompleted-tiers.sh | 41 --- main.go | 492 +++++++++++++++++++++++++++++ 14 files changed, 497 insertions(+), 319 deletions(-) delete mode 100644 convert-time.js delete mode 100644 get-curtime.js delete mode 100755 get-time.sh create mode 100644 go.mod create mode 100644 gojump.sh delete mode 100755 list-completed-tiers.sh delete mode 100644 list-random-midtier.sh delete mode 100644 list-random.sh delete mode 100755 list-tier.sh delete mode 100755 list-tiers.sh delete mode 100644 list-uncompleted-random-midtier.sh delete mode 100644 list-uncompleted-random.sh delete mode 100755 list-uncompleted-tiers.sh create mode 100644 main.go diff --git a/convert-time.js b/convert-time.js deleted file mode 100644 index 98ad0b9..0000000 --- a/convert-time.js +++ /dev/null @@ -1,57 +0,0 @@ - -const input_time = process.argv[2]; - - -//console.log("input_time") -//console.log(input_time) -/*function convertToSeconds(time) { - var parts = time.split(":"); - var seconds = 0; - for (var i = 0; i < parts.length; i++) { - var value = parseFloat(parts[i]); - console.log(`Parsing ${i}: ${value}`) - if (i === 0) { - console.log("as day"); - seconds += value * 86400; - } else if (i === 1) { - console.log("as hour"); - seconds += value * 3600; - } else if (i === 2) { - console.log("as minutes"); - seconds += value * 60; - } else if (i === 3) { - console.log("as seconds"); - seconds += value; - } - } - console.log(seconds); - return seconds; -}*/ -function convertToSeconds(time) { - var parts = time.split(":"); - var seconds = 0; - if(parts.length==1) { - var secs = parseFloat(parts[0]); - seconds += secs; - } - else if(parts.length==2) { - var minutes = parseFloat(parts[0]); - var secs = parseFloat(parts[1]); - seconds += minutes * 60 + secs; - } - else if(parts.length==3) { - var hours = parseFloat(parts[0]); - var minutes = parseFloat(parts[1]); - var secs = parseFloat(parts[2]); - seconds += hours * 3600 + minutes * 60 + secs; - } - else if(parts.length==4) { - var days = parseFloat(parts[0]); - var hours = parseFloat(parts[1]); - var minutes = parseFloat(parts[2]); - var secs = parseFloat(parts[3]); - seconds += days * 86400 + hours * 3600 + minutes * 60 + secs; - } - return seconds; -} -console.log(convertToSeconds(input_time)); diff --git a/get-curtime.js b/get-curtime.js deleted file mode 100644 index 61fca42..0000000 --- a/get-curtime.js +++ /dev/null @@ -1,6 +0,0 @@ -var currentTime = Date.now() / 1000; -console.log(currentTime); -// to reverse -/*var seconds = 1673721347.942; -var date = new Date(seconds * 1000); -console.log(date.toLocaleDateString()); console.log(date.toLocaleTimeString());*/ diff --git a/get-time.sh b/get-time.sh deleted file mode 100755 index 32d6e14..0000000 --- a/get-time.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -e - -usage() { - echo "usage $0 " -} - -# Check that a map name was provided -if [ -z "$1" ]; then - echo "Error: No map name provided" - exit 1 -fi - -WANTED_MAP="$1" -WANTED_CLASS="$2" -case "$WANTED_CLASS" in - s*) - WANTED_CLASS="soldier" - ;; - S*) - WANTED_CLASS="soldier" - ;; - d*) - WANTED_CLASS="demoman" - ;; - D*) - WANTED_CLASS="demoman" - ;; - *) - echo "Error: Invalid class. Must be either SOLDIER or DEMOMAN" - usage - exit - ;; -esac - -FILE_LOC="personal/completed.$WANTED_CLASS/" -files="$(ls "$FILE_LOC/$WANTED_MAP"*.json | sed 's/.json//' | sed 's/.*\///')" -count="$(echo "$files" | wc -l)" -if [ "$count" -gt 1 ]; then - if [ -e "$FILE_LOC/$WANTED_MAP.json" ]; then - files="$WANTED_MAP" - else - if [ "$(echo "$files" | head -l)" ]; then - echo "There are too many maps that match your request: \"$WANTED_MAP\"" - if [ "$count" -lt 5 ]; then - echo "The following maps match your request." - echo "$files" - fi - exit - fi - fi -fi - -# Get the duration for the map -duration=$(jq '.duration' $FILE_LOC/$files.json) - -# Convert the duration to a human-readable format -human_readable=$(awk -v t=$duration 'BEGIN{ - h=int(t/3600); - t-=h*3600; - m=int(t/60); - t-=m*60; - s=t - printf "%dh %dm %ds\n",h,m,s -}') - -echo "Run time for $files: $human_readable" diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..92e7b4d --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module gojump + +go 1.21.1 diff --git a/gojump.sh b/gojump.sh new file mode 100644 index 0000000..b633201 --- /dev/null +++ b/gojump.sh @@ -0,0 +1,2 @@ +#!/bin/sh +go run main.go "$@" diff --git a/list-completed-tiers.sh b/list-completed-tiers.sh deleted file mode 100755 index f175bf7..0000000 --- a/list-completed-tiers.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -# Check that a class was provided -if [ -z "$1" ]; then - echo "Error: No class provided" - exit 1 -fi - -# Normalize the class argument to uppercase -class=$(echo $1 | tr '[:lower:]' '[:upper:]') - -# Check that the class is either SOLDIER or DEMOMAN -case "$class" in - s*) - class="SOLDIER" - ;; - S*) - class="SOLDIER" - ;; - d*) - class="DEMOMAN" - ;; - D*) - class="DEMOMAN" - ;; - *) - echo "Error: Invalid class. Must be either SOLDIER or DEMOMAN" - exit 1 - ;; -esac - -# Get a list of maps -maps=$(ls personal/completed.soldier/) - -# Iterate over the list of maps -for map in $maps; do - # Strip the .json extension from the map name - map_name=$(echo $map | sed 's/.json//') - - # Call the list-tier.sh script with the map name and class as arguments - ./list-tier.sh $map_name $class -done diff --git a/list-random-midtier.sh b/list-random-midtier.sh deleted file mode 100644 index 2e500a7..0000000 --- a/list-random-midtier.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -sh list-tiers.sh s | grep -E '(T3|T4)' | shuf | head -n 6 diff --git a/list-random.sh b/list-random.sh deleted file mode 100644 index 963e77e..0000000 --- a/list-random.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -sh list-tiers.sh s | grep -vE '(T5|T6|T0|Tnull)' | shuf | head -n6 diff --git a/list-tier.sh b/list-tier.sh deleted file mode 100755 index 53a594f..0000000 --- a/list-tier.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -e - -usage() { - echo "usage list-tier " -} - -if [ $# -lt 2 ]; then - echo "Error: At least two arguments is required" - usage - exit 1 -fi - -WANTED_MAP="$1" -WANTED_CLASS="$2" -case "$WANTED_CLASS" in - s*) - WANTED_CLASS="soldier" - ;; - S*) - WANTED_CLASS="soldier" - ;; - d*) - WANTED_CLASS="demoman" - ;; - D*) - WANTED_CLASS="demoman" - ;; - *) - echo "Error: Invalid class. Must be either SOLDIER or DEMOMAN" - usage - exit - ;; -esac - -FILE_LOC="database/map_info/" -files="$(ls $FILE_LOC/$WANTED_MAP*.json | sed 's/.json//' | sed 's/.*\///')" -count="$(echo "$files" | wc -l)" -if [ "$count" -gt 1 ]; then - if [ -e "$FILE_LOC/$WANTED_MAP.json" ]; then - files="$WANTED_MAP" - else - if [ "$(echo "$files" | head -l)" ]; then - echo "There are too many maps that match your request: \"$WANTED_MAP\"" - if [ "$count" -lt 5 ]; then - echo "The following maps match your request." - echo "$files" - fi - exit - fi - fi -fi - -JSON_FILEPATH="$FILE_LOC/$files.json" -FOUND_MAP_TIER="$(jq .tiers."$WANTED_CLASS" "$JSON_FILEPATH")" -FOUND_MAP_NAME="$(jq .name "$JSON_FILEPATH" | tr -d '"')" -echo "$FOUND_MAP_NAME: T$FOUND_MAP_TIER" - - diff --git a/list-tiers.sh b/list-tiers.sh deleted file mode 100755 index 6ca2e64..0000000 --- a/list-tiers.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -e - -usage() { - echo "usage list-tiers " -} - -if [ $# -lt 1 ]; then - echo "Error: At least one argument is required" - usage - exit 1 -fi - -WANTED_CLASS="$1" -case "$WANTED_CLASS" in - s*) - WANTED_CLASS="soldier" - ;; - S*) - WANTED_CLASS="soldier" - ;; - d*) - WANTED_CLASS="demoman" - ;; - D*) - WANTED_CLASS="demoman" - ;; - *) - echo "Unknown class: $1" - usage - exit - ;; -esac - -for i in database/map_info/*.json; do - # Strip the .json extension from the map name - map_name=$(echo $i | sed 's/.json//' | sed 's/.*\///') - - # Call the list-tier.sh script with the map name and class as arguments - ./list-tier.sh $map_name $WANTED_CLASS -done - diff --git a/list-uncompleted-random-midtier.sh b/list-uncompleted-random-midtier.sh deleted file mode 100644 index 7086817..0000000 --- a/list-uncompleted-random-midtier.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -sh list-uncompleted-tiers.sh s | grep -E '(T3|T4)' | shuf | head diff --git a/list-uncompleted-random.sh b/list-uncompleted-random.sh deleted file mode 100644 index c0e3767..0000000 --- a/list-uncompleted-random.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -sh list-uncompleted-tiers.sh s | grep -vE '(T4|T5|T6|T0|Tnull)' | shuf | head diff --git a/list-uncompleted-tiers.sh b/list-uncompleted-tiers.sh deleted file mode 100755 index 0717b18..0000000 --- a/list-uncompleted-tiers.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -# Check that a class was provided -if [ -z "$1" ]; then - echo "Error: No class provided" - exit 1 -fi - -# Normalize the class argument to uppercase -class=$(echo $1 | tr '[:lower:]' '[:upper:]') - -# Check that the class is either SOLDIER or DEMOMAN -case "$class" in - s*) - class="soldier" - ;; - S*) - class="soldier" - ;; - d*) - class="demoman" - ;; - D*) - class="demoman" - ;; - *) - echo "Error: Invalid class. Must be either SOLDIER or DEMOMAN" - exit 1 - ;; -esac - -# Get a list of maps -completed_maps=$(ls personal/completed.$class/ | sed 's/.json//') - -for i in database/map_info/*.json; do - # Strip the .json extension from the map name - map_name=$(echo $i | sed 's/.json//' | sed 's/.*\///') - - # Call the list-tier.sh script with the map name and class as arguments - [ "$(echo "$map_name" | grep -v "$completed_maps")" == "$mapname" ] || ./list-tier.sh $map_name $class -done \ No newline at end of file diff --git a/main.go b/main.go new file mode 100644 index 0000000..2cc4c0c --- /dev/null +++ b/main.go @@ -0,0 +1,492 @@ +package main + +import ( + "encoding/json" + "fmt" + "os" + "path/filepath" + "slices" + "strconv" + "strings" + "time" +) + +type JumpDatabaseMapEntry struct { + Authors []struct { + Name string `json:"name"` + Player struct { + SteamID string `json:"steamId"` + Country string `json:"country"` + } `json:"player"` + } `json:"authors"` + ID string `json:"id"` + Name string `json:"name"` + Videos struct { + Soldier string `json:"soldier"` + Demoman string `json:"demoman"` + } `json:"videos"` + Tiers struct { + Soldier int `json:"soldier"` + Demoman int `json:"demoman"` + } `json:"tiers"` + Zones struct { + Bonus []struct { + ID int `json:"id"` + Map struct { + Tiers struct { + Soldier int `json:"soldier"` + Demoman int `json:"demoman"` + } `json:"tiers"` + } `json:"map"` + Type string `json:"type"` + Zoneindex int `json:"zoneindex"` + CustomName any `json:"customName"` + } `json:"bonus"` + BonusEnd []struct { + ID int `json:"id"` + Map struct { + Tiers struct { + Soldier int `json:"soldier"` + Demoman int `json:"demoman"` + } `json:"tiers"` + } `json:"map"` + Type string `json:"type"` + Zoneindex int `json:"zoneindex"` + CustomName any `json:"customName"` + } `json:"bonusEnd"` + Checkpoint []struct { + ID int `json:"id"` + Map struct { + Tiers struct { + Soldier int `json:"soldier"` + Demoman int `json:"demoman"` + } `json:"tiers"` + } `json:"map"` + Type string `json:"type"` + Zoneindex int `json:"zoneindex"` + CustomName any `json:"customName"` + } `json:"checkpoint"` + Course []struct { + ID int `json:"id"` + Map struct { + Tiers struct { + Soldier int `json:"soldier"` + Demoman int `json:"demoman"` + } `json:"tiers"` + } `json:"map"` + Type string `json:"type"` + Zoneindex int `json:"zoneindex"` + CustomName string `json:"customName"` + } `json:"course"` + CourseEnd []struct { + ID int `json:"id"` + Map struct { + Tiers struct { + Soldier int `json:"soldier"` + Demoman int `json:"demoman"` + } `json:"tiers"` + } `json:"map"` + Type string `json:"type"` + Zoneindex int `json:"zoneindex"` + CustomName any `json:"customName"` + } `json:"courseEnd"` + Linear []any `json:"linear"` + Map []struct { + ID int `json:"id"` + Map struct { + Tiers struct { + Soldier int `json:"soldier"` + Demoman int `json:"demoman"` + } `json:"tiers"` + } `json:"map"` + Type string `json:"type"` + Zoneindex int `json:"zoneindex"` + CustomName any `json:"customName"` + } `json:"map"` + MapEnd []struct { + ID int `json:"id"` + Map struct { + Tiers struct { + Soldier int `json:"soldier"` + Demoman int `json:"demoman"` + } `json:"tiers"` + } `json:"map"` + Type string `json:"type"` + Zoneindex int `json:"zoneindex"` + CustomName any `json:"customName"` + } `json:"mapEnd"` + Misc []struct { + ID int `json:"id"` + Map struct { + Tiers struct { + Soldier int `json:"soldier"` + Demoman int `json:"demoman"` + } `json:"tiers"` + } `json:"map"` + Type string `json:"type"` + Zoneindex int `json:"zoneindex"` + CustomName string `json:"customName"` + } `json:"misc"` + Trick []struct { + ID int `json:"id"` + Map struct { + Tiers struct { + Soldier int `json:"soldier"` + Demoman int `json:"demoman"` + } `json:"tiers"` + } `json:"map"` + Type string `json:"type"` + Zoneindex int `json:"zoneindex"` + CustomName string `json:"customName"` + } `json:"trick"` + } `json:"zones"` +} + +type JumpmapRunTimeEntry struct { + Nontempusrun bool `json:"nontempusrun"` + ManuallyCreated bool `json:"manually_created"` + ID int `json:"id"` + Duration float64 `json:"duration"` + Rank int `json:"rank"` + Date float64 `json:"date"` + Class string `json:"class"` + Name string `json:"name"` +} + +func check(e error) { + if e != nil { + panic(e) + } +} + +func ConvertPrettyTimeToSeconds(time string) float64 { + parts := strings.Split(time, ":") + seconds := 0.0 + + if len(parts) == 1 { + secs, _ := strconv.ParseFloat(parts[0], 64) + seconds += secs + } else if len(parts) == 2 { + minutes, _ := strconv.ParseFloat(parts[0], 64) + secs, _ := strconv.ParseFloat(parts[1], 64) + seconds += minutes*60 + secs + } else if len(parts) == 3 { + hours, _ := strconv.ParseFloat(parts[0], 64) + minutes, _ := strconv.ParseFloat(parts[1], 64) + secs, _ := strconv.ParseFloat(parts[2], 64) + seconds += hours*3600 + minutes*60 + secs + } else if len(parts) == 4 { + days, _ := strconv.ParseFloat(parts[0], 64) + hours, _ := strconv.ParseFloat(parts[1], 64) + minutes, _ := strconv.ParseFloat(parts[2], 64) + secs, _ := strconv.ParseFloat(parts[3], 64) + seconds += days*86400 + hours*3600 + minutes*60 + secs + } + return seconds +} + +func ExtractBareFilenameFromPath(in_path string) string { + baseName := filepath.Base(in_path) + lastDotIndex := strings.LastIndex(baseName, ".") + if lastDotIndex != -1 { + fileNameWithoutExt := baseName[:lastDotIndex] + return fileNameWithoutExt + } else { + // If there's no extension, the whole base name is the filename + return baseName + } +} + +/*func RemoveElement(slice []any, s int) []any { + return append(slice[:s], slice[s+1:]...) +}*/ + +const ( + JumpmapTypeSoldier = 0 + JumpmapTypeDemoman = 1 +) + +func GetFileNameFromJumpmapRunTypeEnum(run_type int) string { + if run_type == JumpmapTypeSoldier { + return "soldier" + } + if run_type == JumpmapTypeDemoman { + return "demoman" + } + panic("unknown jumpmap run types!") + // return "unknown" +} + +func StringToJumpmapRunType(jump_map_wanted_type string) int { + switch jump_map_wanted_type { + case "s": + fallthrough + case "soldier": + return JumpmapTypeSoldier + case "d": + fallthrough + case "demoman": + return JumpmapTypeDemoman + default: + } + panic("Trying to convert to jumpmap run type (soldier/demo) with incorrect string data!") +} + +var mapinfo_database_location = filepath.Join("database", "map_info") + +func ReadDatabaseFile(jump_map_name string) JumpDatabaseMapEntry { + data, error := os.ReadFile(filepath.Join(mapinfo_database_location, jump_map_name+".json")) + check(error) + + var jump_map JumpDatabaseMapEntry + if err := json.Unmarshal(data, &jump_map); err != nil { + check(err) + } + + return jump_map +} + +func ReadRunRecordFile(jump_map_type int, jump_map_name string) JumpmapRunTimeEntry { + data, error := os.ReadFile(filepath.Join("personal", "completed."+GetFileNameFromJumpmapRunTypeEnum(jump_map_type), jump_map_name+".json")) + check(error) + + var jump_map JumpmapRunTimeEntry + if err := json.Unmarshal(data, &jump_map); err != nil { + check(err) + } + + return jump_map +} + +func PrintRecord(printable_record any) string { + data, error := json.MarshalIndent(printable_record, "", "\t") + check(error) + return string(data) +} + +func FindMapNameFromPartial(partial_jump_map_name string) string { + if !strings.HasPrefix(partial_jump_map_name, "jump_") { + partial_jump_map_name = "jump_" + partial_jump_map_name + } + + found_files, err := filepath.Glob(filepath.Join(mapinfo_database_location, partial_jump_map_name+"*.json")) + check(err) + found_file_count := len(found_files) + if found_file_count > 1 { + found_map := filepath.Join(filepath.Join(mapinfo_database_location, partial_jump_map_name+".json")) + if _, err := os.Stat(found_map); err == nil { + return ExtractBareFilenameFromPath(found_map) + } else { + fmt.Printf("There are too many maps that match your request: \"%s\"\n", partial_jump_map_name) + if found_file_count < 5 { + fmt.Println("The following maps match your request:") + fmt.Println(strings.Join(found_files, "\n")) + } + os.Exit(2) + } + } + return ExtractBareFilenameFromPath(found_files[0]) +} + +func GetPrettyMapTime(jump_map_type int, jump_map_name string) string { + run_record := ReadRunRecordFile(jump_map_type, jump_map_name) + duration := time.Duration(run_record.Duration) * time.Second + hours := int(duration.Hours()) + minutes := int(duration.Minutes()) % 60 + seconds := int(duration.Seconds()) % 60 + return fmt.Sprintf("%dh %dm %ds", hours, minutes, seconds) +} + +func GetMapList() []string { + found_files, err := filepath.Glob(filepath.Join(mapinfo_database_location, "*.json")) + check(err) + for index, fle := range found_files { + found_files[index] = ExtractBareFilenameFromPath(fle) + } + return found_files +} + +func GetCompletedMapList(jump_map_type int) []string { + found_files, err := filepath.Glob(filepath.Join("personal", "completed."+GetFileNameFromJumpmapRunTypeEnum(jump_map_type), "*.json")) + check(err) + for index, fle := range found_files { + found_files[index] = ExtractBareFilenameFromPath(fle) + } + return found_files +} + +func GetMapTier(jump_map_type int, jump_map_name string) int { + map_info := ReadDatabaseFile(jump_map_name) + tier := func() int { + switch jump_map_type { + case JumpmapTypeDemoman: + return map_info.Tiers.Demoman + case JumpmapTypeSoldier: + return map_info.Tiers.Soldier + default: + panic("unselectable JumpmapType enum option other than solly or demo") + } + }() + return tier +} + +func IsOnMapIgnorelist(jump_map_name string) bool { + if jump_map_name == "base_jump" { + return true + } + return false +} + +func PrintMapUsageInfo() { + fmt.Println("usage: " + os.Args[0] + "[operation] ") +} + +/*func PrintClassUsageInfo() { +fmt.Println("usage: " + os.Args[0] + "[operation] ") +}*/ + +func PrintUsageInfo() { + fmt.Println("usage: " + os.Args[0] + " [operation] ") + fmt.Println("try running \"" + os.Args[0] + " help\" for additional info on operations") +} + +func PrintHelpInfo() { + PrintUsageInfo() + fmt.Println("help - Get the help you are currently seeing") + fmt.Println("get-time - Get a personal maps completion time") + fmt.Println("list-tier - Get the difficulty tier of a particular map") + fmt.Println("list-tiers - Get all of the difficulty tiers listed out, useful for combining with grep!") + fmt.Println("list-maps - Get a list of all maps available") + fmt.Println("convert-time - Convert a time from HH:MM:SS.MS to seconds, for use in storing times in the database") + fmt.Println("get-curtime - Get the current unix date, time in seconds") +} + +func main() { + argument_length := len(os.Args) + if argument_length < 2 { + PrintUsageInfo() + os.Exit(42) + } + + if os.Args[1] == "help" { + PrintHelpInfo() + os.Exit(0) + } + + if os.Args[1] == "get-time" { + if argument_length < 3 { + fmt.Println("Error: No map name provided") + PrintMapUsageInfo() + os.Exit(1) + } + wanted_class := JumpmapTypeSoldier + if argument_length < 4 { + fmt.Println("Warning: No classname provided, using soldier as default") + } else { + wanted_class = StringToJumpmapRunType(os.Args[3]) + } + // try { + wanted_map := FindMapNameFromPartial(os.Args[2]) + //} catch + + fmt.Println("Run time for " + wanted_map + ": " + GetPrettyMapTime(wanted_class, wanted_map)) + os.Exit(0) + } + + if os.Args[1] == "list-tier" { + if argument_length < 3 { + fmt.Println("Error: No map name provided") + PrintMapUsageInfo() + os.Exit(1) + } + wanted_class := JumpmapTypeSoldier + if argument_length < 4 { + fmt.Println("Warning: No classname provided, using soldier as default") + } else { + wanted_class = StringToJumpmapRunType(os.Args[3]) + } + wanted_map := FindMapNameFromPartial(os.Args[2]) + + fmt.Printf("%s: T%d\n", wanted_map, GetMapTier(wanted_class, wanted_map)) + os.Exit(0) + } + if os.Args[1] == "list-tiers" { + + wanted_class := JumpmapTypeSoldier + if argument_length < 3 { + fmt.Println("Warning: No classname provided, using soldier as default") + } else { + wanted_class = StringToJumpmapRunType(os.Args[3]) + } + + map_list := GetMapList() + fmt.Println("Found map tiers:") + for _, mapp := range map_list { + fmt.Printf("%s: T%d\n", mapp, GetMapTier(wanted_class, mapp)) + } + os.Exit(0) + } + if os.Args[1] == "list-completed-tiers" { + + wanted_class := JumpmapTypeSoldier + if argument_length < 3 { + fmt.Println("Warning: No classname provided, using soldier as default") + } else { + wanted_class = StringToJumpmapRunType(os.Args[3]) + } + + map_list := GetCompletedMapList(wanted_class) + fmt.Println("Found completed map tiers:") + for _, mapp := range map_list { + if !IsOnMapIgnorelist(mapp) { + fmt.Printf("%s: T%d\n", mapp, GetMapTier(wanted_class, mapp)) + } + } + os.Exit(0) + } + if os.Args[1] == "list-uncompleted-tiers" { + wanted_class := JumpmapTypeSoldier + if argument_length < 3 { + fmt.Println("Warning: No classname provided, using soldier as default") + } else { + wanted_class = StringToJumpmapRunType(os.Args[3]) + } + map_list := GetMapList() + completed_map_list := GetCompletedMapList(wanted_class) + fmt.Println("Found uncompleted map tiers:") + for _, mapp := range map_list { + if !slices.Contains(completed_map_list, mapp) { + fmt.Printf("%s: T%d\n", mapp, GetMapTier(wanted_class, mapp)) + } + } + os.Exit(0) + } + + if os.Args[1] == "list-maps" { + map_list := GetMapList() + fmt.Println("Found maps:") + for _, mapp := range map_list { + fmt.Println(mapp) + } + os.Exit(0) + } + + if os.Args[1] == "convert-time" { + if argument_length < 3 { + fmt.Println("Error: No time to convert into seconds???...???") + os.Exit(1) + } + fmt.Printf("Converted-Time-To-Seconds: %f\n", ConvertPrettyTimeToSeconds(os.Args[2])) + os.Exit(0) + } + if os.Args[1] == "get-curtime" { + currentTime := time.Now() + fractional_nanosecond := float64(currentTime.UnixNano()) + unix_seconds := fractional_nanosecond / 1e9 + + fmt.Printf("Curtime: %f\n", unix_seconds) + os.Exit(0) + } + + PrintUsageInfo() +}