Browse Source

Added some functions to help with the use of internet

Netuttki 1 year ago
parent
commit
e7389ab37d
1 changed files with 26 additions and 5 deletions
  1. 26 5
      locations/internet_mobile.qsrc

+ 26 - 5
locations/internet_mobile.qsrc

@@ -134,11 +134,6 @@ if $ARGS[0] = 'cancel_subscription':
     subscription[$ARGS[1]+'-discount'] = 0
 end
 
-!! Sending an sms on a metered contract
-if $ARGS[0] = 'send_sms':
-    if subscription['metered_calls'] = 1: subscription['sms_limit'] -= 1  
-end
-
 !! Renewing the subscription
 if $ARGS[0] = 'renew_subscription':
     renewfee = subscription[$ARGS[1]+'-price']
@@ -242,4 +237,30 @@ if ARGS[0] = 'set_suspension_date':
     killvar 'temp_month'
     killvar 'temp_day'
 end
+
+!! Sending an sms on a metered contract
+if $ARGS[0] = 'send_sms':
+    if subscription['metered_calls'] = 1: subscription['sms_limit'] -= 1  
+end
+
+!! Using the internet - if metered, it lowers the minutes left
+!! $ARGS[1] - the name of the subscription used
+!! ARGS[2] - the number of minutes used
+if $ARGS[0] = 'use_internet':
+    if $subscription[$ARGS[1]+'-type'] = 'metered': 
+        subscription[$ARGS[1]] -= ARGS[2]
+        if subscription[$ARGS[1]] < 0: subscription[$ARGS[1]] = 0
+    end
+end
+
+!! Checks if Sveta still has access to the internet - use it while she is on the computer, mostly relevant for metered net,
+!! but monthly subscription can end abruptly too if she did not pay.
+!! Use it as a func() returns 1 or 0 based on the subscription[$ARGS[1]]  value
+!!
+!! $ARGS[1] - the name of the subscription
+if $ARGS[0] = 'check_internet_access':
+    if subscription[$ARGS[1]] > 0: result = 1
+end
+
+
 --- internet_mobile ---------------------------------