1
0

transport_functions.qsrc 41 KB

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