Toto smaže stránku "Internet and Mobile: Functions, variables and values in the code"
. Buďte si prosím jisti.
A new location that holds internet and mobile subscription related the list of valid internet and mobile plan values, and how to use them.
Plan name | Description |
---|---|
'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 internet used by the phone and the 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 this. |
'<home name>' |
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. |
Variable | Possible values |
---|---|
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 |
subscription[<plan name>] |
The subscription itself that will be checked to see if Sveta can access the internet |
subscription[<plan name>-price] |
The monthly fee of the subscription. |
subscription[<plan_name>-discount] |
The discount applied to the subscription. If the discount was more than the monthly cost of the subscription, then the initial purchase cost 0 rubels, and the remaining discount will be used first to pay the monthly balances until it reaches 0. |
subscription[<plan_name>-type] |
Defines the type of the subscription. |
Used to purchase minutes/credits for metered plans.
$ARGS[1]: string the plan name, the values used are 'meteredmobile' for mobile net
or 'meteredcalls' for phone calls and text messages
ARGS[2]: integer the number of units purchased (minutes, calls, etc.)
right now relevant for metered mobile internet and calls/texts only
The function sets the following values:
subscription[$ARGS[1]] += ARGS[2]
subscription[$ARGS[1]+':type'] = 2
$ARGS[1] = 'metered_calls', ARGS{2] = 60, subscription['metered_calls'] = 21
subscription['metered_call'] = 81
subscription['metered_call-type'] = 2
To purchase the monthly subscriptions.
$ARGS[1]: string The plan name - see on top, generally the name of a property or a mobile plan.
ARGS[2]: integer Subscription fee - the price to be paid every month
ARGS[3]: integer Discount value
subscription[$ARGS[1]] = 1
subscription[$ARGS[1]+'-date'] = day
subscription[$ARGS[1]+'-price'] = ARGS[2]
subscription[$ARGS[1]+'-discount'] = ARGS[3]
subscription[$ARGS[1]+'-type'] = 1
$ARGS[1] = 'mobile', ARGS[2] = 1200, ARGS[3] = 0, day = 12
subscription['mobile'] = 1
subscription['mobile-date'] = 12
subscription['mobile-price'] = 1200
subscription['mobile-discount'] = 0
subscription['mobile-type'] = 1
In theory the top_up_metered and the buy_subscription could be one function, especially if we decide to ignore the discount value. The subscription is treated as inactive if it is 0 and active if it is not zero. However, I feel like keeping them separate makes things less confusing. The $ARGS[0] tells exactly what the goal is, no ambiguity.
Called when the payment fails and the subscription is closed, or if the player decides to cancel it.
*$ARGS[1]: string* The name of the subscription
subscription[$ARGS[1]] = 0
$ARGS[1] = 'mobile', subscription['mobile'] = 1
subscription['mobile'] = 0
Used to transfer an existing subscription from one home to another.
$ARGS[1]: string* The name of the original home - this is the same as the name of the plan
$ARGS[2]: string* The name of the new home - this is the same as the name of the new plan
subscription[$ARGS[2]] = subscription[$ARGS[1]]
subscription_date[$ARGS[2]+'-date'] = subscription[$ARGS[1]+'-date']*<br/>
subscription[$ARGS[2]+'-price'] = subscription[$ARGS[1]+'-price']*<br/>
subscription[$ARGS[2]+'-discount'] = subscription[$ARGS[1]+'-discount']*<br/>
subscription[$ARGS[2]+'-type'] = subscription[$ARGS[1]+'-type']*<br/>
subscription[$ARGS[1]] is deleted*<br/>
This is not really for public use, but could be useful in certain cases. The transfer_subscription functions uses it to decide if the two locations that were passed as parameters are:
internet_enabled
value is 1 - see Homes, properties, locationsThe result of the check is stored in result thus this can be used as:
if func('internet_mobile', 'check_allowed_location', $ARGS[1): .....
$ARGS[0]: string* The location name
result = 0 (false) if the location is either 'none' or 'internet_enabled' = 0<br/>
result = -1 (true) if the location is an existing property and it 'internet_enabled' = 1
Toto smaže stránku "Internet and Mobile: Functions, variables and values in the code"
. Buďte si prosím jisti.