# agentned
if $ARGS[0] = 'start':
CLOSE ALL
*clr & cla
$loc = 'agentned'
$loc_arg = $ARGS[0]
$location_type = 'indoors'
$menu_loc = 'agentned'
$menu_arg = 'start'
menu_off = 0
gs'stat'
gs'dina'
!! gs 'housing', 'rent'
'
Kirsanova Real Estate Agency'
'> src="images/locations/city/citycenter/realestate/agenstvo.jpg">'
*nl
'This is the head office of the largest real estate agency in the Leningrad Oblast.'
*nl
'At the reception, you notice a large print banner:'
'"Please be aware that all sales transactions are made exclusively through your bank account. Rent payments are excluded from this policy."'
act 'View rentals': gt 'agentned', 'rent'
act 'View properties for sale': gt 'agentned', 'buy'
!! Get a list of the properties and their attributes that the player rented:
!! Returns: $property_name[i], $property_code[i], $property_display[i], property_rent[i], property_days[i]
gs 'homes_properties', 'get_rented_properties', 'home'
count = ARRSIZE('$property_name')
if count > 0:
i = 0
'Rent Information
'
:listing_rented_properties_loop
'You have <> days remaining on the lease of your <<$property_display[i]>>, and your monthly rent is <>₽. '+iif(money >= property_rent[i],'You can make a rent payment in cash to extend it.','You can''t afford to pay your rent at the moment')
!! TODO: Make the duplication way less.
if $property_code[i] = 'city_apartment':
act 'Cancel the lease of the <<$property_display[i]>>':
cla & *nl
!! TODO: 1 month notice period like in real life?
'Attention: You won''t be able to return to your apartment when you cancel the lease.'
act 'Return': gt'agentned', 'start'
act 'Cancel it': gs 'homes_properties', 'cancel_rent', 'city_apartment' & gt'agentned', 'start'
end
elseif $property_code[i] = 'old_town_apartment':
act 'Cancel the lease of the <<$property_display[i]>>':
cla & *nl
!! TODO: 1 month notice period like in real life?
'Attention: You won''t be able to return to your apartment when you cancel the lease.'
act 'Return': gt'agentned', 'start'
act 'Cancel it': gs 'homes_properties', 'cancel_rent', 'old_town_apartment' & gt'agentned', 'start'
end
end
i += 1
if i < count: jump 'listing_rented_properties_loop'
end
killvar 'count' & killvar 'i'
!! 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_construction_status, property_is_renovated[], property_sales_price[], property_renovation_value[]
gs 'homes_properties', 'get_owned_properties', 'home'
count = ARRSIZE('$property_name')
if count > 0:
'You own the following properties
'
i = 0
:listing_owned_properties_loop
$property_status_display[i]
i += 1
if i < count: jump 'listing_owned_properties_loop'
*nl
'We are at your service if you decide to sell.'
*nl
end
gs 'homes_properties', 'clean_up_property_data'
killvar 'count' & killvar 'i' & killvar 'j'
act 'Leave': minut += 5 & gt 'city_center'
end
if $ARGS[0] = 'buy':
*clr & cla
$loc = 'agentned'
$loc_arg = $ARGS[0]
$location_type = 'indoors'
$menu_loc = 'agentned'
$menu_arg = 'buy'
menu_off = 0
gs 'housing', 'sale'
gs 'homes_properties', 'clean_up_property_data'
'Real Estate Agency'
'> src="images/locations/city/citycenter/realestate/agenstvo.jpg">'
*nl
' The purchase of any properties requires a bank account. The Agency is not conducting business in cash in compliance with the Anti-Money Laundering Regulations
'
*nl
minut += 5
gs 'stat'
act 'Return':gt'agentned', 'start'
!! "Returns":
!! $property_code[], $property_name[], $property_display[], $property_agency_name[],
!! property_construction_status,property_is_renovated[], property_sales_price[],
!! property_type[]
gs 'homes_properties', 'get_properties_for_sale'
count = ARRSIZE('$property_name')
if count > 0:
i = 0
'We have the following properties for sales
'
:listing_properties_for_sale_loop
if property_is_rented[i] ! 0:
'You could buy the <<$property_display[i]>> you''re currently renting, for <> ₽.'
else
'A(n) <<$property_display[i]>> is available for sale for <> ₽.'
end
if karta >= property_sales_price[i]:
if $property_code[i] = 'city_apartment': act 'Buy the <<$property_display[i]>>': gs 'agentned', 'buy_property', 'city_apartment'
if $property_code[i] = 'village_cottage': act 'Buy the <<$property_display[i]>>': gs 'agentned', 'buy_property', 'village_cottage'
if $property_code[i] = 'matryona_mansion': act 'Buy the <<$property_display[i]>>': gs 'agentned', 'buy_property', 'matryona_mansion'
if $property_code[i] = 'city_house': act 'Buy the <<$property_display[i]>>': gs 'agentned', 'buy_property', 'city_house'
end
i += 1
if i < count: jump 'listing_properties_for_sale_loop'
else
'We currently have no properties listed for sale.'
end
gs 'homes_properties', 'clean_up_property_data'
killvar 'count' & killvar 'i'
end
if $ARGS[0] = 'buy_property':
*clr & cla
menu_off = 1
gs 'homes_properties', 'get_property_sales_info', $ARGS[1]
minut += 30
karta -= property_sales_price
gs 'homes_properties', 'buy_property', $ARGS[1], property_sales_price
$set_homeyn = input("Would you like to set this as your new home? (yes/no)")
if $set_homeyn = 'yes': gs 'homes_properties', 'set_home', $ARGS[1]
killvar '$set_homeyn'
!!TODO: this etoexhib will need some rethinking I get what it means by now, but some better name would help a lot.
!!NOTE: It means how "famous" Sveta is for being an exhibitionist.
if $ARGS[1] = 'village_cottage': etoexhib = 0
gs'stat'
'Real Estate Agency'
'> src="images/locations/city/citycenter/realestate/agenstvo_paperwork.jpg">'
*nl
'You spend half an hour filling in the paperwork to buy the <<$property_display>>. <>₽ has been removed from your bank account.'
killvar 'property' & killvar 'property_code' & killvar 'property_sales_price' & killvar 'property_display'
act 'Return':gt'agentned', 'start'
end
!! NOTE: When a property is sold, it can be bought back. To avoid a guaranteed income from the
!! "I buy property for X, renovate it, sell it for X+Y, then buy it for X, then repeat" loop,
!! the sales price of the property is updated with the price that it was sold for.
if $ARGS[0] = 'sell':
*clr & cla
$loc = 'agentned'
$loc_arg = $ARGS[0]
$location_type = 'indoors'
$menu_loc = 'agentned'
$menu_arg = 'sell'
menu_off = 0
gs 'homes_properties', 'clean_up_property_data'
'Real Estate Agency'
'> src="images/locations/city/citycenter/realestate/agenstvo.jpg">'
*nl
'Any purchase or sale of a property requires a bank account. The Agency is not conducting business in cash in compliance with the Anti-Money Laundering Regulations
'
*nl
act 'Return': gs 'homes_properties', 'clean_up_property_data' & gt'agentned', 'start'
if bankAccount = 1:
!! 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_construction_status, property_is_renovated[], property_sales_price[], property_renovation_value[]
gs 'homes_properties', 'get_owned_properties', 'home'
count = ARRSIZE('$property_name')
if count > 0:
'Available offers for your properties
'
i = 0
:listing_offers_on_owned_properties_loop
if $property_code[i] ! 'matryona_mansion' or ($property_code[i] = 'matryona_mansion' and property_construction_status[i] = 0):
!! NOTE: Offer: (last sales price + rand(-10%, +10%)) + (renovation value + rand(0%,+10%)
!! No need to check what has been renovated, the only thing that matters is the total value of the renovation
!! If Sveta sells, this will be stored as the new sales price of the property
offer = property_sales_price + property_renovation_value + (property_sales_price*rand(-10,10))/100 + (property_renovation_value*rand(0,10))/100
'We have found a buyer for your <<$property_display[i]>>. They will offer <>₽, minus 5% for fees and taxes to the value of <>, bringing the total to <>'
if $property_code[i] = 'city_apartment': act 'Sell the <<$property_display[i]>>': gs 'agentned', 'finalise_sale', 'city_apartment', i
if $property_code[i] = 'village_cottage': act 'Sell the <<$property_display[i]>>': gs 'agentned', 'finalise_sale', 'village_cottage', i
if $property_code[i] = 'matryona_mansion': act 'Sell the <<$property_display[i]>>': gs 'agentned', 'finalise_sale', 'matryona_mansion', i
if $property_code[i] = 'city_house': act 'Sell the <<$property_display[i]>>': gs 'agentned', 'finalise_sale', 'city_house', i
end
i += 1
if i < count: jump 'listing_offers_on_owned_properties_loop'
end
gs 'homes_properties', 'clean_up_property_data'
killvar 'count' & killvar 'i' & killvar 'j'
act 'Leave': minut += 5 & gt 'city_center'
!! NOTE: Keeping this here for future renovation related reference.
!!{
if bankAccount = 1:
if rembedr = 1 and remsitr = 1 and remkorr = 1 and remvanr = 1 and remkuhr = 1:
!Renovated city residential apartment
offer1 = ((800000 + 250000) + rand(-100000, 100000))
else
offer1 = (800000 + rand(-100000, 100000))
end
if func('homes_properties', 'property_renovated', 'village_cottage') = 1:
!Renovated communal cottage
offer2 = ((prop_price['village_cottage'] + 200000) + rand(-10000, 10000))
else
!Communal cottage
offer2 = (prop_price['village_cottage'] + rand(-5000, 5000))
end
}
else
'You need to open a bank account to sell your property'
end
end
if $ARGS[0] = 'finalise_sale':
*clr
menu_off = 1
gs 'homes_properties', 'get_property_sales_info', $ARGS[1]
'Real Estate Agency'
'> src="images/locations/city/citycenter/realestate/agenstvo_paperwork.jpg">'
minut += 30
'You spend thirty minutes filling out the paperwork for the sale of your <<$property_display[ARGS[2]]>>. <>₽ has been paid into your bank account.'
gs 'homes_properties', 'sell_property', $ARGS[1], offer
karta += (offer * 95) / 100
delact 'Sell the <<$property_display[ARGS[2]]>>'
gs 'stat'
killvar 'property_display' & killvar 'property_sales_price'
end
if $ARGS[0] = 'rent':
*clr & cla
$loc = 'agentned'
$loc_arg = $ARGS[0]
$location_type = 'indoors'
$menu_loc = 'agentned'
$menu_arg = 'rent'
menu_off = 0
'Real Estate Agency'
'> src="images/locations/city/citycenter/realestate/agenstvo.jpg">'
*nl
minut += 5
gs 'stat'
act 'Return': killvar 'rent_code' & killvar 'monthly_rent' & gt'agentned', 'start'
gs 'homes_properties', 'get_properties_for_rent', 'home'
count = ARRSIZE('property_name')
if count > 0:
i = 0
'Properties currently available for rent
'
:listing_properties_for_rent_loop
'We have a(n) <<$property_display[i]>> avaible for a monthly rent of <>₽.'
monthly_rent[$property_code[i]] = property_rent[i]
if $property_code[i] = 'city_apartment': act 'View the <<$property_display[i]>> details': gt 'agentned', 'view_property_details', 'city_apartment', monthly_rent['city_apartment']
if $property_code[i] ='old_town_apartment': act 'View the <<$property_display[i]>> details': gt 'agentned', 'view_property_details', 'old_town_apartment', monthly_rent['old_town_apartment']
i += 1
if i < count: jump 'listing_properties_for_rent_loop'
else
'We currently have no properties listed for rent.'
end
*nl
gs 'homes_properties', 'clean_up_property_data'
killvar 'count' & killvar 'i'
end
if $ARGS[0] = 'view_property_details':
*clr & cla
menu_off = 1
'Real Estate Agency'
'> src="images/locations/city/citycenter/realestate/agenstvo.jpg">'
*nl
'<> The receptionist says as he starts pulling out the paperwork, "Rent is <>₽ and leases have to be renewed every 30 days. Payment will be automatically deducted from your account or you can come into the office to pay. Last, but not least, you must make pay the first month when you sign for the lease."'
'
He pulls out a pen and slides the paperwork onto the counter. "Interested? You can move in right away," he says calmly.'
if money >= ARGS[2] or karta >= ARGS[2]:
act 'Agree and pay':
*clr & cla
cls
minut += 30
if money >= ARGS[2]:
money -= ARGS[2]
else
karta -= ARGS[2]
end
gs 'homes_properties', 'rent_property', $ARGS[1]
if func( 'homes_properties', 'get_accessible_property_count', 'home') = 1:
gs 'homes_properties', 'set_home', $ARGS[1]
else
$set_homeyn = input("Would you like to set this as your new home? (yes/no)")
if $set_homeyn = 'yes': gs 'homes_properties', 'set_home', $ARGS[1]
killvar '$set_homeyn'
end
gs'stat'
'Real Estate Agency'
'> src="images/locations/city/citycenter/realestate/agenstvo_paperwork.jpg">'
*nl
'You take the pen then start filling out the paperwork. After writing for half an hour, you hand over the money and receive the keys to your new apartment.'
act 'Return':gt'agentned', 'start'
end
else
'You do not have enough money with you or in your bank account to pay the rent.'
end
act 'Decline':
*clr & cla
minut += 5
'Real Estate Agency'
'> src="images/locations/city/citycenter/realestate/agenstvo.jpg">'
*nl
'You shake your head, "Actually, I need more time to think about this."'
'
The receptionist seems a bit miffed, but says nothing as he takes back the paperwork and stuffs it back into his desk drawer.'
act 'Return':gt'agentned', 'start'
end
killvar 'rent_code' & killvar 'monthly_rent'
end
!! $ARGS[1] - the code of the property.
if $ARGS[0] = 'get_rent_detail_dialogue':
if $ARGS[1] = 'old_town_apartment':
$result = '"We have a small apartment available right now that is in Pushkin’s city center. It’s a little bit pricey, but it’s been recently renovated to be more modern. It looks quite nice, so you won’t find a place like that outside of Pushkin."'
elseif $ARGS[1] = 'city_apartment':
$result = '"We have a flat available right now in the St. Petersburg residential area."'
else
gs 'agentned', 'get_rent_detail_dialogue_hook', $ARGS[1]
$result = $agency_rental_dialogue
killvar '$agency_rental_dialogue'
end
end
!! $ARGS[1] - the code of the property.
if $ARGS[0] = 'get_rent_detail_dialogue_hook':
!! In a mod just redirect this call and set the value of the variable below to the text
!! that should be used for the property by the agency.
$agency_rental_dialogue = ''
end
!! Call: `func('agentned', 'format_price_string', ARGS[1])
!! ARGS[1] - the price (as a number)
if $ARGS[0] = 'format_price_string':
$worknum = STR(ARGS[1])
worknumlength = LEN($worknum)
pos1 = 1
:format_price_string_loop
$split = $MID($worknum, pos1, 1)
if (worknumlength - 1)/3 ! (worknumlength-2)/3:
$result += $split+','
else
$result += $split
end
worknumlength -= 1
pos1 += 1
if pos2 <= worknumlength: jump 'format_price_string_loop'
killvar 'pos1' & killvar 'pos2' & killvar 'worknum' & killvar 'worknumlength' & killvar 'split'
end
--- agentned ---------------------------------