transport_functions.qsrc 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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] ! 'village': gs 'transport_functions', 'set_train_ticket', $ARGS[1], 'village', '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] ! 'village': gs 'transport_functions', 'set_train_ticket', $ARGS[1], 'village', '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. if money < ARGS[1]:
  64. dynamic 'act ''Buy a ticket to <<$ARGS[3]>> (<font color="red"><<temp_price>> <b>₽</b></font>)'': ''<br><font color="red">You don''t have enough money for a ticket to <<$ARGS[3]>>'' '
  65. else
  66. dynamic 'act ''Buy a ticket to <<$ARGS[3]>> (<<temp_price>> <b>₽</b>)'':
  67. money -= <<temp_price>>
  68. menu_off = 1
  69. gt ''train'', ''<<$ARGS[1]>>_<<$ARGS[2]>>''
  70. end'
  71. end
  72. killvar 'temp_price'
  73. end
  74. if $ARGS[0] = 'get_train_price':
  75. result = func('transport_functions', '_private_train_price', $ARGS[2]) - func('transport_functions', '_private_train_price', $ARGS[1])
  76. if result < 0: result = -result
  77. result += 25
  78. end
  79. if $ARGS[0] = '_private_train_price':
  80. if $ARGS[1] = 'pavlovsk':
  81. result = 0
  82. elseif $ARGS[1] = 'village':
  83. result = 50
  84. elseif $ARGS[1] = 'communal':
  85. result = 75
  86. elseif $ARGS[1] = 'ind':
  87. result = 100
  88. elseif $ARGS[1] = 'center':
  89. result = 125
  90. end
  91. end
  92. if $ARGS[0] = 'get_train_timecost':
  93. result = func('transport_functions', '_private_train_time', $ARGS[2]) - func('transport_functions', '_private_train_time', $ARGS[1])
  94. if result < 0: result = -result
  95. end
  96. if $ARGS[0] = '_private_train_time':
  97. if $ARGS[1] = 'pavlovsk':
  98. result = 0
  99. elseif $ARGS[1] = 'village':
  100. result = 15
  101. elseif $ARGS[1] = 'communal':
  102. result = 25
  103. elseif $ARGS[1] = 'ind':
  104. result = 35
  105. elseif $ARGS[1] = 'center':
  106. result = 40
  107. end
  108. end
  109. if $ARGS[0] = 'display_trainpass_time':
  110. $result = 'You have <<transportVars[''trainpass_day''] - daystart>> days left on your train pass.'
  111. end
  112. if $ARGS[0] = 'display_train_timecost':
  113. $result = '00:' + $mid(100 + func('transport_functions', 'get_train_timecost', $ARGS[1], $ARGS[2]), 2, 2)
  114. end
  115. !!=======================================!!
  116. !! !!
  117. !! Busses !!
  118. !! !!
  119. !!=======================================!!
  120. !!=======================================!!
  121. !! !!
  122. !! Metro !!
  123. !! !!
  124. !!=======================================!!
  125. if $ARGS[0] = 'get_metro_price':
  126. result = 16
  127. end
  128. if $ARGS[0] = 'get_metro_timecost':
  129. result = 10
  130. end
  131. --- transport_functions ---------------------------------