transport_functions.qsrc 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078
  1. # transport_functions
  2. if $ARGS[0] = 'init_all':
  3. gs 'transport_functions', 'init_train_prices'
  4. gs 'transport_functions', 'init_train_timecosts'
  5. gs 'transport_functions', 'init_bus_prices'
  6. gs 'transport_functions', 'init_bus_timecosts'
  7. end
  8. !!=======================================!!
  9. !! !!
  10. !! Trains !!
  11. !! !!
  12. !!=======================================!!
  13. if $ARGS[0] = 'buy_train_pass':
  14. if transportVars['trainpass_day'] <= daystart:
  15. if money >= 250:
  16. dynamic 'act ''Buy a daily pass (1 day - 250 <b>₽</b>)'':
  17. cla
  18. money -= 250
  19. transportVars[''trainpass_day''] = daystart + 1
  20. act ''Return'': gt ''<<$loc>>'', ''<<$loc_arg>>''
  21. end'
  22. end
  23. if money >= 1500:
  24. dynamic 'act ''Buy a weekly pass (7 days - 1500 <b>₽</b>)'':
  25. cla
  26. money -= 1500
  27. transportVars[''trainpass_day''] = daystart + 7
  28. act ''Return'': gt ''<<$loc>>'', ''<<$loc_arg>>''
  29. end'
  30. end
  31. if money >= 5500:
  32. dynamic 'act ''Buy a monthly pass (30 days - 5500 <b>₽</b>)'':
  33. cla
  34. money -= 5500
  35. transportVars[''trainpass_day''] = daystart + 30
  36. act ''Return'': gt ''<<$loc>>'', ''<<$loc_arg>>''
  37. end'
  38. end
  39. if money >= 75000:
  40. dynamic 'act ''Buy a yearly pass (365 days - 75000 <b>₽</b>)'':
  41. cla
  42. money -= 75000
  43. transportVars[''trainpass_day''] = daystart + 365
  44. act ''Return'': gt ''<<$loc>>'', ''<<$loc_arg>>''
  45. end'
  46. end
  47. end
  48. end
  49. if $ARGS[0] = 'buy_train_ticket':
  50. if $ARGS[2] = 'pc':
  51. if $ARGS[1] ! 'pavlovsk': gs 'transport_functions', 'set_train_ticket', $ARGS[1], 'pavlovsk', 'Pavlovsk'
  52. if $ARGS[1] ! 'gadukino': gs 'transport_functions', 'set_train_ticket', $ARGS[1], 'gadukino', 'the village of Gadukino'
  53. if $ARGS[1] ! 'communal': gs 'transport_functions', 'set_train_ticket', $ARGS[1], 'communal', 'the communal village'
  54. if $ARGS[1] ! 'ind': gs 'transport_functions', 'set_train_ticket', $ARGS[1], 'ind', 'St. Petersburg city industrial area'
  55. if $ARGS[1] ! 'center': gs 'transport_functions', 'set_train_ticket', $ARGS[1], 'center', 'St. Petersburg city center'
  56. else
  57. if $ARGS[1] ! 'center': gs 'transport_functions', 'set_train_ticket', $ARGS[1], 'center', 'St. Petersburg city center'
  58. if $ARGS[1] ! 'ind': gs 'transport_functions', 'set_train_ticket', $ARGS[1], 'ind', 'St. Petersburg city industrial area'
  59. if $ARGS[1] ! 'communal': gs 'transport_functions', 'set_train_ticket', $ARGS[1], 'communal', 'the communal village'
  60. if $ARGS[1] ! 'gadukino': gs 'transport_functions', 'set_train_ticket', $ARGS[1], 'gadukino', 'the village of Gadukino'
  61. if $ARGS[1] ! 'pavlovsk': gs 'transport_functions', 'set_train_ticket', $ARGS[1], 'pavlovsk', 'Pavlovsk'
  62. end
  63. end
  64. ! $ARGS[1] = origin loc_arg
  65. ! $ARGS[2] = destination loc_arg
  66. ! $ARGS[3] = destination name
  67. if $ARGS[0] = 'set_train_ticket':
  68. temp_price = transportVars['train_price_<<$ARGS[1]>>_<<$ARGS[2]>>']
  69. $temp_time = func('transport_functions', 'display_train_timecost', $ARGS[1], $ARGS[2])
  70. if mid($temp_time, 1, 1) < 2:
  71. if money < ARGS[1]:
  72. dynamic 'act ''Buy a ticket to <<$ARGS[3]>> (<font color="red"><<$temp_time>> - <<temp_price>> <b>₽</b></font>)'': ''<br><font color="red">You don''t have enough money for a ticket to <<$ARGS[3]>>'' '
  73. else
  74. dynamic 'act ''Buy a ticket to <<$ARGS[3]>> (<<$temp_time>> - <<temp_price>> <b>₽</b>)'':
  75. money -= <<temp_price>>
  76. menu_off = 1
  77. gt ''train'', ''<<$ARGS[1]>>_<<$ARGS[2]>>''
  78. end'
  79. end
  80. end
  81. killvar 'temp_price'
  82. killvar 'temp_time'
  83. end
  84. ! Time Table:
  85. ! Train departs every 15 minutes (between 4:00 and 22:00), 30 minutes (between 22:00 and 01:00) and 60 minute (betweeen 01:00 and 04:00)
  86. ! pavlovsk (07) -> gadukino (22) -> communal (32) -> ind (42) -> center
  87. ! center (02) -> ind (07) -> communal (17) -> gadukino (27) -> pavlovsk
  88. if $ARGS[0] = 'set_train_wait_time':
  89. if $ARGS[1] = 'pavlovsk':
  90. if hour = 0:
  91. transportVars['train_wait_center'] = (67 - minut) mod 30
  92. elseif hour <= 3:
  93. transportVars['train_wait_center'] = (67 - minut) mod 60
  94. elseif hour <= 21:
  95. transportVars['train_wait_center'] = (67 - minut) mod 15
  96. else
  97. transportVars['train_wait_center'] = (67 - minut) mod 30
  98. end
  99. elseif $ARGS[1] = 'gadukino':
  100. if hour = 0:
  101. transportVars['train_wait_center'] = (82 - minut) mod 30
  102. transportVars['train_wait_pavlovsk'] = (87 - minut) mod 30
  103. elseif hour <= 3 or hour = 4 and minut <= 22:
  104. transportVars['train_wait_center'] = (82 - minut) mod 60
  105. transportVars['train_wait_pavlovsk'] = (87 - minut) mod 60
  106. elseif hour = 4 and minut <= 27:
  107. transportVars['train_wait_center'] = (82 - minut) mod 15
  108. transportVars['train_wait_pavlovsk'] = (87 - minut) mod 60
  109. elseif hour <= 21 or hour = 22 and minut <= 7:
  110. transportVars['train_wait_center'] = (82 - minut) mod 15
  111. transportVars['train_wait_pavlovsk'] = (87 - minut) mod 15
  112. elseif hour = 22 and minut <= 12:
  113. transportVars['train_wait_center'] = (82 - minut) mod 30
  114. transportVars['train_wait_pavlovsk'] = (87 - minut) mod 15
  115. else
  116. transportVars['train_wait_center'] = (82 - minut) mod 30
  117. transportVars['train_wait_pavlovsk'] = (87 - minut) mod 30
  118. end
  119. elseif $ARGS[1] = 'communal':
  120. if hour = 0 or hour = 1 and minut <= 2:
  121. transportVars['train_wait_center'] = (92 - minut) mod 30
  122. transportVars['train_wait_pavlovsk'] = (77 - minut) mod 30
  123. elseif hour <= 3 or hour = 4 and minut <= 17:
  124. transportVars['train_wait_center'] = (92 - minut) mod 60
  125. transportVars['train_wait_pavlovsk'] = (77 - minut) mod 60
  126. elseif hour = 4 and minut <= 32:
  127. transportVars['train_wait_center'] = (92 - minut) mod 15
  128. transportVars['train_wait_pavlovsk'] = (77 - minut) mod 60
  129. elseif hour <= 21 or hour = 22 and minut <= 2:
  130. transportVars['train_wait_center'] = (92 - minut) mod 15
  131. transportVars['train_wait_pavlovsk'] = (77 - minut) mod 15
  132. elseif hour = 22 and minut <= 17:
  133. transportVars['train_wait_center'] = (92 - minut) mod 15
  134. transportVars['train_wait_pavlovsk'] = (77 - minut) mod 30
  135. else
  136. transportVars['train_wait_center'] = (92 - minut) mod 30
  137. transportVars['train_wait_pavlovsk'] = (77 - minut) mod 30
  138. end
  139. elseif $ARGS[1] = 'ind':
  140. if hour = 0:
  141. transportVars['train_wait_center'] = (102 - minut) mod 30
  142. transportVars['train_wait_pavlovsk'] = (67 - minut) mod 30
  143. elseif hour = 1 and minut <= 12:
  144. transportVars['train_wait_center'] = (102 - minut) mod 30
  145. transportVars['train_wait_pavlovsk'] = (67 - minut) mod 60
  146. elseif hour <= 3:
  147. transportVars['train_wait_center'] = (102 - minut) mod 60
  148. transportVars['train_wait_pavlovsk'] = (67 - minut) mod 60
  149. elseif hour = 4 and minut <= 42:
  150. transportVars['train_wait_center'] = (102 - minut) mod 60
  151. transportVars['train_wait_pavlovsk'] = (67 - minut) mod 15
  152. elseif hour <= 21:
  153. transportVars['train_wait_center'] = (102 - minut) mod 15
  154. transportVars['train_wait_pavlovsk'] = (67 - minut) mod 15
  155. elseif hour = 22 and minut <= 27:
  156. transportVars['train_wait_center'] = (102 - minut) mod 15
  157. transportVars['train_wait_pavlovsk'] = (67 - minut) mod 30
  158. else
  159. transportVars['train_wait_center'] = (102 - minut) mod 30
  160. transportVars['train_wait_pavlovsk'] = (67 - minut) mod 30
  161. end
  162. elseif $ARGS[1] = 'center':
  163. if hour = 0:
  164. transportVars['train_wait_pavlovsk'] = (62 - minut) mod 30
  165. elseif hour <= 3:
  166. transportVars['train_wait_pavlovsk'] = (62 - minut) mod 60
  167. elseif hour <= 21:
  168. transportVars['train_wait_pavlovsk'] = (62 - minut) mod 15
  169. else
  170. transportVars['train_wait_pavlovsk'] = (62 - minut) mod 30
  171. end
  172. end
  173. end
  174. if $ARGS[0] = 'display_trainpass_time':
  175. $result = 'You have <<transportVars[''trainpass_day''] - daystart>> days left on your train pass.'
  176. end
  177. if $ARGS[0] = 'display_train_timecost':
  178. temp_mins = transportVars['train_time_<<$ARGS[1]>>_<<$ARGS[2]>>']
  179. if $ARGS[1] = 'pavlovsk' or $ARGS[2] = 'center 'or ($ARGS[1] = 'gadukino' and $ARGS[2] ! 'pavlovsk') or ($ARGS[1] = 'communal' and $ARGS[2] = 'ind'):
  180. temp_mins += transportVars['train_wait_center']
  181. else
  182. temp_mins += transportVars['train_wait_pavlovsk']
  183. end
  184. temp_hours = temp_mins / 60
  185. temp_mins = temp_mins mod 60
  186. $result = '<<temp_hours>>:<<$mid(100 + temp_mins, 2, 2)>>'
  187. killvar 'temp_mins'
  188. killvar 'temp_hours'
  189. end
  190. if $ARGS[0] = 'display_train_schedule':
  191. if $ARGS[1] = 'pc':
  192. $train_schedule += '<center><h2>Pavlovsk - St. Petersburg</h2></center>'
  193. $train_schedule += '<br><center><table style="text-align:center">'
  194. $train_schedule += '<tr><th></th><th></th><th>Communal</th><th>St. Petersburg</th><th>St. Petersburg</th><th style="border-right:2px solid black; border-left:2px solid black"> </th><th></th><th></th><th>Communal</th><th>St. Petersburg</th><th>St. Petersburg</th></tr>'
  195. $train_schedule += '<tr><th style="border-right:2px solid black">Pavlovsk</th><th style="border-right:2px solid black">Gadukino</th><th style="border-right:2px solid black">Village</th><th style="border-right:2px solid black">Industrial</th><th>Center</th><th style="border-right:2px solid black; border-left:2px solid black"> </th><th style="border-right:2px solid black">Pavlovsk</th><th style="border-right:2px solid black">Gadukino</th><th style="border-right:2px solid black">Village</th><th style="border-right:2px solid black">Industrial</th><th style="border-right:2px solid black">Center</th></tr>'
  196. $train_schedule += '<tr><td colspan=11 style="border-bottom:2px solid black"></td></tr>'
  197. th[0] = 0
  198. :train_schedule_loop1
  199. $th[1] = mid(100 + th[0], 2, 2)
  200. $th[2] = mid(100 + th[0] + 1, 2, 2)
  201. th[3] = th[0] + 12
  202. $th[4] = mid(100 + th[3], 2, 2)
  203. $th[5] = mid(100 + th[3] + 1, 2, 2)
  204. $train_schedule += '<tr>'
  205. $train_schedule += '<td><<$th[1]>>:07</td><td><<$th[1]>>:22</td><td><<$th[1]>>:32</td><td><<$th[1]>>:42</td><td><<$th[1]>>:47</td>'
  206. $train_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  207. $train_schedule += '<td><<$th[4]>>:07</td><td><<$th[4]>>:22</td><td><<$th[4]>>:32</td><td><<$th[4]>>:42</td><td><<$th[4]>>:47</td>'
  208. $train_schedule += '</tr>'
  209. if th[0] >= 4 or th[3] <= 21:
  210. $train_schedule += '<tr>'
  211. if th[0] >= 4:
  212. $train_schedule += '<td><<$th[1]>>:22</td><td><<$th[1]>>:37</td><td><<$th[1]>>:47</td><td><<$th[1]>>:57</td><td><<$th[2]>>:02</td>'
  213. else
  214. $train_schedule += '<td colspan=5></td>'
  215. end
  216. $train_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  217. if th[3] <= 21:
  218. $train_schedule += '<td><<$th[4]>>:22</td><td><<$th[4]>>:37</td><td><<$th[4]>>:47</td><td><<$th[4]>>:57</td><td><<$th[5]>>:02</td>'
  219. else
  220. $train_schedule += '<td colspan=5></td>'
  221. end
  222. $train_schedule += '</tr>'
  223. end
  224. $train_schedule += '<tr>'
  225. if th[0] = 0 or th[0] >= 4:
  226. $train_schedule += '<td><<$th[1]>>:37</td><td><<$th[1]>>:52</td><td><<$th[2]>>:02</td><td><<$th[2]>>:12</td><td><<$th[2]>>:17</td>'
  227. else
  228. $train_schedule += '<td colspan=5></td>'
  229. end
  230. $train_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  231. $train_schedule += '<td><<$th[4]>>:37</td><td><<$th[4]>>:52</td><td><<$th[5]>>:02</td><td><<$th[5]>>:12</td><td><<$th[5]>>:17</td></tr>'
  232. if th[0] >= 4 or th[3] <= 21:
  233. $train_schedule += '<tr>'
  234. if th[0] >= 4:
  235. $train_schedule += '<td><<$th[1]>>:52</td><td><<$th[2]>>:07</td><td><<$th[2]>>:17</td><td><<$th[2]>>:27</td><td><<$th[2]>>:32</td>'
  236. else
  237. $train_schedule += '<td colspan=5></td>'
  238. end
  239. $train_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  240. if th[3] <= 21:
  241. $train_schedule += '<td><<$th[4]>>:52</td><td><<$th[5]>>:07</td><td><<$th[5]>>:17</td><td><<$th[5]>>:27</td><td><<$th[5]>>:32</td>'
  242. else
  243. $train_schedule += '<td colspan=5></td>'
  244. end
  245. $train_schedule += '</tr>'
  246. end
  247. $train_schedule += '<tr><td colspan=11 style="border-bottom:1px solid black"></td></tr>'
  248. th[0] += 1
  249. if th[0] < 12: jump 'train_schedule_loop1'
  250. else
  251. $train_schedule += '<center><h2>St. Petersburg - Pavlovsk</h2></center>'
  252. $train_schedule += '<br><center><table style="text-align:center">'
  253. $train_schedule += '<tr><th>St. Petersburg</th><th>St. Petersburg</th><th>Communal</th><th></th><th></th><th style="border-right:2px solid black; border-left:2px solid black"> </th><th>St. Petersburg</th><th>St. Petersburg</th><th>Communal</th><th></th><th></th></tr>'
  254. $train_schedule += '<tr><th style="border-right:2px solid black">Center</th><th style="border-right:2px solid black">Industrial</th><th style="border-right:2px solid black">Village</th><th style="border-right:2px solid black">Gadukino</th><th>Pavlovsk</th><th style="border-right:2px solid black; border-left:2px solid black"> </th><th style="border-right:2px solid black">Center</th><th style="border-right:2px solid black">Industrial</th><th style="border-right:2px solid black">Village</th><th style="border-right:2px solid black">Gadukino</th><th style="border-right:2px solid black">Pavlovsk</th></tr>'
  255. $train_schedule += '<tr><td colspan=11 style="border-bottom:2px solid black"></td></tr>'
  256. th[0] = 0
  257. :train_schedule_loop2
  258. $th[1] = mid(100 + th[0], 2, 2)
  259. $th[2] = mid(100 + th[0] + 1, 2, 2)
  260. th[3] = th[0] + 12
  261. $th[4] = mid(100 + th[3], 2, 2)
  262. $th[5] = mid(100 + th[3] + 1, 2, 2)
  263. $train_schedule += '<tr>'
  264. $train_schedule += '<td><<$th[1]>>:02</td><td><<$th[1]>>:07</td><td><<$th[1]>>:17</td><td><<$th[1]>>:27</td><td><<$th[1]>>:42</td>'
  265. $train_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  266. $train_schedule += '<td><<$th[4]>>:02</td><td><<$th[4]>>:07</td><td><<$th[4]>>:17</td><td><<$th[4]>>:27</td><td><<$th[4]>>:42</td>'
  267. $train_schedule += '</tr>'
  268. if th[0] >= 4 or th[3] <= 21:
  269. $train_schedule += '<tr>'
  270. if th[0] >= 4:
  271. $train_schedule += '<td><<$th[1]>>:17</td><td><<$th[1]>>:22</td><td><<$th[1]>>:32</td><td><<$th[1]>>:42</td><td><<$th[1]>>:57</td>'
  272. else
  273. $train_schedule += '<td colspan=5></td>'
  274. end
  275. $train_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  276. if th[3] <= 21:
  277. $train_schedule += '<td><<$th[4]>>:17</td><td><<$th[4]>>:22</td><td><<$th[4]>>:32</td><td><<$th[4]>>:42</td><td><<$th[4]>>:57</td>'
  278. else
  279. $train_schedule += '<td colspan=5></td>'
  280. end
  281. $train_schedule += '</tr>'
  282. end
  283. $train_schedule += '<tr>'
  284. if th[0] = 0 or th[0] >= 4:
  285. $train_schedule += '<td><<$th[1]>>:32</td><td><<$th[1]>>:37</td><td><<$th[1]>>:47</td><td><<$th[1]>>:57</td><td><<$th[2]>>:12</td>'
  286. else
  287. $train_schedule += '<td colspan=5></td>'
  288. end
  289. $train_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  290. $train_schedule += '<td><<$th[4]>>:32</td><td><<$th[4]>>:37</td><td><<$th[4]>>:47</td><td><<$th[4]>>:57</td><td><<$th[5]>>:12</td></tr>'
  291. if th[0] >= 4 or th[3] <= 21:
  292. $train_schedule += '<tr>'
  293. if th[0] >= 4:
  294. $train_schedule += '<td><<$th[1]>>:47</td><td><<$th[1]>>:52</td><td><<$th[2]>>:02</td><td><<$th[2]>>:12</td><td><<$th[2]>>:27</td>'
  295. else
  296. $train_schedule += '<td colspan=5></td>'
  297. end
  298. $train_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  299. if th[3] <= 21:
  300. $train_schedule += '<td><<$th[4]>>:47</td><td><<$th[4]>>:52</td><td><<$th[5]>>:02</td><td><<$th[5]>>:12</td><td><<$th[5]>>:27</td>'
  301. else
  302. $train_schedule += '<td colspan=5></td>'
  303. end
  304. $train_schedule += '</tr>'
  305. end
  306. $train_schedule += '<tr><td colspan=11 style="border-bottom:1px solid black"></td></tr>'
  307. th[0] += 1
  308. if th[0] < 12: jump 'train_schedule_loop2'
  309. end
  310. $train_schedule += '</table></center>'
  311. '<<$train_schedule>>'
  312. killvar 'train_schedule'
  313. killvar 'th'
  314. end
  315. if $ARGS[0] = 'init_train_prices':
  316. transportVars['train_price_pavlovsk_gadukino'] = func('transport_functions', 'get_train_price', 'pavlovsk', 'gadukino')
  317. transportVars['train_price_pavlovsk_communal'] = func('transport_functions', 'get_train_price', 'pavlovsk', 'communal')
  318. transportVars['train_price_pavlovsk_ind'] = func('transport_functions', 'get_train_price', 'pavlovsk', 'ind')
  319. transportVars['train_price_pavlovsk_center'] = func('transport_functions', 'get_train_price', 'pavlovsk', 'center')
  320. transportVars['train_price_gadukino_pavlovsk'] = transportVars['train_price_pavlovsk_gadukino']
  321. transportVars['train_price_gadukino_communal'] = func('transport_functions', 'get_train_price', 'gadukino', 'communal')
  322. transportVars['train_price_gadukino_ind'] = func('transport_functions', 'get_train_price', 'gadukino', 'ind')
  323. transportVars['train_price_gadukino_center'] = func('transport_functions', 'get_train_price', 'gadukino', 'center')
  324. transportVars['train_price_communal_pavlovsk'] = transportVars['train_price_pavlovsk_communal']
  325. transportVars['train_price_communal_gadukino'] = transportVars['train_price_gadukino_communal']
  326. transportVars['train_price_communal_ind'] = func('transport_functions', 'get_train_price', 'communal', 'ind')
  327. transportVars['train_price_communal_center'] = func('transport_functions', 'get_train_price', 'communal', 'center')
  328. transportVars['train_price_ind_pavlovsk'] = transportVars['train_price_pavlovsk_ind']
  329. transportVars['train_price_ind_gadukino'] = transportVars['train_price_gadukino_ind']
  330. transportVars['train_price_ind_communal'] = transportVars['train_price_communal_ind']
  331. transportVars['train_price_ind_center'] = func('transport_functions', 'get_train_price', 'ind', 'center')
  332. transportVars['train_price_center_pavlovsk'] = transportVars['train_price_pavlovsk_center']
  333. transportVars['train_price_center_gadukino'] = transportVars['train_price_gadukino_center']
  334. transportVars['train_price_center_communal'] = transportVars['train_price_communal_center']
  335. transportVars['train_price_center_ind'] = transportVars['train_price_ind_center']
  336. end
  337. if $ARGS[0] = 'init_train_timecosts':
  338. transportVars['train_time_pavlovsk_gadukino'] = func('transport_functions', 'get_train_timecost', 'pavlovsk', 'gadukino')
  339. transportVars['train_time_pavlovsk_communal'] = func('transport_functions', 'get_train_timecost', 'pavlovsk', 'communal')
  340. transportVars['train_time_pavlovsk_ind'] = func('transport_functions', 'get_train_timecost', 'pavlovsk', 'ind')
  341. transportVars['train_time_pavlovsk_center'] = func('transport_functions', 'get_train_timecost', 'pavlovsk', 'center')
  342. transportVars['train_time_gadukino_pavlovsk'] = transportVars['train_time_pavlovsk_gadukino']
  343. transportVars['train_time_gadukino_communal'] = func('transport_functions', 'get_train_timecost', 'gadukino', 'communal')
  344. transportVars['train_time_gadukino_ind'] = func('transport_functions', 'get_train_timecost', 'gadukino', 'ind')
  345. transportVars['train_time_gadukino_center'] = func('transport_functions', 'get_train_timecost', 'gadukino', 'center')
  346. transportVars['train_time_communal_pavlovsk'] = transportVars['train_time_pavlovsk_communal']
  347. transportVars['train_time_communal_gadukino'] = transportVars['train_time_gadukino_communal']
  348. transportVars['train_time_communal_ind'] = func('transport_functions', 'get_train_timecost', 'communal', 'ind')
  349. transportVars['train_time_communal_center'] = func('transport_functions', 'get_train_timecost', 'communal', 'center')
  350. transportVars['train_time_ind_pavlovsk'] = transportVars['train_time_pavlovsk_ind']
  351. transportVars['train_time_ind_gadukino'] = transportVars['train_time_gadukino_ind']
  352. transportVars['train_time_ind_communal'] = transportVars['train_time_communal_ind']
  353. transportVars['train_time_ind_center'] = func('transport_functions', 'get_train_timecost', 'ind', 'center')
  354. transportVars['train_time_center_pavlovsk'] = transportVars['train_time_pavlovsk_center']
  355. transportVars['train_time_center_gadukino'] = transportVars['train_time_gadukino_center']
  356. transportVars['train_time_center_communal'] = transportVars['train_time_communal_center']
  357. transportVars['train_time_center_ind'] = transportVars['train_time_ind_center']
  358. end
  359. if $ARGS[0] = 'get_train_price':
  360. result = func('transport_functions', '_private_train_price', $ARGS[2]) - func('transport_functions', '_private_train_price', $ARGS[1])
  361. if result < 0: result *= -1
  362. result += 25
  363. end
  364. if $ARGS[0] = '_private_train_price':
  365. if $ARGS[1] = 'pavlovsk':
  366. result = 0
  367. elseif $ARGS[1] = 'gadukino':
  368. result = 50
  369. elseif $ARGS[1] = 'communal':
  370. result = 75
  371. elseif $ARGS[1] = 'ind':
  372. result = 100
  373. elseif $ARGS[1] = 'center':
  374. result = 125
  375. end
  376. end
  377. if $ARGS[0] = 'get_train_timecost':
  378. result = func('transport_functions', '_private_train_time', $ARGS[2]) - func('transport_functions', '_private_train_time', $ARGS[1])
  379. if result < 0: result *= -1
  380. end
  381. if $ARGS[0] = '_private_train_time':
  382. if $ARGS[1] = 'pavlovsk':
  383. result = 0
  384. elseif $ARGS[1] = 'gadukino':
  385. result = 15
  386. elseif $ARGS[1] = 'communal':
  387. result = 25
  388. elseif $ARGS[1] = 'ind':
  389. result = 35
  390. elseif $ARGS[1] = 'center':
  391. result = 40
  392. end
  393. end
  394. !!=======================================!!
  395. !! !!
  396. !! Busses !!
  397. !! !!
  398. !!=======================================!!
  399. if $ARGS[0] = 'buy_bus_pass':
  400. if transportVars['buspass_day'] <= daystart:
  401. if money >= 100:
  402. dynamic 'act ''Buy a daily bus pass (1 day - 100 <b>₽</b>)'':
  403. cla
  404. money -= 250
  405. transportVars[''buspass_day''] = daystart + 1
  406. act ''Return'': gt ''<<$loc>>'', ''<<$loc_arg>>''
  407. end'
  408. end
  409. if money >= 500:
  410. dynamic 'act ''Buy a weekly bus pass (7 days - 500 <b>₽</b>)'':
  411. cla
  412. money -= 1500
  413. transportVars[''buspass_day''] = daystart + 7
  414. act ''Return'': gt ''<<$loc>>'', ''<<$loc_arg>>''
  415. end'
  416. end
  417. if money >= 1500:
  418. dynamic 'act ''Buy a monthly bus pass (30 days - 1500 <b>₽</b>)'':
  419. cla
  420. money -= 5500
  421. transportVars[''buspass_day''] = daystart + 30
  422. act ''Return'': gt ''<<$loc>>'', ''<<$loc_arg>>''
  423. end'
  424. end
  425. if money >= 13000:
  426. dynamic 'act ''Buy a yearly bus pass (365 days - 13000 <b>₽</b>)'':
  427. cla
  428. money -= 75000
  429. transportVars[''buspass_day''] = daystart + 365
  430. act ''Return'': gt ''<<$loc>>'', ''<<$loc_arg>>''
  431. end'
  432. end
  433. end
  434. end
  435. if $ARGS[0] = 'buy_bus_ticket':
  436. if $ARGS[2] = 'pg':
  437. if $ARGS[1] ! 'community': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'community', 'the Pavlovsk community center'
  438. if $ARGS[1] ! 'pavstation': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'pavstation', 'the Pavlovsk train station'
  439. if $ARGS[1] ! 'pushkin': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'pushkin', 'the old town of Pushkin'
  440. if $ARGS[1] ! 'construction': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'construction', 'the construction site'
  441. if $ARGS[1] ! 'gadukino': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'gadukino', 'the village of Gadukino'
  442. elseif $ARGS[2] = 'gp':
  443. if $ARGS[1] ! 'gadukino': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'gadukino', 'the village of Gadukino'
  444. if $ARGS[1] ! 'construction': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'construction', 'the construction site'
  445. if $ARGS[1] ! 'pushkin': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'pushkin', 'the old town of Pushkin'
  446. if $ARGS[1] ! 'pavstation': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'pavstation', 'the Pavlovsk train station'
  447. if $ARGS[1] ! 'community': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'community', 'the Pavlovsk community center'
  448. elseif $ARGS[2] = 'gs':
  449. if $ARGS[1] ! 'gadukino': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'gadukino', 'the village of Gadukino'
  450. if $ARGS[1] ! 'communal': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'communal', 'the communal village'
  451. if $ARGS[1] ! 'graveyard': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'graveyard', 'the graveyard'
  452. if $ARGS[1] ! 'suburbs': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'suburbs', 'the expensive suburb of St. Petersburg'
  453. else
  454. if $ARGS[1] ! 'suburbs': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'suburbs', 'the expensive suburb of St. Petersburg'
  455. if $ARGS[1] ! 'graveyard': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'graveyard', 'the graveyard'
  456. if $ARGS[1] ! 'communal': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'communal', 'the communal village'
  457. if $ARGS[1] ! 'gadukino': gs 'transport_functions', 'set_bus_ticket', $ARGS[1], 'gadukino', 'the village of Gadukino'
  458. end
  459. end
  460. ! $ARGS[1] = origin loc_arg
  461. ! $ARGS[2] = destination loc_arg
  462. ! $ARGS[3] = destination name
  463. if $ARGS[0] = 'set_bus_ticket':
  464. temp_price = func('transport_functions', 'get_bus_price', $ARGS[1], $ARGS[2])
  465. $temp_time = func('transport_functions', 'display_bus_timecost', $ARGS[1], $ARGS[2])
  466. if money < ARGS[1]:
  467. dynamic 'act ''Buy a ticket to <<$ARGS[3]>> (<font color="red"><<$temp_time>> - <<temp_price>> <b>₽</b></font>)'': ''<br><font color="red">You don''t have enough money for a ticket to <<$ARGS[3]>>'' '
  468. else
  469. dynamic 'act ''Buy a ticket to <<$ARGS[3]>> (<<$temp_time>> - <<temp_price>> <b>₽</b>)'':
  470. money -= <<temp_price>>
  471. menu_off = 1
  472. gt ''bus'', ''<<$ARGS[1]>>_<<$ARGS[2]>>''
  473. end'
  474. end
  475. killvar 'temp_price'
  476. end
  477. ! Time Table:
  478. ! Bus departs every 20 minutes
  479. ! community (13) -> pavstation (15) -> pushkin (23) -> construction (38) -> gadukino
  480. ! gadukino (13) -> construction (38) -> pushkin (53) -> pavstation (01) -> community
  481. ! gadukino (15) -> communal (35) -> graveyard (45) -> suburbs
  482. ! suburbs (05) -> graveyard (15) -> communal (25) -> gadukino
  483. if $ARGS[0] = 'set_bus_wait_time':
  484. if $ARGS[1] = 'community':
  485. if hour <= 4:
  486. transportVars['bus_wait_gadukino'] = (313 - minut - hour * 60)
  487. elseif hour >= 5 and hour <= 22 or hour = 22 and minut <= 53:
  488. transportVars['bus_wait_gadukino'] = (73 - minut) mod 20
  489. else
  490. transportVars['bus_wait_gadukino'] = (433 - minut - (hour-22) * 60)
  491. end
  492. elseif $ARGS[1] = 'pavstation':
  493. if hour <= 4:
  494. transportVars['bus_wait_gadukino'] = (315 - minut - hour * 60)
  495. transportVars['bus_wait_pavlovsk'] = (361 - minut - hour * 60)
  496. elseif hour = 5:
  497. transportVars['bus_wait_gadukino'] = (75 - minut) mod 20
  498. transportVars['bus_wait_pavlovsk'] = (61 - minut)
  499. elseif hour >= 6 and hour <= 22 or hour = 22 and minut <= 55:
  500. transportVars['bus_wait_gadukino'] = (75 - minut) mod 20
  501. transportVars['bus_wait_pavlovsk'] = (61 - minut) mod 20
  502. elseif hour = 22 or hour = 23 and minut <= 41:
  503. transportVars['bus_wait_gadukino'] = (435 - minut - (hour-22) * 60)
  504. transportVars['bus_wait_pavlovsk'] = (61 - minut) mod 20
  505. else
  506. transportVars['bus_wait_gadukino'] = (375 - minut)
  507. transportVars['bus_wait_pavlovsk'] = (421 - minut)
  508. end
  509. elseif $ARGS[1] = 'pushkin':
  510. if hour <= 4:
  511. transportVars['bus_wait_gadukino'] = (323 - minut - hour * 60)
  512. transportVars['bus_wait_pavlovsk'] = (353 - minut - hour * 60)
  513. elseif hour = 5 and minut <= 53:
  514. transportVars['bus_wait_gadukino'] = (63 - minut) mod 20
  515. transportVars['bus_wait_pavlovsk'] = (53 - minut)
  516. elseif hour >= 5 and hour <= 22 or hour = 22 and minut <= 55:
  517. transportVars['bus_wait_gadukino'] = (63 - minut) mod 20
  518. transportVars['bus_wait_pavlovsk'] = (73 - minut) mod 20
  519. elseif hour = 22 or hour = 23 and minut <= 3:
  520. transportVars['bus_wait_gadukino'] = (3 - minut)
  521. transportVars['bus_wait_pavlovsk'] = (73 - minut) mod 20
  522. elseif hour = 22 or hour = 23 and minut <= 33:
  523. transportVars['bus_wait_gadukino'] = (435 - minut - (hour-22) * 60)
  524. transportVars['bus_wait_pavlovsk'] = (73 - minut) mod 20
  525. else
  526. transportVars['bus_wait_gadukino'] = (383 - minut)
  527. transportVars['bus_wait_pavlovsk'] = (413 - minut)
  528. end
  529. elseif $ARGS[1] = 'construction':
  530. if hour <= 4:
  531. transportVars['bus_wait_gadukino'] = (338 - minut - hour * 60)
  532. transportVars['bus_wait_pavlovsk'] = (338 - minut - hour * 60)
  533. elseif hour = 5 and minut <= 38:
  534. transportVars['bus_wait_gadukino'] = (38 - minut)
  535. transportVars['bus_wait_pavlovsk'] = (38 - minut)
  536. elseif hour >= 5 and hour <= 22:
  537. transportVars['bus_wait_gadukino'] = (78 - minut) mod 20
  538. transportVars['bus_wait_pavlovsk'] = (78 - minut) mod 20
  539. elseif hour <= 23 and minut <= 18:
  540. transportVars['bus_wait_gadukino'] = (18 - minut)
  541. transportVars['bus_wait_pavlovsk'] = (18 - minut)
  542. else
  543. transportVars['bus_wait_gadukino'] = (398 - minut)
  544. transportVars['bus_wait_pavlovsk'] = (398 - minut)
  545. end
  546. elseif $ARGS[1] = 'gadukino':
  547. if hour <= 4:
  548. transportVars['bus_wait_suburbs'] = (315 - minut - hour * 60)
  549. transportVars['bus_wait_pavlovsk'] = (313 - minut - hour * 60)
  550. elseif hour >= 5 and hour <= 22 or hour = 22 and minut <= 53:
  551. transportVars['bus_wait_suburbs'] = (75 - minut) mod 20
  552. transportVars['bus_wait_pavlovsk'] = (73 - minut) mod 20
  553. elseif hour = 22 and minut <= 55:
  554. transportVars['bus_wait_suburbs'] = (55 - minut)
  555. transportVars['bus_wait_pavlovsk'] = (433 - minut - (hour-22) * 60)
  556. else
  557. transportVars['bus_wait_suburbs'] = (435 - minut - (hour-22) * 60)
  558. transportVars['bus_wait_pavlovsk'] = (433 - minut - (hour-22) * 60)
  559. end
  560. elseif $ARGS[1] = 'communal':
  561. if hour <= 4:
  562. transportVars['bus_wait_suburbs'] = (335 - minut - hour * 60)
  563. transportVars['bus_wait_gadukino'] = (325 - minut - hour * 60)
  564. elseif hour = 5 and minut <= 25:
  565. transportVars['bus_wait_suburbs'] = (35 - minut)
  566. transportVars['bus_wait_gadukino'] = (25 - minut)
  567. elseif hour = 5 and minut <= 35:
  568. transportVars['bus_wait_suburbs'] = (75 - minut) mod 20
  569. transportVars['bus_wait_gadukino'] = (65 - minut) mod 20
  570. elseif hour >= 5 and hour <= 22:
  571. transportVars['bus_wait_suburbs'] = (75 - minut) mod 20
  572. transportVars['bus_wait_gadukino'] = (65 - minut) mod 20
  573. elseif hour = 23 and minut <= 05:
  574. transportVars['bus_wait_suburbs'] = (15 - minut)
  575. transportVars['bus_wait_gadukino'] = (05 - minut)
  576. elseif hour = 23 and minut <= 15:
  577. transportVars['bus_wait_suburbs'] = (15 - minut)
  578. transportVars['bus_wait_gadukino'] = (385 - minut)
  579. else
  580. transportVars['bus_wait_suburbs'] = (395 - minut)
  581. transportVars['bus_wait_gadukino'] = (385 - minut)
  582. end
  583. elseif $ARGS[1] = 'graveyard':
  584. if hour <= 4:
  585. transportVars['bus_wait_suburbs'] = (345 - minut - hour * 60)
  586. transportVars['bus_wait_gadukino'] = (315 - minut - hour * 60)
  587. elseif hour = 5 and minut <= 15:
  588. transportVars['bus_wait_suburbs'] = (45 - minut)
  589. transportVars['bus_wait_gadukino'] = (15 - minut)
  590. elseif hour = 5 and minut <= 45:
  591. transportVars['bus_wait_suburbs'] = (45 - minut)
  592. transportVars['bus_wait_gadukino'] = (75 - minut) mod 20
  593. elseif hour >= 5 and hour <= 21 or hour = 22 and minut <= 55:
  594. transportVars['bus_wait_suburbs'] = (65 - minut) mod 20
  595. transportVars['bus_wait_gadukino'] = (75 - minut) mod 20
  596. elseif hour = 22 or hour = 23 and minut <= 25:
  597. transportVars['bus_wait_suburbs'] = (65 - minut) mod 20
  598. transportVars['bus_wait_gadukino'] = (435 - minut - (hour-22) * 60)
  599. else
  600. transportVars['bus_wait_suburbs'] = (405 - minut)
  601. transportVars['bus_wait_gadukino'] = (375 - minut)
  602. end
  603. elseif $ARGS[1] = 'suburbs':
  604. if hour <= 4:
  605. transportVars['bus_wait_gadukino'] = (305 - minut - hour * 60)
  606. elseif hour >= 5 and hour <= 22 or hour = 22 and minut <= 45:
  607. transportVars['bus_wait_gadukino'] = (65 - minut) mod 20
  608. else
  609. transportVars['bus_wait_gadukino'] = (425 - minut - (hour-22) * 60)
  610. end
  611. transportVars['bus_wait_gadukino'] = (65 - minut) mod 20
  612. end
  613. end
  614. if $ARGS[0] = 'display_buspass_time':
  615. $result = 'You have <<transportVars[''buspass_day''] - daystart>> days left on your train pass.'
  616. end
  617. if $ARGS[0] = 'display_bus_timecost':
  618. temp_mins = transportVars['bus_time_<<$ARGS[1]>>_<<$ARGS[2]>>']
  619. if $ARGS[1] = 'community' or ($ARGS[1] = 'pavstation' and $ARGS[2] ! 'community') or ($ARGS[1] = 'pushkin' and ($ARGS[2] = 'construction' or $ARGS[2] = 'gadukino')) or $ARGS[1] = 'construction' and $ARGS[2] = 'gadukino':
  620. temp_mins += transportVars['bus_wait_gadukino']
  621. elseif ($ARGS[1] = 'pavstation' and $ARGS[2] = 'community') or ($ARGS[1] = 'pushkin' and ($ARGS[2] = 'community' or $ARGS[2] = 'pavstation')) or ($ARGS[1] = 'construction' and $ARGS[2] ! 'gadukino') or ($ARGS[1] = 'gadukino' and ($ARGS[2] ! 'communal' and $ARGS[2] ! 'graveyard' and $ARGS[2] ! 'suburbs')):
  622. temp_mins += transportVars['bus_wait_pavlovsk']
  623. elseif $ARSG[1] = 'suburbs' or ($ARGS[1] = 'graveyard' and $ARGS[2] ! 'suburbs') or $ARGS[1] = 'communal' and $ARGS[2] = 'gadukino':
  624. temp_mins += transportVars['bus_wait_gadukino']
  625. else
  626. temp_mins += transportVars['bus_wait_suburbs']
  627. end
  628. temp_hours = temp_mins / 60
  629. temp_mins = temp_mins mod 60
  630. $result = '<<temp_hours>>:<<$mid(100 + temp_mins, 2, 2)>>'
  631. killvar 'temp_mins'
  632. killvar 'temp_hours'
  633. end
  634. if $ARGS[0] = 'display_bus_schedule':
  635. $bus_schedule = '<center><h4>Bus schedule</h4></center>'
  636. if $ARGS[1] = 'pg':
  637. $bus_schedule += '<center><h2>Pavlovsk - Gadukino</h2></center>'
  638. $bus_schedule += '<br><center><table style="text-align:center">'
  639. $bus_schedule += '<tr><th>Pavlovsk</th><th>Pavlovsk</th><th></th><th></th><th>Construction</th><th style="border-right:2px solid black; border-left:2px solid black"> </th><th>Pavlovsk</th><th>Pavlovsk</th><th></th><th>Construction</th><th></th></tr>'
  640. $bus_schedule += '<tr><th style="border-right:2px solid black">Community Center</th><th style="border-right:2px solid black">Train Station</th><th style="border-right:2px solid black">Pushkin</th><th style="border-right:2px solid black">Site</th><th>Gadukino</th><th style="border-right:2px solid black; border-left:2px solid black"> </th><th style="border-right:2px solid black">Community Center</th><th style="border-right:2px solid black">Train Station</th><th style="border-right:2px solid black">Pushkin</th><th style="border-right:2px solid black">Site</th><th style="border-right:2px solid black">Gadukino</th></tr>'
  641. $bus_schedule += '<tr><td colspan=11 style="border-bottom:2px solid black"></td></tr>'
  642. th[0] = 4
  643. :bus_schedule_loop1
  644. $th[1] = mid(100 + th[0], 2, 2)
  645. $th[2] = mid(100 + th[0] + 1, 2, 2)
  646. th[3] = th[0] + 10
  647. $th[4] = mid(100 + th[3], 2, 2)
  648. $th[5] = mid(100 + th[3] + 1, 2, 2)
  649. $bus_schedule += '<tr>'
  650. $bus_schedule += '<td><<$th[1]>>:13</td><td><<$th[1]>>:15</td><td><<$th[1]>>:23</td><td><<$th[1]>>:38</td><td><<$th[2]>>:03</td>'
  651. $bus_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  652. if th[3] <= 22:
  653. $bus_schedule += '<td><<$th[4]>>:13</td><td><<$th[4]>>:15</td><td><<$th[4]>>:23</td><td><<$th[4]>>:38</td><td><<$th[5]>>:03</td>'
  654. else
  655. $bus_schedule += '<td colspan=5></td>'
  656. end
  657. $bus_schedule += '</tr>'
  658. $bus_schedule += '<tr>'
  659. $bus_schedule += '<td><<$th[1]>>:33</td><td><<$th[1]>>:35</td><td><<$th[1]>>:43</td><td><<$th[1]>>:58</td><td><<$th[2]>>:23</td>'
  660. $bus_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  661. if th[3] <= 22:
  662. $bus_schedule += '<td><<$th[4]>>:33</td><td><<$th[4]>>:35</td><td><<$th[4]>>:43</td><td><<$th[4]>>:58</td><td><<$th[5]>>:23</td>'
  663. else
  664. $bus_schedule += '<td colspan=5></td>'
  665. end
  666. $bus_schedule += '</tr>'
  667. $bus_schedule += '<tr>'
  668. $bus_schedule += '<td><<$th[1]>>:53</td><td><<$th[1]>>:55</td><td><<$th[2]>>:03</td><td><<$th[2]>>:18</td><td><<$th[2]>>:43</td>'
  669. $bus_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  670. if th[3] <= 22:
  671. $bus_schedule += '<td><<$th[4]>>:53</td><td><<$th[4]>>:55</td><td><<$th[5]>>:03</td><td><<$th[5]>>:18</td><td><<$th[5]>>:43</td>'
  672. else
  673. $bus_schedule += '<td colspan=5></td>'
  674. end
  675. $bus_schedule += '</tr>'
  676. $bus_schedule += '<tr><td colspan=11 style="border-bottom:1px solid black"></td></tr>'
  677. th[0] += 1
  678. if th[0] < 14: jump 'bus_schedule_loop1'
  679. elseif $ARGS[1] = 'gp':
  680. $bus_schedule += '<center><h2>Gadukino - Pavlovsk</h2></center>'
  681. $bus_schedule += '<br><center><table style="text-align:center">'
  682. $bus_schedule += '<tr><th></th><th>Construction</th><th></th><th>Pavlovsk</th><th>Pavlovsk</th><th style="border-right:2px solid black; border-left:2px solid black"> </th><th></th><th>Construction</th><th></th><th>Pavlovsk</th><th>Pavlovsk</th></tr>'
  683. $bus_schedule += '<tr><th style="border-right:2px solid black">Gadukino</th><th style="border-right:2px solid black">Site</th><th style="border-right:2px solid black">Pushkin</th><th style="border-right:2px solid black">Train Station</th><th>Community center</th><th style="border-right:2px solid black; border-left:2px solid black"> </th><th style="border-right:2px solid black">Gadukino</th><th style="border-right:2px solid black">Site</th><th style="border-right:2px solid black">Pushkin</th><th style="border-right:2px solid black">Train Station</th><th style="border-right:2px solid black">Community center</th></tr>'
  684. $bus_schedule += '<tr><td colspan=11 style="border-bottom:2px solid black"></td></tr>'
  685. th[0] = 4
  686. :bus_schedule_loop2
  687. $th[1] = mid(100 + th[0], 2, 2)
  688. $th[2] = mid(100 + th[0] + 1, 2, 2)
  689. th[3] = th[0] + 10
  690. $th[4] = mid(100 + th[3], 2, 2)
  691. $th[5] = mid(100 + th[3] + 1, 2, 2)
  692. $bus_schedule += '<tr>'
  693. $bus_schedule += '<td><<$th[1]>>:13</td><td><<$th[1]>>:38</td><td><<$th[1]>>:53</td><td><<$th[2]>>:01</td><td><<$th[2]>>:03</td>'
  694. $bus_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  695. if th[3] <= 22:
  696. $bus_schedule += '<td><<$th[4]>>:13</td><td><<$th[4]>>:38</td><td><<$th[4]>>:53</td><td><<$th[5]>>:01</td><td><<$th[5]>>:03</td>'
  697. else
  698. $bus_schedule += '<td colspan=5></td>'
  699. end
  700. $bus_schedule += '</tr>'
  701. $bus_schedule += '<tr>'
  702. $bus_schedule += '<tr><td><<$th[1]>>:33</td><td><<$th[1]>>:58</td><td><<$th[2]>>:13</td><td><<$th[2]>>:21</td><td><<$th[2]>>:23</td>'
  703. $bus_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  704. if th[3] <= 22:
  705. $bus_schedule += '<td><<$th[4]>>:33</td><td><<$th[4]>>:58</td><td><<$th[5]>>:13</td><td><<$th[5]>>:21</td><td><<$th[5]>>:23</td>'
  706. else
  707. $bus_schedule += '<td colspan=5></td>'
  708. end
  709. $bus_schedule += '</tr>'
  710. $bus_schedule += '<tr>'
  711. $bus_schedule += '<td><<$th[1]>>:53</td><td><<$th[2]>>:18</td><td><<$th[2]>>:33</td><td><<$th[2]>>:41</td><td><<$th[2]>>:43</td>'
  712. $bus_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  713. if th[3] <= 22:
  714. $bus_schedule += '<td><<$th[4]>>:53</td><td><<$th[5]>>:18</td><td><<$th[5]>>:33</td><td><<$th[5]>>:41</td><td><<$th[5]>>:43</td>'
  715. else
  716. $bus_schedule += '<td colspan=5></td>'
  717. end
  718. $bus_schedule += '</tr>'
  719. $bus_schedule += '<tr><td colspan=11 style="border-bottom:1px solid black"></td></tr>'
  720. th[0] += 1
  721. if th[0] < 14: jump 'bus_schedule_loop2'
  722. elseif $ARGS[1] = 'gs':
  723. $bus_schedule += '<center><h2>Gadukino - Suburbs</h2></center>'
  724. $bus_schedule += '<br><center><table style="text-align:center">'
  725. $bus_schedule += '<tr><th></th><th>Communal</th><th></th><th>St. Petersburg</th><th style="border-right:2px solid black; border-left:2px solid black"> </th><th></th><th>Communal</th><th></th><th>St. Petersburg</th></tr>'
  726. $bus_schedule += '<tr><th style="border-right:2px solid black">Gadukino</th><th style="border-right:2px solid black">Village</th><th style="border-right:2px solid black">Cemetary</th><th>Suburbs</th><th style="border-right:2px solid black; border-left:2px solid black"> </th><th style="border-right:2px solid black">Gadukino</th><th style="border-right:2px solid black">Village</th><th style="border-right:2px solid black">Cemetary</th><th>Suburbs</th></tr>'
  727. $bus_schedule += '<tr><td colspan=9 style="border-bottom:2px solid black"></td></tr>'
  728. th[0] = 4
  729. :bus_schedule_loop3
  730. $th[1] = mid(100 + th[0], 2, 2)
  731. $th[2] = mid(100 + th[0] + 1, 2, 2)
  732. th[3] = th[0] + 10
  733. $th[4] = mid(100 + th[3], 2, 2)
  734. $th[5] = mid(100 + th[3] + 1, 2, 2)
  735. $bus_schedule += '<tr>'
  736. $bus_schedule += '<td><<$th[1]>>:15</td><td><<$th[1]>>:35</td><td><<$th[1]>>:45</td><td><<$th[1]>>:55</td>'
  737. $bus_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  738. if th[3] <= 22:
  739. $bus_schedule += '<td><<$th[4]>>:15</td><td><<$th[4]>>:35</td><td><<$th[4]>>:45</td><td><<$th[4]>>:55</td>'
  740. else
  741. $bus_schedule += '<td colspan=4></td>'
  742. end
  743. $bus_schedule += '</tr>'
  744. $bus_schedule += '<tr>'
  745. $bus_schedule += '<td><<$th[1]>>:35</td><td><<$th[1]>>:55</td><td><<$th[2]>>:05</td><td><<$th[2]>>:15</td>'
  746. $bus_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  747. if th[3] <= 22:
  748. $bus_schedule += '<td><<$th[4]>>:35</td><td><<$th[4]>>:55</td><td><<$th[5]>>:05</td><td><<$th[5]>>:15</td>'
  749. else
  750. $bus_schedule += '<td colspan=4></td>'
  751. end
  752. $bus_schedule += '</tr>'
  753. $bus_schedule += '<tr>'
  754. $bus_schedule += '<td><<$th[4]>>:55</td><td><<$th[5]>>:15</td><td><<$th[5]>>:25</td><td><<$th[5]>>:35</td>'
  755. $bus_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  756. if th[3] <= 22:
  757. $bus_schedule += '<td><<$th[4]>>:55</td><td><<$th[5]>>:15</td><td><<$th[5]>>:25</td><td><<$th[5]>>:35</td>'
  758. else
  759. $bus_schedule += '<td colspan=4></td>'
  760. end
  761. $bus_schedule += '</tr>'
  762. $bus_schedule += '<tr><td colspan=9 style="border-bottom:1px solid black"></td></tr>'
  763. th[0] += 1
  764. if th[0] < 14: jump 'bus_schedule_loop3'
  765. else
  766. $bus_schedule += '<center><h2>Suburbs - Gadukino</h2></center>'
  767. $bus_schedule += '<br><center><table style="text-align:center">'
  768. $bus_schedule += '<tr><th>St. Petersburg</th><th></th><th>Communal</th><th></th><th style="border-right:2px solid black; border-left:2px solid black"> </th><th>St. Petersburg</th><th></th><th>Communal</th><th></th></tr>'
  769. $bus_schedule += '<tr><th style="border-right:2px solid black">Suburbs</th><th style="border-right:2px solid black">Cemetary</th><th style="border-right:2px solid black">Village</th><th>Gadukino</th><th style="border-right:2px solid black; border-left:2px solid black"> </th><th style="border-right:2px solid black">Suburbs</th><th style="border-right:2px solid black">Cemetary</th><th style="border-right:2px solid black">Village</th><th>Gadukino</th></tr>'
  770. $bus_schedule += '<tr><td colspan=9 style="border-bottom:2px solid black"></td></tr>'
  771. th[0] = 4
  772. :bus_schedule_loop4
  773. $th[1] = mid(100 + th, 2, 2)
  774. $th[2] = mid(100 + th + 1, 2, 2)
  775. th[3] = th[0] + 10
  776. $th[4] = mid(100 + th[3], 2, 2)
  777. $th[5] = mid(100 + th[3] + 1, 2, 2)
  778. $bus_schedule += '<tr>'
  779. $bus_schedule += '<td><<$th[1]>>:05</td><td><<$th[1]>>:15</td><td><<$th[1]>>:25</td><td><<$th[1]>>:45</td>'
  780. $bus_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  781. if th[3] <= 22:
  782. $bus_schedule += '<td><<$th[4]>>:05</td><td><<$th[4]>>:15</td><td><<$th[4]>>:25</td><td><<$th[4]>>:45</td>'
  783. else
  784. $bus_schedule += '<td colspan=4></td>'
  785. end
  786. $bus_schedule += '</tr>'
  787. $bus_schedule += '<tr>'
  788. $bus_schedule += '<td><<$th[1]>>:25</td><td><<$th[1]>>:35</td><td><<$th[1]>>:45</td><td><<$th[2]>>:05</td>'
  789. $bus_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  790. if th[3] <= 22:
  791. $bus_schedule += '<td><<$th[4]>>:25</td><td><<$th[4]>>:35</td><td><<$th[4]>>:45</td><td><<$th[5]>>:05</td>'
  792. else
  793. $bus_schedule += '<td colspan=4></td>'
  794. end
  795. $bus_schedule += '</tr>'
  796. $bus_schedule += '<tr>'
  797. $bus_schedule += '<td><<$th[1]>>:45</td><td><<$th[1]>>:55</td><td><<$th[2]>>:05</td><td><<$th[2]>>:25</td>'
  798. $bus_schedule += '<td style="border-right:2px solid black; border-left:2px solid black"> </td>'
  799. if th[3] <= 22:
  800. $bus_schedule += '<td><<$th[4]>>:45</td><td><<$th[4]>>:55</td><td><<$th[5]>>:05</td><td><<$th[5]>>:25</td>'
  801. else
  802. $bus_schedule += '<td colspan=4></td>'
  803. end
  804. $bus_schedule += '</tr>'
  805. $bus_schedule += '<tr><td colspan=9 style="border-bottom:1px solid black"></td></tr>'
  806. th[0] += 1
  807. if th[0] < 14: jump 'bus_schedule_loop4'
  808. end
  809. $bus_schedule += '</table></center>'
  810. '<<$bus_schedule>>'
  811. killvar 'bus_schedule'
  812. killvar 'th'
  813. end
  814. if $ARGS[0] = 'init_bus_prices':
  815. transportVars['bus_price_community_pavstation'] = func('transport_functions', 'get_bus_price', 'community', 'pavstation')
  816. transportVars['bus_price_community_pushkin'] = func('transport_functions', 'get_bus_price', 'community', 'pushkin')
  817. transportVars['bus_price_community_construction'] = func('transport_functions', 'get_bus_price', 'community', 'construction')
  818. transportVars['bus_price_community_gadukino'] = func('transport_functions', 'get_bus_price', 'community', 'gadukino')
  819. transportVars['bus_price_pavstation_community'] = transportVars['bus_price_community_pavstation']
  820. transportVars['bus_price_pavstation_pushkin'] = func('transport_functions', 'get_bus_price', 'pavstation', 'pushkin')
  821. transportVars['bus_price_pavstation_construction'] = func('transport_functions', 'get_bus_price', 'pavstation', 'construction')
  822. transportVars['bus_price_pavstation_gadukino'] = func('transport_functions', 'get_bus_price', 'pavstation', 'gadukino')
  823. transportVars['bus_price_pushkin_community'] = transportVars['bus_price_community_pushkin']
  824. transportVars['bus_price_pushkin_pavstation'] = transportVars['bus_price_pavstation_pushkin']
  825. transportVars['bus_price_pushkin_construction'] = func('transport_functions', 'get_bus_price', 'pushkin', 'construction')
  826. transportVars['bus_price_pushkin_gadukino'] = func('transport_functions', 'get_bus_price', 'pushkin', 'gadukino')
  827. transportVars['bus_price_construction_community'] = transportVars['bus_price_community_construction']
  828. transportVars['bus_price_construction_pavstation'] = transportVars['bus_price_pavstation_construction']
  829. transportVars['bus_price_construction_pushkin'] = transportVars['bus_price_pushkin_construction']
  830. transportVars['bus_price_construction_gadukino'] = func('transport_functions', 'get_bus_price', 'construction', 'gadukino')
  831. transportVars['bus_price_gadukino_community'] = transportVars['bus_price_community_gadukino']
  832. transportVars['bus_price_gadukino_pavstation'] = transportVars['bus_price_pavstation_gadukino']
  833. transportVars['bus_price_gadukino_pushkin'] = transportVars['bus_price_pushkin_gadukino']
  834. transportVars['bus_price_gadukino_construction'] = transportVars['bus_price_gadukino_construction']
  835. transportVars['bus_price_gadukino_communal'] = func('transport_functions', 'get_bus_price', 'gadukino', 'communal')
  836. transportVars['bus_price_gadukino_graveyard'] = func('transport_functions', 'get_bus_price', 'gadukino', 'graveyard')
  837. transportVars['bus_price_gadukino_suburbs'] = func('transport_functions', 'get_bus_price', 'gadukino', 'suburbs')
  838. transportVars['bus_price_communal_gadukino'] = transportVars['bus_price_gadukino_communal']
  839. transportVars['bus_price_communal_graveyard'] = func('transport_functions', 'get_bus_price', 'communal', 'graveyard')
  840. transportVars['bus_price_communal_suburbs'] = func('transport_functions', 'get_bus_price', 'communal', 'suburbs')
  841. transportVars['bus_price_graveyard_gadukino'] = transportVars['bus_price_gadukino_communal']
  842. transportVars['bus_price_graveyard_communal'] = transportVars['bus_price_communal_graveyard']
  843. transportVars['bus_price_graveyard_suburbs'] = func('transport_functions', 'get_bus_price', 'communal', 'suburbs')
  844. transportVars['bus_price_suburbs_gadukino'] = transportVars['bus_price_gadukino_communal']
  845. transportVars['bus_price_suburbs_communal'] = transportVars['bus_price_communal_graveyard']
  846. transportVars['bus_price_suburbs_graveyard'] = transportVars['bus_price_graveyard_suburbs']
  847. end
  848. if $ARGS[0] = 'init_bus_timecosts':
  849. transportVars['bus_time_community_pavstation'] = func('transport_functions', 'get_bus_timecost', 'community', 'pavstation')
  850. transportVars['bus_time_community_pushkin'] = func('transport_functions', 'get_bus_timecost', 'community', 'pushkin')
  851. transportVars['bus_time_community_construction'] = func('transport_functions', 'get_bus_timecost', 'community', 'construction')
  852. transportVars['bus_time_community_gadukino'] = func('transport_functions', 'get_bus_timecost', 'community', 'gadukino')
  853. transportVars['bus_time_pavstation_community'] = transportVars['bus_time_community_pavstation']
  854. transportVars['bus_time_pavstation_pushkin'] = func('transport_functions', 'get_bus_timecost', 'pavstation', 'pushkin')
  855. transportVars['bus_time_pavstation_construction'] = func('transport_functions', 'get_bus_timecost', 'pavstation', 'construction')
  856. transportVars['bus_time_pavstation_gadukino'] = func('transport_functions', 'get_bus_timecost', 'pavstation', 'gadukino')
  857. transportVars['bus_time_pushkin_community'] = transportVars['bus_time_community_pushkin']
  858. transportVars['bus_time_pushkin_pavstation'] = transportVars['bus_time_pavstation_pushkin']
  859. transportVars['bus_time_pushkin_construction'] = func('transport_functions', 'get_bus_timecost', 'pushkin', 'construction')
  860. transportVars['bus_time_pushkin_gadukino'] = func('transport_functions', 'get_bus_timecost', 'pushkin', 'gadukino')
  861. transportVars['bus_time_construction_community'] = transportVars['bus_time_community_construction']
  862. transportVars['bus_time_construction_pavstation'] = transportVars['bus_time_pavstation_construction']
  863. transportVars['bus_time_construction_pushkin'] = transportVars['bus_time_pushkin_construction']
  864. transportVars['bus_time_construction_gadukino'] = func('transport_functions', 'get_bus_timecost', 'construction', 'gadukino')
  865. transportVars['bus_time_gadukino_community'] = transportVars['bus_time_community_gadukino']
  866. transportVars['bus_time_gadukino_pavstation'] = transportVars['bus_time_pavstation_gadukino']
  867. transportVars['bus_time_gadukino_pushkin'] = transportVars['bus_time_pushkin_gadukino']
  868. transportVars['bus_time_gadukino_construction'] = transportVars['bus_time_gadukino_construction']
  869. transportVars['bus_time_gadukino_communal'] = func('transport_functions', 'get_bus_timecost', 'gadukino', 'communal')
  870. transportVars['bus_time_gadukino_graveyard'] = func('transport_functions', 'get_bus_timecost', 'gadukino', 'graveyard')
  871. transportVars['bus_time_gadukino_suburbs'] = func('transport_functions', 'get_bus_timecost', 'gadukino', 'suburbs')
  872. transportVars['bus_time_communal_gadukino'] = transportVars['bus_time_gadukino_communal']
  873. transportVars['bus_time_communal_graveyard'] = func('transport_functions', 'get_bus_timecost', 'communal', 'graveyard')
  874. transportVars['bus_time_communal_suburbs'] = func('transport_functions', 'get_bus_timecost', 'communal', 'suburbs')
  875. transportVars['bus_time_graveyard_gadukino'] = transportVars['bus_time_gadukino_communal']
  876. transportVars['bus_time_graveyard_communal'] = transportVars['bus_time_communal_graveyard']
  877. transportVars['bus_time_graveyard_suburbs'] = func('transport_functions', 'get_bus_timecost', 'communal', 'suburbs')
  878. transportVars['bus_time_suburbs_gadukino'] = transportVars['bus_time_gadukino_communal']
  879. transportVars['bus_time_suburbs_communal'] = transportVars['bus_time_communal_graveyard']
  880. transportVars['bus_time_suburbs_graveyard'] = transportVars['bus_time_graveyard_suburbs']
  881. end
  882. if $ARGS[0] = 'get_bus_price':
  883. result = func('transport_functions', '_private_bus_price', $ARGS[2]) - func('transport_functions', '_private_bus_price', $ARGS[1])
  884. if result < 0: result *= -1
  885. result += 10
  886. end
  887. if $ARGS[0] = '_private_bus_price':
  888. if $ARGS[1] = 'community':
  889. result = 0
  890. elseif $ARGS[1] = 'pavstation':
  891. result = 5
  892. elseif $ARGS[1] = 'pushkin':
  893. result = 15
  894. elseif $ARGS[1] = 'construction':
  895. result = 25
  896. elseif $ARGS[1] = 'gadukino':
  897. result = 35
  898. elseif $ARGS[1] = 'communal':
  899. result = 45
  900. elseif $ARGS[1] = 'graveyard':
  901. result = 55
  902. elseif $ARGS[1] = 'suburbs':
  903. result = 65
  904. end
  905. end
  906. if $ARGS[0] = 'get_bus_timecost':
  907. result = func('transport_functions', '_private_bus_time', $ARGS[2]) - func('transport_functions', '_private_bus_time', $ARGS[1])
  908. if result < 0: result *= -1
  909. end
  910. if $ARGS[0] = '_private_bus_time':
  911. if $ARGS[1] = 'community':
  912. result = 0
  913. elseif $ARGS[1] = 'pavstation':
  914. result = 2
  915. elseif $ARGS[1] = 'pushkin':
  916. result = 10
  917. elseif $ARGS[1] = 'construction':
  918. result = 25
  919. elseif $ARGS[1] = 'gadukino':
  920. result = 50
  921. elseif $ARGS[1] = 'communal':
  922. result = 70
  923. elseif $ARGS[1] = 'graveyard':
  924. result = 80
  925. elseif $ARGS[1] = 'suburbs':
  926. result = 90
  927. end
  928. end
  929. !!=======================================!!
  930. !! !!
  931. !! Metro !!
  932. !! !!
  933. !!=======================================!!
  934. if $ARGS[0] = 'get_metro_price':
  935. result = 16
  936. end
  937. if $ARGS[0] = 'get_metro_timecost':
  938. result = 10
  939. end
  940. --- transport_functions ---------------------------------