35 lines
477 B
Plaintext
35 lines
477 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
itemdir="$( dirname $0 )/../items"
|
||
|
|
||
|
|
||
|
##
|
||
|
# Retrieve name of item from item descriptor file
|
||
|
#
|
||
|
# @param string item tag
|
||
|
#
|
||
|
# @output full item name
|
||
|
##
|
||
|
inv-item-name()
|
||
|
{
|
||
|
local id=$( inv-item-id "$1" )
|
||
|
|
||
|
# we're looking for the NAME line, in the format of "NAME <full name>"
|
||
|
cat "$itemdir/$id" <<< "$1" \
|
||
|
| grep '^NAME ' \
|
||
|
| cut -d' ' -f2-
|
||
|
}
|
||
|
|
||
|
|
||
|
inv-item-id()
|
||
|
{
|
||
|
cut -d':' -f2 <<< "$1"
|
||
|
}
|
||
|
|
||
|
|
||
|
inv-item-count()
|
||
|
{
|
||
|
cut -d':' -f1 <<< "$1"
|
||
|
}
|
||
|
|