Browse Source

Shop rewrite

Rewrite of shop (supermarket) to clean up code and fix missing section
bugs.
Added new single_stock_item and buy_single_item functions, based on
stock_item and buy_item, to allow for abstracted shopping of single
purchase items (like TVs).
Thekingofsweden 9 years ago
parent
commit
eba1a357c9
4 changed files with 281 additions and 808 deletions
  1. 2 0
      glife.qproj
  2. 15 0
      locations/_buy_single_item
  3. 29 0
      locations/_single_stock_item
  4. 235 808
      locations/shop

+ 2 - 0
glife.qproj

@@ -667,7 +667,9 @@
       <Location name="portnoi2"/>
       <Location name="sexorg"/>
       <Location name="$stock_item"/>
+	  <Location name="$single_stock_item"/>
       <Location name="$buy_item"/>
+	  <Location name="$buy_single_item"/>
     </Folder>
     <Folder name="Etogame">
       <Location name="etoexhib"/>

+ 15 - 0
locations/_buy_single_item

@@ -0,0 +1,15 @@
+# $buy_single_item
+!! This buys an item and sets the value of the underlying variable to the specific value
+!! For example, buying a plasma tv sets tv = 2
+
+!! ARGS 0 is the value to set the variable to
+!! 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
+
+dynamic "set <<$ARGS[3]>> = <<ARGS[0]>>"
+set money -= ARGS[2]
+gt $ARGS[4], '<font color="green">You bought a <b><<$ARGS[1]>></b>.</font>'
+
+--- $buy_single_item ---------------------------------

+ 29 - 0
locations/_single_stock_item

@@ -0,0 +1,29 @@
+# $single_stock_item
+!! generic function to be used to stock single purchase items in stores
+!! see # shop, specifically the household appliances section 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
+
+!! This will check to see if the item is already owned
+dynamic "$RESULT = iif(<<$ARGS[3]>> >= <<ARGS[0]>>, '', 'not owned')"
+if $RESULT = '':
+	exit
+end
+
+$RESULT = '<tr>' + _
+'<td align="center"><<$ARGS[1]>></td>' + _
+'<td align="left">costs <<ARGS[2]>> rubles</td>' + _
+'<td align="right">'
+
+if money >= ARGS[2]:
+	$RESULT += '<a href="exec: gs ''$buy_single_item'', <<ARGS[0]>>, ''<<$ARGS[1]>>'', <<ARGS[2]>>, ''<<$ARGS[3]>>'', ''<<$ARGS[4]>>''">buy</a>'
+end
+
+$RESULT += '</td></tr>'
+
+--- $single_stock_item ---------------------------------

File diff suppressed because it is too large
+ 235 - 808
locations/shop


Some files were not shown because too many files changed in this diff