Fetching gun from class now slightly more reliable, also it only deletes builds that don't have a name in the response, rather than the request; though currently that's the same

This commit is contained in:
Zergling_man 2024-11-12 12:21:12 +11:00
parent e82d65061e
commit d77499c011
2 changed files with 7 additions and 6 deletions

View File

@ -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

View File

@ -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"