12345678910111213141516171819202122232425262728293031323334353637383940 |
- # $stock_item
- !! generic function to be used to stock items in stores
- !! see [pharmacy] for an example of use
- !! ARGS 0 is the value identifying when the item is owned
- !! it is assumed that anything >= the value is acceptable, this allows for upgrades like regular tv to plasma
- !! ARGS 1 is the item description
- !! ARGS 2 is the price
- !! ARGS 3 is the variable name for the item
- !! ARGS 4 is the location to go back to
- !! ARGS 5 is $metka
- !! ARGS 6 > 0 to force-disable buy link
- !! ARGS 7 is replacement text for 6
- count = ARGS[0]
- $item = $ARGS[1]
- !price = ARGS[2]
- !$variable_name = $ARGS[3]
- !$location = $ARGS[4]
- dynamic 'in_inventory = <<$ARGS[3]>>'
- $RESULT = '<tr>' + _
- '<td align="center"><<FUNC(''$stock_item_info'', $ARGS[3])>></td>' + _
- '<td align="center"><<$ARGS[1]>></td>'
- if ARGS[6] > 0:
- $RESULT += '<td colspan=2 align=center>'+$ARGS[7]+'</td>'
- else
- !$buy_link = '<a' + iif(money >= price, ' href="exec: gs ''$buy_item'', <<count>>, ''<<$item>>'', <<price>>, ''<<$variable_name>>'', ''<<$location>>''">buy ','>buy ') + count + '</a>'
- $RESULT += '<td align="left">(you have <<in_inventory>>)</td>'
- if money >= ARGS[2]:
- $RESULT += '<td align="left"><a href="exec: gs ''$buy_item'', <<ARGS[0]>>, ''<<$ARGS[1]>>'', <<ARGS[2]>>, ''<<$ARGS[3]>>'', ''<<$ARGS[4]>>'', ''<<$ARGS[5]>>''">buy ' + count + '</a>'
- else
- $RESULT += '<td></td>'
- end
- end
- $RESULT += '<td align="left">for <<ARGS[2]>> <b>₽</b></td>' + _
- '</tr>'
- --- $stock_item ---------------------------------
|