1
0

agentned.qsrc 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. # agentned
  2. if $ARGS[0] = 'start':
  3. CLOSE ALL
  4. *clr & cla
  5. $loc = 'agentned'
  6. $loc_arg = $ARGS[0]
  7. $location_type = 'indoors'
  8. $menu_loc = 'agentned'
  9. $menu_arg = 'start'
  10. menu_off = 0
  11. gs'stat'
  12. gs'dina'
  13. !! gs 'housing', 'rent'
  14. '<center><b><font color = maroon>Kirsanova Real Estate Agency</font></b></center>'
  15. '<center><img <<$set_imgh>> src="images/locations/city/citycenter/realestate/agenstvo.jpg"></center>'
  16. *nl
  17. 'This is the head office of the largest real estate agency in the Leningrad Oblast.'
  18. *nl
  19. 'At the reception, you notice a large print banner:'
  20. '<b>"Please be aware that all sales transactions are made exclusively through your bank account. Rent payments are excluded from this policy."</b>'
  21. act 'View rentals': gt 'agentned', 'rent'
  22. act 'View properties for sale': gt 'agentned', 'buy'
  23. !! Get a list of the properties and their attributes that the player rented:
  24. !! Returns: $property_name[i], $property_code[i], $property_display[i], property_rent[i], property_days[i]
  25. gs 'homes_properties', 'get_rented_properties', 'home'
  26. count = ARRSIZE('$property_name')
  27. if count > 0:
  28. i = 0
  29. '<h4>Rent Information</h4>'
  30. :listing_rented_properties_loop
  31. 'You have <B><<property_days[i]>> days</B> remaining on the lease of your <<$property_display[i]>>, and your monthly rent is <<func(''agentned'', ''format_price_string'', property_rent[i])>><b>₽</b>. '+iif(money >= property_rent[i],'You can make a rent <a href="exec: gs ''homes_properties'', ''pay_rent'', ''<<$property_code[i]>>'', ''cash'' & gt ''agentned'', ''start''">payment</a> in cash to extend it.','You can''t afford to pay your rent at the moment')
  32. !! TODO: Make the duplication way less.
  33. if $property_code[i] = 'city_apartment':
  34. act 'Cancel the lease of the <<$property_display[i]>>':
  35. cla & *nl
  36. !! TODO: 1 month notice period like in real life?
  37. 'Attention: You won''t be able to return to your apartment when you cancel the lease.'
  38. act 'Return': gt'agentned', 'start'
  39. act 'Cancel it': gs 'homes_properties', 'cancel_rent', 'city_apartment' & gt'agentned', 'start'
  40. end
  41. elseif $property_code[i] = 'old_town_apartment':
  42. act 'Cancel the lease of the <<$property_display[i]>>':
  43. cla & *nl
  44. !! TODO: 1 month notice period like in real life?
  45. 'Attention: You won''t be able to return to your apartment when you cancel the lease.'
  46. act 'Return': gt'agentned', 'start'
  47. act 'Cancel it': gs 'homes_properties', 'cancel_rent', 'old_town_apartment' & gt'agentned', 'start'
  48. end
  49. end
  50. i += 1
  51. if i < count: jump 'listing_rented_properties_loop'
  52. end
  53. killvar 'count' & killvar 'i'
  54. !! Get a list of the properties and their attributes that the player rented:
  55. !! $property_code[], $property_name[], $property_display[], $property_status_display[], $property_type[]
  56. !! property_construction_status, property_is_renovated[], property_sales_price[], property_renovation_value[]
  57. gs 'homes_properties', 'get_owned_properties', 'home'
  58. count = ARRSIZE('$property_name')
  59. if count > 0:
  60. '<h4>You own the following properties</h4>'
  61. i = 0
  62. :listing_owned_properties_loop
  63. $property_status_display[i]
  64. i += 1
  65. if i < count: jump 'listing_owned_properties_loop'
  66. *nl
  67. 'We are at your service if you decide to <a href="exec:gt ''agentned'',''sell''">sell</a>.'
  68. *nl
  69. end
  70. gs 'homes_properties', 'clean_up_property_data'
  71. killvar 'count' & killvar 'i' & killvar 'j'
  72. act 'Leave': minut += 5 & gt 'city_center'
  73. end
  74. if $ARGS[0] = 'buy':
  75. *clr & cla
  76. $loc = 'agentned'
  77. $loc_arg = $ARGS[0]
  78. $location_type = 'indoors'
  79. $menu_loc = 'agentned'
  80. $menu_arg = 'buy'
  81. menu_off = 0
  82. gs 'housing', 'sale'
  83. gs 'homes_properties', 'clean_up_property_data'
  84. '<center><b><font color = maroon>Real Estate Agency</font></b></center>'
  85. '<center><img <<$set_imgh>> src="images/locations/city/citycenter/realestate/agenstvo.jpg"></center>'
  86. *nl
  87. '<h4> 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</h4>'
  88. *nl
  89. minut += 5
  90. gs 'stat'
  91. act 'Return':gt'agentned', 'start'
  92. !! "Returns":
  93. !! $property_code[], $property_name[], $property_display[], $property_agency_name[],
  94. !! property_construction_status,property_is_renovated[], property_sales_price[],
  95. !! property_type[]
  96. gs 'homes_properties', 'get_properties_for_sale'
  97. count = ARRSIZE('$property_name')
  98. if count > 0:
  99. i = 0
  100. '<h4>We have the following properties for sales</h4>'
  101. :listing_properties_for_sale_loop
  102. if property_is_rented[i] ! 0:
  103. 'You could buy the <<$property_display[i]>> you''re currently renting, for <<func(''agentned'', ''format_price_string'', property_sales_price[i])>> <b>₽</b>.'
  104. else
  105. 'A(n) <<$property_display[i]>> is available for sale for <<func(''agentned'', ''format_price_string'', property_sales_price[i])>> <b>₽</b>.'
  106. end
  107. if karta >= property_sales_price[i]:
  108. if $property_code[i] = 'city_apartment': act 'Buy the <<$property_display[i]>>': gs 'agentned', 'buy_property', 'city_apartment'
  109. if $property_code[i] = 'village_cottage': act 'Buy the <<$property_display[i]>>': gs 'agentned', 'buy_property', 'village_cottage'
  110. if $property_code[i] = 'matryona_mansion': act 'Buy the <<$property_display[i]>>': gs 'agentned', 'buy_property', 'matryona_mansion'
  111. if $property_code[i] = 'city_house': act 'Buy the <<$property_display[i]>>': gs 'agentned', 'buy_property', 'city_house'
  112. end
  113. i += 1
  114. if i < count: jump 'listing_properties_for_sale_loop'
  115. else
  116. 'We currently have no properties listed for sale.'
  117. end
  118. gs 'homes_properties', 'clean_up_property_data'
  119. killvar 'count' & killvar 'i'
  120. end
  121. if $ARGS[0] = 'buy_property':
  122. *clr & cla
  123. menu_off = 1
  124. gs 'homes_properties', 'get_property_sales_info', $ARGS[1]
  125. minut += 30
  126. karta -= property_sales_price
  127. gs 'homes_properties', 'buy_property', $ARGS[1], property_sales_price
  128. $set_homeyn = input("Would you like to set this as your new home? (yes/no)")
  129. if $set_homeyn = 'yes': gs 'homes_properties', 'set_home', $ARGS[1]
  130. killvar '$set_homeyn'
  131. !!TODO: this etoexhib will need some rethinking I get what it means by now, but some better name would help a lot.
  132. !!NOTE: It means how "famous" Sveta is for being an exhibitionist.
  133. if $ARGS[1] = 'village_cottage': etoexhib = 0
  134. gs'stat'
  135. '<center><b><font color = maroon>Real Estate Agency</font></b></center>'
  136. '<center><img <<$set_imgh>> src="images/locations/city/citycenter/realestate/agenstvo_paperwork.jpg"></center>'
  137. *nl
  138. 'You spend half an hour filling in the paperwork to buy the <<$property_display>>. <<func(''agentned'', ''format_price_string'', property_sales_price)>><b>₽</b> has been removed from your bank account.'
  139. killvar 'property' & killvar 'property_code' & killvar 'property_sales_price' & killvar 'property_display'
  140. act 'Return':gt'agentned', 'start'
  141. end
  142. !! NOTE: When a property is sold, it can be bought back. To avoid a guaranteed income from the
  143. !! "I buy property for X, renovate it, sell it for X+Y, then buy it for X, then repeat" loop,
  144. !! the sales price of the property is updated with the price that it was sold for.
  145. if $ARGS[0] = 'sell':
  146. *clr & cla
  147. $loc = 'agentned'
  148. $loc_arg = $ARGS[0]
  149. $location_type = 'indoors'
  150. $menu_loc = 'agentned'
  151. $menu_arg = 'sell'
  152. menu_off = 0
  153. gs 'homes_properties', 'clean_up_property_data'
  154. '<center><b><font color = maroon>Real Estate Agency</font></b></center>'
  155. '<center><img <<$set_imgh>> src="images/locations/city/citycenter/realestate/agenstvo.jpg"></center>'
  156. *nl
  157. '<h4>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</h4>'
  158. *nl
  159. act 'Return': gs 'homes_properties', 'clean_up_property_data' & gt'agentned', 'start'
  160. if bankAccount = 1:
  161. !! Get a list of the properties and their attributes that the player rented:
  162. !! $property_code[], $property_name[], $property_display[], $property_status_display[], $property_type[]
  163. !! property_construction_status, property_is_renovated[], property_sales_price[], property_renovation_value[]
  164. gs 'homes_properties', 'get_owned_properties', 'home'
  165. count = ARRSIZE('$property_name')
  166. if count > 0:
  167. '<h4>Available offers for your properties</h4>'
  168. i = 0
  169. :listing_offers_on_owned_properties_loop
  170. if $property_code[i] ! 'matryona_mansion' or ($property_code[i] = 'matryona_mansion' and property_construction_status[i] = 0):
  171. !! NOTE: Offer: (last sales price + rand(-10%, +10%)) + (renovation value + rand(0%,+10%)
  172. !! No need to check what has been renovated, the only thing that matters is the total value of the renovation
  173. !! If Sveta sells, this will be stored as the new sales price of the property
  174. offer = property_sales_price + property_renovation_value + (property_sales_price*rand(-10,10))/100 + (property_renovation_value*rand(0,10))/100
  175. 'We have found a buyer for your <<$property_display[i]>>. They will offer <<func(''agentned'', ''format_price_string'', offer)>><b>₽</b>, minus 5% for fees and taxes to the value of <<func(''agentned'', ''format_price_string'', ( (offer*5)/100) )>>, bringing the total to <<func(''agentned'', ''format_price_string'', ( (offer*95)/100 ) )>>'
  176. if $property_code[i] = 'city_apartment': act 'Sell the <<$property_display[i]>>': gs 'agentned', 'finalise_sale', 'city_apartment', i
  177. if $property_code[i] = 'village_cottage': act 'Sell the <<$property_display[i]>>': gs 'agentned', 'finalise_sale', 'village_cottage', i
  178. if $property_code[i] = 'matryona_mansion': act 'Sell the <<$property_display[i]>>': gs 'agentned', 'finalise_sale', 'matryona_mansion', i
  179. if $property_code[i] = 'city_house': act 'Sell the <<$property_display[i]>>': gs 'agentned', 'finalise_sale', 'city_house', i
  180. end
  181. i += 1
  182. if i < count: jump 'listing_offers_on_owned_properties_loop'
  183. end
  184. gs 'homes_properties', 'clean_up_property_data'
  185. killvar 'count' & killvar 'i' & killvar 'j'
  186. act 'Leave': minut += 5 & gt 'city_center'
  187. !! NOTE: Keeping this here for future renovation related reference.
  188. !!{
  189. if bankAccount = 1:
  190. if rembedr = 1 and remsitr = 1 and remkorr = 1 and remvanr = 1 and remkuhr = 1:
  191. !Renovated city residential apartment
  192. offer1 = ((800000 + 250000) + rand(-100000, 100000))
  193. else
  194. offer1 = (800000 + rand(-100000, 100000))
  195. end
  196. if func('homes_properties', 'property_renovated', 'village_cottage') = 1:
  197. !Renovated communal cottage
  198. offer2 = ((prop_price['village_cottage'] + 200000) + rand(-10000, 10000))
  199. else
  200. !Communal cottage
  201. offer2 = (prop_price['village_cottage'] + rand(-5000, 5000))
  202. end
  203. }
  204. else
  205. '<b>You need to open a bank account to sell your property</b>'
  206. end
  207. end
  208. if $ARGS[0] = 'finalise_sale':
  209. *clr
  210. menu_off = 1
  211. gs 'homes_properties', 'get_property_sales_info', $ARGS[1]
  212. '<center><b><font color = maroon>Real Estate Agency</font></b></center>'
  213. '<center><img <<$set_imgh>> src="images/locations/city/citycenter/realestate/agenstvo_paperwork.jpg"></center>'
  214. minut += 30
  215. 'You spend thirty minutes filling out the paperwork for the sale of your <<$property_display[ARGS[2]]>>. <<func(''agentned'', ''format_price_string'', ( (offer*95)/100) )>><b>₽</b> has been paid into your bank account.'
  216. gs 'homes_properties', 'sell_property', $ARGS[1], offer
  217. karta += (offer * 95) / 100
  218. delact 'Sell the <<$property_display[ARGS[2]]>>'
  219. gs 'stat'
  220. killvar 'property_display' & killvar 'property_sales_price'
  221. end
  222. if $ARGS[0] = 'rent':
  223. *clr & cla
  224. $loc = 'agentned'
  225. $loc_arg = $ARGS[0]
  226. $location_type = 'indoors'
  227. $menu_loc = 'agentned'
  228. $menu_arg = 'rent'
  229. menu_off = 0
  230. '<center><b><font color = maroon>Real Estate Agency</font></b></center>'
  231. '<center><img <<$set_imgh>> src="images/locations/city/citycenter/realestate/agenstvo.jpg"></center>'
  232. *nl
  233. minut += 5
  234. gs 'stat'
  235. act 'Return': killvar 'rent_code' & killvar 'monthly_rent' & gt'agentned', 'start'
  236. gs 'homes_properties', 'get_properties_for_rent', 'home'
  237. count = ARRSIZE('property_name')
  238. if count > 0:
  239. i = 0
  240. '<h4>Properties currently available for rent</h4>'
  241. :listing_properties_for_rent_loop
  242. 'We have a(n) <<$property_display[i]>> avaible for a monthly rent of <<func(''agentned'', ''format_price_string'', property_rent[i])>><b>₽</b>.'
  243. monthly_rent[$property_code[i]] = property_rent[i]
  244. if $property_code[i] = 'city_apartment': act 'View the <<$property_display[i]>> details': gt 'agentned', 'view_property_details', 'city_apartment', monthly_rent['city_apartment']
  245. 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']
  246. i += 1
  247. if i < count: jump 'listing_properties_for_rent_loop'
  248. else
  249. 'We currently have no properties listed for rent.'
  250. end
  251. *nl
  252. gs 'homes_properties', 'clean_up_property_data'
  253. killvar 'count' & killvar 'i'
  254. end
  255. if $ARGS[0] = 'view_property_details':
  256. *clr & cla
  257. menu_off = 1
  258. '<center><b><font color = maroon>Real Estate Agency</font></b></center>'
  259. '<center><img <<$set_imgh>> src="images/locations/city/citycenter/realestate/agenstvo.jpg"></center>'
  260. *nl
  261. '<<func(''agentned'', ''get_rent_detail_dialogue'', $ARGS[1])>> The receptionist says as he starts pulling out the paperwork, "Rent is <<func(''agentned'', ''format_price_string'', ARGS[2] )>><b>₽</b> 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."'
  262. '<br>He pulls out a pen and slides the paperwork onto the counter. "Interested? You can move in right away," he says calmly.'
  263. if money >= ARGS[2] or karta >= ARGS[2]:
  264. act 'Agree and pay':
  265. *clr & cla
  266. cls
  267. minut += 30
  268. if money >= ARGS[2]:
  269. money -= ARGS[2]
  270. else
  271. karta -= ARGS[2]
  272. end
  273. gs 'homes_properties', 'rent_property', $ARGS[1]
  274. if func( 'homes_properties', 'get_accessible_property_count', 'home') = 1:
  275. gs 'homes_properties', 'set_home', $ARGS[1]
  276. else
  277. $set_homeyn = input("Would you like to set this as your new home? (yes/no)")
  278. if $set_homeyn = 'yes': gs 'homes_properties', 'set_home', $ARGS[1]
  279. killvar '$set_homeyn'
  280. end
  281. gs'stat'
  282. '<center><b><font color = maroon>Real Estate Agency</font></b></center>'
  283. '<center><img <<$set_imgh>> src="images/locations/city/citycenter/realestate/agenstvo_paperwork.jpg"></center>'
  284. *nl
  285. '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.'
  286. act 'Return':gt'agentned', 'start'
  287. end
  288. else
  289. 'You do not have enough money with you or in your bank account to pay the rent.'
  290. end
  291. act 'Decline':
  292. *clr & cla
  293. minut += 5
  294. '<center><b><font color = maroon>Real Estate Agency</font></b></center>'
  295. '<center><img <<$set_imgh>> src="images/locations/city/citycenter/realestate/agenstvo.jpg"></center>'
  296. *nl
  297. 'You shake your head, "Actually, I need more time to think about this."'
  298. '<br>The receptionist seems a bit miffed, but says nothing as he takes back the paperwork and stuffs it back into his desk drawer.'
  299. act 'Return':gt'agentned', 'start'
  300. end
  301. killvar 'rent_code' & killvar 'monthly_rent'
  302. end
  303. !! $ARGS[1] - the code of the property.
  304. if $ARGS[0] = 'get_rent_detail_dialogue':
  305. if $ARGS[1] = 'old_town_apartment':
  306. $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."'
  307. elseif $ARGS[1] = 'city_apartment':
  308. $result = '"We have a flat available right now in the St. Petersburg residential area."'
  309. else
  310. gs 'agentned', 'get_rent_detail_dialogue_hook', $ARGS[1]
  311. $result = $agency_rental_dialogue
  312. killvar '$agency_rental_dialogue'
  313. end
  314. end
  315. !! $ARGS[1] - the code of the property.
  316. if $ARGS[0] = 'get_rent_detail_dialogue_hook':
  317. !! In a mod just redirect this call and set the value of the variable below to the text
  318. !! that should be used for the property by the agency.
  319. $agency_rental_dialogue = ''
  320. end
  321. !! Call: `func('agentned', 'format_price_string', ARGS[1])
  322. !! ARGS[1] - the price (as a number)
  323. if $ARGS[0] = 'format_price_string':
  324. $worknum = STR(ARGS[1])
  325. worknumlength = LEN($worknum)
  326. pos1 = 1
  327. :format_price_string_loop
  328. $split = $MID($worknum, pos1, 1)
  329. if (worknumlength - 1)/3 ! (worknumlength-2)/3:
  330. $result += $split+','
  331. else
  332. $result += $split
  333. end
  334. worknumlength -= 1
  335. pos1 += 1
  336. if pos2 <= worknumlength: jump 'format_price_string_loop'
  337. killvar 'pos1' & killvar 'pos2' & killvar 'worknum' & killvar 'worknumlength' & killvar 'split'
  338. end
  339. --- agentned ---------------------------------