|
@@ -755,20 +755,23 @@ if $ARGS[0] = 'clothing_state':
|
|
|
end
|
|
|
|
|
|
|
|
|
+
|
|
|
!! Author - Hooded Silence
|
|
|
!! Date created - 26 Aug 22
|
|
|
!! Payment system - Used to pay for items in various game locations
|
|
|
+!! v. 02 - Refactoring to make usage simpler using the epayments array
|
|
|
+
|
|
|
+!! command syntax: gs 'shortgs','payments'
|
|
|
+!! All variabls are initiated at point of origin
|
|
|
!!
|
|
|
-!! command syntax: gs 'shortgs', 'payments', value, 'method', 'item variable', item quantity, 'item description', 'return location', 'act'
|
|
|
-!!
|
|
|
-!! value = cost of goods. Required
|
|
|
-!! method = how it''s to be paid cash or card. leave blank for both. Optional
|
|
|
-!! Item Description - What's been bought. Required
|
|
|
-!! item variable = item variable to be purchased to be added to players inventory. Optional.
|
|
|
-!! Item quantity = How many items to be added. Defaults to one - Optional.
|
|
|
-!! Return Location - Where do you want the character to go to, optional falls back to starting location.
|
|
|
-!! Act - If there's a specific act to return to. Optional
|
|
|
-!!
|
|
|
+!! epayments[value] = cost of goods. Required
|
|
|
+!! $epayments[method] = how it''s to be paid cash or card. leave blank for both. Optional
|
|
|
+!! $epayments[description] = Item Description - What's been bought. Required
|
|
|
+!! $epayments[item_variable] = item variable to be purchased to be added to players inventory. Optional.
|
|
|
+!! epayments[quantity] = How many items to be added. Defaults to one - Optional.
|
|
|
+!! $epayments[loc] = Where do you want the character to go to, optional falls back to starting location if set. Optional
|
|
|
+!! $epayments[act] = If there's a specific act to return to. Optional
|
|
|
+!! $epayments[banner] = banner image for the sale. Optional
|
|
|
!! Optional with no content are ignored.
|
|
|
|
|
|
!! Use stock image for the purchase screen?
|
|
@@ -776,57 +779,39 @@ end
|
|
|
if $ARGS[0] = 'payments':
|
|
|
*clr & cla
|
|
|
|
|
|
- if ARGS[1] = 0:
|
|
|
+ if epayments['value'] = 0:
|
|
|
msg '<b>Error, Cash Value not set.</b>'
|
|
|
end
|
|
|
- if $ARGS[5] = '':
|
|
|
+ if $epayments['description'] = '':
|
|
|
msg '<b>Error, Item Description not set.</b>'
|
|
|
end
|
|
|
|
|
|
- pay_value = ARGS[1]
|
|
|
- $pay_method = $ARGS[2]
|
|
|
- $pay_variable = $ARGS[3]
|
|
|
- pay_quantity = ARGS[4]
|
|
|
-
|
|
|
- $pay_desc = $ARGS[5]
|
|
|
- $pay_section = iif ($ARGS[6] = '', $loc, $ARGS[6])
|
|
|
- $pay_act = iif($ARGS[7] = '', $loc_arg, $ARGS[7])
|
|
|
-
|
|
|
!! Construct payment call
|
|
|
|
|
|
- if $pay_variable ! '':
|
|
|
- $construct_cash = 'exec: gs ''shortgs'', ''paymentcomplete'', ''<<$pay_section>>'', ''<<$pay_act>>'', <<pay_value>>, ''<<$pay_desc>>'', ''cash'' & money -= <<pay_value>> & <<$pay_variable>> += <<pay_quantity>>'
|
|
|
- $construct_card = 'exec: gs ''shortgs'', ''paymentcomplete'', ''<<$pay_section>>'', ''<<$pay_act>>'', <<pay_value>>, ''<<$pay_desc>>'', ''card'' & karta -= <<pay_value>> & <<$pay_variable>> += <<pay_quantity>>'
|
|
|
+ if $epayments['item_variable'] ! '':
|
|
|
+ $construct_cash = '<a href="exec: money -= <<epayments[''value'']>> & <<$epayments[''item_variable'']>> += <<epayments[''quantity'']>> & gs ''shortgs'', ''paymentcomplete'' ">Cash</a>'
|
|
|
+ $construct_card = '<a href="exec: karta -= <<epayments[''value'']>> & <<$epayments[''item_variable'']>> += <<epayments[''quantity'']>> & gs ''shortgs'', ''paymentcomplete'' ">Card</a>'
|
|
|
else
|
|
|
- $construct_cash = 'exec: gs ''shortgs'', ''paymentcomplete'', ''<<$pay_section>>'', ''<<$pay_act>>'', <<pay_value>>, ''<<$pay_desc>>'', ''cash'' & money -= <<pay_value>>'
|
|
|
- $construct_card = 'exec: gs ''shortgs'', ''paymentcomplete'', ''<<$pay_section>>'', ''<<$pay_act>>'', <<pay_value>>, ''<<$pay_desc>>'', ''card'' & karta -= <<pay_value>>'
|
|
|
+ $construct_cash = '<a href="exec: $epayments[''method''] = ''cash'' & money -= <<epayments[''value'']>> & gs ''shortgs'', ''paymentcomplete'' ">Cash</a>'
|
|
|
+ $construct_card = '<a href="exec: $epayments[''method''] = ''card'' & karta -= <<epayments[''value'']>> & gs ''shortgs'', ''paymentcomplete'' ">Card</a>'
|
|
|
end
|
|
|
|
|
|
- $pay_cash = '<a href="<<$construct_cash>>">Cash</a>'
|
|
|
- $pay_card = '<a href="<<$construct_card>>">Card</a>'
|
|
|
-
|
|
|
!Use stock image for the purchase screen?
|
|
|
+ if $epayments['banner'] ! '':
|
|
|
+ '<center><img <<$set_imgh>> src="images/' + $epayments['banner'] + '"></center>'
|
|
|
+ end
|
|
|
|
|
|
- if ($pay_method ! 'cash' and $pay_method ! 'card') and (pay_value <= money and pay_value <= karta + bankDebtLimit):
|
|
|
- 'How do you want to pay for the <<$pay_desc>>? <<$pay_cash>> or <<$pay_card>>'
|
|
|
- elseif ($pay_method = 'cash' or $pay_method = '') and pay_value <= money:
|
|
|
- 'Pay for the <<$pay_desc>> with <<$pay_cash>>?'
|
|
|
- elseif ($pay_method = 'card' or $pay_method = '') and pay_value <= karta + bankDebtLimit:
|
|
|
- 'Pay for the <<$pay_desc>> with your <<$pay_card>>?'
|
|
|
+ if ($epayments['method'] ! 'cash' and $epayments['method'] ! 'card') and (epayments['value'] <= money and epayments['value'] <= karta + bankDebtLimit):
|
|
|
+ 'How do you want to pay for the <<$epayments[''description'']>>? <<$construct_cash>> or <<$construct_card>>'
|
|
|
+ elseif ($epayments['method'] = 'cash' or $epayments['method'] = '') and epayments['value'] <= money:
|
|
|
+ 'Pay for the <<$epayments[''description'']>> with <<$construct_cash>>?'
|
|
|
+ elseif ($epayments['method'] = 'card' or $epayments['method'] = '') and epayments['value'] <= karta + bankDebtLimit:
|
|
|
+ 'Pay for the <<$epayments[''description'']>> with your <<$construct_card>>?'
|
|
|
else
|
|
|
'You don''t have enough money in your purse or bank account for this item.'
|
|
|
end
|
|
|
|
|
|
- act 'Cancel Payment' : gt $pay_section, $pay_act
|
|
|
-
|
|
|
- !! clean up all the variables
|
|
|
-
|
|
|
- killvar 'pay_value'
|
|
|
- killvar '$pay_method'
|
|
|
- killvar '$pay_variable'
|
|
|
- killvar 'pay_quantity'
|
|
|
- killvar '$pay_desc'
|
|
|
- killvar '$pay_type'
|
|
|
+ act 'Cancel Payment': gt $loc, $loc_arg
|
|
|
end
|
|
|
|
|
|
!! Payment complete
|
|
@@ -837,21 +822,17 @@ if $ARGS[0] = 'paymentcomplete':
|
|
|
'Thank you for your custom. Please come again!'
|
|
|
*nl
|
|
|
|
|
|
- if $ARGS[5] = 'cash':
|
|
|
- $pay_type = 'You paid <<ARGS[3]>> <b>₽</b> in cash'
|
|
|
- else
|
|
|
- $pay_type = 'You paid <<ARGS[3]>> <b>₽</b> with your bank card'
|
|
|
- end
|
|
|
-
|
|
|
- '<<$pay_type>> for your <<$ARGS[4]>>'
|
|
|
+ 'You paid ' + epayments['value'] + '<b>₽</b>' + iif ($epayments['method'] = 'cash',' in cash', ' with your bank card') + ' for your ' + $epayments['description']
|
|
|
|
|
|
gs 'stat'
|
|
|
-
|
|
|
- if $ARGS[1] ! '' :
|
|
|
- $loc = $ARGS[1]
|
|
|
- $loc_arg = $ARGS[2]
|
|
|
+ !! clean up all the variables
|
|
|
+ killvar 'construct_cash'
|
|
|
+ killvar 'construct_card'
|
|
|
+ if $epayments['loc'] ! '':
|
|
|
+ act 'Finish payment': gt $epayments['loc'], $epayments['loc_arg']
|
|
|
+ else
|
|
|
+ act 'Finish Payment': gt $loc, $loc_arg
|
|
|
end
|
|
|
- act 'Finish payment' : gt $loc, $loc_arg
|
|
|
end
|
|
|
|
|
|
--- shortgs ---------------------------------
|