_stock_item.qsrc 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # $stock_item
  2. !! generic function to be used to stock items in stores
  3. !! see [pharmacy] for an example of use
  4. !! ARGS 0 is the value identifying when the item is owned
  5. !! it is assumed that anything >= the value is acceptable, this allows for upgrades like regular tv to plasma
  6. !! ARGS 1 is the item description
  7. !! ARGS 2 is the price
  8. !! ARGS 3 is the variable name for the item
  9. !! ARGS 4 is the location to go back to
  10. !! ARGS 5 is $metka
  11. !! ARGS 6 > 0 to force-disable buy link
  12. !! ARGS 7 is replacement text for 6
  13. count = ARGS[0]
  14. $item = $ARGS[1]
  15. !price = ARGS[2]
  16. !$variable_name = $ARGS[3]
  17. !$location = $ARGS[4]
  18. dynamic 'in_inventory = <<$ARGS[3]>>'
  19. $RESULT = '<tr>' + _
  20. '<td align="center"><<FUNC(''$stock_item_info'', $ARGS[3])>></td>' + _
  21. '<td align="center"><<$ARGS[1]>></td>'
  22. if ARGS[6] > 0:
  23. $RESULT += '<td colspan=2 align=center>'+$ARGS[7]+'</td>'
  24. else
  25. !$buy_link = '<a' + iif(money >= price, ' href="exec: gs ''$buy_item'', <<count>>, ''<<$item>>'', <<price>>, ''<<$variable_name>>'', ''<<$location>>''">buy ','>buy ') + count + '</a>'
  26. $RESULT += '<td align="left">(you have <<in_inventory>>)</td>'
  27. if money >= ARGS[2]:
  28. $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>'
  29. else
  30. $RESULT += '<td></td>'
  31. end
  32. end
  33. $RESULT += '<td align="left">for <<ARGS[2]>> <b>₽</b></td>' + _
  34. '</tr>'
  35. --- $stock_item ---------------------------------