Advertisement
Faraone29

NAFC haxfutsal Update

Apr 17th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.40 KB | None | 0 0
  1. var room = HBInit({ roomName: "[NAFC] FutsaBot 4v4", maxPlayers: 20, playerName : "NAFC's Futsabot", public : true});
  2. var futsal = `{
  3.  
  4. "name" : "[NAFC] Official",
  5.  
  6. "width" : 760,
  7.  
  8. "height" : 370,
  9.  
  10. "spawnDistance" : 310,
  11.  
  12. "bg" : { "type" : "hockey", "width" : 671, "height" : 330, "kickOffRadius" : 80, "cornerRadius" : 0 },
  13.  
  14. "vertexes" : [
  15. /* 0 */ { "x" : -671, "y" : 330, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 0.97, "curve" : 0 },
  16. /* 1 */ { "x" : -671, "y" : 77.5, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 0.97, "curve" : 0 },
  17. /* 2 */ { "x" : -671, "y" : -77.5, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 0.97, "curve" : 0 },
  18. /* 3 */ { "x" : -671, "y" : -330, "trait" : "ballArea", "bCoef" : 0.97, "cMask" : ["ball" ] },
  19. /* 4 */ { "x" : 671, "y" : 330, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 0.97 },
  20. /* 5 */ { "x" : 671, "y" : 77.5, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 0.97, "curve" : 0 },
  21. /* 6 */ { "x" : 671, "y" : -77.5, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 0.97, "curve" : 0 },
  22. /* 7 */ { "x" : 671, "y" : -330, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 0.97 },
  23.  
  24. /* 8 */ { "x" : 0, "y" : 339, "trait" : "kickOffBarrier" },
  25. /* 9 */ { "x" : 0, "y" : 80, "trait" : "kickOffBarrier" },
  26.  
  27. /* 10 */ { "x" : 0, "y" : -80, "trait" : "line" },
  28.  
  29. /* 11 */ { "x" : 0, "y" : -339, "trait" : "kickOffBarrier" },
  30.  
  31. /* 12 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : -705, "y" : -77.5, "curve" : 0 },
  32. /* 13 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : 705, "y" : -77.5, "curve" : 0 },
  33. /* 14 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : -705, "y" : 77.5, "curve" : 0 },
  34. /* 15 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : 705, "y" : 77.5, "curve" : 0 },
  35.  
  36. /* 16 */ { "trait" : "line", "x" : -671, "y" : -220 },
  37. /* 17 */ { "trait" : "line", "x" : -475, "y" : -50, "curve" : 0 },
  38. /* 18 */ { "trait" : "line", "x" : 671, "y" : -220 },
  39. /* 19 */ { "trait" : "line", "x" : 475, "y" : -50, "curve" : 0 },
  40. /* 20 */ { "bCoef" : 0, "trait" : "line", "x" : -651, "y" : -330 },
  41. /* 21 */ { "bCoef" : 0, "trait" : "line", "x" : -671, "y" : -310 },
  42. /* 22 */ { "bCoef" : 0, "trait" : "line", "x" : 651, "y" : -330 },
  43. /* 23 */ { "bCoef" : 0, "trait" : "line", "x" : 671, "y" : -310 },
  44. /* 24 */ { "bCoef" : 0, "trait" : "line", "x" : -651, "y" : 330 },
  45. /* 25 */ { "bCoef" : 0, "trait" : "line", "x" : -671, "y" : 310 },
  46. /* 26 */ { "bCoef" : 0, "trait" : "line", "x" : 651, "y" : 330 },
  47. /* 27 */ { "bCoef" : 0, "trait" : "line", "x" : 671, "y" : 310 },
  48.  
  49. /* 28 */ { "bCoef" : 0.97, "trait" : "ballArea", "x" : 671, "y" : 330 },
  50. /* 29 */ { "bCoef" : 0.97, "trait" : "ballArea", "x" : 671, "y" : -330 },
  51.  
  52. /* 30 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : 330 },
  53. /* 31 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -330 },
  54.  
  55. /* 32 */ { "x" : 0, "y" : 80, "trait" : "kickOffBarrier" },
  56. /* 33 */ { "x" : 0, "y" : -80, "trait" : "kickOffBarrier" },
  57.  
  58. /* 34 */ { "bCoef" : 0, "trait" : "line", "x" : -280, "y" : 345 },
  59. /* 35 */ { "bCoef" : 0, "trait" : "line", "x" : -280, "y" : 310 },
  60. /* 36 */ { "bCoef" : 0, "trait" : "line", "x" : 280, "y" : 345 },
  61. /* 37 */ { "bCoef" : 0, "trait" : "line", "x" : 280, "y" : 310 },
  62. /* 38 */ { "bCoef" : 0, "trait" : "line", "x" : -160, "y" : 345 },
  63. /* 39 */ { "bCoef" : 0, "trait" : "line", "x" : -160, "y" : 310 },
  64. /* 40 */ { "bCoef" : 0, "trait" : "line", "x" : 160, "y" : 345 },
  65. /* 41 */ { "bCoef" : 0, "trait" : "line", "x" : 160, "y" : 310 },
  66.  
  67. /* 42 */ { "bCoef" : 0, "trait" : "ballArea", "x" : -671, "y" : -130 },
  68. /* 43 */ { "bCoef" : 0, "trait" : "ballArea", "x" : -690, "y" : -130 },
  69. /* 44 */ { "bCoef" : 0, "trait" : "ballArea", "x" : 671, "y" : -130 },
  70. /* 45 */ { "bCoef" : 0, "trait" : "ballArea", "x" : 690, "y" : -130 },
  71. /* 46 */ { "bCoef" : 0, "trait" : "ballArea", "x" : -671, "y" : 130 },
  72. /* 47 */ { "bCoef" : 0, "trait" : "ballArea", "x" : -690, "y" : 130 },
  73. /* 48 */ { "bCoef" : 0, "trait" : "ballArea", "x" : 671, "y" : 130 },
  74. /* 49 */ { "bCoef" : 0, "trait" : "ballArea", "x" : 690, "y" : 130 },
  75.  
  76. /* 50 */ { "bCoef" : 0, "trait" : "line", "x" : -310, "y" : -3 },
  77. /* 51 */ { "bCoef" : 0, "trait" : "line", "x" : -310, "y" : 3 },
  78. /* 52 */ { "bCoef" : 0, "trait" : "line", "x" : 310, "y" : -3 },
  79. /* 53 */ { "bCoef" : 0, "trait" : "line", "x" : 310, "y" : 3 },
  80. /* 54 */ { "x" : 680, "y" : -80, "trait" : "line", "cMask" : ["red" ], "bCoef" : 1 },
  81.  
  82. /* 55 */ { "x" : 680, "y" : -330, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1 },
  83.  
  84. /* 56 */ { "x" : -680, "y" : -80, "trait" : "line", "cMask" : ["blue" ], "bCoef" : 1 },
  85.  
  86. /* 57 */ { "x" : -680, "y" : -330, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1 },
  87.  
  88. /* 58 */ { "x" : -680, "y" : 80, "trait" : "line", "cMask" : ["blue" ], "bCoef" : 1, "curve" : 0 },
  89.  
  90. /* 59 */ { "x" : -680, "y" : 330, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "curve" : 0 },
  91.  
  92. /* 60 */ { "x" : 680, "y" : 80, "trait" : "line", "cMask" : ["red" ], "bCoef" : 1 },
  93.  
  94. /* 61 */ { "x" : 680, "y" : 330, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1 },
  95.  
  96. /* 62 */ { "bCoef" : 0, "trait" : "line", "x" : -475, "y" : -5 },
  97. /* 63 */ { "bCoef" : 0, "trait" : "line", "x" : -475, "y" : 5 },
  98. /* 64 */ { "bCoef" : 0, "trait" : "line", "x" : -480, "y" : 0 },
  99. /* 65 */ { "bCoef" : 0, "trait" : "line", "x" : -470, "y" : 0 },
  100. /* 66 */ { "bCoef" : 0, "trait" : "line", "x" : -478, "y" : -3 },
  101. /* 67 */ { "bCoef" : 0, "trait" : "line", "x" : -472, "y" : 3 },
  102. /* 68 */ { "bCoef" : 0, "trait" : "line", "x" : -478, "y" : 3 },
  103. /* 69 */ { "bCoef" : 0, "trait" : "line", "x" : -472, "y" : -3 },
  104. /* 70 */ { "bCoef" : 0, "trait" : "line", "x" : 475, "y" : -5 },
  105. /* 71 */ { "bCoef" : 0, "trait" : "line", "x" : 475, "y" : 5 },
  106. /* 72 */ { "bCoef" : 0, "trait" : "line", "x" : 470, "y" : 0 },
  107. /* 73 */ { "bCoef" : 0, "trait" : "line", "x" : 480, "y" : 0 },
  108. /* 74 */ { "bCoef" : 0, "trait" : "line", "x" : 472, "y" : -3 },
  109. /* 75 */ { "bCoef" : 0, "trait" : "line", "x" : 478, "y" : 3 },
  110. /* 76 */ { "bCoef" : 0, "trait" : "line", "x" : 472, "y" : 3 },
  111. /* 77 */ { "bCoef" : 0, "trait" : "line", "x" : 478, "y" : -3 },
  112. /* 78 */ { "bCoef" : 0, "trait" : "line", "x" : -310, "y" : -129 },
  113. /* 79 */ { "bCoef" : 0, "trait" : "line", "x" : -310, "y" : -131 },
  114. /* 80 */ { "bCoef" : 0, "trait" : "line", "x" : -310, "y" : 131 },
  115. /* 81 */ { "bCoef" : 0, "trait" : "line", "x" : -310, "y" : 129 },
  116. /* 82 */ { "bCoef" : 0, "trait" : "line", "x" : 310, "y" : -129 },
  117. /* 83 */ { "bCoef" : 0, "trait" : "line", "x" : 310, "y" : -131 },
  118. /* 84 */ { "bCoef" : 0, "trait" : "line", "x" : 310, "y" : 131 },
  119. /* 85 */ { "bCoef" : 0, "trait" : "line", "x" : 310, "y" : 129 },
  120. /* 86 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -3 },
  121. /* 87 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : 3 },
  122. /* 88 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -3 },
  123. /* 89 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : 3 },
  124. /* 90 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -3 },
  125. /* 91 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : 3 },
  126. /* 92 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -3 },
  127. /* 93 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : 3 },
  128. /* 94 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -3 },
  129. /* 95 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : 3 },
  130. /* 96 */ { "bCoef" : 0, "trait" : "line", "x" : -671, "y" : 220, "curve" : -90 },
  131. /* 97 */ { "bCoef" : 0, "trait" : "line", "x" : -475, "y" : 50, "curve" : 0 },
  132. /* 98 */ { "bCoef" : 0, "trait" : "line", "x" : 475, "y" : 50, "curve" : 0 },
  133. /* 99 */ { "bCoef" : 0, "trait" : "line", "x" : 671, "y" : 220, "curve" : 0 }
  134.  
  135. ],
  136.  
  137. "segments" : [
  138. { "v0" : 0, "v1" : 1, "trait" : "ballArea", "curve" : 0 },
  139. { "v0" : 2, "v1" : 3, "trait" : "ballArea" },
  140. { "v0" : 4, "v1" : 5, "trait" : "ballArea" },
  141. { "v0" : 6, "v1" : 7, "trait" : "ballArea" },
  142.  
  143. { "v0" : 8, "v1" : 9, "trait" : "kickOffBarrier" },
  144. { "v0" : 9, "v1" : 10, "trait" : "kickOffBarrier", "curve" : 180, "cGroup" : ["blueKO" ] },
  145. { "v0" : 9, "v1" : 10, "trait" : "kickOffBarrier", "curve" : -180, "cGroup" : ["redKO" ] },
  146. { "v0" : 10, "v1" : 11, "trait" : "kickOffBarrier" },
  147.  
  148. { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 2, "v1" : 12, "color" : "f9f9f9", "curve" : 0, "y" : -77.5 },
  149. { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 6, "v1" : 13, "color" : "f9f9f9", "curve" : 0, "y" : -77.5 },
  150. { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 1, "v1" : 14, "color" : "f9f9f9", "curve" : 0, "y" : 77.5 },
  151. { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 5, "v1" : 15, "color" : "f9f9f9", "curve" : 0, "y" : 77.5 },
  152. { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 12, "v1" : 14, "x" : -705, "color" : "f9f9f9", "curve" : 0 },
  153. { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 13, "v1" : 15, "x" : 705, "color" : "f9f9f9", "curve" : 0 },
  154.  
  155. { "color" : "FFFFFF", "trait" : "line", "v0" : 16, "v1" : 17, "curve" : 90 },
  156. { "color" : "FFFFFF", "trait" : "line", "v0" : 18, "v1" : 19, "curve" : -90 },
  157. { "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 20, "v1" : 21, "curve" : 90 },
  158. { "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 22, "v1" : 23, "curve" : -90 },
  159. { "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 24, "v1" : 25, "curve" : -90 },
  160. { "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 26, "v1" : 27, "curve" : 90 },
  161.  
  162. { "vis" : true, "color" : "ffffff", "bCoef" : 0.97, "trait" : "ballArea", "v0" : 1, "v1" : 0, "cMask" : ["ball" ], "x" : -671, "curve" : 0 },
  163. { "vis" : true, "color" : "FFFFFF", "bCoef" : 0.97, "trait" : "ballArea", "v0" : 5, "v1" : 4, "cMask" : ["ball" ], "x" : 671 },
  164. { "vis" : true, "color" : "FFFFFF", "bCoef" : 0.97, "trait" : "ballArea", "v0" : 2, "v1" : 3, "cMask" : ["ball" ], "x" : -671 },
  165. { "vis" : true, "color" : "FFFFFF", "bCoef" : 0.97, "trait" : "ballArea", "v0" : 6, "v1" : 7, "cMask" : ["ball" ], "x" : 671 },
  166. { "vis" : true, "color" : "FFFFFF", "bCoef" : 0.97, "trait" : "ballArea", "v0" : 0, "v1" : 28, "y" : 290 },
  167. { "vis" : true, "color" : "FFFFFF", "bCoef" : 0.97, "trait" : "ballArea", "v0" : 3, "v1" : 29, "y" : -330 },
  168.  
  169. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 30, "v1" : 31 },
  170. { "curve" : -180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 10, "v1" : 9 },
  171. { "curve" : 180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 33, "v1" : 32 },
  172. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 34, "v1" : 35, "x" : -280 },
  173. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 36, "v1" : 37, "x" : 280 },
  174. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 38, "v1" : 39, "x" : -160 },
  175. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 40, "v1" : 41, "x" : 160 },
  176.  
  177. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "ballArea", "v0" : 42, "v1" : 43, "y" : -130 },
  178. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "ballArea", "v0" : 44, "v1" : 45, "y" : -130 },
  179. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "ballArea", "v0" : 46, "v1" : 47, "y" : 130 },
  180. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "ballArea", "v0" : 48, "v1" : 49, "y" : 130 },
  181.  
  182. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 2, "v1" : 1 },
  183. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 6, "v1" : 5 },
  184. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 50, "v1" : 51, "x" : -280 },
  185. { "curve" : 90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 50, "v1" : 51, "x" : -280 },
  186. { "curve" : -90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 50, "v1" : 51, "x" : -280 },
  187. { "curve" : -180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 50, "v1" : 51, "x" : -280 },
  188. { "curve" : 180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 50, "v1" : 51, "x" : -280 },
  189. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 52, "v1" : 53, "x" : 280 },
  190. { "curve" : 90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 52, "v1" : 53, "x" : 280 },
  191. { "curve" : -90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 52, "v1" : 53, "x" : 280 },
  192. { "curve" : -180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 52, "v1" : 53, "x" : 280 },
  193. { "curve" : 180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 52, "v1" : 53, "x" : 280 },
  194.  
  195. { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 54, "v1" : 55, "cMask" : ["ball" ], "x" : 680 },
  196. { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 56, "v1" : 57, "cMask" : ["ball" ], "x" : -680 },
  197. { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 58, "v1" : 59, "cMask" : ["ball" ], "x" : -680, "curve" : 0 },
  198. { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 60, "v1" : 61, "cMask" : ["ball" ], "x" : 680 },
  199. { "vis" : true, "color" : "666666", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "v0" : 57, "v1" : 59, "curve" : -60 },
  200. { "vis" : true, "color" : "666666", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "v0" : 55, "v1" : 61, "curve" : 60 },
  201.  
  202. { "curve" : 180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 62, "v1" : 63 },
  203. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 62, "v1" : 63 },
  204. { "curve" : -180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 62, "v1" : 63 },
  205. { "curve" : 0, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 64, "v1" : 65 },
  206. { "curve" : 0, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 66, "v1" : 67 },
  207. { "curve" : 0, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 68, "v1" : 69 },
  208. { "curve" : 180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 70, "v1" : 71 },
  209. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 70, "v1" : 71 },
  210. { "curve" : -180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 70, "v1" : 71 },
  211. { "curve" : 0, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 72, "v1" : 73 },
  212. { "curve" : 0, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 74, "v1" : 75 },
  213. { "curve" : 0, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 76, "v1" : 77 },
  214. { "curve" : 180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 78, "v1" : 79 },
  215. { "curve" : -180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 78, "v1" : 79 },
  216. { "curve" : 180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 80, "v1" : 81 },
  217. { "curve" : -180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 80, "v1" : 81 },
  218. { "curve" : 180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 82, "v1" : 83 },
  219. { "curve" : -180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 82, "v1" : 83 },
  220. { "curve" : 180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 84, "v1" : 85 },
  221. { "curve" : -180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 84, "v1" : 85 },
  222. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 86, "v1" : 87, "x" : -280 },
  223. { "curve" : 90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 88, "v1" : 89, "x" : -280 },
  224. { "curve" : -90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 90, "v1" : 91, "x" : -280 },
  225. { "curve" : -180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 92, "v1" : 93, "x" : -280 },
  226. { "curve" : 180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 94, "v1" : 95, "x" : -280 },
  227. { "curve" : 60, "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "cMask" : ["red" ], "trait" : "line", "v0" : 54, "v1" : 60 },
  228. { "curve" : 60, "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "cMask" : ["blue" ], "trait" : "line", "v0" : 58, "v1" : 56 },
  229. { "curve" : -90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 96, "v1" : 97 },
  230. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 97, "v1" : 17 },
  231. { "curve" : -90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 98, "v1" : 99 },
  232. { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 98, "v1" : 19 }
  233.  
  234. ],
  235.  
  236. "goals" : [
  237. { "p0" : [-679,-77.5 ], "p1" : [-679,77.5 ], "team" : "red" },
  238. { "p0" : [679,77.5 ], "p1" : [679,-77.5 ], "team" : "blue" }
  239.  
  240. ],
  241.  
  242. "discs" : [
  243. { "pos" : [-673,77.5 ], "trait" : "goalPost", "color" : "e56e56", "radius" : 5 },
  244. { "pos" : [-673,-77.5 ], "trait" : "goalPost", "color" : "e56e56", "radius" : 5 },
  245. { "pos" : [673,77.5 ], "trait" : "goalPost", "color" : "5689e5", "radius" : 5 },
  246. { "pos" : [673,-77.5 ], "trait" : "goalPost", "color" : "5689e5", "radius" : 5 },
  247.  
  248. { "radius" : 3, "invMass" : 0, "pos" : [705,77.5 ], "color" : "5689e5", "bCoef" : 0, "trait" : "line" },
  249. { "radius" : 3, "invMass" : 0, "pos" : [-705,77.5 ], "color" : "e56e56", "bCoef" : 0, "trait" : "line" },
  250. { "radius" : 3, "invMass" : 0, "pos" : [705,-77.5 ], "color" : "5689e5", "bCoef" : 0, "trait" : "line" },
  251. { "radius" : 3, "invMass" : 0, "pos" : [-705,-77.5 ], "color" : "e56e56", "bCoef" : 0, "trait" : "line" }
  252.  
  253. ],
  254.  
  255. "planes" : [
  256. { "normal" : [0,1 ], "dist" : -330, "trait" : "ballArea" },
  257. { "normal" : [0,-1 ], "dist" : -330, "trait" : "ballArea" },
  258.  
  259. { "normal" : [0,1 ], "dist" : -370, "bCoef" : 0.2, "cMask" : ["all" ] },
  260. { "normal" : [0,-1 ], "dist" : -370, "bCoef" : 0.2, "cMask" : ["all" ] },
  261. { "normal" : [1,0 ], "dist" : -760, "bCoef" : 0.2, "cMask" : ["all" ] },
  262. { "normal" : [-1,0 ], "dist" : -755, "bCoef" : 0.2, "cMask" : ["all" ] }
  263.  
  264. ],
  265.  
  266. "traits" : {
  267. "ballArea" : { "vis" : false, "bCoef" : 1, "cMask" : ["ball" ] },
  268. "goalPost" : { "radius" : 8, "invMass" : 0, "bCoef" : 1 },
  269. "goalNet" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ] },
  270. "kickOffBarrier" : { "vis" : false, "bCoef" : 0.1, "cGroup" : ["redKO","blueKO" ], "cMask" : ["red","blue" ] },
  271. "line" : { "vis" : true, "bCoef" : 0, "cMask" : ["" ] },
  272. "arco" : { "radius" : 2, "cMask" : ["n/d" ], "color" : "cccccc" }
  273.  
  274. },
  275.  
  276. "playerPhysics" : {
  277. "acceleration" : 0.115,
  278. "kickingAcceleration" : 0.1,
  279. "kickStrength" : 7
  280.  
  281. },
  282.  
  283. "ballPhysics" : {
  284. "radius" : 6.225,
  285. "color" : "D0FA58",
  286. "invMass" : 0.99,
  287. "damping" : 0.99
  288.  
  289. }
  290. }`
  291.  
  292. room.setCustomStadium(futsal);
  293. room.setScoreLimit(3);
  294. room.setTimeLimit(5);
  295.  
  296. function clonekick(player){
  297. players = room.getPlayerList();
  298. for (i = 0; i < players.length-1; i++){
  299. if (player.name == players[i].name){
  300. room.kickPlayer(player.id,"There is already a user with this name",false);
  301. }
  302. }
  303. }
  304.  
  305. var boldedNumbers = 'πŸŽπŸπŸπŸ‘πŸ’πŸ“πŸ”πŸ•πŸ–πŸ—';
  306. var circledNumbers = 'πŸ„‹β“΅β“Άβ“·β“Έβ“Ήβ“Ίβ“»β“Όβ“½';
  307.  
  308. function boldedNumber(num){
  309. var result = '';
  310. var reversedDigits = [];
  311. do{
  312. reversedDigits.push(num % 10);
  313. num = Math.floor(num / 10);
  314. }while(num > 0);
  315. for (var i = reversedDigits.length; i-- > 0; ){
  316. result += boldedNumbers.substr(reversedDigits[i]*2, 2);
  317. }
  318.  
  319. return result;
  320. }
  321.  
  322. function afkFun(player, message){ // !classic
  323. if (afkPlayerIDs.has(player.id)){
  324. afkPlayerIDs.delete(player.id);
  325. room.sendChat("Finally" + player.name + " is back! and ready for play!");}
  326. else {afkPlayerIDs.add(player.id); room.setPlayerTeam(player.id, 0);room.sendChat("Now " + player.name + " is AFK!");}
  327. }
  328.  
  329. function afksFun(player, message){ // !huge
  330. afkPlayers_list = room.getPlayerList().filter((x) => afkPlayerIDs.has(x.id));
  331. afkPlayers_list_string = afkPlayers_list.map(x => x.name).join(", ");
  332. if (afkPlayers_list == "") {
  333. room.sendChat("πŸ’Ž No one's AFK");
  334. }
  335. else {
  336. room.sendChat("AFK players: " + afkPlayers_list_string);
  337. }
  338. }
  339.  
  340. function kickafksFun(player, message){ // !huge
  341. if (player.admin == true){
  342. afksPlayers = room.getPlayerList().filter((x) => afkPlayerIDs.has(x.id));
  343. for(var i=0;i<afksPlayers.length;i++){room.kickPlayer(afksPlayers[i].id,"AFK!",false);}
  344. }
  345. }
  346.  
  347. function circledNumber(num){
  348. var result = '';
  349. var reversedDigits = [];
  350. do{
  351. reversedDigits.push(num % 10);
  352. num = Math.floor(num / 10);
  353. }while(num > 0);
  354. for (var i = reversedDigits.length; i-- > 0; ){
  355. if(reversedDigits[i] == 0){
  356. result += circledNumbers.substr(reversedDigits[i], 2);
  357. }else{
  358. result += circledNumbers.substr(1+reversedDigits[i], 1);
  359. }
  360. }
  361.  
  362. return result;
  363. }
  364.  
  365.  
  366. function confirmedPlayersFun(player, message){ // !huge
  367. var overall = [];
  368. players = room.getPlayerList().filter((x) => confirmedPlayers.has(x.id));
  369. for (var i = 0; i < players.length; i++) {
  370. let account = accounts.find(a => a.playerId === players[i].id);
  371. if (account !== undefined) {
  372. overall.push({name: players[i].name, value: account.username});
  373. }
  374. }
  375. let top15 = overall.splice(0, 20);
  376. let pos = 1;
  377. if (top15.length) {
  378. room.sendChat("confirmed: ");
  379. }else{room.sendChat("There is no confirmed players currently");}
  380. while (top15.length) {
  381. let tmp = top15.splice(0, 5);
  382. let message = tmp.map(e => `${e.name}[${e.value}]`).join(", ");
  383. room.sendChat(message);
  384. }
  385. }
  386. /*
  387. Functions
  388. */
  389. // If there are no admins left in the room give admin to one of the remaining players.
  390. function updateAdmins() {
  391. // Get all players except the host (id = 0 is always the host)
  392. var players = room.getPlayerList().filter((player) => player.id != 0 );
  393. if ( players.length == 0 ){room.stopGame();} // No players left, do nothing.
  394. if ( players.find((player) => player.admin) != null ) return; // There's an admin left so do nothing.
  395. if (players[0] !== undefined){
  396. room.setPlayerAdmin(players[0].id, true); // Give admin to the first non admin player in the list
  397. }
  398. }
  399.  
  400. function initPlayerStats(player){
  401. }
  402.  
  403.  
  404.  
  405.  
  406. /*
  407. for commands
  408. */
  409.  
  410. function swapFun(player){
  411. if (player.admin == true){
  412. if (room.getScores() == null) {
  413. players = room.getPlayerList();
  414. for (i = 0; i < players.length; i++){
  415. if (players[i].team == 1){
  416. room.setPlayerTeam(players[i].id, 2);
  417. }
  418. else if (players[i].team == 2){
  419. room.setPlayerTeam(players[i].id, 1);
  420. }
  421. }
  422. }
  423. }
  424. }
  425.  
  426.  
  427. function pushMuteFun(player, message){ // !mute Anddy
  428. // Prevent somebody to talk in the room (uses the nickname, not the id)
  429. // need to be admin
  430. if (player.admin == true){
  431. if (!(mutedPlayers.includes(message.substr(6)))) mutedPlayers.push(message.substr(6));
  432. }
  433. }
  434.  
  435.  
  436. function gotMutedFun(player){
  437. if (mutedPlayers.includes(player.name)){
  438. return true;
  439. }
  440. }
  441.  
  442. function unmuteFun(player, message){ // !unmute Anddy
  443. // Allow somebody to talk if he has been muted
  444. // need to be admin
  445. if (player.admin == true){
  446. pos = mutedPlayers.indexOf(message.substr(9));
  447. mutedPlayers.splice(pos, 1);
  448. }
  449. }
  450.  
  451. function mutelistFun(player, message){ // !unmute Anddy
  452. // Allow somebody to talk if he has been muted
  453. // need to be admin
  454. if (player.admin == true){
  455. if (mutedPlayers.length > 0){
  456. var mutelist= mutedPlayers.join(",");
  457. room.sendChat("Muted Players List: " + mutelist);
  458. }
  459. else{room.sendChat("There is no muted players in the list.");}
  460. }
  461. }
  462.  
  463. function clearmutesFun(player, message){ // !unmute Anddy
  464. // Allow somebody to talk if he has been muted
  465. // need to be admin
  466. if (player.admin == true){
  467. if (mutedPlayers.length > 0){
  468. mutedPlayers = [];
  469. room.sendChat("All muted Players have been unmuted.");
  470. }
  471. else{room.sendChat("There are no muted players in the list.");}
  472. }
  473. }
  474.  
  475.  
  476.  
  477.  
  478. function confirmFun(player, message){ // !confirm aaa
  479. // Prevent somebody to talk in the room (uses the nickname, not the id)
  480. // need to be admin
  481. let password = message.substr(9);
  482. let account = accounts.find(a => a.password === password);
  483. if (account !== undefined) {
  484. account.playerId = player.id;
  485. room.sendChat("[" + player.name + "] " + account.username + " has confirmed");
  486. confirmedPlayers.add(player.id);
  487. }
  488. return false;
  489. }
  490.  
  491.  
  492. function adminFun(player.id, message){ // !admin NAFCstaff51 // Gives admin to the person who type this password
  493.  
  494. room.setPlayerAdmin(player.id, true);
  495. return false; // The message won't be displayed
  496. }
  497.  
  498. function resignFun(player, message){
  499. room.setPlayerAdmin(player.id, false);
  500. updateAdmins();
  501. }
  502.  
  503.  
  504. function helpFun() { // !help
  505. room.sendChat('πŸ’¬ Available commands: "!confirm", "!afk", "afks", "!confirmed_players",');
  506. room.sendChat('πŸ’¬ "!pm", "!poss", "!adminhelp", "!gkhelp", "!bb"');
  507. }
  508.  
  509. function adminHelpFun() {
  510. room.sendChat('πŸ’¬ Available commands: "!mute Player", "!unmute Player", "!mutelist", "!clearmutes", "!clearbans", "!rr", ')
  511. room.sendChat('πŸ’¬ Available commands: "!kickafks", "!resign", "!swap" (to switch reds and blues).')
  512.  
  513. }
  514.  
  515.  
  516. function gkHelpFun() { // !gkhelp
  517. room.sendChat('πŸ’¬ The most backward player at the kick off will be set as gk ! (write "!gk" if the bot was wrong).')
  518. }
  519.  
  520.  
  521. function clearbansFun(player){ // !clear
  522. if (player.admin == true){ room.clearBans(); room.sendChat("All bans has been reseted.");}
  523. }
  524.  
  525. function resetFun(player){
  526. if (player.admin == true){
  527. room.stopGame();
  528. room.startGame();
  529. }
  530. }
  531.  
  532. function gkFun(player){ // !gk
  533.  
  534. if (room.getScores() != null && room.getScores().time < 60){
  535. if (player.team == 1) {
  536. gk[0] = player;
  537. }
  538. else if (player.team == 2){
  539. gk[1] = player;
  540. }
  541. }
  542. return;
  543. }
  544.  
  545.  
  546.  
  547. function leaveFun(player){
  548. room.kickPlayer(player.id, "ggs!", false);
  549. }
  550.  
  551.  
  552. /*
  553. For ranking
  554. */
  555.  
  556.  
  557.  
  558.  
  559. function whichTeam(){ // gives the players in the red or blue team
  560. var players = room.getPlayerList();
  561. var redTeam = players.filter(player => player.team == 1);
  562. var blueTeam = players.filter(player => player.team == 2);
  563. return [redTeam, blueTeam]
  564. }
  565.  
  566.  
  567. function pmFun(player, message){ //!pm
  568. var pm = message.substr(4);
  569. var index = message.split(" ").slice(1);
  570. var playerID = parseInt(index[0])
  571. delete index[0];
  572. var message2 = index.join(" ");
  573. var message3 = "[PM FROM " + player.name + "(ID:" + player.id + ")]: " + message2;
  574. room.sendChat(message3, parseInt(playerID))
  575. var players = room.getPlayerList().filter((player) => player.id != 0 );
  576. if ( players.find((player => player.id === playerID))) {room.sendChat("PM Sent!", player.id)}
  577. else {room.sendChat("User ID is not found!, Check # for getting his ID.", player.id)};
  578. return false;
  579. }
  580.  
  581. function isGk(){ // gives the mosts backward players before the first kickOff
  582. var players = room.getPlayerList();
  583. var min = players[0];
  584. min.position = {x: room.getBallPosition().x + 60}
  585. var max = min;
  586.  
  587. for (var i = 0; i < players.length; i++) {
  588. if (players[i].position != null){
  589. if (min.position.x > players[i].position.x) min = players[i];
  590. if (max.position.x < players[i].position.x) max = players[i];
  591. }
  592. }
  593. return [min, max]
  594. }
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602. function initBallCarrying(redTeam, blueTeam){
  603. var ballCarrying = new Map();
  604. var playing = redTeam.concat(blueTeam);
  605. for (var i = 0; i < playing.length; i++) {
  606. ballCarrying.set(playing[i].name, [0, playing[i].team]); // secs, team, %
  607. }
  608. return ballCarrying;
  609. }
  610.  
  611.  
  612.  
  613. function updateTeamPoss(value){
  614. if (value[1] == 1) redPoss += value[0];
  615. if (value[1] == 2) bluePoss += value[0];
  616. }
  617.  
  618. var bluePoss;
  619. var redPoss;
  620. var timeOnHalves;
  621.  
  622.  
  623.  
  624.  
  625. /*
  626. For the game
  627. */
  628.  
  629. // Gives the last player who touched the ball, works only if the ball has the same
  630. // size than in classics maps.
  631. var radiusBall = 10;
  632. var triggerDistance = radiusBall + 15 + 0.1;
  633. function getLastTouchTheBall(lastPlayerTouched, time) {
  634. var ballPosition = room.getBallPosition();
  635. var players = room.getPlayerList();
  636. for(var i = 0; i < players.length; i++) {
  637. if(players[i].position != null) {
  638. var distanceToBall = pointDistance(players[i].position, ballPosition);
  639. if(distanceToBall < triggerDistance) {
  640. lastPlayerTouched = players[i];
  641. return lastPlayerTouched;
  642. }
  643. }
  644. }
  645. return lastPlayerTouched;
  646.  
  647. }
  648.  
  649.  
  650.  
  651. // Calculate the distance between 2 points
  652. function pointDistance(p1, p2) {
  653. var d1 = p1.x - p2.x;
  654. var d2 = p1.y - p2.y;
  655. return Math.sqrt(d1 * d1 + d2 * d2);
  656. }
  657.  
  658. function isOvertime(){
  659. scores = room.getScores();
  660. if (scores != null){
  661. if (scores.timeLimit != 0){
  662. if (scores.time > scores.timeLimit){
  663. if (scores.red == 0 && hasFinished == false){
  664. let account = accounts.find(a => a.playerId === gk[0].id);
  665. if (account !== undefined) {
  666. }else{};
  667. let account1 = accounts.find(a => a.playerId === gk[1].id);
  668. if (account1 !== undefined) {
  669. }else{};
  670. hasFinished = true;
  671. }
  672. }
  673. }
  674. }
  675. }
  676. // return: the name of the team who took a goal
  677. var team_name = team => team == 1 ? "πŸ”΄ Red" : "πŸ”΅ Blue";
  678.  
  679. var team_color = team => team == 1 ? "πŸ”΄" : "πŸ”΅";
  680.  
  681. // return: whether it's an OG
  682. var isOwnGoal = (team, player) => team != player.team ? " [OG]" : "";
  683.  
  684. // return: a better display of the second when a goal is scored
  685. var floor = s => s < 10 ? "0" + s : s;
  686.  
  687. // return: whether there's an assist
  688. //var playerTouchedTwice = playerList => playerList[0].team == playerList[1].team ? " (" + playerList[1].name + ")" : "";
  689.  
  690. playerTouchedTwice = function(playerList){
  691. let account = accounts.find(a => a.playerId === playerList[1].id);
  692. if (playerList[0].team == playerList[1].team && account !== undefined){ return " (" + playerList[1].name + "[" + account.username + "]" + ")"; }
  693. else if (playerList[0].team == playerList[1].team && account == undefined){ return " (" + playerList[1].name + ")"; }
  694. else{ return "";};
  695.  
  696. }
  697.  
  698.  
  699.  
  700. /*
  701. Events
  702. */
  703.  
  704. /* window.setInterval(saveStatsFun, 300000); */
  705. var mutedPlayers = []; // Array where will be added muted players
  706. const confirmedPlayers = new Set()
  707. const afkPlayerIDs = new Set()
  708. var init = "init"; // Smth to initialize smth
  709. init.id = 0; // Faster than getting host's id with the method
  710. init.name = "init";
  711. var scorers ; // Map where will be set all scorers in the current game (undefined if reset or end)
  712. var whoTouchedLast; // var representing the last player who touched the ball
  713. var whoTouchedBall = [init, init]; // Array where will be set the 2 last players who touched the ball
  714. var gk = [init, init];
  715. var goalScored = false;
  716. let accounts = [];
  717.  
  718. accounts.push({username: "Enzo",password:
  719. "caralho"});
  720. accounts.push({username: "Bigfatsnoozy",password: "opensesame123"});
  721. accounts.push({username: "Nogo",password: "Nogoisgreat"});
  722. accounts.push({username: "rix",password: "amsterdamsche"});
  723. accounts.push({username: "Kernoa",password: "Kernoa8"});
  724. accounts.push({username: "CreeperReaperX",password: "F0rmuoli"});
  725. accounts.push({username: "Andre Gomes",password: "dolph1n"});
  726. accounts.push({username: "ICLemon",password: "faS78"});
  727. accounts.push({username: "Messi Da Best",password: "FCB2013"});
  728. accounts.push({username: "Spongebob",password: "07095"});
  729. accounts.push({username: "LemΓ‘r",password: "L2E0M1A9R"});
  730. accounts.push({username: "Kaz",password: "hundred1
  731. "});
  732. accounts.push({username: "Player",password: "Confirmcode"});
  733. accounts.push({username: "Player",password: "Confirmcode"});
  734. accounts.push({username: "Player",password: "Confirmcode"});
  735. accounts.push({username: "Player",password: "Confirmcode"});
  736. accounts.push({username: "Player",password: "Confirmcode"});
  737. accounts.push({username: "Player",password: "Confirmcode"});
  738. accounts.push({username: "Player",password: "Confirmcode"});
  739. accounts.push({username: "Player",password: "Confirmcode"});
  740. accounts.push({username: "Player",password: "Confirmcode"});
  741. accounts.push({username: "Player",password: "Confirmcode"});
  742. accounts.push({username: "Player",password: "Confirmcode"});
  743. accounts.push({username: "Player",password: "Confirmcode"});
  744. accounts.push({username: "Player",password: "Confirmcode"});
  745. accounts.push({username: "Player",password: "Confirmcode"});
  746. accounts.push({username: "Player",password: "Confirmcode"});
  747. accounts.push({username: "Player",password: "Confirmcode"});
  748. accounts.push({username: "Player",password: "Confirmcode"});
  749. accounts.push({username: "Player",password: "Confirmcode"});
  750. accounts.push({username: "Player",password: "Confirmcode"});
  751. accounts.push({username: "Player",password: "Confirmcode"});
  752. accounts.push({username: "Player",password: "Confirmcode"});
  753. accounts.push({username: "Player",password: "Confirmcode"});
  754. accounts.push({username: "Player",password: "Confirmcode"});
  755. accounts.push({username: "Player",password: "Confirmcode"});
  756. accounts.push({username: "Player",password: "Confirmcode"});
  757. accounts.push({username: "Player",password: "Confirmcode"});
  758. accounts.push({username: "Player",password: "Confirmcode"});
  759. accounts.push({username: "Player",password: "Confirmcode"});
  760. accounts.push({username: "Player",password: "Confirmcode"});
  761. accounts.push({username: "Player",password: "Confirmcode"});
  762. accounts.push({username: "Player",password: "Confirmcode"});
  763. accounts.push({username: "Player",password: "Confirmcode"});
  764. accounts.push({username: "Player",password: "Confirmcode"});
  765. accounts.push({username: "Player",password: "Confirmcode"});
  766. accounts.push({username: "Player",password: "Confirmcode"});
  767. accounts.push({username: "Player",password: "Confirmcode"});
  768. accounts.push({username: "Player",password: "Confirmcode"});
  769. accounts.push({username: "Player",password: "Confirmcode"});
  770. accounts.push({username: "Player",password: "Confirmcode"});
  771. accounts.push({username: "Player",password: "Confirmcode"});
  772. accounts.push({username: "Player",password: "Confirmcode"});
  773. accounts.push({username: "Player",password: "Confirmcode"});
  774. accounts.push({username: "Player",password: "Confirmcode"});
  775. accounts.push({username: "Player",password: "Confirmcode"});
  776. accounts.push({username: "Player",password: "Confirmcode"});
  777. accounts.push({username: "Player",password: "Confirmcode"});
  778. accounts.push({username: "Player",password: "Confirmcode"});
  779. accounts.push({username: "Player",password: "Confirmcode"});
  780. accounts.push({username: "Player",password: "Confirmcode"});
  781. accounts.push({username: "Player",password: "Confirmcode"});
  782. accounts.push({username: "Player",password: "Confirmcode"});
  783. accounts.push({username: "Player",password: "Confirmcode"});
  784. accounts.push({username: "Player",password: "Confirmcode"});
  785. accounts.push({username: "Player",password: "Confirmcode"});
  786. accounts.push({username: "Player",password: "Confirmcode"});
  787. accounts.push({username: "Player",password: "Confirmcode"});
  788. accounts.push({username: "Player",password: "Confirmcode"});
  789. accounts.push({username: "Player",password: "Confirmcode"});
  790. accounts.push({username: "Player",password: "Confirmcode"});
  791. accounts.push({username: "Player",password: "Confirmcode"});
  792. accounts.push({username: "Player",password: "Confirmcode"});
  793. var commands = {
  794. // Command that doesnt need to know players attributes.
  795. "!help": helpFun,
  796. "!gkhelp": gkHelpFun,
  797. "!adminhelp": adminHelpFun,
  798.  
  799. // Command that need to know who is the player.
  800. "!gk": gkFun,
  801.  
  802. // Command that need to know if a player is admin.
  803. "!swap": swapFun,
  804. "!rr": resetFun,
  805. "!clearbans": clearbansFun,
  806. "!admin AFCstaff51": adminFun,
  807.  
  808. // Command that need to know who is the player and what's the message.
  809. "!bb" : leaveFun,
  810. "!leave" : leaveFun,
  811. "!quit" : leaveFun,
  812. "!confirm" : confirmFun,
  813. "!confirmed_players" : confirmedPlayersFun,
  814. "!afk" : afkFun,
  815. "!afks" : afksFun,
  816. "!kickafks" : kickafksFun,
  817. "!resign" : resignFun,
  818. "!mute" : pushMuteFun,
  819. "!unmute": unmuteFun,
  820. "!pm": pmFun,
  821. "!mutelist": mutelistFun,
  822. "!clearmutes": clearmutesFun,
  823. }
  824.  
  825.  
  826. initPlayerStats(room.getPlayerList()[0]) // lazy lol, i'll fix it later
  827. initPlayerStats(init);
  828.  
  829. room.onPlayerLeave = function(player) {
  830. updateAdmins();
  831. }
  832.  
  833.  
  834.  
  835. room.onPlayerJoin = function(player) {
  836. updateAdmins(); // Gives admin to the first player who join the room if there's no one
  837. clonekick(player);
  838. playerName = player.name.replace(/ /g,"_");
  839. room.sendChat("πŸ’¬ Hi @" + playerName + " welcome to EFL Futsabot by Faraone, If you want to join league, ask anyone availible for link!" )
  840. room.sendChat("@" + playerName + " Write !help, !adminhelp, !rankhelp for commands." )
  841. }
  842.  
  843. var redTeam;
  844. var blueTeam;
  845. room.onGameStart = function() {
  846. [redTeam,blueTeam] = whichTeam();
  847. ballCarrying = initBallCarrying(redTeam, blueTeam);
  848. timeOnHalves = [0,0];
  849. }
  850.  
  851. room.onPlayerTeamChange = function(player){
  852. if (room.getScores() != null){
  853. if (1 <= player.team <= 2) ballCarrying.set(player.name, [0, player.team]);
  854. }
  855. if (player.team !== 0 && afkPlayerIDs.has(player.id))
  856. {room.setPlayerTeam(player.id, 0)
  857. room.sendChat("Now" + player.name + " is AFK!")}
  858. if (player.id <= 0){
  859. room.setPlayerTeam(player.id, 0)}
  860. }
  861.  
  862.  
  863.  
  864. room.onPlayerChat = function(player, message) {
  865. if (mutedPlayers.includes(player.name)) return false;
  866. let spacePos = message.search(" ");
  867. let command = message.substr(0, spacePos !== -1 ? spacePos : message.length);
  868. if (commands.hasOwnProperty(command) == true) return commands[command](player, message);
  869. if (message.indexOf("!") == 0) return false;
  870. }
  871.  
  872.  
  873.  
  874.  
  875. room.onPlayerBallKick = function (player){
  876. whoTouchedLast = player;
  877. }
  878.  
  879. var kickOff = false;
  880. var hasFinished = false;
  881.  
  882. room.onGameTick = function() {
  883.  
  884. if (kickOff == false) { // simplest comparison to not charge usulessly the tick thing
  885. if (room.getScores().time != 0){
  886. kickOff = true;
  887. gk = isGk();
  888. room.sendChat("Red GK: " + gk[0].name + ", Blue GK: " + gk[1].name);
  889. }
  890. }
  891. if (goalScored == false){
  892. whoTouchedLast = getLastTouchTheBall(whoTouchedLast);
  893. }
  894. if (whoTouchedLast != undefined) {
  895.  
  896. if (ballCarrying.get(whoTouchedLast.name)) {
  897. ballCarrying.get(whoTouchedLast.name)[0] += 1/60;
  898. }
  899.  
  900. if ( whoTouchedLast.id != whoTouchedBall[0].id){
  901. whoTouchedBall[1] = whoTouchedBall[0];
  902. whoTouchedBall[0] = whoTouchedLast; // last player who touched the ball
  903. }
  904. }
  905. updateTimeOnHalves();
  906. }
  907.  
  908. updateTimeOnHalves = function(){
  909. if(room.getBallPosition().x < 0){
  910. timeOnHalves[0] += 1/60;
  911. }else if(room.getBallPosition().x > 0){
  912. timeOnHalves[1] += 1/60;
  913. }
  914. }
  915.  
  916. room.onTeamGoal = function(team){ // Write on chat who scored and when.
  917. goalScored = true;
  918. var time = room.getScores().time;
  919. var m = Math.trunc(time/60); var s = Math.trunc(time % 60);
  920. time = m + ":" + floor(s); // MM:SS format
  921. var ownGoal = isOwnGoal(team, whoTouchedBall[0]);
  922. var assist = "";
  923. if (ownGoal == "") assist = playerTouchedTwice(whoTouchedBall);
  924. room.sendChat("⚽ GOAL scored by " + whoTouchedBall[0].name +
  925. assist + ownGoal + " at [" +
  926. time + "] for team " + team_name(team));
  927. room.sendChat("Match Score now: " + team_color(1) + " " +
  928. boldedNumber(room.getScores().red) + " - " + boldedNumber(room.getScores().blue) + " " + team_color(2));
  929.  
  930. if (scorers == undefined) scorers = new Map(); // Initializing dict of scorers
  931. scorers.set(scorers.size + 1 +") " + whoTouchedLast.name, [time, assist, ownGoal])
  932. whoTouchedBall = [init, init];
  933. whoTouchedLast = undefined;
  934. }
  935.  
  936. room.onPositionsReset = function(){
  937. goalScored = false;
  938. }
  939.  
  940.  
  941. room.onTeamVictory = function(scores){ // Sum up all scorers since the beginning of the match.
  942. room.sendChat("Scored goals ⚽:")
  943. for (var [key, value] of scorers) { // key: name of the player, value: time of the goal
  944. room.sendChat(key + " " + value[1] + value[2] + ": " + value[0]);
  945. }
  946. room.stopGame();
  947. players = room.getPlayerList();
  948. for (var i = 0; i < players.length; i++) {
  949. room.setPlayerTeam(players[i].id, 0);}
  950. }
  951.  
  952. room.onGameStop = function(){
  953. scorers = undefined;
  954. whoTouchedBall = [init, init];
  955. whoTouchedLast = undefined;
  956. gk = [init, init];
  957. kickOff = false;
  958. hasFinished = false;
  959. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement