homes_properties.qsrc 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. # homes_properties
  2. !!{ All the existing properties should be added here.
  3. name: Display name
  4. display: The string to use in the middle of a sentence
  5. town: The town/city/village the property can be found
  6. location: The region within the town
  7. entrance: The location where the charactes enter
  8. type: The type of the property
  9. rent: Whether the property can be rented by Sveta or not.
  10. 1: Can be rented
  11. internet_enabled: If the value is 1, then Sveta can buy, cancel, transfer an internet subscription here
  12. Property Types
  13. !! IMPORTANT:
  14. !! NOTE: The types are not 100% clear and decided yet, need some more thinking. Also new ones can be added.
  15. permanent_residence: This is a home that can be used for everything. Certain things don''t allow the more "transient"
  16. homes, like the dating app in Uni.
  17. temporary_residence: This is a home that some events/actions won''t consider.
  18. New ones in the future could be for porperties that Sveta can own, rent, used, is not a home but can be changed/customised, etc.
  19. For example a music studio/practice room, or a gallery, or a newspaper kiosk
  20. To make life easier, if is 0 or '' for a property, then I didn''t include it.
  21. Undefined strings will always evaluate to '' and undefined integers have a value of 0.
  22. }
  23. if ARRSIZE('rent') < 2:
  24. prop_rent['city_apartment'] = 15000
  25. $prop_rent['city_apartment'] = '15,000'
  26. prop_rent['old_town_apartment'] = 10000
  27. $prop_rent['old_town_apartment'] = '10,000'
  28. end
  29. if ARRSIZE('price') < 4:
  30. prop_price['city_apartment'] = 800000
  31. $prop_price['city_apartment'] = '800,000'
  32. prop_price['village_cottage'] = 150000
  33. $prop_price['village_cottage'] = '150,000'
  34. prop_price['matryona_mansion'] = 1500000
  35. $prop_price['matryona_mansion'] = '1,500,000'
  36. prop_price['city_house'] = 100000
  37. $prop_price['city_house'] = '100,000'
  38. end
  39. !! Always call this function with gs and use killvar'property' after finished with the data.
  40. if $ARGS[0] = 'get_property_attr':
  41. if $ARGS[1] = 'city_apartment':
  42. $property['name'] = 'City residential apartment'
  43. $property['display'] = 'apartment in St. Petersburg''s residential area'
  44. $property['agency_display'] = 'An apartment in St. Petersburg''s residential area'
  45. $property['town'] = 'city'
  46. $property['location'] = 'city_residential'
  47. $property['entrance'] = 'korr'
  48. $property['type'] = 'permanent_residence'
  49. $property['price'] = $prop_price['city_apartment']
  50. $property['rent'] = $prop_rent['city_apartment']
  51. property['price'] = prop_price['city_apartment']
  52. property['rent'] = prop_rent['city_apartment']
  53. property['id'] = 1
  54. property['rental'] = 1
  55. property['internet_enabled'] = 1
  56. elseif $ARGS[1] = 'parents_home':
  57. $property['name'] = 'Parent''s home in Pavlovsk'
  58. $property['display'] = 'your parent''s home in Pavlovsk'
  59. $property['town'] = 'pavlovsk'
  60. $property['location'] = 'pav_complex'
  61. $property['entrance'] = 'korrPar'
  62. $property['type'] = 'permanent_residence'
  63. property['id'] = 2
  64. elseif $ARGS[1] = 'village_cottage':
  65. $property['name'] = 'My cottage in the cooperative village'
  66. $property['display'] = 'cottage in the cooperative village'
  67. $property['agency_display'] = 'A cottage located in the cooperative village'
  68. $property['town'] = 'city'
  69. $property['location'] = 'dachamy'
  70. $property['entrance'] = 'dachamy'
  71. $property['type'] = 'permanent_residence'
  72. $property['price'] = $prop_price['village_cottage']
  73. property['id'] = 3
  74. property['price'] = prop_price['village_cottage']
  75. property['internet_enabled'] = 1
  76. elseif $ARGS[1] = 'old_town_apartment':
  77. $property['name'] = 'Old town apartment'
  78. $property['display'] = 'old town apartment'
  79. $property['angecy-display'] = 'An apartment in the old town of Puskin.'
  80. $property['town'] = 'oldtown'
  81. $property['location'] = 'liames'
  82. $property['entrance'] = 'korr2x'
  83. $property['type'] = 'permanent_residence'
  84. $property['rent'] = $prop_rent['old_town_apartment']
  85. property['price'] = prop_rent['old_town_apartment']
  86. property['id'] = 4
  87. property['rental'] = 1
  88. property['internet_enabled'] = 1
  89. elseif $ARGS[1] = 'matryona_mansion':
  90. $property['name'] = 'Matryona mansion'
  91. $property['display'] = 'the Matryona mansion'
  92. $property['agency_display'] = 'A plot of land in the St. Petersburg''s suburbs'
  93. $property['town'] = 'city'
  94. $property['location'] = 'city_mansion_entrance'
  95. $property['entrance'] = 'city_mansion_residence_1'
  96. $property['type'] = 'permanent_residence'
  97. $property['price'] = $prop_rent['matryona_mansion']
  98. property['price'] = prop_rent['matryona_mansion']
  99. property['id'] = 5
  100. property['internet_enabled'] = 1
  101. property['contstruction_needed'] = 1
  102. elseif $ARGS[1] = 'pavlovsk_hotel':
  103. $property['name'] = 'My hotel room in Pavlovsk'
  104. $property['display'] = 'your hotel room in Pavlovsk'
  105. $property['town'] = 'pavlovsk'
  106. $property['location'] = 'pav_market'
  107. $property['entrance'] = 'pav_hotel'
  108. $property['type'] = 'temporary_residence'
  109. property['id'] = 6
  110. elseif $ARGS[1] = 'maid_bedroom':
  111. $property['name'] = 'Nicholas'' Apartment'
  112. $property['display'] = 'your maid bedroom in Nicholas'' apartment'
  113. $property['town'] = 'city'
  114. $property['location'] = 'city_center'
  115. $property['entrance'] = 'nichBedroomServant'
  116. $property['type'] = 'permanent_residence'
  117. property['id'] = 7
  118. elseif $ARGS[1] = 'nikos_apartment':
  119. $property['name'] = 'Niko''s apartment'
  120. $property['display'] = 'Niko''s apartment'
  121. $property['town'] = 'pavlovsk'
  122. $property['location'] = 'pav_residential'
  123. $property['entrance'] = 'pav_residential'
  124. $property['type'] = 'temporary_residence'
  125. property['id'] = 8
  126. elseif $ARGS[1] = 'sergeys_apartment':
  127. $property['name'] = 'Uncle Sergey''s apartment'
  128. $property['display'] = 'Uncle Sergey''s apartment'
  129. $property['town'] = 'pavlovsk'
  130. $property['location'] = 'pav_complex'
  131. $property['entrance'] = 'shulgahall'
  132. $property['type'] = 'temporary_residence'
  133. property['id'] = 9
  134. elseif $ARGS[1] = 'lyceum_dorm':
  135. $property['name'] = 'Lyceum school'
  136. $property['display'] = 'your room in the Lyceum dorm'
  137. $property['town'] = 'pavlovsk'
  138. $property['location'] = 'pav_commercial'
  139. $property['entrance'] = 'etoexhib'
  140. $property['type'] = 'permanent_residence'
  141. property['id'] = 10
  142. elseif $ARGS[1] = 'university_dorm':
  143. $property['name'] = 'University halls'
  144. $property['display'] = 'your room in the university dorm'
  145. $property['town'] = 'city'
  146. $property['location'] = 'city_island'
  147. $property['entrance'] = 'uni_dorm'
  148. $property['type'] = 'permanent_residence'
  149. property['id'] = 11
  150. elseif $ARGS[1] = 'hunters_lodge':
  151. $property['name'] = 'Hunter''s lodge in Gadukino'
  152. $property['display'] = 'the hunter''s lodge in Gadukino'
  153. $property['town'] = 'gadukino'
  154. $property['location'] = 'swamp_yard'
  155. $property['entrance'] = 'swamphouse'
  156. $property['type'] = 'temporary_residence'
  157. property['id'] = 12
  158. elseif $ARGS[1] = 'shared_apartment':
  159. $property['name'] = 'Shared apartment in Pavlovsk'
  160. $property['display'] = 'the shared apartment in Pavlovsk'
  161. $property['town'] = 'pavlovsk'
  162. $property['location'] = 'pav_complex'
  163. $property['entrance'] = 'pav_shared_apt'
  164. $property['type'] = 'temporary_residence'
  165. property['id'] = 13
  166. elseif $ARGS[1] = 'grandparents_house':
  167. $property['name'] = 'Grandparent''s house in Gadukino'
  168. $property['display'] = 'your grandparent''s house in Gadukino'
  169. $property['town'] = 'gadukino'
  170. $property['location'] = 'gaddvor'
  171. $property['entrance'] = 'gaddvor'
  172. $property['type'] = 'temporary_residence'
  173. property['id'] = 14
  174. elseif $ARGS[1] = 'city_house':
  175. $property['name'] = 'City residential house'
  176. $property['display'] = 'house in the St. Petersburg''s residential area'
  177. $property['agency_display'] = 'A house in the St. Petersburg''s residential area'
  178. $property['town'] = 'city'
  179. $property['location'] = 'city_residential'
  180. $property['entrance'] = 'city_house_res_misc'
  181. $property['type'] = 'permanent_residence'
  182. $property['price'] = $prop_price['city_house']
  183. property['price'] = prop_price['city_house']
  184. property['id'] = 15
  185. property['internet_enabled'] = 1
  186. elseif $ARGS[1] = 'meynold_household':
  187. $property['name'] = 'Meynold Household'
  188. $property['display'] = 'the Meynold Household'
  189. $property['town'] = 'pavlovsk'
  190. $property['location'] = 'pav_residential'
  191. $property['entrance'] = 'mey_home'
  192. $property['type'] = 'temporary_residence'
  193. property['id'] = 16
  194. else
  195. !! Nonexisting property. CAn be useful if someone wants to check if something is a property or not. For example the
  196. !! internet transfer code does this right now.
  197. gs 'homes_properties', 'mod_property_query_hook'
  198. if $property = '': $property = 'none'
  199. end
  200. end
  201. if $ARGS[0] = 'mod_property_query_hook':
  202. !! use this for the redirect
  203. mod_result = 1
  204. end
  205. if $ARGS[0] = 'set_home':
  206. gs 'homes_properties', 'get_property_attr', $ARGS[1]
  207. COPYARR 'home','property'
  208. $home['current'] = $ARGS[1]
  209. if $owned_property[$ARGS[1]+'-status'] = 0: gs 'homes_properties', 'set_ownership', $ARGS[1], 1
  210. killvar '$property'
  211. killvar 'property'
  212. end
  213. !! $ARGS[1]: the name of the property (the index name)
  214. !! ARGS[2]: ownership type
  215. !! 0: no acces -> 'no access'
  216. !! 1: rented -> 'rented'
  217. !! 2: owned -> 'owned'
  218. !! 3: owned and rented out -> 'tenants'
  219. !! 4: has acess -> 'has access' / homes that behave like rentals but no rent is tracked
  220. !! parents home, university dorm, lyceum dorm and the shared apartment, the Shulga and Meynold household, etc.
  221. !! ARGS[3]: construction status
  222. !! 0: land only
  223. !! 1: foundation, frames built, utilities are connected
  224. !! 2: fully built
  225. !! ARGS[4]:renovation status
  226. !! 0: not renovated
  227. !! 1: fully renovated
  228. if $ARGS[0] = 'set_ownership':
  229. gs 'homes_properties', 'get_property_attr', $ARGS[1]
  230. owned_property[$ARGS[1]] = ARGS[2]
  231. $owned_property[$ARGS[1]] = $ARGS[1]
  232. if $property['contstruction_needed'] = 1:
  233. owned_property[$ARGS[1]+'-construction-status'] = ARGS[3]
  234. else
  235. owned_property[$ARGS[1]+'-construction-status'] = 2
  236. end
  237. owned_property[$ARGS[1]+'-renovated'] = ARGS[4]
  238. if ARGS[2] = 1:
  239. owned_property[$ARGS[1]+'-days-left'] += func( 'homes_properties', 'rent_due')
  240. elseif ARGS[2] = 0:
  241. if $home['current'] = $ARGS[1]: killvar '$home'
  242. owned_property[$ARGS[1]+'-days-left'] = 0
  243. elseif ARGS[2] = 2 or ARGS[2] = 3:
  244. owned_property[$ARGS[1]+'-days-left'] = 0
  245. end
  246. killvar 'property'
  247. end
  248. !! Use it as a func() returns the total count of properties that are homes and are owned (including wiht tenants)
  249. if $ARGS[0] = 'get_owned_homes':
  250. i = 0
  251. count = ARRSIZE('owned_property')
  252. if count > 0:
  253. :countloop
  254. gs 'homes_properties', 'get_property_attr', $owned_property[i]
  255. if $property['type'] = 'permanent_residence' and (owned_property[i] = 2 or owned_property[i] = 3): counter += 1
  256. i += 1
  257. killvar 'property'
  258. if i < count: jump 'countloop'
  259. end
  260. result = counter
  261. killvar 'counter'
  262. killvar 'count'
  263. killvar 'i'
  264. end
  265. !! Use it as a func() returns the total count of rented properties that are homes
  266. if $ARGS[0] = 'get_rented_count':
  267. i = 0
  268. count = ARRSIZE('owned_property')
  269. if count > 0:
  270. :countloop
  271. gs 'homes_properties', 'get_property_attr', $owned_property[i]
  272. if $property['type'] = 'permanent_residence' or $property['type'] = 'temporary_residence' and owned_property[i] = 1: counter += 1
  273. i += 1
  274. killvar 'property'
  275. if i < count: jump 'countloop'
  276. end
  277. result = counter
  278. killvar 'counter'
  279. killvar 'count'
  280. killvar 'i'
  281. end
  282. !! Use it as a func() returns the total count of properties that are homes and accessible
  283. if $ARGS[0] = 'get_accessible_count':
  284. i = 0
  285. count = ARRSIZE('owned_property')
  286. if count > 0:
  287. :countloop
  288. gs 'homes_properties', 'get_property_attr', $owned_property[i]
  289. if $property['type'] = 'permanent_residence' or $property['type'] = 'temporary_residence' and owned_property[i] ! 0 and owned_property[i] ! 3: counter += 1
  290. i += 1
  291. killvar 'property'
  292. if i < count: jump 'countloop'
  293. end
  294. result = counter
  295. killvar 'counter'
  296. killvar 'count'
  297. killvar 'i'
  298. end
  299. !! ARGS[1] = the code name of the property, e.g. 'city_apartment'
  300. !! ARGS[2] - the number of days to add.
  301. !! if the value is 0 then the code will add the number of days that is there in the month
  302. if $ARGS[0] = 'add_rent_days':
  303. if ARGS[2] = 0:
  304. owned_property[$ARGS[1]+'-days-left'] += func( 'homes_properties', 'rent_due')
  305. else
  306. owned_property[$ARGS[1]+'-days-left'] += ARGS[2]
  307. end
  308. end
  309. !! ARGS[1] = the code name of the property, e.g. 'city_apartment'
  310. !! ARGS[2] - the number of days to set to.
  311. if $ARGS[0] = 'set_rent_days':
  312. owned_property[$ARGS[1]+'-days-left'] = ARGS[2]
  313. end
  314. !! Call it as a func()
  315. !! ARGS[1] = the code name of the property, e.g. 'city_apartment'
  316. if $ARGS[0] = 'get_rent_days':
  317. result = owned_property[$ARGS[1]+'-days-left']
  318. end
  319. !! Call it as a func()
  320. !! ARGS[1] = the code name of the property, e.g. 'city_apartment'
  321. if $ARGS[0] = 'property_construction_status':
  322. result = owned_property[$ARGS[1]+'-construction-status']
  323. end
  324. !! ARGS[1] = the code name of the property, e.g. 'city_apartment'
  325. if $ARGS[0] = 'progress_construction_status':
  326. if owned_property[$ARGS[1]+'-construction-status'] < 2: owned_property[$ARGS[1]+'-construction-status'] += 1
  327. end
  328. !! Call it as a func()
  329. !! ARGS[1] = the code name of the property, e.g. 'city_apartment'
  330. if $ARGS[0] = 'property_renovated':
  331. result = owned_property[$ARGS[1]+'-renovated']
  332. end
  333. !! Returns a simple string representation of the status
  334. !! ARGS[1]: the code name of the property, e.g. 'city_apartment'
  335. if $ARGS[0] = 'property_status_to_text':
  336. if ARGS[1] = 0:
  337. result = 'no access'
  338. elseif ARGS[1] = 1:
  339. result = 'rented'
  340. elseif ARGS[1] = 2:
  341. result = 'owned'
  342. elseif ARGS[1] = 3:
  343. result = 'tenants'
  344. elseif ARGS[1] = 4:
  345. result = 'has access'
  346. else
  347. result = 'invalid status'
  348. end
  349. end
  350. !! Returns a string that can be displayed in a longer text.
  351. !! For example 'You have tenants living in your city apartment.'
  352. !! ARGS[1]: The ownership type
  353. if $ARGS[0] = 'property_status_to_display_text':
  354. if ARGS[1] = 0:
  355. result = 'You have no access to '
  356. elseif ARGS[1] = 1:
  357. result = 'Yo are renting '
  358. elseif ARGS[1] = 2:
  359. result = 'You own '
  360. elseif ARGS[1] = 3:
  361. result = 'You have tenants living in '
  362. else
  363. result = 'invalid status'
  364. end
  365. end
  366. !! Returns the monthly rent the property has - both as a number and as a string (result and $result)
  367. !! Call as a func()
  368. !! ARGS[1] - the code (not display) name of the property, e.g. city_apartment
  369. if $ARGS[0] = 'get_rent':
  370. result = prop_rent[$ARGS[1]]
  371. end
  372. !! Returns the price of the property - both as a number and as a string (result and $result)
  373. !! Call as a func()
  374. !! ARGS[1] - the code (not display) name of the property, e.g. city_apartment
  375. if $ARGS[0] = 'get_price':
  376. result = prop_price[$ARGS[0]]
  377. end
  378. !! Returns the rent due date for the given month. Call as a func()
  379. if $ARGS[0] = 'rent_due':
  380. if month = 1 or month = 3 or month = 5 or month = 7 or month = 8 or month = 10 or month = 12:
  381. result = 31
  382. elseif month = 2:
  383. if ((year mod 4 = 0) and (year mod 100 ! 0)) or (year mod 400 = 0):
  384. result = 29
  385. else
  386. result = 28
  387. end
  388. else
  389. result = 30
  390. end
  391. end
  392. --- homes_properties ---------------------------------