diff --git a/swat-codegen/PKGBUILD b/swat-codegen/PKGBUILD index 1a2b6ed..2c183be 100644 --- a/swat-codegen/PKGBUILD +++ b/swat-codegen/PKGBUILD @@ -1,8 +1,8 @@ # Maintainer: Zergling_man, from fedora.email pkgname=swat-codegen -pkgver=1.0.5 -pkgrel=2 +pkgver=1.0.6 +pkgrel=1 pkgdesc="A simple CLI interface to RCPDv3, the rank code management service for the game SWAT: Aftermath" arch=('any') url=http://rakka.au/contact diff --git a/swat-codegen/codegen.sh b/swat-codegen/codegen.sh index c08bac6..4efe657 100755 --- a/swat-codegen/codegen.sh +++ b/swat-codegen/codegen.sh @@ -65,8 +65,9 @@ function builds function save { if [ -n "$2" ]; then name=',"buildName":"'"${*:2}"'"'; fi - post rank-code '{"rankCode":"'$1'"'"$name"'}' | jq - if [ -z "$2" ]; then delete_code $1; fi # Don't bother storing any build that doesn't have a name. Assume it's just logging the results of a game. + res=`post rank-code '{"rankCode":"'$1'"'"$name"'}'` + jq <<< "$res" + if [ -z "`jq -r '.buildName // ""' <<< $"res"`" ]; then delete_code $1; fi # Don't bother storing any build that doesn't have a name. Assume it's just logging the results of a game. } function generate @@ -78,8 +79,8 @@ function generate elif [ $length -eq 5 ]; then IFS=/ read class armour trait spec talent <<< "$*" elif [ $length -eq 4 ]; then IFS=/ read class trait spec talent <<< "$*"; fi # Probably a borg or a wm. if [ -z "$gun" ]; then - if [ "${class:2}" = "wm" ]; then gun=${class%wm}; class=wm - elif [ "${class:1}" = "mav" ] || [ "${class:2}" = "mav" ]; then gun=${class%mav}; class=mav; fi + if [ "${class%wm}" != "$class" ]; then gun=${class%wm}; class=wm + elif [ "${class%mav}" != "$class" ]; then gun=${class%mav}; class=mav; fi fi res=0 lookup class "$class"