_stock_item.qsrc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. !! ARGS 8 is custom buy link when ARGS 6 > 0
  14. !$location = $ARGS[4]
  15. count = ARGS[0]
  16. $item = $ARGS[1]
  17. !price = ARGS[2]
  18. !$variable_name = $ARGS[3]
  19. !$location = $ARGS[4]
  20. dynamic 'in_inventory = <<$ARGS[3]>>'
  21. $RESULT = '<tr>' + _
  22. '<td align="center"><<FUNC(''$stock_item_info'', $ARGS[3])>></td>' + _
  23. '<td align="center"><<$ARGS[1]>></td>'
  24. if ARGS[6] > 0:
  25. $RESULT += '<td align=left>'+$ARGS[7]+'</td><td align=left>'+$ARGS[8]+'</td>'
  26. else
  27. $RESULT += '<td align="left">(you have <<in_inventory>>)</td>'
  28. if money >= ARGS[2]:
  29. $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>'
  30. else
  31. $RESULT += '<td></td>'
  32. end
  33. end
  34. $RESULT += '<td align="left">for <<ARGS[2]>> <b>₽</b></td>' + _
  35. '</tr>'
  36. --- $stock_item ---------------------------------