transport_functions.qsrc 40 KB

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