Advertisement
MWTab

Untitled

Feb 29th, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #! /bin/bash
  2.  
  3. first=""
  4. var=""
  5. if [ -n "$2" ];then
  6. limit=$2
  7. else
  8. limit=10000
  9. fi
  10. if [ -n "$1" ];then
  11. case $1 in
  12. -c) field=3; type="total cost";;
  13. -s) field=7; type="total skillpoints";;
  14. -q) field=6; type="total questpoints";;
  15. -m) field=8; type="total maxstats";;
  16. -g) field=4; type="total gold";;
  17. *) echo "Usage: $0 [-g|-m|-q|-s|-c] [limit levels]. g=gold, q=questpoints, s=skillpoints, m=maxstats, c=xp cost."; exit 1;;
  18. esac
  19. else
  20. field=7; type="total skillpoints"
  21. fi
  22. for x in $(cat levels |tr -s ' ' |cut -d\ -f$field |head -n $limit);do
  23. if [ -z "$first" ];then
  24. var="$x"
  25. first="y"
  26. else
  27. var="$var+$x"
  28. fi
  29. done
  30. echo "$type: $(echo "$var" |bc)"
  31. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement