123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116 |
- # homes_properties
- if ARRSIZE('homes') < 16 or ARRSIZE('home_name') < 7:
- gs 'homes_properties_attr'
- end
- !!-----------------------------------------------------------------------------------------------------
- !!
- !! General calls
- !!
- !!-----------------------------------------------------------------------------------------------------
- !! Call: `gs 'homes_properties', 'calculate_available_for_rent_property_count'`
- !! This calculate the value of accessible_property['available_for_rent_home_count'] and accessible_property['available_for_rent_business_count']
- !! Right now it is called once when the first call to this location finds that the value for these are 0.
- !! However, I added it as a named thing in case a mod adds new properties, especially business type properties, in which the mod should call this
- !! to recalculate the values to include the newly added properties.
- !!
- !! NOTE: The code will set the value to -1 if now property of correct type is found.
- !! The reason for this is to make sure that it will not run more than once because there are no properties of that type - like business properties right now -,
- !! but to also make it sure that if we add one or more, either in the main game, or via some mod, we will not have to worry about this, as it will calculate correctly.
- !!
- !! ARGS[1] - property type filter: 'home', 'business', 'all' or '' or missing
- if $ARGS[0] = 'calculate_rentable_property_count':
- count = ARRSIZE('homes')
- if count > 0:
- hp_i = 0
- :get_rentable_property_count_loop
- gs 'homes_properties_attr', 'get_property_attr', $homes[hp_i]
- if $ARGS[1] ! 'home' and INSTR($property['type'], 'residence') = 0 and property['rental']:
- accessible_property['rentable_business_count'] += 1
- elseif $ARGS[1] ! 'business' and INSTR($property['type'], 'business') = 0 and property['rental']:
- accessible_property['rentable_home_count'] += 1
- end
- hp_i += 1
- if hp_i < count: jump 'get_rentable_property_count_loop'
- killvar 'hp_i'
- end
- if accessible_property['rentable_business_count'] = 0: accessible_property['rentable_business_count'] = -1
- if accessible_property['rentable_home_count'] = 0: accessible_property['rentable_home_count'] = -1
- accessible_property['available_for_rent_home_count'] = accessible_property['rentable_home_count']
- accessible_property['available_for_rent_business_count'] = accessible_property['rentable_business_count']
- end
- !! Set the current home for Sveta based on either the property code or the id - for backward compatibility or some mods
- !! $ARGS[1] - a string to identify the property.
- !! Possible values:
- !! A property code - 'city_apartment', 'village_cottage', etc.
- !! A location name - $loc passed
- !! An empty string - in this case ARGS[2] is mandatory
- !! A number as str - really should remove this
- !!
- if $ARGS[0] = 'set_home':
- $homepropcode = iif($ARGS[1] = '', $home_name[$loc], $home_name[$ARGS[1]])
- if $homepropcode ! '':
- killvar 'home'
- gs 'homes_properties_attr', 'get_property_attr', $homepropcode
- if INSTR($property['type'], 'residence') > 0:
- COPYARR 'home','property'
- $home['current'] = $property['code']
- if accessible_property[$home['current']] = 0: gs 'homes_properties', 'set_access', $home['current'], 1
- killvar 'property'
- end
- end
- end
- !! Call: `gs 'homes_properties', 'set_access', $ARGS[1], ARGS[2], ARGS[3]. ARGS[4]`
- !!
- !! $ARGS[1]: the location for which the access is set
- !! Accepted values
- !! - property code -> 'city_apartment', 'parents_home'
- !! - a location -> 'bedrPar', 'koo2x' - A value that can shop up in $loc
- !! - empty strying -> '' - will work as if a location was passed, but will use the actual value of $loc
- !! - A number as str -> '1', '2' - this should be the id of the property
- !! NOTE: only added in case someone really want to use the old ids
- !! ARGS[2]: ownership type
- !! 0: no acces -> 'no access'
- !! 1: not owned but can live her - a rented property or living at some else''s place
- !! 2: owned -> 'owned'
- !! 3: owned and rented out -> 'tenants'
- !! ARGS[3]: construction status - optional
- !! 0: land only
- !! 1: foundation, frames built, utilities are connected
- !! 2: fully built
- !! ARGS[4]:renovation status - optional
- !! 0: not renovated
- !! 1: fully renovated
- if $ARGS[0] = 'set_access':
- $propcode = iif($ARGS[1] = '', $home_name[$loc], $home_name[$ARGS[1]])
- orig_status_code = accessible_property[$propcode]
- new_status_code = ARGS[2]
- if orig_status_code ! new_status_code:
- if $accessible_property[$propcode] = '' or $accessible_property['<<$propcode>>-display'] = '' or $accessible_property['<<$propcode>>-name'] = '':
- if $property['code'] ! $propcode:
- gs 'homes_properties_attr', 'get_property_attr', $propcode
- else
- nokill = 1
- end
- if ARGS[2] = 1 and property['rental'] = 0: new_status_code = 4
- accessible_property[$propcode] = new_status_code
- $accessible_property[$propcode] = $propcode
- $accessible_property['<<$propcode>>-name'] = $property['name']
- $accessible_property['<<$propcode>>-type'] = $property['type']
- if property['construction_needed'] = 1:
- accessible_property['<<$propcode>>-construction-status'] = ARGS[3]
- $accessible_property['<<$propcode>>-display'] = $property['display_<<ARGS[3]>>']
- else
- accessible_property['<<$propcode>>-construction-status'] = 2
- $accessible_property['<<$propcode>>-display'] = $property['display']
- end
- if INSTR($property['type'], 'residence') > 0: accessible_property['<<$propcode>>-is-home'] = 1
- accessible_property['<<$propcode>>-rental'] = property['rental']
- accessible_property['<<$propcode>>-renovated'] = ARGS[4]
- accessible_property['<<$propcode>>-sales-price'] = property['price']
- accessible_property['<<$propcode>>-rent'] = property['rent']
- end
- if accessible_property[$propcode] = 0:
- !! If this was the current home then killing it
- if $home['current'] = $propcode: killvar '$home'
- !! Updating home counts
- !! NOTE: Valid transitions: 1 -> 0, 2 -> 0, 4 -> 0
- if accessible_property['<<$propcode>>-is-home'] = 1:
- if orig_status_code = 1:
- accessible_property['rental_home_count'] -= 1
- accessible_property['available_for_rent_home_count'] += 1
- end
- if orig_status_code = 2: accessible_property['owned_home_count'] -= 1
- if accessible_property['<<$propcode>>-construction-status'] = 2: accessible_property['furnishable_home_count'] -= 1
- accessible_property['accessible_home_count'] -= 1
- end
- if accessible_property['accessible_home_count'] = 1:
- gs 'homes_properties', 'get_accessible_properties', 'home'
- if accessible_property['<<$ARGS[1]>>-is-home'] = 1: gs 'homes_properties', 'set_home', $property_code
- gs 'homes_properties', 'clean_up_property_data'
- end
- !! Property is rented
- elseif accessible_property[$propcode] = 1:
- !! Updating home counts
- !! NOTE: Only valid transition is 0 -> 1
- if accessible_property['<<$propcode>>-is-home'] = 1:
- accessible_property['rental_home_count'] += 1
- accessible_property['accessible_home_count'] += 1
- accessible_property['available_for_rent_home_count'] -= 1
- if accessible_property['<<$propcode>>-construction-status'] = 2: accessible_property['furnishable_home_count'] +=1
- end
- !! Property is owned
- elseif accessible_property[$propcode] = 2:
- !! Updating home counts
- !! NOTE: Valid transitions: 0 -> 2, 1 -> 2, 3-> 2
- if accessible_property['<<$propcode>>-is-home'] = 1:
- if orig_status_code = 0:
- accessible_property['accessible_home_count'] += 1
- elseif orig_status_code = 1:
- accessible_property['rental_home_count'] -= 1
- accessible_property['available_for_rent_home_count'] += 1
- elseif orig_status_code = 3:
- accessible_property['tenant_home_count'] -= 1
- accessible_property['<<$propcode>>-tenant-day'] = -1
- accessible_property['<<$propcode>>-tenant-month'] = -1
- if accessible_property['<<$propcode>>-construction-status'] = 2: accessible_property['furnishable_home_count'] += 1
- end
- if accessible_property['<<$propcode>>-construction-status'] = 2 and orig_status_code ! 1: accessible_property['furnishable_home_count'] += 1
- accessible_property['owned_home_count'] += 1
- end
- !! Property has tenants
- elseif accessible_property[$propcode] = 3:
- !! Updating home counts
- !! NOTE: Valid transitions: 2 -> 3
- if accessible_property['<<$propcode>>-is-home'] = 1:
- if $home['current'] = $propcode: killvar '$home'
- accessible_property['tenant_home_count'] += 1
- accessible_property['owned_home_count'] -= 1
- accessible_property['accessible_home_count'] -= 1
- if accessible_property['<<$propcode>>-construction-status'] = 2: accessible_property['furnishable_home_count'] -= 1
- end
- !! Property is just accessible
- elseif accessible_property[$propcode] = 4:
- !! Updating home counts
- !! NOTE: Valid transitions: 0 -> 4
- if accessible_property['<<$propcode>>-is-home'] = 1:
- accessible_property['accessible_home_count'] += 1
- end
- end
- if nokill = 0 : killvar 'property'
- end
- killvar 'propcode' & killvar 'orig_status_code' & killvar 'new_status_code' & killvar 'nokill'
- end
- !! Call: dyneval($is_homeless)
- $is_homeless = {
- result = ($home['current'] = 'homeless')
- }
- !! Call: `func('homes_properties', 'can_live_here', $ARGS[1])`
- !! Return -1 if the location/property is a place where Sveta can live, whether he owns or rents the place,
- !! she is just allowed to live there: university dorm, parents home, the Meynold Household, etc.
- !!
- !! $ARGS[1]: the location for which the access is set
- !! Accepted values
- !! - property code -> 'city_apartment', 'parents_home'
- !! - a location -> 'bedrPar', 'koo2x' - A value that can shop up in $loc
- !! - empty strying -> '' - will work as if a location was passed, but will use the actual value of $loc
- !! - A number as str -> '1', '2' - this should be the id of the property
- !! NOTE: only added in case someone really want to use the old ids
- if $ARGS[0] = 'can_live_here':
- $canlivecode = iif($ARGS[1] = '', $home_name[$loc], $home_name[$ARGS[1]])
- result = accessible_property[$canlivecode] > 0 and accessible_property[$canlivecode] ! 3 and func('homes_properties', 'get_property_construction_status', $canlivecode) = 2
- killvar 'canlivecode'
- end
- !! Call: `func('homes_properties', 'is_current_home', $ARGS[1])`
- !! Returns 0 if the location/property is not the current home, otherwise -1.
- !!
- !! $ARGS[1]: the location for which the access is set
- !! Accepted values
- !! - property code -> 'city_apartment', 'parents_home'
- !! - a location -> 'bedrPar', 'koo2x' - A value that can shop up in $loc
- !! - empty strying -> '' - will work as if a location was passed, but will use the actual value of $loc
- !! - A number as str -> '1', '2' - this should be the id of the property
- !! NOTE: only added in case someone really want to use the old ids
- if $ARGS[0] = 'is_current_home':
- $currenthomecode = iif($ARGS[1] = '', $home_name[$loc], $home_name[$ARGS[1]])
- result = $home['current'] = $currenthomecode
- killvar 'currenthomecode'
- end
- !! Call: `func('homes_properties', 'is_at_a_home', $ARGS[1])`
- !! Tells if the location passed in $ARGS[1] or if empty the $loc is a home or not.
- !! If true then returns -1, if false 0.
- !!
- !! $ARGS[1]: the location for which the access is set
- !! Accepted values
- !! - property code -> 'city_apartment', 'parents_home'
- !! - a location -> 'bedrPar', 'koo2x' - A value that can shop up in $loc
- !! - empty strying -> '' - will work as if a location was passed, but will use the actual value of $loc
- !! - A number as str -> '1', '2' - this should be the id of the property
- !! NOTE: only added in case someone really want to use the old ids
- if $ARGS[0] = 'is_at_a_home':
- $isathomecode = iif($ARGS[1] = '', $home_name[$loc], $home_name[$ARGS[1]])
- result = accessible_property['<<$isathomecode>>-is-home'] = 1
- killvar 'isathomecode'
- end
- !! Call: `func('homes_properties', 'is_property_of_status', $ARGS[1])`
- !! Tells if the location passed in $ARGS[1] or if empty the $loc is of the queried status.
- !! If true then returns -1, if false 0.
- !!
- !! $ARGS[1]: the status that is checked
- !! Accepted values
- !! 'rented' -> is the property rented?
- !! 'owned' -> is the property is owned (bought by Sveta) ?
- !! 'tenants' -> are there tenants in the property?
- !! 'purchased' -> both 'owned' and 'tenants'
- !! 'blocked' -> is the property blocked?
- !! 'hasaccess' -> can Sveta use the property (without owning or renting it)?
- !!
- !! $ARGS[2]: the location for which the access is set
- !! Accepted values
- !! - property code -> 'city_apartment', 'parents_home'
- !! - a location -> 'bedrPar', 'koo2x' - A value that can shop up in $loc
- !! - empty strying -> '' - will work as if a location was passed, but will use the actual value of $loc
- !! - A number as str -> '1', '2' - this should be the id of the property
- !! NOTE: only added in case someone really want to use the old ids
- if $ARGS[0] = 'is_property_of_status':
- $propstatcode = iif($ARGS[2] = '', $home_name[$loc], $home_name[$ARGS[2]])
- if $ARGS[1] = 'rented':
- result = accessible_property[$propstatcode] = 1
- elseif $ARGS[1] = 'owned':
- result = accessible_property[$propstatcode] = 2
- elseif $ARGS[1] = 'tenants':
- result = accessible_property[$propstatcode] = 3
- elseif $ARGS[1] = 'blocked':
- result = accessible_property[$propstatcode] = 0
- elseif $ARGS[1] = 'hasacces':
- result = accessible_property[$propstatcode] = 4
- elseif $ARGS[1] = 'purchased':
- result = accessible_property[$propstatcode] = 2 or accessible_property[$propstatcode] = 3
- else
- result = 0
- end
- killvar 'propstatcode'
- end
- !! Call `func('homes_properties', 'get_property_code', $ARGS[1])`
- !! Returns
- !!
- !! $ARGS[1]: the location for which the access is set
- !! Accepted values
- !! - property code -> 'city_apartment', 'parents_home'
- !! - a location -> 'bedrPar', 'koo2x' - A value that can shop up in $loc
- !! - empty strying -> '' - will work as if a location was passed, but will use the actual value of $loc
- !! - A number as str -> '1', '2' - this should be the id of the property
- !! NOTE: only added in case someone really want to use the old ids
- if $ARGS[0] = 'get_property_code':
- $result = iif($ARGS[1] = '', $home_name[$loc], $home_name[$ARGS[1]])
- end
- !!---------------------------------------------------------
- !! Home and Property Counts - FUNC()
- !!---------------------------------------------------------
- !! Call: `func('homes_properties', 'get_rented_property_count', $ARGS[1])`
- !! Returns the count of rented properties
- !!
- !! ARGS[1] - property type filter: 'home', 'business', 'all' or '' or missing
- if $ARGS[0] = 'get_rented_property_count':
- if $ARGS[1] = 'home':
- result = accessible_property['rental_home_count']
- elseif $ARGS[1] = 'business':
- result = accessible_property['rental_business_count']
- elseif $ARGS[1] = 'all' or $ARGS[1] = '':
- result = accessible_property['rental_home_count'] + accessible_property['rental_business_count']
- end
- end
- !! Call: `func('homes_properties', 'get_accessible_property_count', $ARGS[1])`
- !! Returns the count of accessible properties
- !!
- !! ARGS[1] - property type filter: 'home', 'business', 'all' or '' or missing
- if $ARGS[0] = 'get_accessible_property_count':
- if $ARGS[1] = 'home':
- result = accessible_property['accessible_home_count']
- elseif $ARGS[1] = 'business':
- result = accessible_property['accessible_business_count']
- elseif $ARGS[1] = 'all' or $ARGS[1] = '':
- result = accessible_property['accessible_home_count'] + accessible_property['accessible_business_count']
- end
- end
- !! Call: `func('homes_properties', 'get_rentable_property_count', $ARGS[1])`
- !! Returns the count of properties that can be rented (all properties with where property['rental'] = 1)
- !!
- !! ARGS[1] - property type filter: 'home', 'business', 'all' or '' or missing
- if $ARGS[0] = 'get_rentable_property_count':
- if $ARGS[1] = 'home':
- result = accessible_property['rentable_home_count']
- elseif $ARGS[1] = 'business':
- result = accessible_property['rentable_business_count']
- elseif $ARGS[1] = 'all' or $ARGS[1] = '':
- result = accessible_property['rentable_home_count'] + accessible_property['rentable_business_count']
- end
- end
- !! Call: `func('homes_properties', 'get_available_for_rent_property_count', $ARGS[1])`
- !! Returns the number of properties that are avaiable for rent - rentable properties that are not rented.
- !! ARGS[1] - property type filter: 'home', 'business', 'all' or '' or missing
- if $ARGS[0] = 'get_available_for_rent_property_count':
- if $ARGS[1] = 'home':
- result = accessible_property['available_for_rent_home_count']
- elseif $ARGS[1] = 'business':
- result = accessible_property['available_for_rent_business_count']
- elseif $ARGS[1] = 'all' or $ARGS[1] = '':
- result = accessible_property['available_for_rent_home_count'] + accessible_property['available_for_rent_business_count']
- end
- end
- !! Call: `func('homes_properties', 'furnishable_home_count', $ARGS[1])`
- !! Returns the count of furnishable properties (for shops)
- !!
- !! ARGS[1] - property type filter: 'home', 'business', 'all' or '' or missing
- if $ARGS[0] = 'get_furnishable_property_count':
- if $ARGS[1] = 'home':
- result = accessible_property['furnishable_home_count']
- elseif $ARGS[1] = 'business':
- result = accessible_property['furnishable_business_count']
- elseif $ARGS[1] = 'all' or $ARGS[1] = '':
- result = accessible_property['furnishable_home_count'] + accessible_property['furnishable_business_count']
- end
- end
- !!---------------------------------------------------------
- !! Get Properties and their values
- !!---------------------------------------------------------
- !! Use it as `gs`, creates a set of arrays that contains the relevant info for
- !! rented properties
- !!
- !! Returns: property_rent, property_days, $property_name, $property_display, $property_code
- !! $ARGS[1] - the property_type: 'home' - homes, 'business' - business properties, 'all' or '' - both types
- !! ARGS[2] - optional, if value is 1 then only $property_code[] is created.
- if $ARGS[0] = 'get_rented_properties':
- hp_i = 0
- hp_j = 0
- gs 'homes_properties', 'clean_up_property_data'
- count = ARRSIZE('accessible_property')
- if count > 0:
- :get_rented_properties_loop
- $getrentedpropcode = $accessible_property[hp_i]
- if $home_name[$getrentedpropcode] ! '' and accessible_property[hp_i] = 1:
- if ($ARGS[1] ! 'home' and accessible_property['<<$getrentedpropcode>>-is-home'] = 0) or ($ARGS[1] ! 'business' and accessible_property['<<$getrentedpropcode>>-is-home'] = 1):
- $property_code[hp_j] = $getrentedpropcode
- if ARGS[2] = 0:
- $property_name[hp_j] = $accessible_property['<<$getrentedpropcode>>-name']
- $property_display[hp_j] = $accessible_property['<<$getrentedpropcode>>-display']
- property_days[hp_j] = accessible_property['<<$getrentedpropcode>>-days-left']
- property_rent[hp_j] = accessible_property['<<$getrentedpropcode>>-rent']
- end
- j += 1
- end
- end
- hp_i += 1
- if hp_i < count: jump 'get_rented_properties_loop'
- end
- killvar 'count'
- killvar 'hp_i'
- killvar 'hp_j'
- killvar '$getrentedpropcode'
- end
- !! Use it as `gs`, creates a set of arrays that contains the relevant info for
- !! all owned (bought) properties.
- !!
- !! "Returns":
- !! $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[]
- !!
- !! $ARGS[1] - the class of the property: 'home' - returns only homes; 'business' - returns only business properties;
- !! 'all' or '' (or $ARGS[1] not passed) - returns both types
- !! IMPORTANT: If $ARGS[2] is passed, the $ARGS[1] will be ignored and will be treated as if it was 'all'/''.
- !! $ARGS[2] - optional, a property code or a location. If $ARGS[2] passed, only one property will be checked and returned.
- !!
- if $ARGS[0] = 'get_owned_properties':
- hp_i = 0
- hp_j = 0
- gs 'homes_properties', 'clean_up_property_data'
- $type = iif($ARGS[2] = '', $ARGS[1], 'all')
- count = iif($ARGS[2] = '', ARRSIZE('accessible_property'), 1)
- if count > 0:
- !!'<h3>Building Owned Properties List</h3>'
- !!'Count: <b><<count>></b>'
- :get_owned_properties_loop
- $getownedpropcode = iif( $ARGS[2] = '', $accessible_property[hp_i], $ARGS[2] )
- !!' Index: <b><<hp_i>></b> Code: <b><<$getownedpropcode>></b> Status: <b><<accessible_property[hp_i]>></b>'
- if $home_name[$getownedpropcode] ! '' and (accessible_property[$getownedpropcode] = 2 or accessible_property[$getownedpropcode] = 3):
- !!' $ARGS[1]: <b><<$ARGS[hp_i]>></b> Is home: <b><<accessible_property[''<<$getownedpropcode>>-is-home'']>></b>'
- if ($type ! 'home' and accessible_property['<<$getownedpropcode>>-is-home'] = 0) or ($type ! 'business' and accessible_property['<<$getownedpropcode>>-is-home'] = 1):
- $property_code[hp_j] = $getownedpropcode
- $property_name[hp_j] = $accessible_property['<<$getownedpropcode>>-name']
- if property['construction_needed'] = 1:
- $property_display[hp_j] = iif($accessible_property[$getownedpropcode] = '', $property['display_0'], $accessible_property['<<$getownedpropcode>>-display'])
- else
- $property_display[hp_j] = iif($accessible_property[$getownedpropcode] = '', $property['display'], $accessible_property['<<$getownedpropcode>>-display'])
- end
- $property_type[hp_j] = $accessible_property['<<$getownedpropcode>>-type']
- if accessible_property[$getownedpropcode] = 3:
- $property_status_display[hp_j] = 'A(n) <<$property_display[hp_j]>> which is currently occupied by your tenants'
- else
- $property_status_display[hp_j] = 'A(n) <<$property_display[hp_j]>> ' + iif($accessible_property[$getownedpropcode] = $home['current'], 'where you currently live.', 'which is currently empty.')
- end
- property_status[hp_j] = accessible_property[$getownedpropcode]
- property_construction_status[hp_j] = accessible_property['<<$getownedpropcode>>-construction-status']
- property_is_renovated[hp_j] = accessible_property['<<$getownedpropcode>>-renovated']
- property_sales_price[hp_j] = accessible_property['<<$getownedpropcode>>-sales-price']
- property_renovation_value[hp_j] = accessible_property['<<$getownedpropcode>>-renovation-value']
- hp_j += 1
- end
- end
- hp_i += 1
- if hp_i < count: jump 'get_owned_properties_loop'
- end
- killvar 'count'
- killvar 'hp_i'
- killvar 'hp_j'
- killvar 'getownedpropcode'
- end
- !! Use it as `gs`, creates a set of arrays that contains the relevant info for
- !! all accessible (rented, bought or just allowed to stay) properties.
- !!
- !! "Returns":
- !! $property_code[], $property_name[], $property_display[], $property_status_display[], $property_type[]
- !! property_status[], property_construction_status[], property_is_renovated[], property_renovation_value[]
- !!
- !! $ARGS[1] - the class of the property: 'home' - returns only homes; 'business' - returns only business properties; '' - returns both types
- if $ARGS[0] = 'get_accessible_properties':
- hp_i = 0
- hp_j = 0
- gs 'homes_properties', 'clean_up_property_data'
- count = ARRSIZE('accessible_property')
- if count > 0:
- :get_accessible_properties_loop
- $getaccessiblepropcode = $accessible_property[hp_i]
- if $home_name[$getaccessiblepropcode] ! '' and accessible_property[$getaccessiblepropcode] > 0:
- if ($ARGS[1] ! 'home' and accessible_property['<<$getaccessiblepropcode>>-is-home'] = 0) or ($ARGS[1] ! 'business' and accessible_property['<<$getaccessiblepropcode>>-is-home'] = 1):
- $property_code[hp_j] = $getaccessiblepropcode
- $property_name[hp_j] = $accessible_property['<<$getaccessiblepropcode>>-name']
- if property['construction_needed'] = 1:
- $property_display[hp_j] = iif($accessible_property[$getaccessiblepropcode] = '', $property['display_0'], $accessible_property['<<$getaccessiblepropcode>>-display'])
- else
- $property_display[hp_j] = iif($accessible_property[$getaccessiblepropcode] = '', $property['display'], $accessible_property['<<$getaccessiblepropcode>>-display'])
- end
- if accessible_property[$getaccessiblepropcode] = 1:
- $property_status_display[hp_j] = 'You rent the <<$property_display[hp_j]>> '+iif($accessible_property[$getaccessiblepropcode] = $home['current'], 'where you currently live.', 'which is currently empty.')
- elseif accessible_property[$getaccessiblepropcode] = 2:
- $property_status_display[hp_j] = 'You own the <<$property_display[hp_j]>> ' + iif($accessible_property[$getaccessiblepropcode] = $home['current'], 'where you currently live.', 'which is currently empty.')
- elseif accessible_property[$getaccessiblepropcode] = 3:
- $property_status_display[hp_j] = 'You own the <<$property_display[hp_j]>> which is currently occupied by your tenants'
- else
- $property_status_display[hp_j] = 'You can stay at the <<$property_display[hp_j]>> which is currently occupied by your tenants'
- end
- property_status[hp_j] = accessible_property[$getaccessiblepropcode]
- property_construction_status[hp_j] = accessible_property['<<$getaccessiblepropcode>>-construction-status']
- property_is_renovated[hp_j] = accessible_property['<<$getaccessiblepropcode>>-renovated']
- property_type[hp_j] = accessible_property['<<$getaccessiblepropcode>>-type']
- hp_j += 1
- end
- end
- hp_i += 1
- if hp_i < count: jump 'get_accessible_properties_loop'
- end
- killvar 'count'
- killvar 'hp_i'
- killvar 'hp_j'
- killvar 'getaccessiblepropcode'
- end
- !! Use it as `gs`, creates a set of arrays that contains the relevant info for
- !! all properties that are for sale.
- !!
- !! "Returns":
- !! $property_code[], $property_name[], $property_display[], $property_type[]
- !! property_construction_status,property_is_renovated[], property_sales_price[], property_renovation_value[]
- !!
- !! $ARGS[1] - the class of the property: 'home' - returns only homes; 'business' - returns only business properties; '' - returns both types
- if $ARGS[0] = 'get_properties_for_sale':
- hp_i = 0
- hp_j = 0
- gs 'homes_properties', 'clean_up_property_data'
- count = ARRSIZE('homes')
- if count > 0:
- :get_properties_for_sale_loop
- $getforsalespropcode = $homes[hp_i]
- if $getforsalespropcode ! '' and checked_homes[$getforsalespropcode] = 0 and accessible_property[$getforsalespropcode] < 2:
- checked_homes[$getforsalespropcode] = 1
- if $accessible_property[$getforsalespropcode] = '': gs 'homes_properties_attr', 'get_property_attr', $getforsalespropcode
- ishome = iif($accessible_property[$getforsalespropcode] = '', INSTR($property['type'], 'residence') > 0, INSTR($accessible_property['<<$getforsalespropcode>>-type'], 'residence') > 0 )
- hasprice = iif($accessible_property[$getforsalespropcode] = '', property['price'] > 0, accessible_property['<<$getforsalespropcode>>-sales-price'] > 0)
- if (($ARGS[1] ! 'home' and ishome = 0) or ($ARGS[1] ! 'business' and ishome)) and hasprice:
- $property_code[hp_j] = $getforsalespropcode
- $property_name[hp_j] = iif($accessible_property[$getforsalespropcode] = '', $property['name'], $accessible_property['<<$getforsalespropcode>>-name'])
- $property_type[hp_j] = iif($accessible_property[$getforsalespropcode] = '', $property['type'], $accessible_property['<<$getforsalespropcode>>-type'])
- if property['construction_needed'] = 1:
- $property_display[hp_j] = iif($accessible_property[$getforsalespropcode] = '', $property['display_0'], $accessible_property['<<$getforsalespropcode>>-display'])
- else
- $property_display[hp_j] = iif($accessible_property[$getforsalespropcode] = '', $property['display'], $accessible_property['<<$getforsalespropcode>>-display'])
- end
- property_is_rented[hp_j] = accessible_property[$getforsalespropcode] = 1
- property_construction_status[hp_j] = iif($accessible_property[$getforsalespropcode] = '', 0, accessible_property['<<$getforsalespropcode>>-construction-status'])
- property_is_renovated[hp_j] = iif($accessible_property[$getforsalespropcode] = '', 0, accessible_property['<<$getforsalespropcode>>-renovated'])
- property_sales_price[hp_j] = iif($accessible_property[$getforsalespropcode] = '', property['price'], accessible_property['<<$getforsalespropcode>>-sales-price'])
- hp_j += 1
- end
- killvar 'property'
- end
- hp_i += 1
- if hp_i < count: jump 'get_properties_for_sale_loop'
- end
- killvar 'count'
- killvar 'hp_i'
- killvar 'j'
- killvar 'propcode'
- killvar 'checked_homes'
- killvar 'ishome'
- killvar 'hasprice'
- killvar '$getforsalespropcode'
- end
- !! Use it as `gs`, creates a set of arrays that contains the relevant info for
- !! all properties that the player can rent.
- !!
- !! "Returns":
- !! $property_code[], $property_name[], $property_display[]
- !! property_days[], property_rent[]
- !!
- !! $ARGS[1] - the class of the property: 'home' - returns only homes; 'business' - returns only business properties; '' - returns both types
- if $ARGS[0] = 'get_properties_for_rent':
- hp_i = 0
- hp_j = 0
- gs 'homes_properties', 'clean_up_property_data'
- count = ARRSIZE('homes')
- if count > 0:
- :get_properties_for_rent_loop
- $getpropforrentcode = $homes[hp_i]
- if $getpropforrentcode ! '' and checked_homes[$getpropforrentcode] = 0 and accessible_property[$getpropforrentcode] = 0:
- checked_homes[$getpropforrentcode] = 1
- if $accessible_property[$getpropforrentcode] = '': gs 'homes_properties_attr', 'get_property_attr', $getpropforrentcode
- ishome = iif($accessible_property[$getpropforrentcode] = '', INSTR($property['type'], 'residence') > 1, INSTR($accessible_property['<<$getpropforrentcode>>-type'], 'residence') > 1 )
- isrental = iif($accessible_property[$getpropforrentcode] = '', property['rental'] = 1, accessible_property['<<$getpropforrentcode>>-rental'] = 1 )
- if (($ARGS[1] ! 'home' and ishome = 0) or ($ARGS[1] ! 'business' and ishome)) and isrental:
- $property_code[hp_j] = $getpropforrentcode
- $property_name[hp_j] = iif($accessible_property[$getpropforrentcode] = '', $property['name'], $accessible_property['<<$getpropforrentcode>>-name'])
- if property['construction_needed'] = 1:
- $property_display[hp_j] = iif($accessible_property[$getpropforrentcode] = '', $property['display_0'], $accessible_property['<<$getpropforrentcode>>-display'])
- else
- $property_display[hp_j] = iif($accessible_property[$getpropforrentcode] = '', $property['display'], $accessible_property['<<$getpropforrentcode>>-display'])
- end
- property_days[hp_j] = iif($accessible_property[$getpropforrentcode] = '', 0, accessible_property['<<$getpropforrentcode>>-days-left'])
- property_rent[hp_j] = iif($accessible_property[$getpropforrentcode] = '', property['rent'], accessible_property['<<$getpropforrentcode>>-rent'])
- hp_j += 1
- end
- killvar 'property'
- end
- hp_i += 1
- if hp_i < count: jump 'get_properties_for_rent_loop'
- end
- killvar 'checked_homes'
- killvar 'count'
- killvar 'hp_i'
- killvar 'hp_j'
- killvar '$getpropforrentcode'
- killvar 'ishome'
- killvar 'isrental'
- end
- !! Use it as `gs`, creates a set of arrays that contains the relevant info for
- !! all properties for which the player can buy an internet subscription
- !!
- !! "Returns":
- !! $property_code[], $property_name[], $property_status[], property__is_current_home[]
- !! $property_stat values: 'rented', 'owned', 'tenants', 'no access'
- !!
- !! $ARGS[1] - the class of the property: 'home' - returns only homes; 'business' - returns only business properties; '' - returns both types
- !! $ARGS[2] - '' or 'hasaccess'. 'hasaccess' returns only those internet enabled properties that are purchased or rented by Sveta
- !! including ones with tenants.
- if $ARGS[0] = 'get_internet_enabled_properties':
- hp_i = 0
- hp_j = 0
- gs 'homes_properties', 'clean_up_property_data'
- count = ARRSIZE('homes')
- if count > 0:
- :get_internet_enabled_properties_loop
- $getnetenabledprocode = $homes[hp_i]
- if checked_homes[$getnetenabledprocode] = 0:
- checked_homes[$getnetenabledprocode] = 1
- gs 'homes_properties_attr', 'get_property_attr', $getnetenabledprocode
- accesscheck = ($ARGS[2] = 'hasaccess' and accessible_property[$getnetenabledprocode] ! 0 and accessible_property[$getnetenabledprocode] ! 4) or $ARGS[2] = ''
- typecheck = (($ARGS[1] ! 'home' and INSTR($property['type'], 'residence') = 0) or ($ARGS[1] ! 'business' and INSTR($property['type'], 'residence') > 0))
- if accesscheck and typecheck and property['internet_enabled']:
- $property_name[hp_j] = $property['name']
- $property_code[hp_j] = $getnetenabledprocode
- if accessible_property[$getnetenabledprocode] = 0:
- $property_status[hp_j] = 'no access'
- elseif accessible_property[$getnetenabledprocode] = 1:
- $property_status[hp_j] = 'rented'
- elseif accessible_property[$getnetenabledprocode] = 2:
- $property_status[hp_j] = 'owned'
- elseif accessible_property[$getnetenabledprocode] = 3:
- $property_status[hp_j] = 'tenants'
- end
- property__is_current_home[hp_j] = $home['current'] = $getnetenabledprocode
- hp_j += 1
- killvar 'accesscheck'
- killvar 'typecheck'
- end
- killvar 'property'
- end
- hp_i += 1
- if hp_i < count: jump 'get_internet_enabled_properties_loop'
- end
- killvar 'count'
- killvar 'hp_i'
- killvar 'hp_j'
- killvar 'propcode'
- killvar 'checked_homes'
- end
- !! Call after using any of the above calls to run killvar on all the temporary variables
- if $ARGS[0] = 'clean_up_property_data':
- killvar 'property_rent'
- killvar 'property_days'
- killvar 'property_code'
- killvar 'property_status'
- killvar 'property_name'
- killvar 'property_display'
- killvar 'property_type'
- killvar 'property_status_display'
- killvar 'property_is_rented'
- killvar 'property_construction_status'
- killvar 'property_is_renovated'
- killvar 'property_sales_price'
- killvar 'property_renovation_value'
- killvar 'property__is_current_home'
- end
- !! If there are no properties that can be used as home, Sveta is homeless.
- if $ARGS[0] = 'set_homeless':
- $home['current'] = 'homeless'
- end
- !!---------------------------------------------------------
- !! Give and block access to properties - use these if the
- !! property is not bought or rented.
- !! Parents home[], Meynold household, Grandparents house, etc.
- !!---------------------------------------------------------
- !! $ARGS[1]: the location for which the access is set
- !! Accepted values
- !! - property code -> 'city_apartment', 'parents_home'
- !! - a location -> 'bedrPar', 'koo2x' - A value that can shop up in $loc
- !! - empty strying -> '' - will work as if a location was passed, but will use the actual value of $loc
- !! - A number as str -> '1', '2' - this should be the id of the property
- !! NOTE: only added in case someone really want to use the old ids
- if $ARGS[0] = 'give_access':
- $accesscode = iif($ARGS[1] = '', $home_name[$loc], $ARGS[1])
- gs 'homes_properties', 'set_access', $accesscode, 1
- if accessible_property['accessible_home_count'] = 1 and accessible_property['<<$accesscode>>-is-home'] = 1 and $home['current'] = '': gs 'homes_properties', 'set_home', $accesscode
- killvar '$accesscode'
- end
- !! $ARGS[1]: the location for which the access is set
- !! Accepted values
- !! - property code -> 'city_apartment', 'parents_home'
- !! - a location -> 'bedrPar', 'koo2x' - A value that can shop up in $loc
- !! - empty strying -> '' - will work as if a location was passed, but will use the actual value of $loc
- !! - A number as str -> '1', '2' - this should be the id of the property
- !! NOTE: only added in case someone really want to use the old ids
- if $ARGS[0] = 'block_access':
- $blockcode = iif($ARGS[1] = '', $home_name[$loc], $ARGS[1])
- gs 'homes_properties', 'set_access', $blockcode, 0
- if accessible_property['accessible_home_count'] = 1 and ($home['current'] = '' or dyneval($is_homeless)):
- gs 'homes_properties', 'get_accessible_properties', 'home'
- if accessible_property['<<$property_code>>-is-home'] = 1: gs 'homes_properties', 'set_home', $property_code
- gs 'homes_properties', 'clean_up_property_data'
- elseif accessible_property['accessible_home_count'] < 1:
- gs 'homes_properties', 'set_homeless'
- end
- killvar 'blockcode'
- end
- !! Call: `func('homes_properties', 'has_access', $ARGS[1])`
- !! Returns 0 if Sveta has no access to the property and 1 or -1 if she has access, irrelecant of the type of access
- !! - owns the property, rents the property or allowed to stay at the property
- !!
- !! $ARGS[1]: the location for which the access is set
- !! Accepted values
- !! - property code -> 'city_apartment', 'parents_home'
- !! - a location -> 'bedrPar', 'koo2x' - A value that can shop up in $loc
- !! - empty strying -> '' - will work as if a location was passed, but will use the actual value of $loc
- !! - A number as str -> '1', '2' - this should be the id of the property
- !! NOTE: only added in case someone really want to use the old ids
- if $ARGS[0] = 'has_access':
- $hasaccesscode = iif($ARGS[1] = '', $home_name[$loc], $ARGS[1])
- result = accessible_property[$hasaccesscode] > 0 and accessible_property[$hasaccesscode] ! 3
- killvar 'hasaccesscode'
- end
- !!---------------------------------------------------------
- !! Buy, rent out and sell properties
- !!---------------------------------------------------------
- !! Call: `gs 'homes_properties', 'get_property_sales_info', $ARGS[1]`
- !! Creates $property_display and property_sales_price for a specific property.
- !!
- !! $ARGS[1] = the code of the property, e.g. 'city_apartment'
- if $ARGS[0] = 'get_property_sales_info':
- if $accessible_property[$ARGS[1]] = '' : gs 'homes_properties_attr', 'get_property_attr', $ARGS[1]
- if property['construction_needed'] = 1:
- $property_display = iif($accessible_property[$ARGS[1]] = '', $property['display_0'], $accessible_property['<<$ARGS[1]>>-display'])
- else
- $property_display = iif($accessible_property[$ARGS[1]] = '', $property['display'], $accessible_property['<<$ARGS[1]>>-display'])
- end
- property_sales_price = iif($accessible_property[$ARGS[1]] = '', property['price'], accessible_property['<<$ARGS[1]>>-sales-price'])
- killvar 'property'
- end
- !! Call: `gs 'homes_properties', 'buy_property', $ARGS[1], ARGS[2]`
- !! Makes all the necessary changes to the property status, access, etc.
- !! and stores the new sales value for future reference in case Sveta sells the property.
- !!
- !! $ARGS[1] = the code of the property, e.g. 'city_apartment'
- !! ARGS[2] = the final sales price in the transaction
- if $ARGS[0] = 'buy_property':
- gs 'homes_properties', 'set_access', $ARGS[1], 2
- accessible_property['<<$ARGS[1]>>-sales-price'] = ARGS[2]
- end
- !! Call: `gs 'homes_properties', 'sell_property', $ARGS[1], ARGS[2]`
- !! Makes all the necessary changes to the property status, access, etc.
- !! and stores the new sales value for future reference in case Sveta buys the property back.
- !!
- !! $ARGS[1] = the code name of the property, e.g. 'city_apartment'
- !! ARGS[2] = the final sales price in the transaction
- if $ARGS[0] = 'sell_property':
- gs 'homes_properties', 'set_access',$ARGS[1], 0
- accessible_property['<<$ARGS[1]>>-sales-price'] = ARGS[2]
- end
- !! Call: gs 'homes_properties', 'tenants_move_in', $ARGS[1], ARGS[2], ARGS[3]
- !! Makes the necessary changes to the property to track the tenants.
- !!
- !! $ARGS[1] - the property code of the home that is rented to tenants
- !! ARGS[2] - the tenancy end day
- !! ARGS[3] - the tenancy end month
- if $ARGS[0] = 'tenants_move_in':
- gs 'homes_properties', 'set_access', $ARGS[1], 3
- accessible_property['<<$ARGS[1]>>-tenant-day'] = ARGS[2]
- accessible_property['<<$ARGS[1]>>-tenant-month'] = ARGS[3]
- if $home['current'] = '' and accessible_property['accessible_home_count'] = 1:
- gs 'homes_properties', 'get_accessible_properties', 'home'
- if accessible_property['<<$property_code>>-is-home']: gs 'homes_properties', 'set_home', $property_code
- gs 'homes_properties', 'clean_up_property_data'
- end
- end
- !! Call: gs 'homes_properties', 'tenants_move_out', $ARGS[1]
- !! Makes the necessary changes to the property to track the tenants.
- !!
- !! $ARGS[1] - the property code of the home that was rented to tenants
- if $ARGS[0] = 'tenants_move_out':
- if $ARGS[1] ! '':
- gs 'homes_properties', 'set_access', $ARGS[1], 2
- if $home['current'] = '' and accessible_property['<<$ARGS[1]>>-is-home'] = 1 and accessible_property['accessible_home_count'] = 1: gs 'homes_properties', 'set_home', $ARGS[1]
- end
- end
- !! Call: `func('homes_properties', 'tenant_move_out_check')`
- !! Returns an array of messages for the tenants that have moved out.
- !! Runs every night and sees if any tenants are moving out
- !! If the tenants are moving out, the property becomes accessible again
- !!
- if $ARGS[0] = 'tenant_move_out_check':
- count = ARRSIZE('accessible_property')
- hp_i = 0
- hp_j = 0
- if count > 0:
- :tenantloop
- $tenantcode = $accessible_property[hp_i]
- if $home_name[$tenantcode] ! '' and accessible_property[$tenantcode] = 3:
- if accessible_property['<<$tenantcode>>-tenant-day'] = day and accessible_property['<<$tenantcode>>-tenant-month'] = month:
- gs 'homes_properties', 'set_access', $tenantcode, 2
- $result[hp_j] = '<b><font color="red">Your tenants have moved out from your <<$accessible_property[''<<$tenantcode>>-display'']>> and your apartment is now vacant.</font></b>'
- hp_j += 1
- end
- end
- hp_i += 1
- killvar 'property'
- if hp_i < count: jump 'tenantloop'
- end
- if accessible_property['accessible_home_count'] = 1 and $home['current'] = '':
- gs 'homes_properties', 'get_accessible_properties', 'home'
- if accessible_property['<<$property_code>>-is-home'] = 1: gs 'homes_properties', 'set_home', $property_code
- gs 'homes_properties', 'clean_up_property_data'
- end
- killvar 'hp_i'
- killvar 'hp_j'
- killvar 'count'
- end
- !! Call: `func('homes_properties', 'get_property_sales_price', $ARGS[1])`
- !! Returns the actual sales price of the property
- !!
- !! $ARGS[1] - property code
- if $ARGS[0] = 'get_property_sales_price':
- if $accessible_property[$ARGS[1]] ! '':
- result = accessible_property['<<$ARGS[1]>>-sales-price']
- else
- gs 'homes_properties_attr', 'get_property_attr', $ARGS[1]
- result = property['price']
- killvar 'property'
- end
- end
- !!---------------------------------------------------------
- !! Create, Update and Cancel Rents and related values
- !!---------------------------------------------------------
- !! Call: `gs 'homes_properties', 'rent_property', $ARGS[1], ARGS[2]`
- !! Rents a property. For now with immediate effect.
- !!
- !! $ARGS[1] = the code name of the property, e.g. 'city_apartment'
- !! ARGS[2] = the number of days the rent is paid for, optional
- if $ARGS[0] = 'rent_property':
- gs 'homes_properties', 'set_access', $ARGS[1], 1
- gs 'homes_properties', 'set_rent_days', $ARGS[1], ARGS[2]
- end
- !! Call: `gs 'homes_properties', 'cancel_rent', $ARGS[1]`
- !! Cancels the rent. For now with immediate effect.
- !!
- !! $ARGS[1] = the code name of the property, e.g. 'city_apartment'
- if $ARGS[0] = 'cancel_rent':
- gs 'homes_properties', 'set_access', $ARGS[1], 0
- gs 'homes_properties', 'set_rent_days', $ARGS[1], -1
- if accessible_property['accessible_home_count'] > 0 and $home['current'] = '':
- gs 'homes_properties', 'get_accessible_properties', 'home'
- if accessible_property['<<$ARGS[1]>>-is-home'] = 1: gs 'homes_properties', 'set_home', $property_code
- gs 'homes_properties', 'clean_up_property_data'
- end
- end
- !! Call: `gs 'homes_properties', 'cancel_rent', $ARGS[1], $ARGS[2]`
- !!
- !! $ARGS[1] - property code of the rental
- !! $ARGS[2] - payment method: 'card' or 'cash'
- if $ARGS[0] = 'pay_rent':
- if $ARGS[2] = 'card':
- karta -= accessible_property['<<$ARGS[1]>>-rent']
- elseif $ARGS[2] = 'cash':
- money -= accessible_property['<<$ARGS[1]>>-rent']
- end
- gs 'homes_properties', 'add_rent_days', $ARGS[1]
- end
- !! Call: `gs 'homes_properties', 'add_rent_days', $ARGS[1], ARGS[2]`
- !! Add the number of days passed to the remaining rental days.
- !!
- !! $ARGS[1] = the code name of the property, e.g. 'city_apartment'
- !! ARGS[2] - the number of days to add (can be negative).
- !! if the value is 0 then the code will add the number of days equal to the length of the month
- if $ARGS[0] = 'add_rent_days':
- if ARGS[2] = 0:
- accessible_property['<<$ARGS[1]>>-days-left'] += func( 'homes_properties', 'days_in_month')
- else
- accessible_property['<<$ARGS[1]>>-days-left'] += ARGS[2]
- end
- end
- !! Call: `gs 'homes_properties', 'set_rent_days', $ARGS[1], ARGS[2]`
- !! Sets the remaining rental days to a specific amount.
- !!
- !! $ARGS[1] - the code name of the property, e.g. 'city_apartment'
- !! ARGS[2] - the number of days to set to - it is an absolute value
- !! If the value is zero, it will be set to the length of the month (ie. 28,29,30 or 31 days)
- if $ARGS[0] = 'set_rent_days':
- if ARGS[2] = 0:
- accessible_property['<<$ARGS[1]>>-days-left'] = func( 'homes_properties', 'days_in_month')
- else
- accessible_property['<<$ARGS[1]>>-days-left'] = ARGS[2]
- end
- end
- !! Call: `gs 'homes_properties', 'set_rent_amount', $ARGS[1], ARGS[2]`
- !! Sets the monthly rent of the property
- !!
- !! $ARGS[1] - property code
- !! ARGS[2] - the new rent amount
- if $ARGS[0] = 'set_rent_amount':
- if accessible_property['<<$ARGS[1]>>-rental'] and ARGS[2] >= 0 : accessible_property['<<$ARGS[1]>>-rent'] = ARGS[2]
- end
- !! Call: `func('homes_properties', 'get_rent_days', $ARGS[1])`
- !! Returns the remaining rent days for the property
- !!
- !! $ARGS[1] = the code name of the property, e.g. 'city_apartment'
- if $ARGS[0] = 'get_rent_days':
- result = accessible_property['<<$ARGS[1]>>-days-left']
- end
- !! Call: `func('homes_properties', 'get_rent_amount', $ARGS[1])`
- !! Returns the monthly rent of the property
- !!
- !! $ARGS[1] - property code
- if $ARGS[0] = 'get_rent_amount':
- if $accessible_property[$ARGS[1]] ! '':
- result = accessible_property['<<$ARGS[1]>>-rent']
- else
- gs 'homes_properties_attr', 'get_property_attr', $ARGS[1]
- result = property['rent']
- killvar 'property'
- end
- end
- !! Call: `gs 'homes_properties', 'progress_property_rent_time'`
- !! Decreases the number of days left on the lease.
- !!
- if $ARGS[0] = 'progress_property_rent_time':
- gs 'homes_properties', 'get_rented_properties', 1
- count = ARRSIZE('property_code')
- hp_i = 0
- if count > 0:
- :progress_property_rent_time_loop
- gs 'homes_properties', 'add_rent_days', $property_code[hp_i], -1
- hp_i += 1
- if hp_i < count: jump 'progress_property_rent_time_loop'
- end
- killvar 'property_code'
- killvar 'count'
- killvar 'hp_i'
- end
- !! Call: `func('homes_properties', 'days_in_month')`
- !! Returns the rent the number of days in a give month.
- !!
- if $ARGS[0] = 'days_in_month':
- if monthsend[1] = 0: gs 'time', 'init_monthends'
- result = monthsend[month]
- end
- !!---------------------------------------------------------
- !! Construction and Renovation of Properties
- !!---------------------------------------------------------
- !! Call: `func('homes_properties', 'get_property_construction_status', $ARGS[1])`
- !! $ARGS[1] - the property code or location, if empty it will use $loc
- if $ARGS[0] = 'get_property_construction_status':
- $constrstatcheckpropcode = iif($ARGS[1] = '', $home_name[$loc], $home_name[$ARGS[1]])
- result = accessible_property['<<$constrstatcheckpropcode>>-construction-status']
- killvar 'constrstatcheckpropcode'
- end
- !! Call: `func('homes_properties', 'progress_construction_status', $ARGS[1])`
- !! $ARGS[1] - the property code or location, if empty it will use $loc
- if $ARGS[0] = 'progress_construction_status':
- $constrstatpropcode = iif($ARGS[1] = '', $home_name[$loc], $home_name[$ARGS[1]])
- if accessible_property['<<$constrstatpropcode>>-construction-status'] < 2: accessible_property['<<$constrstatpropcode>>-construction-status'] += 1
- killvar 'constrstatpropcode'
- end
- !! Call: `func('homes_properties', 'is_property_renovated', $ARGS[1])`
- !! $ARGS[1] - the property code or location, if empty it will use $loc
- if $ARGS[0] = 'is_property_renovated':
- $checkrenpropcode = iif($ARGS[1] = '', $home_name[$loc], $home_name[$ARGS[1]])
- result = accessible_property['<<$checkrenpropcode>>-renovated']
- killvar 'checkrenpropcode'
- end
- !! Call: `gs 'homes_properties', 'renovate_property', $ARGS[1], ARGS[2], $ARGS[3]`
- !!
- !! $ARGS[1] - the property code or location, if empty it will use $loc
- !! ARGS[2] - the value of the renovation
- !! $ARGS[3] - the part of the property that was renovated - 'bedroom', 'living room', etc. Optional
- if $ARGS[0] = 'renovate_property':
- $renovatepropcode = iif($ARGS[1] = '', $home_name[$loc], $home_name[$ARGS[1]])
- accessible_property['<<$renovatepropcode>>-renovated'] = 1
- accessible_property['<<$renovatepropcode>>-renovation-value'] += ARGS[2]
- if $ARGS[3] ! '' : $accessible_property['<<$renovatepropcode>>-renovations'] += ';<<$ARGS[3]>>'
- killvar '$renovatepropcode'
- end
- !!---------------------------------------------------------
- !! Go to properties, home, free internet checksm etc.
- !!---------------------------------------------------------
- !! Call: `gs 'homes_properties', 'go_home'`
- !! Takes Sveta to the location where her home can be found
- if $ARGS[0] = 'go_home':
- if dyneval($is_homeless) or $home['region'] ! $region:
- dynamic($train_station[$region])
- else
- gt $home['location'], $home['location_arg']
- end
- end
- !! Call: `gs 'homes_properties', 'go_straight_home'`
- !! Takes Sveta to the entrance of her home
- if $ARGS[0] = 'go_straight_home':
- if dyneval($is_homeless) or $home['region'] ! $region:
- dynamic($train_station[$region])
- else
- gt $home['entrance'], $home['entrance_arg']
- end
- end
- !! Call: `gs 'homes_properties', 'go_bathroom'`
- !! Takes Sveta to the bathroom of the property they are at, or the property passed in $ARGS[1]
- !! $ARGS[1] - the property code or location, if empty it will use $loc
- if $ARGS[0] = 'go_bathroom':
- $name = iif($ARGS[1] = '', $home_name[$loc], $home_name[$ARGS[1]])
- gs 'homes_properties_attr', 'get_property_attr', $name
- gt $property['bathroom'], $property['bathroom_arg']
- killvar '$property'
- killvar '$name'
- end
- !! Call: `gs 'homes_properties', 'go_bedroom'`
- !! Takes Sveta to the bedroom of the property they are at, or the property passed in $ARGS[1]
- !! $ARGS[1] - the property code or location, if empty it will use $loc
- if $ARGS[0] = 'go_bedroom':
- $name = iif($ARGS[1] = '', $home_name[$loc], $home_name[$ARGS[1]])
- gs 'homes_properties_attr', 'get_property_attr', $name
- gt $property['bedroom'], $property['bedroom_arg']
- killvar '$property'
- killvar '$name'
- end
- !! Returns 0 if the property doesn''t give free internet access, and 1 or -1 if it does
- !!
- !! Call: func('homes_properties', 'free_internet_available')
- !! $ARGS[1] The location to be checked
- !! Accepted values:
- !! - a property code - 'city_apartment', etc.
- !! - a location - a value that could show up in $loc, like 'bedr' or 'mey_home'
- !! - empty string - in this case the actual $loc value will be used
- if $ARGS[0] = 'free_internet_available':
- gs 'homes_properties_attr', 'get_property_attr', iif($ARGS[1] = '', $home_name[$loc], $home_name[$ARGS[1]])
- result = property['free_internet'] = 1
- killvar 'property'
- end
- --- homes_properties ---------------------------------
|