123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309 |
- # internet_mobile
- !! { Plans and Subscriptions
- subscription[<plan name>] The subscription itself that will be checked to see if Sveta can access the internet
- Possible values:
- Monthly subscriptions:
- 0: subscription is inactive, either never bought or expired.
- 1: subscription is active
- Metered plans:
- Any integer number, which means the available minutes left within the plan.
- This is how the old mobile minutes and internet time worked, but tracked in minutes,
- not hours for the internet.
- subscription[<plan name>-date] The day the subscription was bought for the home (or mobile), this will be the renewal day.
- automatically set to `day`.
- Possible values 0-31, 1-31 are renewal days, 0 means the plan never expires.
- subscription[<plan name>-price] The monthly fee of the subscription.
- subscription[<plan name>-discount] The discount on the plan - relevant if the original discount was greater than the monthly
- fee. If the value is higher than 0, payments come from this first until the value gets to
- 0.
- subscription[<plan nam>-type] The type of the subscription.
- Possible values:
- 1: Monthly subscription
- 2: Metered plan
- Plan Names
- free: A subscription that is freely available, libraries, friends and lovers apartment, etc. that has a computer.
- The value of this plan is always 1 and the subscription date is 0.
- mobile: Mobile telephone (only internet or calls too?) and laptop if taken somewhere else.
- If at a location where subscription['free'] is used, she has to ask first to be able to use her own laptop
- with the local internet, otherwise it will still use the mobile subscription - if there is none, it won''t work.
- metered_mobile Cheaper option for broke Svetas. When subscription['mobile'] = 0 check for this and if
- `subscription['metered_mobile'] > 0` then use it.
- <property code> This is a monthly subscription that can be used in a specific home owned/rented by Sveta.
- This is tracking the internet subscription per home. So if Sveta owns several places, she has a separate
- subscription for each of them.
- For allowed values see `homes_properties`.
- monthly_calls A monthly mobile subscription giving unlimited call minutes and text message
- metered_calls A mobile plan that gives a set amount of minutes that can be used.
- }
- if subscription['free'] = 0: subscription['free'] = 1
- !! Used for metered calls/texts/internet.
- !! $ARGS[1] = subscription name, i.e., 'metered_mobile' for mobile net or 'metered_calls' for phone calls and text messages
- !! ARGS[2] = the number of units purchased (minutes, calls, etc.) right now relevant for metered mobile internet
- !! ARGS[3] = the number of sms messages that can be sent with this top up - only for metered_calls
- !! NOTE: Putting this on top so if we decide not to use it, it is easy to find and delete
- if $ARGS[0] = 'top_up_metered':
- subscription[$ARGS[1]] += ARGS[2]
- subscription['<<$ARGS[1]>>-date'] = day
- if $ARGS[1] = 'metered_calls': subscription['<<$ARGS[1]>>-sms_limit'] += ARGS[3]
- if subscription['<<$ARGS[1]>>-type'] = 0: subscription['<<$ARGS[1]>>-type'] = 2
- end
- !! In case we decide that internet prices are different for different homes (mobile definitely should be)
- !! $ARGS[1] = The plan name - see on top, generally the name of a property or a mobile plan.
- !! ARGS[2] = Subscription fee - the price to be paid every month
- !! ARGS[3] = The remaining amount from the discount when it was more than the monthly fee. Optional value
- !! See valid values in set_home.qsrc
- if $ARGS[0] = 'buy_subscription':
- subscription[$ARGS[1]] = 1
- subscription['<<$ARGS[1]>>-date'] = day
- subscription['<<$ARGS[1]>>-price'] = ARGS[2]
- subscription['<<$ARGS[1]>>-discount'] = ARGS[3]
- if subscription['<<$ARGS[1]>>-type'] = 0: subscription['<<$ARGS[1]>>-type'] = 1
- end
- !! Nightly check called from cikl - check for subscription renewal and suspension.
- if $ARGS[0] = 'check_subscription_actions':
- !! Get a list of the properties and their attributes that the player rented:
- !! $property_code[], $property_name[], $property_display[], $property_status_display[], $property_type[]
- !! property_status[], property_construction_status[], property_is_renovated[], property_sales_price[],
- !! property_renovation_value[]
- gs 'homes_properties', 'get_accessible_properties', 'home'
- count = ARRSIZE('$property_name')
- if count > 0:
- i = 0
- :home_internet_subscription_loop
- if (property_status[i] = 1 or property_status[i] = 2) and subscription[$property_code[i]] = 1:
- if subscription['<<$property_code[i]>>-date'] = day: gs 'internet_mobile', 'renew_subscription', $property_code[i]
- if subscription['<<$property_code[i]>>-suspension_month'] = month and subscription['<<$property_code[i]>>-suspension_day'] >= day: gs 'internet_mobile', 'renew_subscription', $property_code[i]
- if subscription['<<$property_code[i]>>-suspension_month'] <= month and subscription['<<$property_code[i]>>-suspension_day'] < day: gs 'internet_mobile', 'suspend_subscription', $property_code[i]
- $result[j] = 'Internet Subscription for <<$property_display[i]>>: <<subscription[''<<$property_code[i]>>-contract_message'']>>'
- j += 1
- end
- i += 1
- if i < count: jump 'home_internet_subscription_loop'
- end
- gs 'homes_properties', 'clean_up_property_data'
- if subscription['mobile'] = 1:
- if subscription['mobile-date'] = day: gs 'internet_mobile', 'renew_subscription', 'mobile'
- if subscription['mobile-suspension_month'] = month and subscription['mobile-suspension_day'] >= day: gs 'internet_mobile', 'renew_subscription', 'mobile'
- if subscription['mobile-suspension_month'] <= month and subscription['mobile-suspension_day'] < day: gs 'internet_mobile', 'suspend_subscription', 'mobile'
- $result[j] = 'You Mobile Internet Subscription: <<subscription[''mobile-contract_message'']>>'
- j += 1
- end
- if subscription['monthly_calls'] = 1:
- if subscription['monthly_calls-date'] = day: gs 'internet_mobile', 'renew_subscription', 'monthly_calls'
- if subscription['monthly_calls-suspension_month'] = month and subscription['monthly_calls-suspension_day'] >= day: gs 'internet_mobile', 'renew_subscription', 'monthly_calls'
- if subscription['monthly_calls-suspension_month'] <= month and subscription['monthly_calls-suspension_day'] < day: gs 'internet_mobile', 'suspend_subscription', 'monthly_calls'
- $result[j] = 'You mobile contract: <<subscription[''monthly_calls-contract_message'']>>'
- j += 1
- end
- killvar 'count' & killvar 'i' & killvar 'j'
- end
- !! Cancelling a subscription (currently uused only for metered_calls and metered_mobile to clean them up when a monthly subscription
- !! is bought to repplace them)
- !! $ARGS[1] - subscription name
- if $ARGS[0] = 'cancel_subscription':
- subscription[$ARGS[1]] = 0
- subscription['<<$ARGS[1]>>-date'] = 0
- subscription['<<$ARGS[1]>>-sms_limit'] = 0
- subscription['<<$ARGS[1]>>-type'] = 0
- subscription['<<$ARGS[1]>>-price'] = 0
- subscription['<<$ARGS[1]>>-discount'] = 0
- end
- !! Renewing the subscription
- if $ARGS[0] = 'renew_subscription':
- renewfee = subscription['<<$ARGS[1]>>-price']
- acc_discount = subscription['<<$ARGS[1]>>-discount']
- app_discount = MIN(acc_discount,renewfee)
- finalfee = app_discount
- rem_discount = acc_discount-app_discount
- if karta > finalfee:
- karta -= finalfee
- subscription['<<$ARGS[1]>>-discount'] = rem_discount
- if app_discount > 0: $discounttext = '<<renewfee>>₽ and you had <<acc_discount>><b>₽</b> left on your account. After applying <<app_discount>><b>₽</b> to your monthly fee, your final payable was <b><font color="green"><<finalfee>>₽</b></font> and you were left with <<rem_discount>><b>₽</b> on your account.'
- $subscription['<<$ARGS[1]>>-contract_message'] = 'Your monthly fee was' + iif(app_discount > 0, $discounttext, '<b><font color="green"><<renewfee>>₽</font></b> which was taken from your bank account.')
- if subscription['<<$ARGS[1]>>-suspension_month'] > 0: subscription['<<$ARGS[1]>>-suspension_month'] = 0
- if subscription['<<$ARGS[1]>>-suspension_day'] > 0: subscription['<<$ARGS[1]>>-suspension_day'] = 0
- else
- remainingday = 5
- if subscription['<<$ARGS[1]>>-suspension_day'] > 0: remainingday = subscription['<<$ARGS[1]>>-suspension_day'] - day
- if app_discount > 0: $discounttext = ' and you had <<acc_discount>><b>₽</b> left on your account. After applying <<app_discount>><b>₽</b> to your monthly fee, your final payable was <<finalfee>><b>₽</b> and you were left with <<rem_discount>><b>₽</b> on your account.'
- $subscription['<<$ARGS[1]>>-contract_message'] = 'Your monthly fee was <<renewfee>><b>₽</b>'+ iif(app_discount >0, $discounttext,', unfortunately your payment was declined. We will try to take the payment over the next <b><font color="red"><<remainingday>> days</font></b> before suspending services.')
- gs 'internet_mobile', 'set_suspension_date', $ARGS[1]
- end
- killvar 'renewfee'
- killvar 'acc_discount'
- killvar 'app_discount'
- killvar 'finalfee'
- killvar 'rem_discount'
- killvar '$discounttext'
- killvar 'remainingday'
- end
- !! Transfer existing subscription from one home to another if Sveta is moving.
- if $ARGS[0] = 'transfer_subscription':
- allowed = func('internet_mobile', 'check_allowed_location', $ARGS[1])
- allowed = allowed and func('internet_mobile', 'check_allowed_location', $ARGS[2])
- if allowed:
- subscription[$ARGS[2]] = subscription[$ARGS[1]]
- subscription['<<ARGS[2]>>-date'] = subscription['<<$ARGS[1]>>-date']
- subscription['<<ARGS[2]>>-price'] = subscription['<<$ARGS[1]>>-price']
- subscription['<<ARGS[2]>>-discount'] = subscription['<<$ARGS[1]>>-discount']
- !! This one is always 1 because only type 1 subscriptions can be transferred, but making it "future proof"
- subscription['<<ARGS[2]>>-type'] = subscription['<<$ARGS[1]>>-type']
- subscription[$ARGS[0]] = 0
- killvar 'allowed'
- end
- end
- !! This is a separate "function" because the check is a bit long, and can change if we realize it isn't the best way to do it.
- !! Spoiler alert: It is not, I'm pretty sure.
- !!
- if $ARGS[0] = 'check_allowed_location':
- gs 'homes_properties_attr', 'get_property_attr', $ARGS[1]
- result = property['internet_enabled'] = 1
- killvar 'property'
- end
- !! $ARGS[1] - this is expected only if the location allows the use of subscription['free'], otherwise pass ''
- !! $ARGS[2] - Limitation code: : 'noporn', 'nocamshow'
- !! and on...can be up to 10 arguments.
- if $ARGS[0] = 'get_access':
- killvar 'access'
- $subsname = iif($ARGS[1] = '', func('homes_properties', 'get_property_code'), func('homes_properties', 'get_property_code', $ARGS[1]))
- if func('homes_properties', 'free_internet_available', $subsname) ! 0:
- $access['subscription'] = 'free'
- elseif $ARGS[1] = 'free':
- $access['subscription'] = 'free'
- elseif subscription[$subsname] = 1:
- $access['subscription'] = $subsname
- elseif subscription['mobile'] = 1:
- $access['subscription'] = 'mobile'
- elseif subscription['metered_mobile'] > 0:
- $access['subscription'] = 'metered_mobile'
- else
- $access = 'denied'
- end
- if $access ! 'denied':
- if subscription['<<$access[''subscription'']>>-type'] = 2: access['metered'] = 1
- count = ARRSIZE('ARGS')
- if count > 2:
- k = 2
- :loop_args
- access[$ARGS[k]] = 1
- k += 1
- if k < count: jump 'loop_args'
- end
- if access['noporn'] = 1: $access['noporn'] = 'You can''t search for porn on this computer'
- if access['nocamshow'] = 1: $access['nocamshow'] = 'You can''t do a cam show in this place'
- killvar 'count' & killvar 'k'
- end
- killvar 'subsname'
- end
- !! Adds a new limiation with a custom message
- !! If the limitation is already set, the existing message will be overwritten by the one passed here.
- !!
- !! $ARGS[1] - Limitation code: : 'noporn', 'nocamshow'
- !! $ARGS[2] - Custom message - optional
- if $ARGS[0] = 'add_limitation':
- access[$ARGS[1]] = 1
- $access[$ARGS[1]] = $ARGS[2]
- end
- !!Remove the limiation passed in $ARGS[1] and set's it's custom message to ''
- !!
- !! $ARGS[1] - Limitation code: : 'noporn', 'nocamshow'
- if $ARGS[0] = 'remove_limitation':
- access[$ARGS[1]] = 0
- $access[$ARGS[1]] = ''
- end
- !! Sets the message to limitation passed in $ARGS[1] if the limitation is active
- !!
- !! $ARGS[1] - Limitation code: : 'noporn', 'nocamshow'
- !! $ARGS[2] - Custom message
- if $ARGS[0] = 'set_limitation_message':
- if access[$ARGS[1]] = 1: $access[$ARGS[1]] = $ARGS[2]
- end
- !! Sets the date when the subscription will be cancelled if not paid.
- !!
- !! $ARGS[1] - the subscription name
- if $ARGS[0] = 'set_suspension_date':
- temp_month = month
- if month = 2:
- if ((year mod 4 = 0) and (year mod 100 ! 0)) or (year mod 400 = 0):
- switchday = 29
- else
- switchday = 28
- end
- elseif month = 4 or month = 6 or month = 9 or month = 11:
- switchday = 30
- else
- switchday = 31
- end
- temp_day = day + 5
- if temp_day > switchday:
- temp_day -= switchday
- temp_month += 1
- end
- subscription[$ARGS[1]+'suspension_day'] = temp_day
- subscription[$ARGS[1]+'suspension_month'] = temp_month
- 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 (this could be completely unnecessary, at this point there is an active
- !! $access which holds 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 (this could be completely unnecessary, at this point there is an active
- !! $access which holds the subscription used.)
- if $ARGS[0] = 'check_internet_access':
- if subscription[$ARGS[1]] > 0: result = 1
- end
- --- internet_mobile ---------------------------------
|