1
0

crossfit_north_record.qsrc 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # crossfit_north_record
  2. if $ARGS[0] = 'view_records':
  3. cla
  4. *clr
  5. gs 'crossfit_north_record', 'update_box_records'
  6. '<center><img <<$set_imgh>> src="<<$crossfit_north_image_dir>>records.jpg"></center>'
  7. 'You look at the board outlining the personal records'
  8. '<center><table border=1><tr><th>Workout</th><th>Personal Best</th><th>Box Record (Women)</th><th>Box Record Holder</th></tr>'
  9. record_table_counter = 0
  10. :recordloop
  11. if record_table_counter < ARRSIZE('$crossfit_wods'):
  12. $crossfit_wod = $crossfit_wods[record_table_counter]
  13. '<tr><td><<$crossfit_wod>></td><td>' & func('crossfit_north_record', 'recordstring', $crossfit_wod, personal_wod_record[$crossfit_wod]) & '</td><td>' & func('crossfit_north_record', 'recordstring', $crossfit_wod, box_wod_record[$crossfit_wod]) & '</td><td> <<$box_wod_record_holder[$crossfit_wod]>></td></tr>'
  14. record_table_counter += 1
  15. jump 'recordloop'
  16. end
  17. '</table></center>'
  18. killvar 'record_table_counter'
  19. killvar '$crossfit_wod'
  20. act 'Go back':
  21. gt $loc, $metka
  22. end
  23. end
  24. if $ARGS[0] = 'recordstring':
  25. if ARGS[2] = 0:
  26. $result = 'No score yet'
  27. else
  28. wod_score = wod_min_score[$ARGS[1]] + (wod_max_score[$ARGS[1]] - wod_min_score[$ARGS[1]]) * ARGS[2] / 100
  29. if $wod_type[$ARGS[1]] = 'for_time':
  30. $result = '<<wod_score/60>> minutes and <<wod_score - (wod_score/60)*60>> seconds'
  31. end
  32. if $wod_type[$ARGS[1]] = 'for_rounds':
  33. $result = '<<wod_score/100>> rounds and <<wod_score - (wod_score/100)*100>>% of the last one'
  34. end
  35. end
  36. end
  37. if $ARGS[0] = 'update_box_records':
  38. if last_box_record_update = 0 or last_box_record_update + 30 < daystart:
  39. number_of_box_record_updates = 30
  40. else
  41. number_of_box_record_updates = daystart - last_box_record_update
  42. end
  43. last_box_record_update = daystart
  44. current_record_update_count = 0
  45. :recordupdateloop
  46. if current_record_update_count < number_of_box_record_updates:
  47. gs 'crossfit_north_record', 'box_records'
  48. current_record_update_count += 1
  49. jump 'recordupdateloop'
  50. end
  51. killvar 'current_record_update_count'
  52. killvar 'number_of_box_record_updates'
  53. end
  54. if $ARGS[0] = 'box_records':
  55. crossfit_record_it = 0
  56. :recordgeneratorloop
  57. if crossfit_record_it < ARRSIZE('$crossfit_wods'):
  58. $crossfit_wod = $crossfit_wods[crossfit_record_it]
  59. new_record_wod_time = max(1,(100 - (100 * (rand(40,100) + rand(0,100) + rand(0,100) + rand(0,100)) / 400)))
  60. if box_wod_record[$crossfit_wod] = 0 or box_wod_record[$crossfit_wod] > new_record_wod_time:
  61. box_wod_record[$crossfit_wod] = new_record_wod_time
  62. !! record holder changes only in 1/3rd of the cases from previous holder, or if sveta is record holder
  63. if rand(1,3) = 1 OR $box_wod_record_holder[$crossfit_wod] = '' OR $box_wod_record_holder[$crossfit_wod] = $pcs_nickname:
  64. gs 'npcrnamefile', 'rusFemale'
  65. $box_wod_record_holder[$crossfit_wod] = $npctempgn[1]
  66. end
  67. end
  68. crossfit_record_it += 1
  69. jump 'recordgeneratorloop'
  70. end
  71. killvar 'crossfit_record_it'
  72. killvar 'new_record_wod_time'
  73. killvar '$crossfit_wod'
  74. end
  75. --- crossfit_north_record ---------------------------------