Reuse functions in use_generic() - dotg - Day Of The GrParazyd | |
git clone git://bitreich.org/dotg git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d… | |
Log | |
Files | |
Refs | |
Tags | |
--- | |
commit cdb81a83f5ba6ba11c731be0480b078535105922 | |
parent fbb4090a34602bcd45831df1f262b4eaf8ad24c8 | |
Author: parazyd <[email protected]> | |
Date: Fri, 23 Feb 2018 20:41:37 +0100 | |
Reuse functions in use_generic() | |
Diffstat: | |
M act-i/functions | 54 ++++++++++++-----------------… | |
1 file changed, 21 insertions(+), 33 deletions(-) | |
--- | |
diff --git a/act-i/functions b/act-i/functions | |
@@ -143,41 +143,29 @@ find_usecase() { | |
} | |
use_generic() { | |
- case "$1" in | |
- Cigarettes) | |
- oldcount="$(cat $inventory/Cigarettes)" | |
- newcount="$(( $oldcount -1 ))" | |
- printf "$newcount" > "$inventory/Cigarettes" | |
- if [ "$newcount" -lt 1 ]; then | |
- rm -f "$inventory/Cigarettes" | |
- fi | |
- echo "You smoke a cigarette." | |
- return | |
- ;; | |
- Beers) | |
- oldcount="$(cat $inventory/Beers)" | |
- newcount="$(( $oldcount -1 ))" | |
- printf "$newcount" > "$inventory/Beers" | |
- if [ "$newcount" -lt 1 ]; then | |
- rm -f "$inventory/Beers" | |
- fi | |
- echo "You drink a beer." | |
- return | |
- ;; | |
- Plastic_bottle_of_rakia) | |
- cat <<EOM | |
-You take a sip of rakia. | |
- | |
-You feel drunk. | |
-EOM | |
- ;; | |
+ case "$1" in | |
+ Cigarettes) | |
+ dropitem "$item" | |
+ echo "You smoke a cigarette." | |
+ ;; | |
+ | |
+ Beers) | |
+ dropitem "$item" | |
+ echo "You drink a beer." | |
+ ;; | |
+ | |
+ Plastic_bottle_of_rakia) | |
+ _msg "You take a sip of rakia. | |
+ | |
+ You feel drunk." | |
+ ;; | |
+ | |
Keychain_with_a_key) | |
- cat <<EOM | |
-You try to unlock things, but there's no place to use the key. | |
+ _msg "You try to unlock things, but there's no place t… | |
-You put it back in your pocket. | |
-EOM | |
- esac | |
+ You put it back in your pocket." | |
+ ;; | |
+ esac | |
} | |
use_specific() { |