Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 138.75 KB | None | 0 0
  1. /*jshint esversion: 6 */
  2. /*jslint browser: true */
  3. /*global window */
  4. /*global console */
  5. /*global HBInit */
  6.  
  7. // TODO: MOTM
  8. // red "🌿🔴[EFC Futsal] ◻️ discord.gg/jTn2ZDp" "code": "eu", "lat": 48.1371535, "lon": 11.5761235};
  9. // bleu "🌿🔵[EFC Futsal] ◻️ Sign up & Register" "code": "eu", "lat": 48.1371545, "lon": 11.5761245};
  10. // white "🌿⚪[EFC Futsal] ◻️ Play with friends" "code": "eu", "lat": 48.1371540, "lon": 11.5761240};
  11. // black "🌿⚫[EFC Futsal] ◻️ New Season 4" "code": "eu", "lat": 48.1371540, "lon": 11.5761240};
  12. // orange 🌿☢️[EFC Futsal] ◻️ Join us !" "code": "eu", "lat": 48.1371550, "lon": 11.5761250};
  13. var MAX_PLAYERS = 15;
  14.  
  15. let geo = {"code": "eu", "lat": 48.1371540, "lon": 11.5761240};
  16. var room = HBInit({ roomName: "🌿⚫[EFC Futsal] ◻️ New Season 4",
  17. playerName: "Phoenix 🦅", maxPlayers: MAX_PLAYERS, public: false, geo });
  18.  
  19. let first_stadium_loaded = false;
  20. room.setDefaultStadium("Small");
  21. room.setScoreLimit(3);
  22. room.setTimeLimit(3);
  23. room.setTeamsLock(true);
  24.  
  25.  
  26.  
  27.  
  28. class Player {
  29. constructor(name) {
  30. this.name = name;
  31. /*************************************
  32. ************ Individual stats**********
  33. **************************************/
  34. this.goals = 0; /* Number of goals */
  35. this.assists = 0; /* Number of assists */
  36. this.cs = 0; /* Number of cleensheets */
  37. this.ownGoals = 0; /* Number of own goals */
  38. this.wins = 0; /* Number of wins */
  39. this.loses = 0; /* Number of loses */
  40. this.motm = 0; /* Number of time a player is the man of the match */
  41. this.playedGk = 0;
  42.  
  43. this.badPasses = 0; /* Number of passes */
  44. this.goodPasses = 1; /* Number of passes that reached a team mate */
  45. this.passAcc = 0; /* Pass accuracy % */
  46. this.motmRatio = 0; /* Man of the match % */
  47. this.winsRatio = 0; /* Wins / Loses */
  48. this.csPG = 0; /* CS % per game */
  49. this.goalsPG = 0; /* Number of goals per game */
  50. this.assistsPG = 0; /* Number of assists per game */
  51. this.elo = 1000; /* ELO */
  52.  
  53. this.secsPlayed = 0; /* Number of mins played */
  54. this.minsPlayed = 0; /* Number of mins played */
  55. this.currentStreak = 0; /* Number of current matches won in a row */
  56. this.bestStreak = 0; /* Number of maximum amount of wins in a row */
  57. this.statsString1 = "";
  58. this.statsString2 = "";
  59. this.statsString3 = "";
  60. /*************************************
  61. ************ Haxball manager**********
  62. **************************************/
  63. this.gameStarted = 0;
  64. this.price = 10;
  65. this.money = 100;
  66. this.currentBet = 0;
  67. this.winPred = 0;
  68. this.dreamTeam = {"gk": null, "dm": null, "am": null, "st": null};
  69. this.teamScore = 0;
  70.  
  71. /*************************************
  72. ************ Revelant to the room*****
  73. **************************************/
  74. this.team = 0;
  75. this.gotKicked = 0; /* Number of time this player got kicked by another player */
  76. this.kickedSomeone = 0; /* Number of time this player kicked someone */
  77. this.id = 0; /* Current player's id on the room */
  78. this.pw = 0; /* Password for player's account */
  79. this.isTrustedAdmin = 0; /* Whether he's a trusted admin */
  80. this.logged = 1; /* 0 if the player is not in the room, 1 if he's */
  81. this.isBanned = 0; /* Whether a player is banned */
  82. this.isPermaBanned = 0; /* Whether a player is banned permanently*/
  83. this.isRegistered = 0; /* Whether a player is registered (e.g. his stats will count) */
  84. this.auth = 0; /* Player's last auth */
  85. this.conn = 0; /* Player's last conn */
  86. this.isMuted = 0; /* Whether a player is muted */
  87. this.isAFK = false;
  88. }
  89.  
  90.  
  91. updateGoals(){
  92. if (gameStats.scorers.hasOwnProperty(this.name))
  93. this.goals += gameStats.scorers[this.name];
  94. }
  95. updateAssists(){
  96. if (gameStats.assisters.hasOwnProperty(this.name))
  97. this.assists += gameStats.assisters[this.name];
  98. }
  99. updateCs(){
  100. let [team, idteam] = this.team === 1 ? ["blueScore", 1] : ["redScore", 2];
  101. this.cs += gameStats[team] === 0 &&
  102. this.name === gameStats.Gks[idteam - 1];
  103. }
  104. updateOG(){
  105. if (gameStats.ownScorers.hasOwnProperty(this.name))
  106. this.ownGoals += gameStats.ownScorers[this.name];
  107. }
  108. updatePlayedGk(){
  109. this.playedGk += gameStats.Gks.includes(this.name);
  110. }
  111. updateWins(winningTeam){
  112. this.wins += this.team === winningTeam;
  113. }
  114.  
  115. updateLoses(losingTeam){
  116. this.loses += this.team === losingTeam;
  117. }
  118. updateWinRatio(){
  119. this.winsRatio = ((this.wins / (this.wins + this.loses)) * 100).toFixed(2) || 0;
  120. }
  121. updateGoalsPG(){
  122. this.goalsPG = (this.goals / (this.loses + this.wins)).toFixed(2) || 0;
  123. }
  124. updateAssistsPG(){
  125. this.assistsPG = (this.assists / (this.loses + this.wins)).toFixed(2) || 0;
  126. }
  127. updateCSPG(){
  128. this.csPG = ((this.cs / this.playedGk) * 100).toFixed(2) || 0;
  129. }
  130. updateCurrentStreak(won){
  131. this.currentStreak = won === this.team ? this.currentStreak + 1 : 0;
  132. }
  133.  
  134. updateBestStreak(){
  135. this.bestStreak = this.currentStreak >= this.bestStreak ?
  136. this.currentStreak : this.bestStreak;
  137. }
  138. updateSecsPlayed(){
  139. this.secsPlayed += Number(((this.team !== 0) / 60).toFixed(2));
  140. }
  141. updateMinsPlayed(){
  142. this.minsPlayed = Math.floor((this.secsPlayed / 60));
  143. }
  144.  
  145. updatePassAccuracy(){
  146. this.passAcc = ((this.goodPasses / (this.goodPasses + this.badPasses)) * 100).toFixed(2);
  147. }
  148. updateKickedSomeone(){
  149. this.kickedSomeone += this.isTrustedAdmin === 0;
  150. }
  151. updatePassword(m){
  152. this.pw = m;
  153. }
  154. updateMoney(won){
  155. let diff = won == this.winPred ? this.currentBet : -1 * this.currentBet;
  156. this.money += diff;
  157. this.currentBet = 0;
  158. this.winPred = 0;
  159. }
  160. disconnect(){
  161. this.logged = 0;
  162. this.isTrustedAdmin = 0;
  163. this.price = 0;
  164. }
  165.  
  166. statsToString(){
  167. this.statsString1 = " | Goals: " + this.goals + " | Assists: " + this.assists +
  168. " | Own goals: " + this.ownGoals + " | cs: " + this.cs +
  169. " | Wins: " + this.wins + " | Losses: " + this.loses;
  170.  
  171. this.statsString2 = " | MOTM: " + "[Soon]" +
  172. " | MOTMR: " + "[Soon]" + " | W/L %: " + this.winsRatio +
  173. " | Pass acc %: " + this.passAcc + " | Elo: " + this.elo;
  174.  
  175. this.statsString3 = " | GPG: " + this.goalsPG + " | APG: " + this.assistsPG +
  176. " | csPG %: " + this.csPG + " | Best streak: " + this.bestStreak +
  177. " | Mins: " + this.minsPlayed + "| EFCOINS: " + this.money;
  178. }
  179. displayStats(query_id){
  180. this.statsToString();
  181. room.sendChat(this.statsString1, query_id);
  182. room.sendChat(this.statsString2, query_id);
  183. room.sendChat(this.statsString3, query_id);
  184. this.statsString1 = this.statsString2 = this.statsString3 = "";
  185. }
  186. updateEGStats(){
  187. let winners = gameStats.redScore > gameStats.blueScore ? 1 : 2;
  188. let losers = 1 + (winners === 1);
  189. this.updateGoals();
  190. this.updateAssists();
  191. this.updateOG();
  192. this.updateWins(winners);
  193. this.updateLoses(winners - 1);
  194. this.updatePlayedGk();
  195.  
  196.  
  197. this.updateWinRatio();
  198. this.updateGoalsPG();
  199. this.updateAssistsPG();
  200. this.updateCSPG();
  201. this.updatePassAccuracy();
  202. this.updateCurrentStreak(winners);
  203. this.updateBestStreak(winners);
  204. this.updateCs();
  205. this.updateMoney(winners);
  206. }
  207. }
  208.  
  209.  
  210.  
  211.  
  212. class GameStats {
  213. constructor() {
  214. this.redScore = 0; /* Number of goals red team scored this match */
  215. this.blueScore = 0; /* Number of goals blue team scored this match */
  216. this.Gks = ["", ""]; /* Name of the gks */
  217. this.scorers = {}; /* {name: number_of_goals_scored} */
  218. this.assisters = {}; /* {name: number_of_assists} */
  219. this.ownScorers = {}; /* {name: number_of_own_goals} */
  220. this.redTeam = []; /* [name of the players in red team] */
  221. this.blueTeam = []; /* [name of the players in blue team] */
  222. this.matchsumup = [];
  223. this.isOvertime = false;
  224. this.hasStarted = false;
  225. this.rec = false;
  226. }
  227. updateScore(team){
  228. this.redScore += team === 1;
  229. this.blueScore += team === 2;
  230. }
  231.  
  232. updateGK(){
  233. var players = room.getPlayerList();
  234. var min = players[0];
  235. min.position = {x: room.getBallPosition().x + 60};
  236. var max = min;
  237.  
  238. for (var i = 1; i < players.length; i++) {
  239. if (players[i].position !== null){
  240. if (min.position.x > players[i].position.x) min = players[i];
  241. if (max.position.x < players[i].position.x) max = players[i];
  242. }
  243. }
  244. this.Gks = [min.name, max.name];
  245. }
  246. updateScorers(p, team){
  247. if (p !== undefined && p.team === team) updateObject(this.scorers, p);
  248. }
  249. updateAssisters(p, team){
  250. if (p !== undefined && p.team === team) updateObject(this.assisters, p);
  251. }
  252. updateOwnScorers(p, team){
  253. if (p.team !== team) updateObject(this.ownScorers, p);
  254. }
  255.  
  256. updateRedTeam(){
  257. this.redTeam = room.getPlayerList().filter(player => player.team === 1);
  258. }
  259. updateBlueTeam(){
  260. this.blueTeam = room.getPlayerList().filter(player => player.team === 2);
  261. }
  262. updateOvertime(){
  263. this.isOvertime = true;
  264. }
  265. sumMatch(p){
  266. if (lastMatchSumUp.length === 0) return;
  267. let last_match = lastMatchSumUp.length - 1;
  268. let last_match_length = lastMatchSumUp[last_match].length;
  269. for (var i = 0; i < last_match_length; i++){
  270. room.sendChat(lastMatchSumUp[last_match][i], p.id);
  271. }
  272. }
  273.  
  274. }
  275.  
  276.  
  277.  
  278. class GameControl {
  279. constructor(radiusBall) {
  280. this.radiusBall = radiusBall || 10;
  281. this.triggerDistance = this.radiusBall + 15 + 0.1;
  282. this.currentBallOwner = "";
  283. this.lastBallOwners = ["", ""]; /* [name: name] */
  284. this.passesInARow = {"red": 0, "blue": 0}; /* {team: max} */
  285. this.maxPassesInARow = 0;
  286. this.redPoss = 0;
  287. this.bluePoss = 0;
  288. this.smth = "";
  289. }
  290. resetBallOwner(){
  291. this.currentBallOwner = "";
  292. this.lastBallOwners = ["", ""];
  293. }
  294. updateBallOwner(){
  295. var ballPosition = room.getBallPosition();
  296. var players = room.getPlayerList();
  297. var distanceToBall;
  298. for (var i = 0; i < players.length; i++) {
  299. if (players[i].position != null) {
  300. distanceToBall = pointDistance(players[i].position, ballPosition);
  301. if (distanceToBall < this.triggerDistance) {
  302. this.currentBallOwner = players[i].name;
  303. }
  304. }
  305. }
  306. }
  307. updateLastBallOwners(){
  308. if (this.currentBallOwner !== "" &&
  309. this.currentBallOwner !== this.lastBallOwners[0]){
  310.  
  311. this.lastBallOwners[1] = this.lastBallOwners[0];
  312. this.lastBallOwners[0] = this.currentBallOwner; // last player who touched the ball
  313. }
  314. }
  315. updatePassesInARow(){
  316. if (gameStats.redTeam.length !== gameStats.blueTeam.length ||
  317. gameStats.redTeam.length < 2) return;
  318.  
  319. if (this.lastBallOwners[1] !== "" && this.smth !== this.currentBallOwner){
  320.  
  321. if (Stats[this.lastBallOwners[0]].team ===
  322. Stats[this.lastBallOwners[1]].team){
  323.  
  324. Stats[this.lastBallOwners[1]].goodPasses++;
  325.  
  326.  
  327. if (Stats[this.lastBallOwners[0]].team === 1){
  328. this.passesInARow.red += 1;
  329. this.updateMaxPassesInARow("blue");
  330. this.passesInARow.blue = 0;
  331. }
  332. else {
  333. this.passesInARow.blue += 1;
  334. this.updateMaxPassesInARow("red");
  335. this.passesInARow.red = 0;
  336.  
  337. }
  338. }
  339. else {
  340. Stats[this.lastBallOwners[1]].badPasses++;
  341. }
  342.  
  343. this.smth = this.currentBallOwner;
  344. }
  345. }
  346. updateMaxPassesInARow(team){
  347. this.maxPassesInARow = this.passesInARow[team] > this.maxPassesInARow ?
  348. this.passesInARow[team] : this.maxPassesInARow;
  349. }
  350. }
  351.  
  352.  
  353. class Records {
  354. constructor() {
  355. this.bestPassesInARow = 0;
  356. this.bestAccuracy = "";
  357. this.bestStreak = {}; /*{[team]: score};*/
  358. this.fastestWin = 0;
  359. this.longestMatch = 0;
  360. }
  361. updateBestPassesInARow(){
  362. this.bestPassesInARow = this.maxPassesInARow > this.bestPassesInARow ?
  363. this.passesInARow : this.bestPassesInARow;
  364.  
  365. }
  366. }
  367.  
  368. class ELO {
  369. constructor() {
  370. this.redAverage = 0;
  371. this.blueAverage = 0;
  372. this.redChanceToWin = 0;
  373. this.blueChanceToWin = 0;
  374. this.redRating = 0;
  375. this.blueRating = 0;
  376. }
  377. getAverageRank(team){
  378. let average = 0;
  379. for (var i = 0; i < team.length; i++) {
  380. average += Stats[team[i].name].elo;
  381. }
  382. return average / team.length;
  383. }
  384. updateTeamAverages(){
  385. this.redAverage = this.getAverageRank(gameStats.redTeam);
  386. this.blueAverage = this.getAverageRank(gameStats.blueTeam);
  387. }
  388. updateChancesToWin(){
  389. this.redChanceToWin = 1 / ( 1 + Math.pow(10, (this.blueAverage - this.redAverage) / 400));
  390. this.blueChanceToWin = 1 / ( 1 + Math.pow(10, (this.redAverage - this.blueAverage) / 400));
  391. }
  392. updateRating(rwin, bwin){
  393. this.redRating = Math.round(32 * (rwin - this.redChanceToWin));
  394. this.blueRating = Math.round(32 * (bwin - this.blueChanceToWin));
  395. }
  396. handleEloCalc(){
  397. this.updateTeamAverages();
  398. this.updateChancesToWin();
  399. }
  400. updateElo(){
  401. if (gameStats.redTeam.length === gameStats.blueTeam.length){
  402. let winners = gameStats.redScore > gameStats.blueScore;
  403. let pr, pb;
  404. this.updateRating(winners, !winners);
  405. for (var i = 0; i < gameStats.redTeam.length; i++) {
  406. pr = gameStats.redTeam[i].name;
  407. pb = gameStats.blueTeam[i].name;
  408.  
  409. Stats[pr].elo += this.redRating;
  410. Stats[pb].elo += this.blueRating;
  411. }
  412. }
  413. }
  414. }
  415.  
  416. /**************************************************************
  417. * ************************** ADMINS ************************
  418. ***************************************************************/
  419.  
  420. var headAdminsAuths = {
  421. "Et576Ip_llwpLQe7PAq-0x-Ont8-slyZM4wlbeCVcBg": "Mona1",
  422. "FD7dcGdmO0W4TdrP7T6m57xzcFtoDl05MOu5sxHdwx0": "Kang1",
  423. "xE5ePWxHAYRejeCWVln_H8ArK-ZsAXQlbYbo5pqcwZY": "Tidus"
  424.  
  425. };
  426.  
  427. var roomAdminsAuth = {
  428. "Et576Ip_llwpLQe7PAq-0x-Ont8-slyZM4wlbeCVcBg": "Mona1",
  429. "FD7dcGdmO0W4TdrP7T6m57xzcFtoDl05MOu5sxHdwx0": "Kang1",
  430. "xE5ePWxHAYRejeCWVln_H8ArK-ZsAXQlbYbo5pqcwZY": "Tidus",
  431. "dOKIGfR8z70iF3KxsXS5zNkvg1Xaj-fC4ocgX9JrtNQ": "Common",
  432. "D2BOPzz1QJg0KOco6LHgPVwgrbZdCMjDC3AsVxswaMM": "DbK1",
  433. "kF0mUASq7VGKC5zb2rth8Bs58rfQvmAbTfxjKqUWgBk": "Lethal1",
  434. "xsAMlZWedf3R0msP7PcPtgthtHfauaHUvthdGnxPJ3M": "Alexinhooooo1",
  435. "NzU6hY8_OxYfJq4az7V7WFE-1fWGXV0-C0qzf4IOtX4": "Kamikaze1",
  436. "P9kK4sqeLYHpv2J5VgKa8iP1mIK_X1rrbA_3_a6TVpE": "Ben Simmons1"
  437.  
  438. };
  439.  
  440. function banConn(player){
  441. if (player.conn === "38342E3137342E3232382E313734") { // Zed.
  442. room.kickPlayer(player.id, "Zed. is permanently banned", true);
  443. console.log("🔴🔴🔴" + player.name + " has been banned permanently by the bot")
  444. }
  445. if (player.conn === "39342E322E35392E3432") { // Madness
  446. room.kickPlayer(player.id, "Madness is permanently banned", true);
  447. console.log("🔴🔴🔴" + player.name + " has been banned permanently by the bot")
  448. }
  449. if (player.conn === "3130392E39302E3233322E323331") { // Tsubasa
  450. room.kickPlayer(player.id, "Tsubasa is permanently banned", true);
  451. console.log("🔴🔴🔴" + player.name + " has been banned permanently by the bot")
  452. }
  453. if (player.conn === "39322E3233382E38332E3930") { // Kernoa
  454. room.kickPlayer(player.id, "Kernoa is permanently banned", true);
  455. console.log("🔴🔴🔴" + player.name + " has been banned permanently by the bot")
  456. }
  457. if (player.conn === "37372E3130302E39362E323137") { // Kl
  458. room.kickPlayer(player.id, "Kl is permanently banned", true);
  459. console.log("🔴🔴🔴" + player.name + " has been banned permanently by the bot")
  460. }
  461. if (player.conn === "3231332E3132372E382E3134") { // Lyreco
  462. room.kickPlayer(player.id, "Lyreco is permanently banned", true);
  463. console.log("🔴🔴🔴" + player.name + " has been banned permanently by the bot")
  464. }
  465. if (player.conn === "38332E38332E33352E313032") { // 24
  466. room.kickPlayer(player.id, "24 is permanently banned", true);
  467. console.log("🔴🔴🔴" + player.name + " has been banned permanently by the bot")
  468. }
  469. if (player.conn === "37382E36312E3131372E3532") { // Killer
  470. room.kickPlayer(player.id, "Killer is permanently banned", true);
  471. console.log("🔴🔴🔴" + player.name + " has been banned permanently by the bot")
  472. }
  473. if (player.conn === "3137362E3134392E37362E313537") { // Killer
  474. room.kickPlayer(player.id, "Killer is permanently banned", true);
  475. console.log("🔴🔴🔴" + player.name + " has been banned permanently by the bot")
  476. }
  477. if (player.conn === "37392E382E3132362E323238") { // Sicko
  478. room.kickPlayer(player.id, "Sicko is permanently banned", true);
  479. console.log("🔴🔴🔴" + player.name + " has been banned permanently by the bot")
  480. }
  481. if (player.conn === "38302E3138392E3232382E313939") { // Sicko
  482. room.kickPlayer(player.id, "Sicko is permanently banned", true);
  483. console.log("🔴🔴🔴" + player.name + " has been banned permanently by the bot")
  484. }
  485. if (player.conn === "38342E38372E3133312E313533") { // Aomine
  486. room.kickPlayer(player.id, "Aomine is permanently banned", true);
  487. console.log("🔴🔴🔴" + player.name + " has been banned permanently by the bot")
  488. }
  489. if (player.conn === "38392E39392E34312E3635") { // Le7
  490. room.kickPlayer(player.id, "Le7 is permanently banned", true);
  491. console.log("🔴🔴🔴" + player.name + " has been banned permanently by the bot")
  492. }
  493. if (player.conn === "3136332E3135382E3135392E313231") { // Kernoa
  494. room.kickPlayer(player.id, "You are permanently banned", true);
  495. console.log("🔴🔴🔴" + player.name + " (Kernoa) has been banned permanently by the bot")
  496. }
  497. if (player.conn === "38342E32372E3130352E3135") { // Tarik
  498. room.kickPlayer(player.id, "You are permanently banned", true);
  499. console.log("🔴🔴🔴" + player.name + " (Tarik) has been banned permanently by the bot")
  500. }
  501. if (player.conn === "3137362E3137302E31382E323331") { // Fury
  502. room.kickPlayer(player.id, "You are permanently banned", true);
  503. console.log("🔴🔴🔴" + player.name + " (Fury) has been banned permanently by the bot")
  504. }
  505. if (player.conn === "39332E302E39302E313337") { // Rosa
  506. room.kickPlayer(player.id, "You are permanently banned", true);
  507. console.log("🔴🔴🔴" + player.name + " (Rosa) has been banned permanently by the bot")
  508. }
  509. if (player.conn === "3137362E3132362E38352E3132") { // Le7
  510. room.kickPlayer(player.id, "You are permanently banned", true);
  511. console.log("🔴🔴🔴" + player.name + " (Le7) has been banned permanently by the bot")
  512. }
  513. if (player.conn === "39302E3131322E32372E313634") { // Sativa
  514. room.kickPlayer(player.id, "You are permanently banned", true);
  515. console.log("🔴🔴🔴" + player.name + " (Sativa) has been banned permanently by the bot")
  516. }
  517. if (player.conn === "3231372E32352E31372E323030") { // HD
  518. room.kickPlayer(player.id, "You are permanently banned", true);
  519. console.log("🔴🔴🔴" + player.name + " (HD) has been banned permanently by the bot")
  520. }
  521. if (player.conn === "3138382E3235332E3233372E313731") { // HD
  522. room.kickPlayer(player.id, "You are permanently banned", true);
  523. console.log("🔴🔴🔴" + player.name + " (HD) has been banned permanently by the bot")
  524. }
  525. if (player.conn === "3130352E3130342E3132312E313432") { // Dopped
  526. room.kickPlayer(player.id, "You are permanently banned", true);
  527. console.log("🔴🔴🔴" + player.name + " (Dopped) has been banned permanently by the bot")
  528. }
  529. if (player.conn === "37372E32312E3138372E313631") { // Misuki
  530. room.kickPlayer(player.id, "You are permanently banned", true);
  531. console.log("🔴🔴🔴" + player.name + " (Heist) has been banned permanently by the bot")
  532. }
  533. if (player.conn === "37372E32312E3138392E313031") { // Heist
  534. room.kickPlayer(player.id, "You are permanently banned", true);
  535. console.log("🔴🔴🔴" + player.name + " (Heist) has been banned permanently by the bot")
  536. }
  537. if (player.conn === "37372E3233392E38382E3736") { // Maestro
  538. room.kickPlayer(player.id, "You are permanently banned", true);
  539. console.log("🔴🔴🔴" + player.name + " (Maestro) has been banned permanently by the bot")
  540. }
  541. if (player.conn === "3130352E3130342E3132352E3335") { // xSha
  542. room.kickPlayer(player.id, "You are permanently banned", true);
  543. console.log("🔴🔴🔴" + player.name + " (xSha) has been banned permanently by the bot")
  544. }
  545. if (player.conn === "3139332E3234382E3134332E3635") { // Fury
  546. room.kickPlayer(player.id, "You are permanently banned", true);
  547. console.log("🔴🔴🔴" + player.name + " (Fury) has been banned permanently by the bot")
  548. }
  549. if (player.conn === "39302E3235342E34332E323331") { // July4th
  550. room.kickPlayer(player.id, "You are permanently banned", true);
  551. console.log("🔴🔴🔴" + player.name + " (July4th) has been banned permanently by the bot")
  552. }
  553. if (player.conn === "37372E3133362E3139382E3238") { // Mila
  554. room.kickPlayer(player.id, "You are permanently banned", true);
  555. console.log("🔴🔴🔴" + player.name + " (Mila) has been banned permanently by the bot")
  556. }
  557. if (player.conn === "33312E3232332E3133302E313633") { // Kyuashu
  558. room.kickPlayer(player.id, "You are permanently banned", true);
  559. console.log("🔴🔴🔴" + player.name + " (Kyuashu) has been banned permanently by the bot")
  560. }
  561. if (player.conn === "3130392E32382E3138322E313732") { // Dindane
  562. room.kickPlayer(player.id, "You are permanently banned", true);
  563. console.log("🔴🔴🔴" + player.name + " (Dindane) has been banned permanently by the bot")
  564. }
  565. if (player.conn === "33312E3232332E3133302E313833") { // Kyuashu
  566. room.kickPlayer(player.id, "You are permanently banned", true);
  567. console.log("🔴🔴🔴" + player.name + " (Kyuashu) has been banned permanently by the bot")
  568. }
  569. if (player.conn === "38332E35392E3132342E313631") { // Ddoser
  570. room.kickPlayer(player.id, "You are permanently banned", true);
  571. console.log("🔴🔴🔴" + player.name + " (Ddoser) has been banned permanently by the bot")
  572. }
  573. if (player.conn === "39332E372E37312E313933") { // Pub ddoser 2
  574. room.kickPlayer(player.id, "You are permanently banned", true);
  575. console.log("🔴🔴🔴" + player.name + " (Ddoser) has been banned permanently by the bot")
  576. }
  577. if (player.conn === "3137362E3135382E3137362E323436") { // Isaac
  578. room.kickPlayer(player.id, "You are permanently banned", true);
  579. console.log("🔴🔴🔴" + player.name + " (Isaac) has been banned permanently by the bot")
  580. }
  581. if (player.conn === "38372E3131362E3137392E3836") { // mebej
  582. room.kickPlayer(player.id, "You are permanently banned", true);
  583. console.log("🔴🔴🔴" + player.name + " (Mebej) has been banned permanently by the bot")
  584. }
  585.  
  586.  
  587. }
  588.  
  589. function lastPlace (){
  590. var players = room.getPlayerList();
  591. if ( players.length == 15 )
  592. room.setPassword("efc2040");
  593.  
  594. if (players.length < 15 )
  595. room.setPassword();
  596.  
  597. }
  598.  
  599. function kickFakeAdmin (player){
  600. if (player.name === "Mona" && player.auth != "Et576Ip_llwpLQe7PAq-0x-Ont8-slyZM4wlbeCVcBg") {
  601. room.kickPlayer(player.id, "Fake! There is only one Mona", true);
  602. }
  603. if (player.name === "Kang" && player.auth != "FD7dcGdmO0W4TdrP7T6m57xzcFtoDl05MOu5sxHdwx0") {
  604. room.kickPlayer(player.id, "Fake! There is only one Kang", true);
  605. }
  606.  
  607. }
  608.  
  609. function doubleSpace(player){
  610. thename = player.name
  611. if (thename.includes(" ")){
  612. room.kickPlayer(player.id,"Take the spaces off your nickname", false);
  613. console.log("🚫🚫🚫 " + player.name + " has been kicked for double space in his name");
  614. }
  615. }
  616.  
  617.  
  618.  
  619. function kickWord(p, m){
  620. if (m.includes("nigga")){
  621. room.kickPlayer(p.id,"We don't tolerate that here", false);
  622. Stats[p.name].isMuted = 1;
  623. Stats[p.name].kickedSomeone = 0;
  624. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  625. }
  626. if (m.includes("nigger")){
  627. room.kickPlayer(p.id,"We don't tolerate that here", false);
  628. Stats[p.name].isMuted = 1;
  629. Stats[p.name].kickedSomeone = 0;
  630. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  631. }
  632. if (m.includes("nibba")){
  633. room.kickPlayer(p.id,"We don't tolerate that here", false);
  634. Stats[p.name].isMuted = 1;
  635. Stats[p.name].kickedSomeone = 0;
  636. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  637. }
  638. if (m.includes("niga")){
  639. room.kickPlayer(p.id,"We don't tolerate that here", false);
  640. Stats[p.name].isMuted = 1;
  641. Stats[p.name].kickedSomeone = 0;
  642. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  643. }
  644. if (m.includes("gay")){
  645. room.kickPlayer(p.id,"We don't tolerate that here", false);
  646. Stats[p.name].isMuted = 1;
  647. Stats[p.name].kickedSomeone = 0;
  648. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  649. }
  650. if (m.includes("gaay")){
  651. room.kickPlayer(p.id,"We don't tolerate that here", false);
  652. Stats[p.name].isMuted = 1;
  653. Stats[p.name].kickedSomeone = 0;
  654. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  655. }
  656. if (m.includes("gaaay")){
  657. room.kickPlayer(p.id,"We don't tolerate that here", false);
  658. Stats[p.name].isMuted = 1;
  659. Stats[p.name].kickedSomeone = 0;
  660. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  661. }
  662. if (m.includes("rape")){
  663. room.kickPlayer(p.id,"We don't tolerate that here", false);
  664. Stats[p.name].isMuted = 1;
  665. Stats[p.name].kickedSomeone = 0;
  666. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  667. }
  668. if (m.includes("raped")){
  669. room.kickPlayer(p.id,"We don't tolerate that here", false);
  670. Stats[p.name].isMuted = 1;
  671. Stats[p.name].kickedSomeone = 0;
  672. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  673. }
  674. if (m.includes("rapist")){
  675. room.kickPlayer(p.id,"We don't tolerate that here", false);
  676. Stats[p.name].isMuted = 1;
  677. Stats[p.name].kickedSomeone = 0;
  678. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  679. }
  680. if (m.includes("cunt")){
  681. room.kickPlayer(p.id,"We don't tolerate that here", false);
  682. Stats[p.name].isMuted = 1;
  683. Stats[p.name].kickedSomeone = 0;
  684. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  685. }
  686. if (m.includes("Cunt")){
  687. room.kickPlayer(p.id,"We don't tolerate that here", false);
  688. Stats[p.name].isMuted = 1;
  689. Stats[p.name].kickedSomeone = 0;
  690. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  691. }
  692. if (m.includes("your mom")){
  693. room.kickPlayer(p.id,"We don't tolerate that here", false);
  694. Stats[p.name].isMuted = 1;
  695. Stats[p.name].kickedSomeone = 0;
  696. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  697. }
  698. if (m.includes("you mom")){
  699. room.kickPlayer(p.id,"We don't tolerate that here", false);
  700. Stats[p.name].isMuted = 1;
  701. Stats[p.name].kickedSomeone = 0;
  702. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  703. }
  704. if (m.includes("your sister")){
  705. room.kickPlayer(p.id,"We don't tolerate that here", false);
  706. Stats[p.name].isMuted = 1;
  707. Stats[p.name].kickedSomeone = 0;
  708. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  709. }
  710. if (m.includes("your dad")){
  711. room.kickPlayer(p.id,"We don't tolerate that here", false);
  712. Stats[p.name].isMuted = 1;
  713. Stats[p.name].kickedSomeone = 0;
  714. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  715. }
  716. if (m.includes("fuck your")){
  717. room.kickPlayer(p.id,"We don't tolerate that here", false);
  718. Stats[p.name].isMuted = 1;
  719. Stats[p.name].kickedSomeone = 0;
  720. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  721. }
  722. if (m.includes("you fucking")){
  723. room.kickPlayer(p.id,"We don't tolerate that here", false);
  724. Stats[p.name].isMuted = 1;
  725. Stats[p.name].kickedSomeone = 0;
  726. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  727. }
  728. if (m.includes("coon")){
  729. room.kickPlayer(p.id,"We don't tolerate that here", false);
  730. Stats[p.name].isMuted = 1;
  731. Stats[p.name].kickedSomeone = 0;
  732. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  733. }
  734. if (m.includes("Coon")){
  735. room.kickPlayer(p.id,"We don't tolerate that here", false);
  736. Stats[p.name].isMuted = 1;
  737. Stats[p.name].kickedSomeone = 0;
  738. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  739. }
  740. if (m.includes("cooon")){
  741. room.kickPlayer(p.id,"We don't tolerate that here", false);
  742. Stats[p.name].isMuted = 1;
  743. Stats[p.name].kickedSomeone = 0;
  744. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  745. }
  746. if (m.includes(" pute")){
  747. room.kickPlayer(p.id,"We don't tolerate that here", false);
  748. Stats[p.name].isMuted = 1;
  749. Stats[p.name].kickedSomeone = 0;
  750. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  751. }
  752. if (m.includes(" pute")){
  753. room.kickPlayer(p.id,"We don't tolerate that here", false);
  754. Stats[p.name].isMuted = 1;
  755. Stats[p.name].kickedSomeone = 0;
  756. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  757. }
  758. if (m.includes("la pute")){
  759. room.kickPlayer(p.id,"We don't tolerate that here", false);
  760. Stats[p.name].isMuted = 1;
  761. Stats[p.name].kickedSomeone = 0;
  762. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  763. }
  764. if (m.includes("fdp")){
  765. room.kickPlayer(p.id,"We don't tolerate that here", false);
  766. Stats[p.name].isMuted = 1;
  767. Stats[p.name].kickedSomeone = 0;
  768. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  769. }
  770. if (m.includes("FDP")){
  771. room.kickPlayer(p.id,"We don't tolerate that here", false);
  772. Stats[p.name].isMuted = 1;
  773. Stats[p.name].kickedSomeone = 0;
  774. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  775. }
  776. if (m.includes("raping")){
  777. room.kickPlayer(p.id,"We don't tolerate that here", false);
  778. Stats[p.name].isMuted = 1;
  779. Stats[p.name].kickedSomeone = 0;
  780. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  781. }
  782. if (m.includes("fils de")){
  783. room.kickPlayer(p.id,"We don't tolerate that here", false);
  784. Stats[p.name].isMuted = 1;
  785. Stats[p.name].kickedSomeone = 0;
  786. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  787. }
  788. if (m.includes("f d p")){
  789. room.kickPlayer(p.id,"We don't tolerate that here", false);
  790. Stats[p.name].isMuted = 1;
  791. Stats[p.name].kickedSomeone = 0;
  792. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  793. }
  794. if (m.includes("Fdp")){
  795. room.kickPlayer(p.id,"We don't tolerate that here", false);
  796. Stats[p.name].isMuted = 1;
  797. Stats[p.name].kickedSomeone = 0;
  798. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  799. }
  800. if (m.includes("nique ta")){
  801. room.kickPlayer(p.id,"We don't tolerate that here", false);
  802. Stats[p.name].isMuted = 1;
  803. Stats[p.name].kickedSomeone = 0;
  804. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  805. }
  806. if (m.includes("niquer ta")){
  807. room.kickPlayer(p.id,"We don't tolerate that here", false);
  808. Stats[p.name].isMuted = 1;
  809. Stats[p.name].kickedSomeone = 0;
  810. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  811. }
  812. if (m.includes("salope")){
  813. room.kickPlayer(p.id,"We don't tolerate that here", false);
  814. Stats[p.name].isMuted = 1;
  815. Stats[p.name].kickedSomeone = 0;
  816. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  817. }
  818. if (m.includes("baise ta")){
  819. room.kickPlayer(p.id,"We don't tolerate that here", false);
  820. Stats[p.name].isMuted = 1;
  821. Stats[p.name].kickedSomeone = 0;
  822. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  823. }
  824. if (m.includes("ta mère")){
  825. room.kickPlayer(p.id,"We don't tolerate that here", false);
  826. Stats[p.name].isMuted = 1;
  827. Stats[p.name].kickedSomeone = 0;
  828. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  829. }
  830. if (m.includes("ta mere")){
  831. room.kickPlayer(p.id,"We don't tolerate that here", false);
  832. Stats[p.name].isMuted = 1;
  833. Stats[p.name].kickedSomeone = 0;
  834. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  835. }
  836. if (m.includes("Pute")){
  837. room.kickPlayer(p.id,"We don't tolerate that here", false);
  838. Stats[p.name].isMuted = 1;
  839. Stats[p.name].kickedSomeone = 0;
  840. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  841. }
  842. if (m.includes("pute ")){
  843. room.kickPlayer(p.id,"We don't tolerate that here", false);
  844. Stats[p.name].isMuted = 1;
  845. Stats[p.name].kickedSomeone = 0;
  846. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  847. }
  848. if (m.includes(" PUTE")){
  849. room.kickPlayer(p.id,"We don't tolerate that here", false);
  850. Stats[p.name].isMuted = 1;
  851. Stats[p.name].kickedSomeone = 0;
  852. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  853. }
  854. if (m.includes("puute")){
  855. room.kickPlayer(p.id,"We don't tolerate that here", false);
  856. Stats[p.name].isMuted = 1;
  857. Stats[p.name].kickedSomeone = 0;
  858. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  859. }
  860. if (m.includes("negro")){
  861. room.kickPlayer(p.id,"We don't tolerate that here", false);
  862. Stats[p.name].isMuted = 1;
  863. Stats[p.name].kickedSomeone = 0;
  864. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  865. }
  866. if (m.includes("negre")){
  867. room.kickPlayer(p.id,"We don't tolerate that here", false);
  868. Stats[p.name].isMuted = 1;
  869. Stats[p.name].kickedSomeone = 0;
  870. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  871. }
  872. if (m.includes("nègre")){
  873. room.kickPlayer(p.id,"We don't tolerate that here", false);
  874. Stats[p.name].isMuted = 1;
  875. Stats[p.name].kickedSomeone = 0;
  876. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  877. }
  878. if (m.includes("ta soeur")){
  879. room.kickPlayer(p.id,"We don't tolerate that here", false);
  880. Stats[p.name].isMuted = 1;
  881. Stats[p.name].kickedSomeone = 0;
  882. console.log("🚫🚫🚫 " + p.name + " has been kicked and muted for bad word");
  883. }
  884.  
  885. }
  886.  
  887.  
  888.  
  889.  
  890. /* PLAYER FUNCTIONS */
  891.  
  892. var teamRed;
  893. var teamBlue;
  894. var teamSpec;
  895.  
  896. function updateTeams(player) { // update the players' list and all the teams' list
  897. players = room.getPlayerList().filter((player) => player.id != 0);
  898. teamRed = players.filter(player => player.team === 1);
  899. teamBlue = players.filter(player => player.team === 2);
  900. teamSpec = players.filter(player => player.team === 0);
  901. }
  902.  
  903. var Team = {
  904. SPECTATORS: 0,
  905. RED: 1,
  906. BLUE: 2
  907. };
  908.  
  909. function chooseNumberRed(player, message){
  910. if (teamRed.length !== 0 && teamBlue.length !== 0) {
  911. if (player.id == teamRed[0].id || player.id == teamBlue[0].id) {
  912. if (teamRed.length <= teamBlue.length && player.id == teamRed[0].id) {
  913. if (!Number.isNaN(Number.parseInt(message[0]))) {
  914. if (Number.parseInt(message[0]) > teamSpec.length || Number.parseInt(message[0]) < 1) {
  915. room.sendChat("Invalid Number !", player.id);
  916. return false;
  917. }
  918. else {
  919. room.setPlayerTeam(teamSpec[Number.parseInt(message[0]) - 1].id, 1);
  920. return false;
  921. }
  922. }
  923. }
  924. }
  925. }
  926. }
  927.  
  928. function chooseNumberBlue(player, message){
  929. if (teamBlue.length !== 0 && teamRed.length !== 0) {
  930. if (player.id == teamBlue[0].id || player.id == teamRed[0].id) {
  931. if (teamBlue.length <= teamRed.length && player.id == teamBlue[0].id) {
  932. if (!Number.isNaN(Number.parseInt(message[0]))) {
  933. if (Number.parseInt(message[0]) > teamSpec.length || Number.parseInt(message[0]) < 1) {
  934. room.sendChat("Invalid number !", player.id);
  935. return false;
  936. }
  937. else {
  938. room.setPlayerTeam(teamSpec[Number.parseInt(message[0]) - 1].id, 2);
  939. return false;
  940. }
  941. }
  942. }
  943. }
  944. }
  945. }
  946.  
  947.  
  948.  
  949.  
  950. function startBig(){
  951. if (teamRed.length === 4 && teamBlue.length === 4) {
  952. room.setCustomStadium(maps.big);
  953. room.startGame();
  954. }
  955. if ((teamRed.length === 3 && teamBlue.length === 3) &&
  956. !(teamSpec.length > 2)) {
  957. room.setCustomStadium(maps.medium);
  958. room.startGame();
  959. }
  960. if ((teamRed.length === 2 && teamBlue.length === 2) &&
  961. !(teamSpec.length > 2)) {
  962. room.setCustomStadium(maps.small);
  963. room.startGame();
  964. }
  965. if ((teamRed.length === 1 && teamBlue.length === 1) &&
  966. !(teamSpec.length > 2)) {
  967. room.setCustomStadium(maps.small);
  968. room.startGame();
  969. }
  970. }
  971.  
  972. function loadFirstMap(){
  973. var players = room.getPlayerList();
  974. if (players.length < 6) {
  975. room.setCustomStadium(maps.small);
  976. }
  977. }
  978.  
  979.  
  980. var redCaptainChoice = "";
  981. var blueCaptainChoice = "";
  982.  
  983. function chooseTopRed(player, message){
  984. if (teamRed.length !== 0 && teamBlue.length !== 0) {
  985. if (player.id == teamRed[0].id || player.id == teamBlue[0].id) { // we care if it's one of the captains choosing
  986. if (teamRed.length <= teamBlue.length && player.id == teamRed[0].id) { // we care if it's red turn && red cap talking
  987. if (message === "top") {
  988. room.setPlayerTeam(teamSpec[0].id, 1);
  989. redCaptainChoice = "top";
  990. return false;
  991. }
  992. }
  993. }
  994. }
  995. }
  996.  
  997. function chooseTopBlue(player, message){
  998. if (teamBlue.length !== 0 && teamRed.length !== 0) {
  999. if (player.id == teamBlue[0].id || player.id == teamRed[0].id) { // we care if it's one of the captains choosing
  1000. if (teamBlue.length <= teamRed.length && player.id == teamBlue[0].id) { // we care if it's red turn && red cap talking
  1001. if (message === "top") {
  1002. room.setPlayerTeam(teamSpec[0].id, 2);
  1003. redCaptainChoice = "top";
  1004. return false;
  1005. }
  1006. }
  1007. }
  1008. }
  1009. }
  1010.  
  1011. function chooseTopRed2(player, message){
  1012. if (teamRed.length !== 0 && teamBlue.length !== 0) {
  1013. if (player.id == teamRed[0].id || player.id == teamBlue[0].id) { // we care if it's one of the captains choosing
  1014. if (teamRed.length <= teamBlue.length && player.id == teamRed[0].id) { // we care if it's red turn && red cap talking
  1015. if (message === "Top") {
  1016. room.setPlayerTeam(teamSpec[0].id, 1);
  1017. redCaptainChoice = "top";
  1018. return false;
  1019. }
  1020. }
  1021. }
  1022. }
  1023. }
  1024.  
  1025. function chooseTopBlue2(player, message){
  1026. if (teamBlue.length !== 0 && teamRed.length !== 0) {
  1027. if (player.id == teamBlue[0].id || player.id == teamRed[0].id) { // we care if it's one of the captains choosing
  1028. if (teamBlue.length <= teamRed.length && player.id == teamBlue[0].id) { // we care if it's red turn && red cap talking
  1029. if (message === "Top") {
  1030. room.setPlayerTeam(teamSpec[0].id, 2);
  1031. redCaptainChoice = "top";
  1032. return false;
  1033. }
  1034. }
  1035. }
  1036. }
  1037. }
  1038.  
  1039. function chooseTopRed3(player, message){
  1040. if (teamRed.length !== 0 && teamBlue.length !== 0) {
  1041. if (player.id == teamRed[0].id || player.id == teamBlue[0].id) { // we care if it's one of the captains choosing
  1042. if (teamRed.length <= teamBlue.length && player.id == teamRed[0].id) { // we care if it's red turn && red cap talking
  1043. if (message === "TOP") {
  1044. room.setPlayerTeam(teamSpec[0].id, 1);
  1045. redCaptainChoice = "top";
  1046. return false;
  1047. }
  1048. }
  1049. }
  1050. }
  1051. }
  1052.  
  1053. function chooseTopBlue3(player, message){
  1054. if (teamBlue.length !== 0 && teamRed.length !== 0) {
  1055. if (player.id == teamBlue[0].id || player.id == teamRed[0].id) { // we care if it's one of the captains choosing
  1056. if (teamBlue.length <= teamRed.length && player.id == teamBlue[0].id) { // we care if it's red turn && red cap talking
  1057. if (message === "TOP") {
  1058. room.setPlayerTeam(teamSpec[0].id, 2);
  1059. redCaptainChoice = "top";
  1060. return false;
  1061. }
  1062. }
  1063. }
  1064. }
  1065. }
  1066.  
  1067. function getRandomInt2(max) { // returns a random number from 0 to max-1
  1068. return Math.floor(Math.random() * Math.floor(3));
  1069. }
  1070.  
  1071. function chooseAutoRed(player, message){
  1072. if (teamRed.length !== 0 && teamBlue.length !== 0) {
  1073. if (player.id == teamRed[0].id || player.id == teamBlue[0].id) { // we care if it's one of the captains choosing
  1074. if (teamRed.length <= teamBlue.length && player.id == teamRed[0].id) { // we care if it's red turn && red cap talking
  1075. if (message === "auto") {
  1076. var r = getRandomInt2(teamSpec.length);
  1077. room.setPlayerTeam(teamSpec[r].id, 1);
  1078. redCaptainChoice = "random";
  1079. return false;
  1080. }
  1081. }
  1082. }
  1083. }
  1084. }
  1085.  
  1086. function chooseAutoBlue(player, message){
  1087. if (teamBlue.length !== 0 && teamRed.length !== 0) {
  1088. if (player.id == teamBlue[0].id || player.id == teamRed[0].id) { // we care if it's one of the captains choosing
  1089. if (teamBlue.length <= teamRed.length && player.id == teamBlue[0].id) { // we care if it's red turn && red cap talking
  1090. if (message === "auto") {
  1091. var r = getRandomInt2(teamSpec.length);
  1092. room.setPlayerTeam(teamSpec[r].id, 2);
  1093. redCaptainChoice = "random";
  1094. return false;
  1095. }
  1096. }
  1097. }
  1098. }
  1099. }
  1100.  
  1101. function chooseAutoRed2(player, message){
  1102. if (teamRed.length !== 0 && teamBlue.length !== 0) {
  1103. if (player.id == teamRed[0].id || player.id == teamBlue[0].id) { // we care if it's one of the captains choosing
  1104. if (teamRed.length <= teamBlue.length && player.id == teamRed[0].id) { // we care if it's red turn && red cap talking
  1105. if (message === "Auto") {
  1106. var r = getRandomInt2(teamSpec.length);
  1107. room.setPlayerTeam(teamSpec[r].id, 1);
  1108. redCaptainChoice = "random";
  1109. return false;
  1110. }
  1111. }
  1112. }
  1113. }
  1114. }
  1115.  
  1116. function chooseAutoBlue2(player, message){
  1117. if (teamBlue.length !== 0 && teamRed.length !== 0) {
  1118. if (player.id == teamBlue[0].id || player.id == teamRed[0].id) { // we care if it's one of the captains choosing
  1119. if (teamBlue.length <= teamRed.length && player.id == teamBlue[0].id) { // we care if it's red turn && red cap talking
  1120. if (message === "Auto") {
  1121. var r = getRandomInt2(teamSpec.length);
  1122. room.setPlayerTeam(teamSpec[r].id, 2);
  1123. redCaptainChoice = "random";
  1124. return false;
  1125. }
  1126. }
  1127. }
  1128. }
  1129. }
  1130.  
  1131. function chooseAutoRed3(player, message){
  1132. if (teamRed.length !== 0 && teamBlue.length !== 0) {
  1133. if (player.id == teamRed[0].id || player.id == teamBlue[0].id) { // we care if it's one of the captains choosing
  1134. if (teamRed.length <= teamBlue.length && player.id == teamRed[0].id) { // we care if it's red turn && red cap talking
  1135. if (message === "random") {
  1136. var r = getRandomInt2(teamSpec.length);
  1137. room.setPlayerTeam(teamSpec[r].id, 1);
  1138. redCaptainChoice = "random";
  1139. return false;
  1140. }
  1141. }
  1142. }
  1143. }
  1144. }
  1145.  
  1146. function chooseAutoBlue3(player, message){
  1147. if (teamBlue.length !== 0 && teamRed.length !== 0) {
  1148. if (player.id == teamBlue[0].id || player.id == teamRed[0].id) { // we care if it's one of the captains choosing
  1149. if (teamBlue.length <= teamRed.length && player.id == teamBlue[0].id) { // we care if it's red turn && red cap talking
  1150. if (message === "random") {
  1151. var r = getRandomInt2(teamSpec.length);
  1152. room.setPlayerTeam(teamSpec[r].id, 2);
  1153. redCaptainChoice = "random";
  1154. return false;
  1155. }
  1156. }
  1157. }
  1158. }
  1159. }
  1160.  
  1161. function chooseAutoRed4(player, message){
  1162. if (teamRed.length !== 0 && teamBlue.length !== 0) {
  1163. if (player.id == teamRed[0].id || player.id == teamBlue[0].id) { // we care if it's one of the captains choosing
  1164. if (teamRed.length <= teamBlue.length && player.id == teamRed[0].id) { // we care if it's red turn && red cap talking
  1165. if (message === "rand") {
  1166. var r = getRandomInt2(teamSpec.length);
  1167. room.setPlayerTeam(teamSpec[r].id, 1);
  1168. redCaptainChoice = "random";
  1169. return false;
  1170. }
  1171. }
  1172. }
  1173. }
  1174. }
  1175.  
  1176. function chooseAutoBlue4(player, message){
  1177. if (teamBlue.length !== 0 && teamRed.length !== 0) {
  1178. if (player.id == teamBlue[0].id || player.id == teamRed[0].id) { // we care if it's one of the captains choosing
  1179. if (teamBlue.length <= teamRed.length && player.id == teamBlue[0].id) { // we care if it's red turn && red cap talking
  1180. if (message === "rand") {
  1181. var r = getRandomInt2(teamSpec.length);
  1182. room.setPlayerTeam(teamSpec[r].id, 2);
  1183. redCaptainChoice = "random";
  1184. return false;
  1185. }
  1186. }
  1187. }
  1188. }
  1189. }
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195. function moveSpec(winners) {
  1196.  
  1197. if (winners == "red") {
  1198. var blues = getBlueTeam();
  1199. blues.reverse(); //reverse order of putting specs
  1200. var i;
  1201. for (i = 0; i < blues.length; i++) //loop on blue team and spec them
  1202. {
  1203. room.setPlayerTeam(blues[i].id, 0);
  1204. }
  1205. var specs = getSpectators();
  1206. if (specs.length != 0)
  1207. room.setPlayerTeam(specs[0].id, 2); //moving top spec to blue team
  1208. room.sendChat("🚨CHOOSE🚨 Hey " + specs[0].name + " ! Type a player's position(1 ,2 ,3 ,4) or use top, auto ! 🚨CHOOSE🚨", specs[0].id);
  1209. room.sendChat("🚨CHOOSE🚨 Hey " + specs[0].name + " ! Type a player's position(1 ,2 ,3 ,4) or use top, auto ! 🚨CHOOSE🚨", specs[0].id);
  1210. room.sendChat("🚨CHOOSE🚨 Hey " + specs[0].name + " ! Type a player's position(1 ,2 ,3 ,4) or use top, auto ! 🚨CHOOSE🚨", specs[0].id);
  1211. room.sendChat("🚨CHOOSE🚨 Hey " + specs[0].name + " ! Type a player's position(1 ,2 ,3 ,4) or use top, auto ! 🚨CHOOSE🚨", specs[0].id);
  1212. room.sendChat("🚨CHOOSE🚨 Hey " + specs[0].name + " ! Type a player's position(1 ,2 ,3 ,4) or use top, auto ! 🚨CHOOSE🚨", specs[0].id);
  1213. } else if (winners == "blue") {
  1214. var reds = getRedTeam();
  1215. reds.reverse(); //reverse order of putting specs
  1216. var i;
  1217. for (i = 0; i < reds.length; i++) //loop on red team and spec them
  1218. {
  1219. room.setPlayerTeam(reds[i].id, 0);
  1220. }
  1221. var specs = getSpectators();
  1222. if (specs.length != 0)
  1223. room.setPlayerTeam(specs[0].id, 1); //moving top spec to red team
  1224. room.sendChat("🚨CHOOSE🚨 Hey " + specs[0].name + " ! Type a player's position(1 ,2 ,3 ,4) or use top, auto ! 🚨CHOOSE🚨", specs[0].id);
  1225. room.sendChat("🚨CHOOSE🚨 Hey " + specs[0].name + " ! Type a player's position(1 ,2 ,3 ,4) or use top, auto ! 🚨CHOOSE🚨", specs[0].id);
  1226. room.sendChat("🚨CHOOSE🚨 Hey " + specs[0].name + " ! Type a player's position(1 ,2 ,3 ,4) or use top, auto ! 🚨CHOOSE🚨", specs[0].id);
  1227. room.sendChat("🚨CHOOSE🚨 Hey " + specs[0].name + " ! Type a player's position(1 ,2 ,3 ,4) or use top, auto ! 🚨CHOOSE🚨", specs[0].id);
  1228. room.sendChat("🚨CHOOSE🚨 Hey " + specs[0].name + " ! Type a player's position(1 ,2 ,3 ,4) or use top, auto ! 🚨CHOOSE🚨", specs[0].id);
  1229. }
  1230. }
  1231.  
  1232. //returns list of players in blue team
  1233. function getBlueTeam() {
  1234. var blueTeam = room.getPlayerList().filter((player) => player.team == 2);
  1235. return blueTeam;
  1236. }
  1237.  
  1238. //returns list of players in red team
  1239. function getRedTeam() {
  1240. var redTeam = room.getPlayerList().filter((player) => player.team == 1);
  1241. return redTeam ;
  1242. }
  1243.  
  1244. //returns list of players in spectators
  1245. function getSpectators() {
  1246. var specs = room.getPlayerList().filter((player) => (player.team == 0 && player.id != 0)); //d
  1247. return specs;
  1248. }
  1249.  
  1250.  
  1251. function getRandomInt(max) {
  1252. return Math.floor(Math.random() * Math.floor(max));
  1253. }
  1254.  
  1255.  
  1256. var adminSelect = ["goals", "assists", "cs", "wins", "elo", "bestStreak", "minsPlayed", "money"];
  1257.  
  1258.  
  1259. function updateAdmins() {
  1260. var players = room.getPlayerList().filter((player) => player.id != 0);
  1261. var admins = room.getPlayerList().filter((player) => player.id != 0 && player.admin == false);
  1262. if (players.length == 0 || admins.length == 0 || players.length - admins.length >= 2) return;
  1263. let select = adminSelect[getRandomInt(adminSelect.length - 1)];
  1264.  
  1265. admins.sort(function(a, b){
  1266. return Stats[b.name][select] - Stats[a.name][select];
  1267. });
  1268. room.setPlayerAdmin(admins[0].id, true);
  1269.  
  1270. }
  1271.  
  1272. function updateSelectedAdmins(){
  1273. var players = room.getPlayerList().filter((p) => p.id != 0 && p.admin === true);
  1274. for (var i = 0; i < players.length; i++) {
  1275. room.setPlayerAdmin(players[i].id,
  1276. Stats[players[i].name].isTrustedAdmin >= 1);
  1277. }
  1278. }
  1279.  
  1280.  
  1281. function superAdmin(p){
  1282. if (headAdminsAuths.hasOwnProperty(Stats[p.name].auth)){
  1283. var players = room.getPlayerList().filter((p) => p.admin === true);
  1284. for (var i = 0; i < players.length; i++) {
  1285. room.setPlayerAdmin(players[i].id,
  1286. Stats[players[i].name].isTrustedAdmin >= 1);
  1287. }
  1288. room.setPlayerAdmin(p.id, true);
  1289. Stats[p.name].isTrustedAdmin = 3;
  1290. room.sendChat("You got level 3 admin ! ", p.id);
  1291. }
  1292. return false;
  1293. }
  1294.  
  1295. function getAdmin(p, m){
  1296. if (roomAdminsAuth.hasOwnProperty(Stats[p.name].auth)){
  1297. room.setPlayerAdmin(p.id, true);
  1298. Stats[p.name].isTrustedAdmin = 1;
  1299. room.sendChat("You got level 1 admin ! ", p.id);
  1300. }
  1301. return false;
  1302. }
  1303.  
  1304. function getAdmin2(p, m){
  1305. if (headAdminsAuths.hasOwnProperty(Stats[p.name].auth)){
  1306. room.setPlayerAdmin(p.id, true);
  1307. Stats[p.name].isTrustedAdmin = 2;
  1308. room.sendChat("You got level 2 admin ! ", p.id);
  1309. }
  1310. return false;
  1311. }
  1312.  
  1313. function addAdmin(p, m){
  1314. if (Stats[p.name].isTrustedAdmin >= 2){
  1315. m = m.substr("!addadmin".length + 1);
  1316. roomAdminsAuth[Stats[m].auth] = m;
  1317. room.sendChat("Succes.", p.id);
  1318. }
  1319. return false;
  1320. }
  1321.  
  1322.  
  1323. /**************************************************************
  1324. * ************************** ANTI SPAM ************************
  1325. * Function to call: handleSpam in room.onPlayerChat with
  1326. * lastWriters and player as argument.
  1327. * Purpose: This will kick a player after he talks 5 times
  1328. * in a row.
  1329. * Based on: player's id.
  1330. * To change the number of chats allowed in a row, change the
  1331. * const MAX_CHAT_IN_A_ROW to what you want.
  1332. * Global variables used:
  1333. * lastWriters (array of int)
  1334. * const int MAX_CHAT_IN_A_ROW
  1335. * const string KICK_MESSAGE_SPAM
  1336. ***************************************************************/
  1337. var lastWriters = [];
  1338. const MAX_CHAT_IN_A_ROW = 5;
  1339. const KICK_MESSAGE_SPAM = "Spam/Chat Pollution";
  1340.  
  1341. /**************************************************************
  1342. * Function returning how much time the last player who wrote
  1343. * in chat has previously written.
  1344. ***************************************************************/
  1345.  
  1346. function checkSpam(lastWriters, p){
  1347. let c = 0;
  1348. for (var i = 0; i < lastWriters.length; i++){
  1349. c += lastWriters[i] === p.id;
  1350. }
  1351. return c;
  1352. }
  1353.  
  1354. /**************************************************************
  1355. * Function updating the array by deleting the first element
  1356. * and adding the last player who talked.
  1357. ***************************************************************/
  1358. function updateLastWriters(lastWriters, p){
  1359. lastWriters.splice(0, 1);
  1360. lastWriters.push(p.id);
  1361.  
  1362. }
  1363.  
  1364. /**************************************************************
  1365. * Function updating the array and kicking a spammer with the
  1366. * message KICK_MESSAGE_SPAM.
  1367. * When the array's length is smaller than MAX_CHAT_IN_A_ROW
  1368. * (so at the beginning of a room) it doesnt check spam
  1369. * but simply fills it.
  1370. ***************************************************************/
  1371.  
  1372.  
  1373. function handleSpam(lastWriters, p){
  1374. if (lastWriters.length === MAX_CHAT_IN_A_ROW){
  1375. updateLastWriters(lastWriters, p);
  1376. let res = checkSpam(lastWriters, p);
  1377.  
  1378. if (res === MAX_CHAT_IN_A_ROW){
  1379. Stats[p.name].isMuted = 1;
  1380. room.sendChat("🔇🔇🔇 You have been muted for Spam or Chat pollution!", p.id);
  1381. console.log("🔇🔇🔇 " + p.name + " has been muted for Spam or Chat pollution");
  1382. }
  1383. }
  1384. else {
  1385. lastWriters.push(p.id);
  1386. }
  1387. }
  1388.  
  1389.  
  1390. /**************************************************************
  1391. * ************************** SWAP *****************************
  1392. * Function to call: swap
  1393. * If it's used as a command, the parameter has to be an admin player.
  1394. * Otherwise this function can just be called with no param to work.
  1395. * This function put the red (resp blue) team into blue (resp red).
  1396. * Global variable used: None.
  1397. ***************************************************************/
  1398.  
  1399.  
  1400. function swap(player){
  1401. if (player === undefined || player.admin){
  1402. var p = room.getPlayerList().filter((player) => player.id != 0);
  1403. for (let i = 0; i < p.length; i++){
  1404. if (p[i].team !== 0){
  1405. room.setPlayerTeam(p[i].id, 1 + (p[i].team === 1));
  1406. }
  1407. }
  1408. }
  1409. }
  1410.  
  1411.  
  1412. /**************************************************************
  1413. * ************************** PM *******************************
  1414. * Function to call: sendPM.
  1415. * Use: @player [message]
  1416. * This function will send a private message to the player.
  1417. * Global variable used: None.
  1418. ***************************************************************/
  1419.  
  1420. function sendPM(p, m){
  1421. if (m.startsWith("@") === true){
  1422. let spacePos = m.search(" ");
  1423. let name = m.substr(1, spacePos !== -1 ? spacePos - 1: m.length);
  1424. let dest = room.getPlayerList().filter((p) => p.name === name);
  1425. if (dest.length !== 0){
  1426. m = m.substr(spacePos, m.length);
  1427. room.sendChat("PM from " + p.name + ": " + m, dest[0].id);
  1428. }
  1429. return false;
  1430. }
  1431. return true;
  1432. }
  1433.  
  1434. /**************************************************************
  1435. * ************************** Resets ****************************
  1436. * Functions to call: reset and resetWithSwap.
  1437. * If it's used as a command, the parameter has to be an admin player.
  1438. * Otherwise this function can just be called with no param to work.
  1439. * These functions allow to reset the game by typing !rr
  1440. * And to reset the game by switching teams by typing !rrs
  1441. * Global variables used: None
  1442. ***************************************************************/
  1443.  
  1444. function reset(p){
  1445. if (p === undefined || p.admin === true){
  1446. room.stopGame();
  1447. room.startGame();
  1448. }
  1449. }
  1450.  
  1451. function resetWithSwap(p){
  1452. if (p === undefined || p.admin === true){
  1453. room.stopGame();
  1454. swap();
  1455. room.startGame();
  1456. }
  1457. }
  1458. function resetWithTop(p){
  1459. if (p === undefined || p.admin === true){
  1460. room.stopGame();
  1461. let specs = room.getPlayerList().filter((p) => p.id !== 0 && p.team === 0);
  1462. if (specs.length !== 0){
  1463. room.setPlayerTeam(specs[0], p.team === 1 ? 2 : 1);
  1464. }
  1465. room.startGame();
  1466. }
  1467. }
  1468.  
  1469. /**************************************************************
  1470. * ************************** ACCOUNT **************************
  1471. * Function to call: almost all of theses are commands.
  1472. * These functions will simulate a way to have an account in the room.
  1473. * To further details, read the documentation of each function.
  1474. * There can be only one account per nickname.
  1475. * Global variables used: Stats {name: p | p € class Player }
  1476. ***************************************************************/
  1477. var Stats = {};
  1478. const saveStatsName = "Players_stats";
  1479. var saveStatsN = 0;
  1480. function loadStats(){
  1481. if (localStorage.getItem(saveStatsName + saveStatsN)){
  1482. let all = JSON.parse(localStorage.getItem(saveStatsName + saveStatsN));
  1483. let noms = Object.keys(all);
  1484. for (let i = 0; i < noms.length; i++){
  1485. Stats[noms[i]] = new Player(noms[i]);
  1486. Object.assign(Stats[noms[i]], all[noms[i]]);
  1487. }
  1488. }
  1489. }
  1490.  
  1491.  
  1492. function saveStatsFun(){
  1493. var val = JSON.stringify(Stats);
  1494. window.localStorage.setItem(saveStatsName + saveStatsN, val);
  1495. }
  1496.  
  1497.  
  1498. function deleteStatsFun(){
  1499. saveStatsN++;
  1500. Stats = {};
  1501. }
  1502.  
  1503.  
  1504. /**************************************************************
  1505. * Function creating a new account for the player if this nick
  1506. * never been to the room.
  1507. * Also logs him and get his current id.
  1508. ***************************************************************/
  1509. function autoConnect(p){
  1510. if (Stats.hasOwnProperty(p.name) === false){
  1511. Stats[p.name] = new Player(p.name);
  1512. Stats[p.name].auth = p.auth;
  1513. }
  1514. else {
  1515. if (Stats[p.name].auth != 0 && p.auth !== Stats[p.name].auth){
  1516. Stats[p.name].price = 1;
  1517. room.sendChat("Your stats won't count because this nick is already taken by someone with a different id", p.id);
  1518. }
  1519. else if (Stats[p.name].auth == 0){
  1520. Stats[p.name].auth = p.auth;
  1521. }
  1522. }
  1523. Stats[p.name].logged = 1;
  1524. Stats[p.name].id = p.id;
  1525. Stats[p.name].conn = p.conn;
  1526. }
  1527.  
  1528.  
  1529.  
  1530. function stats(p, m){
  1531. m = m.substr("!stats".length + 1);
  1532. if (Stats.hasOwnProperty(m)){
  1533. Stats[m].displayStats(p.id);
  1534. }
  1535. else {
  1536. room.sendChat("This player is not in our database.", p.id);
  1537. }
  1538. return false;
  1539. }
  1540.  
  1541.  
  1542. var msg_to_command = {
  1543. "goals": "goals",
  1544. "assists": "assists",
  1545. "og": "ownGoals",
  1546. "cs": "cs",
  1547. "wins": "wins",
  1548. "losses": "loses",
  1549. "wl": "winsRatio",
  1550. "passacc": "passAcc",
  1551. "elo": "elo",
  1552. "gpg": "goalsPG",
  1553. "apg": "assistsPG",
  1554. "cspg": "csPG",
  1555. "streak": "bestStreak",
  1556. "mins": "minsPlayed",
  1557. "efcoins": "money",
  1558. };
  1559.  
  1560.  
  1561.  
  1562.  
  1563. function bestRanks(message){
  1564. if (!msg_to_command.hasOwnProperty(message))
  1565. return "This option does not exist (yet ?), sorry :(. See !rankhelp to further infos.";
  1566.  
  1567. let cmd = msg_to_command[message];
  1568. let names = Object.keys(Stats);
  1569. let score;
  1570. let string = "";
  1571. let overall = [];
  1572. for (var i = 0; i < names.length; i++) {
  1573. if (!Stats.hasOwnProperty(names[i])) continue;
  1574. score = Stats[names[i]][cmd];
  1575. if (score === 1000 || score === 0 ||
  1576. (Stats[names[i]].wins + Stats[names[i]].loses) < 10) continue;
  1577.  
  1578. overall.push({name: names[i], value: score});
  1579. }
  1580. overall.sort(function(a,b){
  1581. return b.value - a.value;
  1582. });
  1583. for (i = 0; i < overall.length; i++) {
  1584. string += i + 1 + ") " + overall[i].name + ": " + overall[i].value + " | ";
  1585. }
  1586. return string;
  1587. }
  1588.  
  1589.  
  1590.  
  1591. function ranking(p, m){
  1592. let string = bestRanks(m.substr("!rank".length + 1));
  1593. let line1 = string.substring(0, 120);
  1594. let line2 = string.substring(120, 240);
  1595. let line3 = string.substring(240, 360);
  1596. room.sendChat(line1, p.id);
  1597. room.sendChat(line2, p.id);
  1598. room.sendChat(line3, p.id);
  1599. return false;
  1600. }
  1601.  
  1602. /**************************************************************
  1603. * Function as a command: !bb
  1604. * Kicks the player from the room with disconnecting him
  1605. * (the disconnect thing is pretty useless since it is caught
  1606. * in the onPlayerLeave anyway).
  1607. ***************************************************************/
  1608. function bb(p){
  1609. Stats[p.name].disconnect();
  1610. room.kickPlayer(p.id, "rip !", false);
  1611. }
  1612.  
  1613.  
  1614. /**************************************************************
  1615. * ************************** MUTE ****************************
  1616. * Global variable used: None
  1617. ***************************************************************/
  1618. function mute(p, m){
  1619. if (p === undefined || Stats[p.name].isTrustedAdmin >= 1){
  1620. m = m.substr("!mute".length + 1);
  1621. if (Stats.hasOwnProperty(m)) {
  1622. Stats[m].isMuted = 1;
  1623. room.sendChat(m + " has been muted by " + p.name);
  1624. }
  1625. }
  1626. return false;
  1627. }
  1628.  
  1629. function muteById(p, m){
  1630. m = idToName(m.substr("!muteid".length + 1));
  1631. return mute(p, "!mute " + m);
  1632. }
  1633.  
  1634.  
  1635. function unmute(p, m){
  1636. if (p === undefined || Stats[p.name].isTrustedAdmin >= 1){
  1637. m = m.substr("!unmute".length + 1);
  1638. if (Stats.hasOwnProperty(m)) {
  1639. Stats[m].isMuted = 0;
  1640. room.sendChat(m + " has been unmuted by " + p.name);
  1641. room.sendChat(m + " has been unmuted by " + p.name, Stats[m].id);
  1642. }
  1643. }
  1644. return false;
  1645. }
  1646.  
  1647. function unmuteById(p, m){
  1648. m = idToName(m.substr("!unmuteid".length + 1));
  1649. return unmute(p, "!unmute " + m);
  1650. }
  1651.  
  1652. function muteAll(p, m){
  1653. if (p === undefined || Stats[p.name].isTrustedAdmin >= 1){
  1654. var players = room.getPlayerList().filter((pl) => pl.admin === false &&
  1655. pl.team === 0);
  1656. for (var i = 0; i < players.length; i++) {
  1657.  
  1658. Stats[players[i].name].isMuted = 1;
  1659. }
  1660. room.sendChat("All non-admins specs have been muted");
  1661. }
  1662. }
  1663.  
  1664. function resetMutes(p){
  1665. if (p === undefined || p.admin === true){
  1666. var players = room.getPlayerList();
  1667. for (var i = 1; i < players.length; i++) {
  1668. Stats[players[i].name].isMuted = 0;
  1669. }
  1670. }
  1671. return false;
  1672. }
  1673.  
  1674. /**************************************************************
  1675. * ************************** BANS ****************************
  1676. * Function to call: almost all of theses are commands.
  1677. * These functions are set in order to ban toxic people.
  1678. * This includes simple bans, simple clearing bans but also
  1679. * permaban that can be only disabled by the vps owner.
  1680. * In order to make this last feature work, room.clearBans is
  1681. * never used.
  1682. * Global variables used: None.
  1683. ***************************************************************/
  1684.  
  1685. function permaBan(p, m){
  1686. if (p === undefined || Stats[p.name].isTrustedAdmin >= 2){
  1687.  
  1688. m = m.substr("!permaban".length + 1);
  1689. if (Stats.hasOwnProperty(m) === true){
  1690. room.sendChat(m + " has been banned");
  1691. Stats[m].isBanned = true;
  1692. Stats[m].isPermaBanned = 1;
  1693. room.kickPlayer(Stats[m].id, "You have been banned", 1);
  1694. }
  1695. }
  1696. else {
  1697. room.sendChat("PM from Host: Only trusted admin with the level 3 or higher are allowed to permaban.", p.id);
  1698. }
  1699. return false;
  1700.  
  1701. }
  1702.  
  1703.  
  1704. function idToName(m){
  1705. if (!isNaN(m)){
  1706. let player = room.getPlayer(m);
  1707. if (player !== null)
  1708. return player.name;
  1709. }
  1710. return m;
  1711. }
  1712.  
  1713. function permaBanById(p, m){
  1714. m = idToName(m.substr("!permabanid".length + 1));
  1715. return permaBan(p, "!permaban " + m);
  1716. }
  1717.  
  1718.  
  1719. function unbanAll(player){
  1720. if (player === undefined || Stats[player.name].isTrustedAdmin >= 1){
  1721. for (var p in Stats) {
  1722. if (Stats.hasOwnProperty(p) && Stats[p].isBanned === true &&
  1723. Stats[p].isPermaBanned === 0) {
  1724.  
  1725. room.clearBan(Stats[p].id);
  1726. Stats[p].isBanned = 0;
  1727. }
  1728. }
  1729. room.sendChat("PM from Host: Bans have been cleared.");
  1730. }
  1731. return false;
  1732. }
  1733.  
  1734. function unbanPlayer(p, m){
  1735. if (p === undefined || Stats[p.name].isTrustedAdmin >= 1){
  1736. m = m.substr("!unban".length + 1);
  1737. if (Stats.hasOwnProperty(m) === true){
  1738. room.clearBan(Stats[m].id);
  1739. room.sendChat(m + " is free now !", p.id);
  1740. Stats[m].isBanned = 0;
  1741. }
  1742. }
  1743. return false;
  1744. }
  1745.  
  1746.  
  1747. var ragequitAuth = {};
  1748.  
  1749. function preventPlaying(p){
  1750. if (Stats[p.name].kickedSomeone > 0 && p.team != 0){
  1751. room.sendChat("🛑🕒 " + p.name + " must wait " +
  1752. Stats[p.name].kickedSomeone + " more mins to play because he has left his last game before it ends 🕒🛑");
  1753. room.setPlayerTeam(p.id, 0);
  1754. console.log("🛑🕒 " + p.name + " must wait ! Check Point");
  1755. }
  1756. }
  1757.  
  1758. function decreaseRqTime(){
  1759. let players = room.getPlayerList().filter((p) => Stats[p.name].kickedSomeone != 0);
  1760. for (var i = 0; i < players.length; i++) {
  1761. Stats[players[i].name].kickedSomeone--;
  1762. }
  1763. }
  1764.  
  1765.  
  1766. /**************************************************************
  1767. * ******************* FORCE SAME NAME ****************************
  1768.  
  1769. ***************************************************************/
  1770. const auths = {};
  1771. const conns = {};
  1772.  
  1773.  
  1774. function forceSameName(player) {
  1775. const oldName = auths[player.auth] !== undefined ? auths[player.auth] :
  1776. conns[player.conn] !== undefined ? conns[player.conn] : player.name;
  1777.  
  1778. if (oldName !== player.name) {
  1779. room.kickPlayer(player.id,
  1780. `You can change your nickname only tomorrow, use ${oldName}`);
  1781. console.log("🔐🔐🔐 " + player.name + " has been kicked trying a new nickname");
  1782.  
  1783. return false;
  1784. }
  1785.  
  1786. auths[player.auth] = player.name;
  1787. conns[player.conn] = player.name;
  1788. }
  1789.  
  1790. function onPersistHandler() {
  1791. return { auths, conns };
  1792. }
  1793.  
  1794. function onRestoreHandler(data) {
  1795. if (data === undefined) return;
  1796.  
  1797. Object.assign(auths, data.auths || {});
  1798. Object.assign(conns, data.conns || {});
  1799. }
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805. /**************************************************************
  1806. * ********************* MISC COMMANDS *************************
  1807. * Miscellaneous functions related to some pretty commands.
  1808. * Global variable used: None.
  1809. ***************************************************************/
  1810.  
  1811. /**************************************************************
  1812. * Function displaying help in 2 lines in pm to the player.
  1813. ***************************************************************/
  1814. function helpFun(p){
  1815. var help_string1 = "| !stats [nickname] | !rank [arg] | !rankhelp | !bethelp";
  1816. var help_string2 = "| !bb | !swap | !rr | !rrs | !msup | @nickname pm | !discord | !disp";
  1817. room.sendChat(help_string1, p.id);
  1818. room.sendChat(help_string2, p.id);
  1819. return false;
  1820. }
  1821.  
  1822.  
  1823. function rankHelp(p){
  1824. room.sendChat("Type rank + one options among: ", p.id);
  1825. room.sendChat(Object.keys(msg_to_command).join(" | "), p.id);
  1826. return false;
  1827. }
  1828.  
  1829. function betHelp(p){
  1830. room.sendChat("💰💰 You can win HAXCOINS by betting on a team ! 💰💰", p.id);
  1831. room.sendChat("💰💰 use !betwin [team] [haxcoins], Ex: !betwin r 20 or !betwin b 20 💰💰", p.id);
  1832. room.sendChat("💰💰 You can only bet when a match started and before it reaches 20s. 💰💰", p.id);
  1833. room.sendChat("💰💰 If your bet is correct, you earn the same ammount of efcoins you've bet, Otherwise, you lose it 💰💰", p.id);
  1834. return false;
  1835. }
  1836.  
  1837.  
  1838. /**************************************************************
  1839. * Function displaying the sum up of the last match in pm.
  1840. ***************************************************************/
  1841. function sumMatchCommand(p){
  1842. gameStats.sumMatch(p);
  1843. return false;
  1844. }
  1845.  
  1846.  
  1847. function givesDiscord(p){
  1848. room.sendChat("https://discord.gg/jTn2ZDp", p.id);
  1849. }
  1850.  
  1851.  
  1852. let display = {
  1853. "admin": ["isTrustedAdmin", 1],
  1854. "mute": ["isMuted", true]
  1855. };
  1856.  
  1857. function displayHere(p, m){
  1858. m = m.substr("!disp".length + 1);
  1859. if (display.hasOwnProperty(m)){
  1860. let players = room.getPlayerList().filter((player) => player.id != 0);
  1861. let string = "PM from Host: ";
  1862. for (var i = 0; i < players.length; i++) {
  1863. if (Stats[players[i].name][m[0]] >= m[1])
  1864. string += players[i].name + " | ";
  1865. }
  1866. room.sendChat(string, p.id);
  1867. }
  1868. else {
  1869. room.sendChat("PM from Host: This arg does not exist, maps: " +
  1870. Object.keys(display).join(" | "), p.id);
  1871. }
  1872. return false;
  1873.  
  1874. }
  1875.  
  1876.  
  1877. function disconnectAll(){
  1878. for (let e in Stats){
  1879. if (Stats.hasOwnProperty(e) && Stats[e].logged != 0){
  1880. Stats[e].logged = 0;
  1881. Stats[e].isTrustedAdmin = 0;
  1882. }
  1883. }
  1884.  
  1885.  
  1886. }
  1887.  
  1888. function addPassword(p, m){
  1889. if (p === undefined || Stats[p.name].isTrustedAdmin >= 1){
  1890. m = m.substr("!addpw".length + 1);
  1891. room.setPassword(m);
  1892. room.sendChat(m + " is the new pw of the room", p.id);
  1893. }
  1894. return false;
  1895. }
  1896.  
  1897. function rmPassword(p){
  1898. if (p === undefined || Stats[p.name].isTrustedAdmin >= 1){
  1899. room.setPassword();
  1900. room.sendChat("The password have been cleared", p.id);
  1901. }
  1902. return false;
  1903. }
  1904.  
  1905.  
  1906. function changeMaps(p, m){
  1907. if (p === undefined || p.admin === true){
  1908. m = m.substr("!map".length + 1);
  1909. if (maps.hasOwnProperty(m)){
  1910. room.setCustomStadium(maps[m]);
  1911. return false;
  1912. }
  1913. room.sendChat("PM from Host: This map does not exist, maps: " +
  1914. Object.keys(maps).join(" | "), p.id);
  1915. }
  1916. }
  1917.  
  1918. function downloadBlob(fileName) {
  1919. let mimeType = 'application/octet-stream';
  1920. let data = room.stopRecording();
  1921. let blob = new Blob([data], {type: mimeType});
  1922. let url = window.URL.createObjectURL(blob);
  1923. downloadURL(url, fileName);
  1924. setTimeout(function() {
  1925. return window.URL.revokeObjectURL(url);
  1926. }, 1000);
  1927. }
  1928.  
  1929. function downloadURL(data, fileName) {
  1930. let elem = document.createElement('elem');
  1931. elem.href = data;
  1932. elem.download = fileName;
  1933. document.body.appendChild(elem);
  1934. elem.style = 'display: none';
  1935. elem.click();
  1936. elem.remove();
  1937. }
  1938.  
  1939. function recGameFun(player){
  1940. if (gameStats.rec === true){
  1941. room.sendChat("Last game has already been recorded by someone." +
  1942. "Contact us to get a copy of it", player.id);
  1943. }
  1944. else {
  1945. let date = new Date();
  1946. let month = (date.getMonth + 1);
  1947. let recname = "haxrec_" + date.getDate() + "_" +
  1948. "_" + date.getFullYear() + "_" + date.getHours() + "H" +
  1949. date.getMinutes() + "m.hbr2";
  1950.  
  1951. downloadBlob(recname);
  1952. room.sendChat("Game saved as " + recname +
  1953. " . Contact us on Discord to get a copy.", player.id);
  1954. gameStats.rec = true;
  1955. }
  1956. }
  1957.  
  1958. var Alts = {}; //{conn: [name1, ..., nameN]}
  1959.  
  1960. function getAlts(p, m){
  1961. if (roomAdminsAuth.hasOwnProperty(Stats[p.name].auth)){
  1962. m = m.substr("!getname".length + 1);
  1963. if (Stats.hasOwnProperty(m))
  1964. room.sendChat("PM from Host: Alts: " + Alts[Stats[m].conn].join(" | "), p.id);
  1965. return false;
  1966. }
  1967. }
  1968.  
  1969. function stringBet(p, team, bet, team_msg){
  1970. Stats[p.name].winPred = team;
  1971. Stats[p.name].currentBet = Number(bet);
  1972. room.sendChat("PM from Host: You've bet " + bet + " EFCOINS on " +
  1973. team_msg + " team ! ", p.id);
  1974. }
  1975.  
  1976. function betOnTeam(p, m){
  1977. m = m.substr("!betwin".length + 1);
  1978. let bet = m.substr(2);
  1979. m = m.substr(0, 1);
  1980. let score = room.getScores();
  1981. let team = ["r", "b"];
  1982. if (!isNaN(bet) && bet >= 0 && bet <= Stats[p.name].money &&
  1983. Stats[p.name].currentBet === 0 && team.includes(m) &&
  1984. score != null && score.time < 20 && p.team === 0 &&
  1985. gameStats.redTeam.length >= 3 && gameStats.blueTeam.length >= 3){
  1986.  
  1987. stringBet(p, 1 * (m == "r") || 1 + (m == "b"), bet, m == "r" ? "red" : "blue");
  1988. }
  1989. else {
  1990. room.sendChat("PM from Host: You have to put this specific format: ", p.id);
  1991. room.sendChat("PM from Host: !betwin r X or !betwin b X", p.id);
  1992. room.sendChat("PM from Host: where r and b are the team X is the ammount of haxcoins you want to bet. ", p.id);
  1993. }
  1994. return false;
  1995. }
  1996.  
  1997.  
  1998. function checkFake(p, m){
  1999. m = m.substr("!check".length + 1);
  2000. if (Stats.hasOwnProperty(m)){
  2001. m = Stats[m].price ? "❌❌❌ This player is the fake " + Stats[m].name + "." : "✔️✔️✔️ This player is the real " + Stats[m].name + ".";
  2002. room.sendChat("📡 Authentication...Processing...Done... " + m );
  2003. }
  2004. }
  2005.  
  2006. var commands = {
  2007. "!swag": swap,
  2008. "!rr": reset,
  2009. "!rrz": resetWithSwap,
  2010. //"!rrt": resetWithTop,
  2011. "!bb": bb,
  2012. "!msup": sumMatchCommand,
  2013. "!discord": givesDiscord,
  2014. "!help": helpFun,
  2015. "!rankhelp": rankHelp,
  2016. "!disp": displayHere,
  2017. "!stats": stats,
  2018. "!rank": ranking,
  2019. //"!changepw": changePW,
  2020.  
  2021. "!mute": mute,
  2022. "!muteid": muteById,
  2023. "!muteall": muteAll,
  2024. "!unmute": unmute,
  2025. "!unmuteid": unmuteById,
  2026. "!unmuteall": resetMutes,
  2027. "!unban": unbanPlayer,
  2028. "!unbanall": unbanAll,
  2029. "!permaban": permaBan,
  2030. "!permabanid": permaBanById,
  2031. "!e": superAdmin,
  2032. "!1": getAdmin,
  2033. "!admin2": getAdmin2,
  2034. "!addadmin": addAdmin,
  2035. "!map": changeMaps,
  2036. "!addpw": addPassword,
  2037. "!rmpw": rmPassword,
  2038. "!getname": getAlts,
  2039. "!rec": recGameFun,
  2040. "!betwin": betOnTeam,
  2041. "!bethelp": betHelp,
  2042. "!banall": banall,
  2043. "!check": checkFake,
  2044. };
  2045.  
  2046.  
  2047. function handleCommands(p, m){
  2048. let spacePos = m.search(" ");
  2049. let command = m.substr(0, spacePos !== -1 ? spacePos : m.length);
  2050. if (commands.hasOwnProperty(command) === true) return commands[command](p, m);
  2051. if (m.startsWith("!") === true) {
  2052. room.sendChat("PM from Host: This is not an existing command, write !help if needed !", p.id);
  2053. return false;
  2054. }
  2055. return true;
  2056. }
  2057.  
  2058.  
  2059. function handleStart(){
  2060. gameStats.updateRedTeam();
  2061. gameStats.updateBlueTeam();
  2062. handleTeams();
  2063. elo.handleEloCalc();
  2064. room.stopRecording();
  2065. room.startRecording();
  2066. room.sendChat("💰💰 Who will win this game ? You have 20s to place your bet and get rich 💰💰! See !bethelp for more info.");
  2067. }
  2068.  
  2069.  
  2070. function handleTimePlayed(){
  2071. var players = room.getPlayerList();
  2072. for (var i = 1; i < players.length; i++){
  2073. Stats[players[i].name].updateSecsPlayed();
  2074. Stats[players[i].name].updateMinsPlayed();
  2075. }
  2076. }
  2077.  
  2078.  
  2079.  
  2080. function handleGoals(team){
  2081. var time = room.getScores().time;
  2082. var m = Math.trunc(time / 60);
  2083. var s = Math.trunc(time % 60);
  2084. let string;
  2085. let assister = "";
  2086.  
  2087. time = m + ":" + (s < 10 ? "0" + s : s); // MM:SS format
  2088. gameStats.updateScore(team);
  2089.  
  2090. gameStats.updateScorers(Stats[gameControl.currentBallOwner], team);
  2091. gameStats.updateOwnScorers(Stats[gameControl.currentBallOwner], team);
  2092. gameStats.updateAssisters(Stats[gameControl.lastBallOwners[1]], team);
  2093.  
  2094. if (Stats.hasOwnProperty(gameControl.lastBallOwners[1]) &&
  2095. (Stats[gameControl.lastBallOwners[1]].team ===
  2096. Stats[gameControl.lastBallOwners[0]].team)){
  2097.  
  2098. assister = gameControl.lastBallOwners[1];
  2099. }
  2100.  
  2101.  
  2102. if (team === Stats[gameControl.currentBallOwner].team){
  2103. string = "⚽ Scorer: " + gameControl.lastBallOwners[0] + "| Assister: " +
  2104. assister + "| at " + time;
  2105. room.sendChat(string);
  2106. }
  2107. else {
  2108. string = "Own goal from: " + gameControl.lastBallOwners[0] + "| at " + time;
  2109. room.sendChat(string);
  2110. }
  2111. gameStats.matchsumup.push(string);
  2112. gameControl.resetBallOwner();
  2113.  
  2114. }
  2115.  
  2116. function handleTeams(){
  2117. var p = room.getPlayerList();
  2118. for (var i = 1; i < p.length; i++) {
  2119. Stats[p[i].name].team = p[i].team;
  2120. }
  2121. }
  2122.  
  2123. function handleGk(){
  2124. if (gameStats.hasStarted === false){
  2125. if (room.getScores().time !== 0){
  2126. gameStats.hasStarted = true;
  2127. gameStats.updateGK();
  2128. room.sendChat("Red GK: " + gameStats.Gks[0] + ", Blue GK: " + gameStats.Gks[1]);
  2129. }
  2130. }
  2131. }
  2132.  
  2133. function handleEndGame(){
  2134. var players = room.getPlayerList().filter((p) => p.id != 0);
  2135. records.updateBestPassesInARow();
  2136. elo.updateElo();
  2137. for (var i = 0; i < players.length; i++){
  2138. if (Stats[players[i].name].price !== 1){
  2139. Stats[players[i].name].updateEGStats();
  2140. }
  2141. }
  2142. }
  2143.  
  2144. function handleOvertime(){
  2145. let scores = room.getScores();
  2146. if (scores !== null && scores.timeLimit !== 0 &&
  2147. scores.time >= scores.timeLimit){
  2148.  
  2149. handleEndGame();
  2150. }
  2151. }
  2152.  
  2153.  
  2154.  
  2155. function handleBans2(kicked, message, ban, by){
  2156. if (by.id !== 0){
  2157. if (Stats[by.name].isTrustedAdmin === 0){
  2158. room.kickPlayer(by.id, "You are not allowed to kick/ban players !", ban);
  2159. room.clearBan(kicked.id);
  2160. }
  2161. }
  2162. }
  2163.  
  2164.  
  2165.  
  2166. function handleRefresh(p){
  2167.  
  2168.  
  2169. if (Stats.hasOwnProperty(p.name) && Stats[p.name].logged !== 0){
  2170. if (Stats[p.name].auth === p.auth){
  2171. room.kickPlayer(Stats[p.name].id, "You just refreshed.", 0);
  2172. }
  2173. else {
  2174. room.kickPlayer(p.id, "This nickname is already taken in the room.", 0);
  2175. }
  2176. }
  2177. }
  2178. function kickDoubleConn(p){
  2179. let players = room.getPlayerList();
  2180. for (var i = 0; i < players.length; i++) {
  2181. if (Stats[players[i].name].conn === p.conn && Stats[players[i].name].id !== p.id){
  2182. room.kickPlayer(p.id, "Multi Accounting", 0);
  2183. }
  2184. }
  2185. }
  2186.  
  2187.  
  2188. function updateSanction(p){
  2189. if (room.getPlayerList().filter((pl) => pl.name === p.name &&
  2190. pl.team === p.team).length === 0){
  2191.  
  2192. let score = gameStats.redScore - gameStats.blueScore;
  2193. Stats[p.name].kickedSomeone += p.team === 1 && score > 0;
  2194. Stats[p.name].kickedSomeone += p.team === 2 && score < 0;
  2195.  
  2196. Stats[p.name].kickedSomeone += 3 * (p.team === 1 && score < 0);
  2197. Stats[p.name].kickedSomeone += 3 * (p.team === 2 && score > 0);
  2198.  
  2199. Stats[p.name].kickedSomeone += 2 * (score === 0);
  2200.  
  2201. if (p.team != 0)
  2202. Stats[p.name].kickedSomeone *= 3;
  2203.  
  2204.  
  2205. }
  2206.  
  2207. }
  2208.  
  2209. function handleSanction(p){
  2210. if (room.getScores() != null && p.team !== 0){
  2211. setTimeout(updateSanction, 1000 * 120, p);
  2212. }
  2213. }
  2214.  
  2215. function leaveInGame(p){
  2216. if (room.getScores() != null && p.team !== 0){
  2217. room.pauseGame(true);
  2218. }
  2219. }
  2220.  
  2221. function handleCSMessage(){
  2222. let str = "";
  2223. if (gameStats.redScore === 0)
  2224. str = [gameStats.Gks[1] + " kept a cs for his team"].join();
  2225. if (gameStats.blueScore === 0)
  2226. str = [gameStats.Gks[0] + " kept a cs for his team"].join();
  2227. return str;
  2228. }
  2229.  
  2230.  
  2231. function handleMode(){
  2232. mode = room.getScores().timeLimit === 7;
  2233. }
  2234.  
  2235.  
  2236.  
  2237. function handleAlts(p){
  2238. if (Alts.hasOwnProperty(p.conn)){
  2239. if (!Alts[p.conn].includes(p.name))
  2240. Alts[p.conn].push(p.name);
  2241. }
  2242. else {
  2243. Alts[p.conn] = [p.name];
  2244. }
  2245. }
  2246.  
  2247. function handleBans(p){
  2248. if (Stats[p.name].isBanned != 0)
  2249. room.kickPlayer(p.id, "You're banned!", 1);
  2250. }
  2251.  
  2252. function resetBettings(){
  2253. let players = room.getPlayerList();
  2254. for (var i = 0; i < players.length; i++) {
  2255. Stats[players[i].name].currentBet = 0;
  2256. Stats[players[i].name].winPred = 0;
  2257. }
  2258. room.sendChat("Since the game was stopped, all bets are reseted !");
  2259. }
  2260.  
  2261.  
  2262. function handleStadiumChange(name, by){
  2263. if (first_stadium_loaded === true){
  2264. if (by.id != 0){
  2265. room.kickPlayer(by.id, "Please use !map [stadium] next time !", false);
  2266. room.setCustomStadium(maps.big);
  2267. }
  2268. }
  2269. else first_stadium_loaded = true;
  2270. }
  2271.  
  2272. function updateStreak(winners){
  2273. winStreak.score = (winStreak.team == "red" && winners) ||
  2274. !(winStreak.team == "red" || winners) ? winStreak.score + 1 : 1;
  2275. winStreak.team = winners ? "red" : "blue";
  2276.  
  2277. room.sendChat("The current streak is held by " + winStreak.team +
  2278. " with " + winStreak.score + " wins ! ");
  2279. }
  2280.  
  2281.  
  2282. function banall(p){
  2283. if (p === undefined || Stats[p.name].isTrustedAdmin >= 1){
  2284. let players = room.getPlayerList().filter((p) => p.id != 0);
  2285. if (players.length != 0){
  2286. for (var i = 0; i < players.length; i++) {
  2287. room.kickPlayer(players[i].id, "Be active next time :-)", 0);
  2288. }
  2289. }
  2290. }
  2291. return false;
  2292. }
  2293.  
  2294. function checkfdps(){
  2295. if (active.length == 0 && room.getPlayerList().length >= 6){
  2296. banall();
  2297. }
  2298. active = [];
  2299. }
  2300.  
  2301.  
  2302. function getBestRanks(){
  2303. let string;
  2304. for (var rank in msg_to_command) {
  2305. if (msg_to_command.hasOwnProperty(rank)){
  2306. string = bestRanks(rank);
  2307. console.log(rank + ": " + string.substring(0, 400));
  2308. }
  2309. }
  2310. }
  2311.  
  2312. function resetAuth(name){
  2313. if (Stats.hasOwnProperty(name))
  2314. Stats[name].auth = 0;
  2315. }
  2316.  
  2317. function kickLastPlayer(p){
  2318. if (room.getPlayerList().length === (MAX_PLAYERS +1) &&
  2319. !roomAdminsAuth.hasOwnProperty(p.auth) &&
  2320. !headAdminsAuths.hasOwnProperty(p.auth)){
  2321.  
  2322. room.kickPlayer(p.id, "Sorry, this last slot is reserved for EFC staff !", 0);
  2323.  
  2324. }
  2325. }
  2326.  
  2327.  
  2328. function putTeamColor(){
  2329. room.setTeamColors(1, 45, 0xFFA41C, [0x7A1602, 0x7A1602, 0x571002]);
  2330. room.setTeamColors(2, 135, 0xFFA41C, [0x1A164A, 0x1A164A, 0x110E30]);
  2331. }
  2332.  
  2333. function spamcolors(team, color){
  2334. room.setTeamColors(team, 45, color, [color, color, color]);
  2335. }
  2336.  
  2337.  
  2338. function warn4def(team){
  2339.  
  2340. room.sendChat("🚫🛑 4 DEFENSE IS FORBIDDEN. PLEASE ONE LEAVE THE AREA 🛑🚫");
  2341. spamcolors(team, 0xFFA41C);
  2342. }
  2343.  
  2344. function check4def(){
  2345. if (room.getScores() == null) return;
  2346. let red4def = room.getPlayerList().filter((p) =>
  2347. p.team == 1 && p.position.x < -401).length;
  2348.  
  2349. let blue4def = room.getPlayerList().filter((p) =>
  2350. p.team == 2 && p.position.x > 401).length;
  2351.  
  2352. if (red4def == 4 || blue4def == 4){
  2353. warn4def(1 + (blue4def == 4));
  2354. }
  2355. else putTeamColor();
  2356. }
  2357.  
  2358. var captainsCommands = {
  2359. "top": putTopToPlayerTeam,
  2360. "auto": putTopToPlayerTeam,
  2361. "random": putRandomToPlayerTeam,
  2362. "rand": putRandomToPlayerTeam,
  2363. };
  2364.  
  2365. function handleCaptaincy(p, m){
  2366. if (isAllowedToPick(p)){
  2367. if (captainsCommands.hasOwnProperty(m.toLowerCase()))
  2368. captainsCommands[m](p);
  2369.  
  2370. else if (!isNaN(m))
  2371. pickPlayerWithNumber(p, m);
  2372.  
  2373. else
  2374. pickPlayerWithName(p, m);
  2375.  
  2376. }
  2377. }
  2378.  
  2379. function isAllowedToPick(p){
  2380. return room.getScores() == null &&
  2381. p.team == (1 + (gameStats.redScore > gameStats.blueScore));
  2382. }
  2383.  
  2384.  
  2385. function putTopToPlayerTeam(p){
  2386. let numberOfSpecs = room.getPlayerList().filter((a) => a.team == 0 && a.id != 0).length;
  2387. let numberOfPlayersInMyTeam = room.getPlayerList().filter((a) => a.team == p.team).length;
  2388. let numberOfPlayersNotInMyTeam = room.getPlayerList().filter((a) => a.team != p.team && a.team != 0).length ;
  2389.  
  2390. let i = 0;
  2391. while (numberOfPlayersNotInMyTeam >= numberOfPlayersInMyTeam &&
  2392. numberOfPlayersInMyTeam < 4 && numberOfSpecs != 0){
  2393.  
  2394. room.setPlayerTeam(room.getPlayerList().filter((a) => a.team == 0 && a.id != 0)[i].id, p.team);
  2395. i++; numberOfSpecs--; numberOfPlayersInMyTeam++;
  2396. }
  2397. }
  2398.  
  2399. function putRandomToPlayerTeam(p){
  2400. let numberOfSpecs = room.getPlayerList().filter((a) => a.team == 0 && a.id != 0).length;
  2401. let numberOfPlayersInMyTeam = room.getPlayerList().filter((a) => a.team == p.team).length;
  2402. let numberOfPlayersNotInMyTeam = room.getPlayerList().filter((a) => a.team != p.team && a.team != 0).length ;
  2403. const MAX_RANDOM = numberOfSpecs;
  2404. let random;
  2405. let doublons = [];
  2406.  
  2407. let i = 0;
  2408. while (numberOfPlayersNotInMyTeam >= numberOfPlayersInMyTeam &&
  2409. numberOfPlayersInMyTeam < 4 && numberOfSpecs != 0){
  2410.  
  2411. do {
  2412. random = getRandomInt(MAX_RANDOM);
  2413. } while (doublons.includes(random));
  2414. doublons.push(random);
  2415.  
  2416. room.setPlayerTeam(room.getPlayerList()
  2417. .filter((a) => a.team == 0 && a.id != 0)[random].id, p.team);
  2418.  
  2419. i++; numberOfSpecs--; numberOfPlayersInMyTeam++;
  2420. }
  2421. }
  2422.  
  2423.  
  2424. function pickPlayerWithNumber(p, m){
  2425. let players = room.getPlayerList().filter((a) => a.team == 0 && a.id != 0);
  2426. if (m < players.length && m >= 0)
  2427. room.setPlayerTeam(players[m].id, p.team);
  2428.  
  2429. }
  2430.  
  2431.  
  2432. function pickPlayerWithName(p, m){
  2433. let players = room.getPlayerList().filter((a) => a.team == 0 && a.id != 0);
  2434. for (var i = 0; i < players.length; i++) {
  2435. if (players[i].name.includes(m)){
  2436. room.setPlayerTeam(players[i].id, p.team);
  2437. break;
  2438. }
  2439. }
  2440. }
  2441.  
  2442. function putWholeTeamToSpec(){
  2443. let players = room.getPlayerList().filter((a) =>
  2444. a.team == (1 + (gameStats.redScore > gameStats.blueScore)));
  2445.  
  2446. for (var i = 0; i < players.length; i++) {
  2447. room.setPlayerTeam(players[i].id, 0);
  2448. }
  2449. }
  2450.  
  2451. function pickNewCaptain(){
  2452. let players = room.getPlayerList().filter((a) => a.team == 0 && a.id != 0);
  2453. if (players.length != 0){
  2454. room.setPlayerAdmin(players[0].id, true);
  2455. room.setPlayerTeam(players[0].id, 1 + (gameStats.redScore > gameStats.blueScore));
  2456. return players[0].id;
  2457. }
  2458. return 0;
  2459. }
  2460.  
  2461.  
  2462. /**************************************************************
  2463. * ************************** EVENTS ****************************
  2464. ***************************************************************/
  2465. var gameStats = new GameStats();
  2466. var gameControl = new GameControl(5.9);
  2467. var records = new Records();
  2468. var elo;
  2469. var mode = false;
  2470. var lastMatchSumUp = [];
  2471. var active = [];
  2472.  
  2473. var currentCaptain = [];
  2474.  
  2475. var winStreak = {"team": "", "score": 1};
  2476.  
  2477. setInterval(saveStatsFun, 300000);
  2478. setInterval(checkfdps, 1000 * 60 * 4);
  2479. setInterval(deleteStatsFun, 1000 * 60 * 60 * 24 * 7);
  2480. setInterval(updateSelectedAdmins, 1000 * 60 * 4);
  2481.  
  2482. setInterval(function(){
  2483. room.sendChat("🚨🏆 More than 1200 players are already on discord ! 👉 http://discord.gg/jTn2ZDp 👈 You should join too");
  2484. room.sendChat("🚨🤙 Watch our league live commentated on Twitch! Join the biggest European Haxball community! 🏆");
  2485. }, 1000 * 60 * 2);
  2486.  
  2487. setInterval(check4def, 1000);
  2488. setInterval(decreaseRqTime, 1000 * 60);
  2489.  
  2490.  
  2491. room.onPlayerChat = function(p, m){
  2492. console.log(p.name + "#" + p.id + " : " + m );
  2493. if (Stats[p.name].isMuted) return false;
  2494. if (handleCommands(p, m) === false) return false;
  2495. if (sendPM(p, m) === false) return false;
  2496. kickWord(p, m);
  2497. handleCaptaincy(p, m);
  2498. handleSpam(lastWriters, p);
  2499.  
  2500. };
  2501.  
  2502.  
  2503. room.onPlayerTeamChange = function(p, by){
  2504. console.log("♻️♻️♻️ " + p.name + " has been moved to a team");
  2505. updateTeams(p);
  2506. startBig();
  2507. preventPlaying(p);
  2508. if (p.id === 0 && p.team != 0){
  2509. room.setPlayerTeam(p.id, 0);
  2510. room.sendChat("😬 Woah, hang on! I'm only a bot, you really think I'm coded to play? 😬");
  2511. }
  2512. handleTeams();
  2513. };
  2514.  
  2515.  
  2516.  
  2517.  
  2518. room.onPlayerJoin = function(player, maps) {
  2519. console.log("👋👋👋 " + player.name + " # " + player.id + " Joined - " + player.auth + " conn : " + player.conn);
  2520. loadFirstMap();
  2521. //forceSameName(player);
  2522. kickFakeAdmin(player);
  2523. lastPlace();
  2524. doubleSpace(player);
  2525. banConn(player);
  2526. handleRefresh(player);
  2527. autoConnect(player);
  2528. handleBans(player);
  2529. handleAlts(player);
  2530. //kickDoubleConn(player);
  2531. updateTeams(player);
  2532. updateAdmins();
  2533. room.sendChat("👋 Hey " + player.name + " ! 📣📣 https://discord.gg/jTn2ZDp ! Our new season has started! Join and play with us! ", player.id);
  2534.  
  2535. if (!active.includes(Stats[player.name].conn)) {
  2536. active.push(Stats[player.name].conn);
  2537. }
  2538. };
  2539.  
  2540. room.onPlayerLeave = function(player) {
  2541. console.log("😢😢😢 " + player.name + " has left the room");
  2542. lastPlace();
  2543. updateAdmins();
  2544. updateTeams(player);
  2545. leaveInGame(player);
  2546. handleSanction(player);
  2547. Stats[player.name].disconnect();
  2548.  
  2549. };
  2550.  
  2551. room.onPersist = function(){
  2552. onPersistHandler();
  2553. };
  2554.  
  2555. room.onRestore = function(data){
  2556. onRestoreHandler(data);
  2557. };
  2558.  
  2559.  
  2560.  
  2561.  
  2562. room.onPlayerKicked = function(kicked, message, ban, by){
  2563. handleBans2(kicked, message, ban, by);
  2564. };
  2565.  
  2566.  
  2567. room.onGameStart = function(p){
  2568. console.log("🎮🎲🎮 Game has started !");
  2569. updateTeams(p);
  2570. putTeamColor();
  2571. gameStats = new GameStats();
  2572. gameControl = new GameControl(5.9);
  2573. elo = new ELO();
  2574. handleStart();
  2575. handleMode();
  2576. room.setPlayerAdmin(currentCaptain[0], false);
  2577.  
  2578. };
  2579.  
  2580.  
  2581. room.onTeamGoal = function(team){
  2582. handleGoals(team);
  2583. };
  2584.  
  2585.  
  2586. room.onGameStop = function(p){
  2587. console.log("🎮🎲🎮 Game has ended !");
  2588. updateTeams(p);
  2589. resetMutes();
  2590. gameControl.resetBallOwner();
  2591.  
  2592. };
  2593.  
  2594.  
  2595.  
  2596. room.onGameTick = function(){
  2597. gameControl.updateBallOwner();
  2598. gameControl.updateLastBallOwners();
  2599. gameControl.updatePassesInARow();
  2600. handleGk();
  2601. handleTimePlayed();
  2602. if (mode === true) setInterval(handleOvertime, 5000);
  2603. };
  2604.  
  2605. room.onPlayerBallKick = function (player){
  2606. gameControl.currentBallOwner = player.name;
  2607. };
  2608.  
  2609.  
  2610. room.onTeamVictory = function(player){
  2611. console.log("🎮🎉🎮 Game has ended on a Victory ! 🎉");
  2612. updateTeams(player);
  2613. if (mode === false) handleEndGame();
  2614. gameStats.matchsumup.push(handleCSMessage());
  2615. lastMatchSumUp.push(gameStats.matchsumup);
  2616. updateStreak(gameStats.redScore > gameStats.blueScore);
  2617. room.stopGame();
  2618. putWholeTeamToSpec();
  2619. currentCaptain = [pickNewCaptain(), false];
  2620.  
  2621.  
  2622.  
  2623. };
  2624.  
  2625. room.onPlayerAdminChange = function(p, by){
  2626. if (by != null && Stats[p.name].isTrustedAdmin > Stats[by.name].isTrustedAdmin){
  2627. room.kickPlayer(by.id, "Don't try this at home, kid.", false);
  2628. room.setPlayerAdmin(p.id, true);
  2629. }
  2630. updateAdmins();
  2631. };
  2632.  
  2633. room.onRoomLink = function(){
  2634. let vide = "";
  2635. vide.name = "";
  2636. loadStats();
  2637. disconnectAll();
  2638. autoConnect(room.getPlayer(0));
  2639. autoConnect(vide);
  2640. };
  2641.  
  2642.  
  2643. room.onStadiumChange = function(name, by){
  2644. handleStadiumChange(name, by);
  2645. };
  2646.  
  2647.  
  2648.  
  2649.  
  2650. room.onPlayerActivity = function(p){
  2651. if (!active.includes(Stats[p.name].conn)) {
  2652. active.push(Stats[p.name].conn);
  2653. }
  2654. };
  2655.  
  2656. /* EOF */
  2657.  
  2658.  
  2659. /* Python-like update dict method having at least an empty object */
  2660. function updateObject(object, p){
  2661. if (object.hasOwnProperty(p.name)){
  2662. object[p.name]++;
  2663. }
  2664. else {
  2665. object[p.name] = 1;
  2666. }
  2667. }
  2668.  
  2669.  
  2670. // Gives the last player who touched the ball, works only if the ball has the same
  2671. // size than in classics maps.
  2672. // Calculate the distance between 2 points
  2673. function pointDistance(p1, p2) {
  2674. var d1 = p1.x - p2.x;
  2675. var d2 = p1.y - p2.y;
  2676. return Math.sqrt(d1 * d1 + d2 * d2);
  2677. }
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687. var bigmap = `{
  2688.  
  2689. "name" : "[EFC][Big] Mona & Kang",
  2690.  
  2691. "width" : 800,
  2692.  
  2693. "height" : 350,
  2694.  
  2695. "spawnDistance" : 350,
  2696.  
  2697. "bg" : { "type" : "hockey", "width" : 0, "height" : 0, "kickOffRadius" : 80, "cornerRadius" : 0 },
  2698.  
  2699. "vertexes" : [
  2700. /* 0 */ { "x" : -700, "y" : 320, "trait" : "ballArea" },
  2701. /* 1 */ { "x" : -700, "y" : -320, "trait" : "ballArea" },
  2702. /* 2 */ { "x" : 700, "y" : 320, "trait" : "ballArea" },
  2703. /* 3 */ { "x" : 700, "y" : -320, "trait" : "ballArea" },
  2704.  
  2705. /* 4 */ { "x" : 0, "y" : 350, "trait" : "kickOffBarrier" },
  2706. /* 5 */ { "x" : 0, "y" : 80, "trait" : "kickOffBarrier", "color" : "3377ae", "vis" : true, "curve" : 180 },
  2707. /* 6 */ { "x" : 0, "y" : -80, "trait" : "kickOffBarrier", "color" : "3377ae", "vis" : true, "curve" : 180 },
  2708. /* 7 */ { "x" : 0, "y" : -350, "trait" : "kickOffBarrier" },
  2709.  
  2710. /* 8 */ { "x" : -700, "y" : -85, "trait" : "goalNet", "curve" : 0, "color" : "DA4D4B" },
  2711. /* 9 */ { "x" : -741, "y" : -85, "trait" : "goalNet", "curve" : -23, "color" : "DA4D4B", "bCoef" : 0.8 },
  2712. /* 10 */ { "x" : -741, "y" : 85, "trait" : "goalNet", "curve" : -23, "color" : "DA4D4B", "bCoef" : 0.8 },
  2713. /* 11 */ { "x" : -700, "y" : 85, "trait" : "goalNet", "curve" : 0, "color" : "DA4D4B" },
  2714. /* 12 */ { "x" : 700, "y" : -85, "trait" : "goalNet", "curve" : 0, "color" : "3377ae" },
  2715. /* 13 */ { "x" : 743, "y" : -85, "trait" : "goalNet", "curve" : 23, "color" : "3377ae", "bCoef" : 0.8 },
  2716. /* 14 */ { "x" : 743, "y" : 84, "trait" : "goalNet", "curve" : 23, "color" : "3377ae", "bCoef" : 0.8 },
  2717. /* 15 */ { "x" : 700, "y" : 85, "trait" : "goalNet", "curve" : 0, "color" : "3377ae" },
  2718.  
  2719. /* 16 */ { "x" : -700, "y" : 85, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2720. /* 17 */ { "x" : -700, "y" : 320, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2721. /* 18 */ { "x" : -700, "y" : -85, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2722. /* 19 */ { "x" : -700, "y" : -320, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2723. /* 20 */ { "x" : -700, "y" : 320, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2724. /* 21 */ { "x" : 700, "y" : 320, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2725. /* 22 */ { "x" : 700, "y" : 85, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2726. /* 23 */ { "x" : 700, "y" : 320, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2727. /* 24 */ { "x" : 700, "y" : -320, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2728. /* 25 */ { "x" : 700, "y" : -85, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2729. /* 26 */ { "x" : 700, "y" : -320, "bCoef" : 0, "cMask" : ["ball" ], "trait" : "ballArea" },
  2730. /* 27 */ { "x" : 700, "y" : -320, "bCoef" : 0, "cMask" : ["ball" ], "trait" : "ballArea" },
  2731. /* 28 */ { "x" : -700.0350255928246, "y" : -319.76086191288704, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2732. /* 29 */ { "x" : 699.9648932977058, "y" : -320.237418842872, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2733.  
  2734. /* 30 */ { "x" : 0, "y" : -318, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573", "_selected" : "segment" },
  2735. /* 31 */ { "x" : 0, "y" : -81, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573", "_selected" : "segment" },
  2736. /* 32 */ { "x" : 0, "y" : 82, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573" },
  2737. /* 33 */ { "x" : 0, "y" : 318, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573" },
  2738. /* 34 */ { "x" : 0, "y" : -82, "bCoef" : 0.1, "cMask" : ["red","blue" ], "trait" : "kickOffBarrier", "vis" : true, "color" : "F8F8F8" },
  2739. /* 35 */ { "x" : 0, "y" : 82, "bCoef" : 0.1, "cMask" : ["red","blue" ], "trait" : "kickOffBarrier", "vis" : true, "color" : "F8F8F8" },
  2740. /* 36 */ { "x" : 0, "y" : -150, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier" },
  2741. /* 37 */ { "x" : 0, "y" : 82, "trait" : "kickOffBarrier", "color" : "F8F8F8", "vis" : true, "curve" : -180 },
  2742. /* 38 */ { "x" : 0, "y" : -82, "trait" : "kickOffBarrier", "color" : "F8F8F8", "vis" : true, "curve" : -180 },
  2743. /* 39 */ { "x" : 0, "y" : 82, "trait" : "kickOffBarrier", "color" : "F8F8F8", "vis" : true, "curve" : 0 },
  2744.  
  2745. /* 40 */ { "x" : -707.5, "y" : 85, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false },
  2746. /* 41 */ { "x" : -707.5, "y" : -344, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 },
  2747. /* 42 */ { "x" : -707.5, "y" : -85, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 },
  2748. /* 43 */ { "x" : 697, "y" : -85, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea" },
  2749. /* 44 */ { "x" : 697, "y" : -87, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 },
  2750. /* 45 */ { "x" : 696, "y" : 84, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false },
  2751.  
  2752. /* 46 */ { "x" : -700, "y" : -86, "bCoef" : 0.1, "cMask" : ["blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573" },
  2753. /* 47 */ { "x" : -700, "y" : 81, "bCoef" : 0.1, "cMask" : ["blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573" },
  2754. /* 48 */ { "x" : 700, "y" : -83, "bCoef" : 0.1, "cMask" : ["red" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573" },
  2755. /* 49 */ { "x" : 700, "y" : 84, "bCoef" : 0.1, "cMask" : ["red" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573" },
  2756.  
  2757. /* 50 */ { "x" : -385.5, "y" : 318, "bCoef" : 0, "cMask" : ["wall" ], "color" : "737573" },
  2758. /* 51 */ { "x" : -385.5, "y" : -318, "bCoef" : 0, "cMask" : ["wall" ], "color" : "737573" },
  2759. /* 52 */ { "x" : 385.5, "y" : 318, "bCoef" : 0, "cMask" : ["wall" ], "color" : "737573" },
  2760. /* 53 */ { "x" : 385.5, "y" : -318, "bCoef" : 0, "cMask" : ["wall" ], "color" : "737573" },
  2761. /* 54 */ { "x" : -385.5, "y" : -130, "cMask" : ["wall" ], "curve" : 90, "color" : "737573" },
  2762. /* 55 */ { "x" : -385.5, "y" : 130, "cMask" : ["wall" ], "curve" : 90, "color" : "737573" },
  2763. /* 56 */ { "x" : 385.5, "y" : -130, "cMask" : ["wall" ], "curve" : -90, "color" : "737573" },
  2764. /* 57 */ { "x" : 385.5, "y" : 130, "cMask" : ["wall" ], "curve" : -90, "color" : "737573" },
  2765. /* 58 */ { "x" : -620, "y" : -115, "cMask" : ["wall" ], "color" : "737573" },
  2766. /* 59 */ { "x" : -698, "y" : -115, "cMask" : ["wall" ], "color" : "737573" },
  2767. /* 60 */ { "x" : -620, "y" : 115, "cMask" : ["wall" ], "color" : "737573" },
  2768. /* 61 */ { "x" : -698, "y" : 115, "cMask" : ["wall" ], "color" : "737573" },
  2769. /* 62 */ { "x" : -620, "y" : -115, "cMask" : ["wall" ], "color" : "737573" },
  2770. /* 63 */ { "x" : -620, "y" : 115, "cMask" : ["wall" ], "color" : "737573" },
  2771. /* 64 */ { "x" : 620, "y" : 115, "cMask" : ["wall" ], "color" : "737573" },
  2772. /* 65 */ { "x" : 698, "y" : 115, "cMask" : ["wall" ], "color" : "737573" },
  2773. /* 66 */ { "x" : 620, "y" : -115, "cMask" : ["wall" ], "color" : "737573" },
  2774. /* 67 */ { "x" : 698, "y" : -115, "cMask" : ["wall" ], "color" : "737573" },
  2775. /* 68 */ { "x" : 620, "y" : -115, "cMask" : ["wall" ], "color" : "737573" },
  2776. /* 69 */ { "x" : 620, "y" : 115, "cMask" : ["wall" ], "color" : "737573" },
  2777. /* 70 */ { "x" : 500, "y" : -2, "cMask" : ["wall" ], "curve" : 180, "color" : "737573" },
  2778. /* 71 */ { "x" : 500, "y" : 2, "cMask" : ["wall" ], "curve" : 180, "color" : "737573" },
  2779. /* 72 */ { "x" : 500, "y" : -2, "cMask" : ["wall" ], "curve" : -180, "color" : "737573" },
  2780. /* 73 */ { "x" : 500, "y" : 2, "cMask" : ["wall" ], "curve" : -180, "color" : "737573" },
  2781. /* 74 */ { "x" : -500, "y" : -2, "cMask" : ["wall" ], "curve" : 180, "color" : "737573" },
  2782. /* 75 */ { "x" : -500, "y" : 2, "cMask" : ["wall" ], "curve" : 180, "color" : "737573" },
  2783. /* 76 */ { "x" : -500, "y" : -2, "cMask" : ["wall" ], "curve" : -180, "color" : "737573" },
  2784. /* 77 */ { "x" : -500, "y" : 2, "cMask" : ["wall" ], "curve" : -180, "color" : "737573" },
  2785. /* 78 */ { "x" : 0, "y" : -2, "cMask" : ["wall" ], "curve" : 180, "color" : "737573" },
  2786. /* 79 */ { "x" : 0, "y" : 2, "cMask" : ["wall" ], "curve" : 180, "color" : "737573" },
  2787. /* 80 */ { "x" : 0, "y" : -2, "cMask" : ["wall" ], "curve" : -180, "color" : "737573" },
  2788. /* 81 */ { "x" : 0, "y" : 2, "cMask" : ["wall" ], "curve" : -180, "color" : "737573" },
  2789.  
  2790. /* 82 */ { "x" : -707.5, "y" : 344, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 },
  2791. /* 83 */ { "x" : -707.5, "y" : 85, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 },
  2792. /* 84 */ { "x" : 707.5, "y" : 344, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 },
  2793. /* 85 */ { "x" : 707.5, "y" : 85, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 },
  2794. /* 86 */ { "x" : 707.5, "y" : -344, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 },
  2795. /* 87 */ { "x" : 707.5, "y" : -85, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 }
  2796.  
  2797. ],
  2798.  
  2799. "segments" : [
  2800. { "v0" : 8, "v1" : 9, "curve" : 0, "color" : "DA4D4B", "trait" : "goalNet" },
  2801. { "v0" : 9, "v1" : 10, "curve" : -23, "color" : "DA4D4B", "trait" : "goalNet", "bCoef" : 0.8 },
  2802. { "v0" : 10, "v1" : 11, "curve" : 0, "color" : "DA4D4B", "trait" : "goalNet" },
  2803. { "v0" : 12, "v1" : 13, "curve" : 0, "color" : "3377ae", "trait" : "goalNet" },
  2804. { "v0" : 13, "v1" : 14, "curve" : 23, "color" : "3377ae", "trait" : "goalNet", "bCoef" : 0.8 },
  2805. { "v0" : 14, "v1" : 15, "curve" : 0, "color" : "3377ae", "trait" : "goalNet" },
  2806.  
  2807. { "v0" : 4, "v1" : 5, "trait" : "kickOffBarrier" },
  2808. { "v0" : 5, "v1" : 6, "curve" : 180, "vis" : true, "color" : "DA4D4B", "cGroup" : ["blueKO" ], "trait" : "kickOffBarrier" },
  2809. { "v0" : 5, "v1" : 6, "curve" : -180, "vis" : true, "color" : "3377ae", "cGroup" : ["redKO" ], "trait" : "kickOffBarrier" },
  2810. { "v0" : 6, "v1" : 7, "trait" : "kickOffBarrier" },
  2811.  
  2812. { "v0" : 16, "v1" : 17, "vis" : true, "color" : "1e252a", "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea" },
  2813. { "v0" : 18, "v1" : 19, "vis" : true, "color" : "1e252a", "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea" },
  2814. { "v0" : 20, "v1" : 21, "vis" : true, "color" : "1e252a", "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea" },
  2815. { "v0" : 22, "v1" : 23, "vis" : true, "color" : "1e252a", "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea" },
  2816. { "v0" : 24, "v1" : 25, "vis" : true, "color" : "1e252a", "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea" },
  2817. { "v0" : 26, "v1" : 27, "vis" : true, "color" : "F8F8F8", "bCoef" : 0, "cMask" : ["ball" ], "trait" : "ballArea" },
  2818. { "v0" : 28, "v1" : 29, "vis" : true, "color" : "1e252a", "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea" },
  2819.  
  2820. { "v0" : 30, "v1" : 31, "vis" : true, "color" : "737573", "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "_selected" : true },
  2821. { "v0" : 32, "v1" : 33, "vis" : true, "color" : "737573", "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier" },
  2822.  
  2823. { "v0" : 41, "v1" : 42, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : -707.5 },
  2824.  
  2825. { "v0" : 46, "v1" : 47, "vis" : true, "color" : "737573", "bCoef" : 0.1, "cMask" : ["blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "x" : -700 },
  2826. { "v0" : 48, "v1" : 49, "vis" : true, "color" : "737573", "bCoef" : 0.1, "cMask" : ["red" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "x" : 700 },
  2827.  
  2828. { "v0" : 50, "v1" : 51, "curve" : 0, "vis" : true, "color" : "737573", "bCoef" : 0.1, "cMask" : ["wall" ], "trait" : "goalNet" },
  2829. { "v0" : 52, "v1" : 53, "curve" : 0, "vis" : true, "color" : "737573", "bCoef" : 0.1, "cMask" : ["wall" ], "trait" : "goalNet", "x" : 385.5 },
  2830.  
  2831. { "v0" : 54, "v1" : 55, "curve" : 90, "vis" : true, "color" : "737573", "cMask" : ["wall" ] },
  2832. { "v0" : 56, "v1" : 57, "curve" : -90, "vis" : true, "color" : "737573", "cMask" : ["wall" ], "x" : 385.5 },
  2833. { "v0" : 58, "v1" : 59, "curve" : 0, "vis" : true, "color" : "737573", "cMask" : ["wall" ] },
  2834. { "v0" : 60, "v1" : 61, "curve" : 0, "vis" : true, "color" : "737573", "cMask" : ["wall" ], "y" : 115 },
  2835. { "v0" : 62, "v1" : 63, "curve" : 0, "vis" : true, "color" : "737573", "cMask" : ["wall" ] },
  2836. { "v0" : 64, "v1" : 65, "curve" : 0, "vis" : true, "color" : "737573", "cMask" : ["wall" ], "y" : 215 },
  2837. { "v0" : 66, "v1" : 67, "curve" : 0, "vis" : true, "color" : "737573", "cMask" : ["wall" ], "y" : -115 },
  2838. { "v0" : 68, "v1" : 69, "curve" : 0, "vis" : true, "color" : "737573", "cMask" : ["wall" ], "x" : 620 },
  2839. { "v0" : 70, "v1" : 71, "curve" : 180, "vis" : true, "color" : "737573", "cMask" : ["wall" ] },
  2840. { "v0" : 72, "v1" : 73, "curve" : -180, "vis" : true, "color" : "737573", "cMask" : ["wall" ] },
  2841. { "v0" : 74, "v1" : 75, "curve" : 180, "vis" : true, "color" : "737573", "cMask" : ["wall" ], "x" : -500 },
  2842. { "v0" : 76, "v1" : 77, "curve" : -180, "vis" : true, "color" : "737573", "cMask" : ["wall" ], "x" : -500 },
  2843. { "v0" : 78, "v1" : 79, "curve" : 180, "vis" : true, "color" : "737573", "cMask" : ["wall" ], "x" : 0 },
  2844. { "v0" : 80, "v1" : 81, "curve" : -180, "vis" : true, "color" : "737573", "cMask" : ["wall" ], "x" : 0 },
  2845.  
  2846. { "v0" : 82, "v1" : 83, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : -707.5 },
  2847. { "v0" : 84, "v1" : 85, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 707.5 },
  2848. { "v0" : 86, "v1" : 87, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 707.5 }
  2849.  
  2850. ],
  2851.  
  2852. "goals" : [
  2853. { "p0" : [-706,91 ], "p1" : [-706,-79 ], "team" : "red" },
  2854. { "p0" : [706,91 ], "p1" : [706,-79 ], "team" : "blue" }
  2855.  
  2856. ],
  2857.  
  2858. "discs" : [
  2859. { "radius" : 5.4, "pos" : [-700,85 ], "color" : "ce9e9e", "trait" : "goalPost" },
  2860. { "radius" : 5.4, "pos" : [-700,-85 ], "color" : "ce9e9e", "trait" : "goalPost" },
  2861. { "radius" : 5.4, "pos" : [699,85 ], "color" : "9eafce", "trait" : "goalPost" },
  2862. { "radius" : 5.4, "pos" : [699,-84 ], "color" : "9eafce", "trait" : "goalPost" }
  2863.  
  2864. ],
  2865.  
  2866. "planes" : [
  2867. { "normal" : [0,1 ], "dist" : -320, "trait" : "ballArea", "vis" : false, "curve" : 0 },
  2868. { "normal" : [0,-1 ], "dist" : -320, "trait" : "ballArea" },
  2869.  
  2870. { "normal" : [0,1 ], "dist" : -350, "bCoef" : 0.1 },
  2871. { "normal" : [0,-1 ], "dist" : -352, "bCoef" : 0.1 },
  2872. { "normal" : [1,0 ], "dist" : -800, "bCoef" : 0.1 },
  2873. { "normal" : [-1,0 ], "dist" : -800, "bCoef" : 0.1 },
  2874.  
  2875. { "bCoef" : 0.8, "cMask" : ["ball" ], "trait" : "goalNet", "dist" : -754, "normal" : [-1,0 ] },
  2876. { "bCoef" : 0.8, "cMask" : ["ball" ], "trait" : "goalNet", "dist" : -753.006773306292, "normal" : [0.9999309835650598,0.011748536360424984 ] }
  2877.  
  2878. ],
  2879.  
  2880. "traits" : {
  2881. "ballArea" : { "vis" : false, "bCoef" : 1, "cMask" : ["ball" ] },
  2882. "goalPost" : { "radius" : 8, "invMass" : 0, "bCoef" : 0.5 },
  2883. "goalNet" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["ball" ] },
  2884. "kickOffBarrier" : { "vis" : false, "bCoef" : 0.1, "cGroup" : ["redKO","blueKO" ], "cMask" : ["red","blue" ] }
  2885.  
  2886. },
  2887.  
  2888. "playerPhysics" : {
  2889. "bCoef" : 0,
  2890. "acceleration" : 0.11,
  2891. "kickingAcceleration" : 0.083,
  2892. "kickStrength" : 4.545
  2893.  
  2894. },
  2895.  
  2896. "ballPhysics" : {
  2897. "radius" : 5.8,
  2898. "bCoef" : 0.412,
  2899. "invMass" : 1.5,
  2900. "damping" : 0.99,
  2901. "color" : "ffd133"
  2902.  
  2903. }
  2904. }`;
  2905.  
  2906. var mediummap = `{
  2907.  
  2908. "name" : "[EFC][Medium] by Kang",
  2909.  
  2910. "width" : 648,
  2911.  
  2912. "height" : 270,
  2913.  
  2914. "spawnDistance" : 350,
  2915.  
  2916. "bg" : { "type" : "hockey" },
  2917.  
  2918. "vertexes" : [
  2919. /* 0 */ { "x" : 550, "y" : 240, "trait" : "ballArea" },
  2920. /* 1 */ { "x" : 550, "y" : -240, "trait" : "ballArea" },
  2921.  
  2922. /* 2 */ { "x" : 0, "y" : 270, "trait" : "kickOffBarrier" },
  2923. /* 3 */ { "x" : 0, "y" : 80, "trait" : "kickOffBarrier", "color" : "3377ae", "vis" : true, "curve" : 180 },
  2924. /* 4 */ { "x" : 0, "y" : -80, "trait" : "kickOffBarrier", "color" : "3377ae", "vis" : true, "curve" : 180 },
  2925. /* 5 */ { "x" : 0, "y" : -270, "trait" : "kickOffBarrier" },
  2926.  
  2927. /* 6 */ { "x" : -550, "y" : -80, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : 0, "color" : "DA4D4B", "pos" : [-700,-80 ] },
  2928. /* 7 */ { "x" : -590, "y" : -80, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : -23, "color" : "DA4D4B", "pos" : [-700,-80 ], "bCoef" : 0.8 },
  2929. /* 8 */ { "x" : -590, "y" : 80, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : -23, "color" : "DA4D4B", "pos" : [-700,80 ], "bCoef" : 0.8 },
  2930. /* 9 */ { "x" : -550, "y" : 80, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : 0, "color" : "DA4D4B", "pos" : [-700,80 ] },
  2931. /* 10 */ { "x" : 550, "y" : -80, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : 0, "color" : "3377ae", "pos" : [700,-80 ] },
  2932. /* 11 */ { "x" : 590, "y" : -80, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : 23, "color" : "3377ae", "pos" : [700,-80 ], "bCoef" : 0.8 },
  2933. /* 12 */ { "x" : 590, "y" : 80, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : 23, "color" : "3377ae", "pos" : [700,80 ], "bCoef" : 0.8 },
  2934. /* 13 */ { "x" : 550, "y" : 80, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : 0, "color" : "3377ae", "pos" : [700,80 ] },
  2935.  
  2936. /* 14 */ { "x" : -550, "y" : 80, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "231017", "pos" : [-700,80 ] },
  2937. /* 15 */ { "x" : -550, "y" : 240, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "231017" },
  2938. /* 16 */ { "x" : -550, "y" : -80, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a", "pos" : [-700,-80 ] },
  2939. /* 17 */ { "x" : -550, "y" : -240, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2940. /* 18 */ { "x" : -550, "y" : 240, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2941. /* 19 */ { "x" : 550, "y" : 240, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2942. /* 20 */ { "x" : 550, "y" : 80, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "pos" : [700,80 ], "color" : "1e252a" },
  2943. /* 21 */ { "x" : 550, "y" : 240, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2944. /* 22 */ { "x" : 550, "y" : -240, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  2945. /* 23 */ { "x" : 550, "y" : -80, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a", "pos" : [700,-80 ] },
  2946. /* 24 */ { "x" : 550, "y" : -240, "bCoef" : 0, "cMask" : ["ball" ], "trait" : "ballArea" },
  2947. /* 25 */ { "x" : 550, "y" : -240, "bCoef" : 0, "cMask" : ["ball" ], "trait" : "ballArea" },
  2948. /* 26 */ { "x" : -550, "y" : -240, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "color" : "1e252a" },
  2949. /* 27 */ { "x" : 550, "y" : -240, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "color" : "1e252a" },
  2950.  
  2951. /* 28 */ { "x" : 0, "y" : -240, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573" },
  2952. /* 29 */ { "x" : 0, "y" : -82, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573" },
  2953. /* 30 */ { "x" : 0, "y" : 82, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573" },
  2954. /* 31 */ { "x" : 0, "y" : 240, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573" },
  2955. /* 32 */ { "x" : 0, "y" : -82, "bCoef" : 0.1, "cMask" : ["red","blue" ], "trait" : "kickOffBarrier", "vis" : true, "color" : "F8F8F8" },
  2956. /* 33 */ { "x" : 0, "y" : 82, "bCoef" : 0.1, "cMask" : ["red","blue" ], "trait" : "kickOffBarrier", "vis" : true, "color" : "F8F8F8" },
  2957. /* 34 */ { "x" : 0, "y" : 82, "trait" : "kickOffBarrier", "color" : "F8F8F8", "vis" : true, "curve" : -180 },
  2958. /* 35 */ { "x" : 0, "y" : -82, "trait" : "kickOffBarrier", "color" : "F8F8F8", "vis" : true, "curve" : -180 },
  2959. /* 36 */ { "x" : 0, "y" : 82, "trait" : "kickOffBarrier", "color" : "F8F8F8", "vis" : true, "curve" : 0 },
  2960. /* 37 */ { "x" : 0, "y" : -82, "trait" : "kickOffBarrier", "color" : "F8F8F8", "vis" : true, "curve" : 0 },
  2961.  
  2962. /* 38 */ { "x" : -557.5, "y" : 80, "bCoef" : 0.1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false, "pos" : [-700,80 ] },
  2963. /* 39 */ { "x" : -557.5, "y" : 240, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false },
  2964. /* 40 */ { "x" : -557.5, "y" : -240, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 },
  2965. /* 41 */ { "x" : -557.5, "y" : -80, "bCoef" : 0.1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0, "pos" : [-700,-80 ] },
  2966. /* 42 */ { "x" : 557.5, "y" : -240, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 },
  2967. /* 43 */ { "x" : 557.5, "y" : -80, "bCoef" : 0.1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0, "pos" : [700,-80 ] },
  2968. /* 44 */ { "x" : 557.5, "y" : 80, "bCoef" : 0.1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false, "pos" : [700,80 ] },
  2969. /* 45 */ { "x" : 557.5, "y" : 240, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false },
  2970.  
  2971. /* 46 */ { "x" : 0, "y" : 82, "bCoef" : 0.1, "trait" : "line", "color" : "afa370" },
  2972. /* 47 */ { "x" : -550, "y" : -80, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  2973. /* 48 */ { "x" : -550, "y" : 80, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  2974. /* 49 */ { "x" : 550, "y" : -80, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  2975. /* 50 */ { "x" : 550, "y" : 80, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  2976. /* 51 */ { "x" : -548, "y" : 160, "bCoef" : 0.1, "trait" : "line", "color" : "737573", "curve" : -180 },
  2977. /* 52 */ { "x" : -548, "y" : -160, "bCoef" : 0.1, "trait" : "line", "color" : "737573", "curve" : -180 },
  2978. /* 53 */ { "x" : 548, "y" : 160, "bCoef" : 0.1, "trait" : "line", "color" : "737573", "curve" : 180 },
  2979. /* 54 */ { "x" : 548, "y" : -160, "bCoef" : 0.1, "trait" : "line", "color" : "737573", "curve" : 180 },
  2980. /* 55 */ { "x" : 0, "y" : -2, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  2981. /* 56 */ { "x" : 0, "y" : 2, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  2982. /* 57 */ { "x" : 0, "y" : -2, "bCoef" : 0.1, "trait" : "line", "curve" : 180, "color" : "737573" },
  2983. /* 58 */ { "x" : 0, "y" : 2, "bCoef" : 0.1, "trait" : "line", "curve" : 180, "color" : "737573" },
  2984. /* 59 */ { "x" : 480, "y" : -2, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  2985. /* 60 */ { "x" : 480, "y" : 2, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  2986. /* 61 */ { "x" : 480, "y" : -2, "bCoef" : 0.1, "trait" : "line", "curve" : 180, "color" : "737573" },
  2987. /* 62 */ { "x" : 480, "y" : 2, "bCoef" : 0.1, "trait" : "line", "curve" : 180, "color" : "737573" },
  2988. /* 63 */ { "x" : -480, "y" : -2, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  2989. /* 64 */ { "x" : -480, "y" : 2, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  2990. /* 65 */ { "x" : -480, "y" : -2, "bCoef" : 0.1, "trait" : "line", "curve" : 180, "color" : "737573" },
  2991. /* 66 */ { "x" : -480, "y" : 2, "bCoef" : 0.1, "trait" : "line", "curve" : 180, "color" : "737573" }
  2992.  
  2993. ],
  2994.  
  2995. "segments" : [
  2996. { "v0" : 6, "v1" : 7, "curve" : 0, "color" : "DA4D4B", "cMask" : ["ball" ], "trait" : "goalNet", "pos" : [-700,-80 ], "y" : -80 },
  2997. { "v0" : 7, "v1" : 8, "curve" : -23, "color" : "DA4D4B", "cMask" : ["ball" ], "trait" : "goalNet", "x" : -590, "bCoef" : 0.8 },
  2998. { "v0" : 8, "v1" : 9, "curve" : 0, "color" : "DA4D4B", "cMask" : ["ball" ], "trait" : "goalNet", "pos" : [-700,80 ], "y" : 80 },
  2999. { "v0" : 10, "v1" : 11, "curve" : 0, "color" : "3377ae", "cMask" : ["ball" ], "trait" : "goalNet", "pos" : [700,-80 ], "y" : -80 },
  3000. { "v0" : 11, "v1" : 12, "curve" : 23, "color" : "3377ae", "cMask" : ["ball" ], "trait" : "goalNet", "x" : 590, "bCoef" : 0.8 },
  3001. { "v0" : 12, "v1" : 13, "curve" : 0, "color" : "3377ae", "cMask" : ["ball" ], "trait" : "goalNet", "pos" : [700,80 ], "y" : 80 },
  3002.  
  3003. { "v0" : 2, "v1" : 3, "trait" : "kickOffBarrier" },
  3004. { "v0" : 3, "v1" : 4, "curve" : 180, "vis" : true, "color" : "DA4D4B", "cGroup" : ["blueKO" ], "trait" : "kickOffBarrier" },
  3005. { "v0" : 3, "v1" : 4, "curve" : -180, "vis" : true, "color" : "3377ae", "cGroup" : ["redKO" ], "trait" : "kickOffBarrier" },
  3006. { "v0" : 4, "v1" : 5, "trait" : "kickOffBarrier" },
  3007.  
  3008. { "v0" : 14, "v1" : 15, "vis" : true, "color" : "231017", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : -550 },
  3009. { "v0" : 16, "v1" : 17, "vis" : true, "color" : "1e252a", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : -550 },
  3010. { "v0" : 18, "v1" : 19, "curve" : 0, "vis" : true, "color" : "1e252a", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "y" : 240 },
  3011. { "v0" : 20, "v1" : 21, "vis" : true, "color" : "1e252a", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 550 },
  3012. { "v0" : 22, "v1" : 23, "vis" : true, "color" : "1e252a", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 550 },
  3013. { "v0" : 24, "v1" : 25, "vis" : true, "color" : "F8F8F8", "bCoef" : 0, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 550, "y" : -240 },
  3014. { "v0" : 26, "v1" : 27, "curve" : 0, "vis" : true, "color" : "1e252a", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "y" : -240 },
  3015.  
  3016. { "v0" : 28, "v1" : 29, "vis" : true, "color" : "737573", "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier" },
  3017. { "v0" : 30, "v1" : 31, "vis" : true, "color" : "737573", "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier" },
  3018.  
  3019. { "v0" : 38, "v1" : 39, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "x" : -557.5 },
  3020. { "v0" : 40, "v1" : 41, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "x" : -557.5 },
  3021. { "v0" : 42, "v1" : 43, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 557.5 },
  3022. { "v0" : 44, "v1" : 45, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 557.5 },
  3023.  
  3024. { "v0" : 47, "v1" : 48, "curve" : 0, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line", "x" : -550 },
  3025. { "v0" : 49, "v1" : 50, "curve" : 0, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line", "x" : 550 },
  3026. { "v0" : 51, "v1" : 52, "curve" : -180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line" },
  3027. { "v0" : 53, "v1" : 54, "curve" : 180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line", "x" : 548 },
  3028. { "v0" : 55, "v1" : 56, "curve" : -180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line" },
  3029. { "v0" : 57, "v1" : 58, "curve" : 180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line" },
  3030. { "v0" : 59, "v1" : 60, "curve" : -180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line", "x" : 480 },
  3031. { "v0" : 61, "v1" : 62, "curve" : 180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line", "x" : 480 },
  3032. { "v0" : 63, "v1" : 64, "curve" : -180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line", "x" : -480 },
  3033. { "v0" : 65, "v1" : 66, "curve" : 180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line", "x" : -480 }
  3034.  
  3035. ],
  3036.  
  3037. "goals" : [
  3038. { "p0" : [-556.3,-80 ], "p1" : [-556.3,80 ], "team" : "red" },
  3039. { "p0" : [556.3,80 ], "p1" : [556.3,-80 ], "team" : "blue" }
  3040.  
  3041. ],
  3042.  
  3043. "discs" : [
  3044. { "radius" : 5, "pos" : [-550,80 ], "color" : "ce9e9e", "trait" : "goalPost", "y" : 80 },
  3045. { "radius" : 5, "pos" : [-550,-80 ], "color" : "ce9e9e", "trait" : "goalPost", "y" : -80, "x" : -560 },
  3046. { "radius" : 5, "pos" : [550,80 ], "color" : "9eafce", "trait" : "goalPost", "y" : 80 },
  3047. { "radius" : 5, "pos" : [550,-80 ], "color" : "9eafce", "trait" : "goalPost", "y" : -80 }
  3048.  
  3049. ],
  3050.  
  3051. "planes" : [
  3052. { "normal" : [0,1 ], "dist" : -240, "bCoef" : 1, "trait" : "ballArea", "vis" : false, "curve" : 0 },
  3053. { "normal" : [0,-1 ], "dist" : -240, "bCoef" : 1, "trait" : "ballArea" },
  3054.  
  3055. { "normal" : [0,1 ], "dist" : -270, "bCoef" : 0.1 },
  3056. { "normal" : [0,-1 ], "dist" : -270, "bCoef" : 0.1 },
  3057. { "normal" : [1,0 ], "dist" : -642, "bCoef" : 0.1 },
  3058. { "normal" : [-1,0 ], "dist" : -644, "bCoef" : 0.1 },
  3059.  
  3060. { "normal" : [1,0 ], "dist" : -642, "bCoef" : 0.1, "trait" : "ballArea", "vis" : false, "curve" : 0 },
  3061. { "normal" : [-1,0 ], "dist" : -643, "bCoef" : 0.1, "trait" : "ballArea", "vis" : false, "curve" : 0 }
  3062.  
  3063. ],
  3064.  
  3065. "traits" : {
  3066. "ballArea" : { "vis" : false, "bCoef" : 1, "cMask" : ["ball" ] },
  3067. "goalPost" : { "radius" : 8, "invMass" : 0, "bCoef" : 0.5 },
  3068. "goalNet" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["ball" ] },
  3069. "line" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["" ] },
  3070. "kickOffBarrier" : { "vis" : false, "bCoef" : 0.1, "cGroup" : ["redKO","blueKO" ], "cMask" : ["red","blue" ] }
  3071.  
  3072. },
  3073.  
  3074. "playerPhysics" : {
  3075. "bCoef" : 0,
  3076. "acceleration" : 0.11,
  3077. "kickingAcceleration" : 0.083,
  3078. "kickStrength" : 4.2
  3079.  
  3080. },
  3081.  
  3082. "ballPhysics" : {
  3083. "radius" : 5.8,
  3084. "bCoef" : 0.412,
  3085. "invMass" : 1.5,
  3086. "damping" : 0.99,
  3087. "color" : "ffd133"
  3088.  
  3089. }
  3090. }`;
  3091.  
  3092.  
  3093. var smallmap = `{
  3094.  
  3095. "name" : "[EFC][Small] by Kang",
  3096.  
  3097. "width" : 497,
  3098.  
  3099. "height" : 220,
  3100.  
  3101. "spawnDistance" : 350,
  3102.  
  3103. "bg" : { "type" : "hockey" },
  3104.  
  3105. "vertexes" : [
  3106. /* 0 */ { "x" : 400, "y" : 190, "trait" : "ballArea" },
  3107. /* 1 */ { "x" : 400, "y" : -190, "trait" : "ballArea" },
  3108.  
  3109. /* 2 */ { "x" : 0, "y" : 220, "trait" : "kickOffBarrier" },
  3110. /* 3 */ { "x" : 0, "y" : 60, "trait" : "kickOffBarrier", "color" : "3377ae", "vis" : true, "curve" : 180 },
  3111. /* 4 */ { "x" : 0, "y" : -60, "trait" : "kickOffBarrier", "color" : "3377ae", "vis" : true, "curve" : 180 },
  3112. /* 5 */ { "x" : 0, "y" : -220, "trait" : "kickOffBarrier" },
  3113.  
  3114. /* 6 */ { "x" : -400, "y" : -70, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : 0, "color" : "DA4D4B", "pos" : [-700,-80 ] },
  3115. /* 7 */ { "x" : -440, "y" : -70, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : -23, "color" : "DA4D4B", "pos" : [-700,-80 ], "bCoef" : 0.8 },
  3116. /* 8 */ { "x" : -440, "y" : 70, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : -23, "color" : "DA4D4B", "pos" : [-700,80 ], "bCoef" : 0.8 },
  3117. /* 9 */ { "x" : -400, "y" : 70, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : 0, "color" : "DA4D4B", "pos" : [-700,80 ] },
  3118. /* 10 */ { "x" : 400, "y" : -70, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : 0, "color" : "3377ae", "pos" : [700,-80 ] },
  3119. /* 11 */ { "x" : 440, "y" : -70, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : 23, "color" : "3377ae", "pos" : [700,-80 ], "bCoef" : 0.8 },
  3120. /* 12 */ { "x" : 440, "y" : 70, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : 23, "color" : "3377ae", "pos" : [700,80 ], "bCoef" : 0.8 },
  3121. /* 13 */ { "x" : 400, "y" : 70, "cMask" : ["ball" ], "trait" : "goalNet", "curve" : 0, "color" : "3377ae", "pos" : [700,80 ] },
  3122.  
  3123. /* 14 */ { "x" : -400, "y" : 70, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a", "pos" : [-700,80 ] },
  3124. /* 15 */ { "x" : -400, "y" : 190, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  3125. /* 16 */ { "x" : -400, "y" : -70, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a", "pos" : [-700,-80 ] },
  3126. /* 17 */ { "x" : -400, "y" : -190, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  3127. /* 18 */ { "x" : -400, "y" : 190, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  3128. /* 19 */ { "x" : 400, "y" : 190, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  3129. /* 20 */ { "x" : 400, "y" : 70, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "pos" : [700,80 ], "color" : "1e252a" },
  3130. /* 21 */ { "x" : 400, "y" : 190, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  3131. /* 22 */ { "x" : 400, "y" : -190, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a" },
  3132. /* 23 */ { "x" : 400, "y" : -70, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "1e252a", "pos" : [700,-80 ] },
  3133. /* 24 */ { "x" : 400, "y" : -190, "bCoef" : 0, "cMask" : ["ball" ], "trait" : "ballArea" },
  3134. /* 25 */ { "x" : 400, "y" : -190, "bCoef" : 0, "cMask" : ["ball" ], "trait" : "ballArea" },
  3135. /* 26 */ { "x" : -400, "y" : -190, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "color" : "1e252a" },
  3136. /* 27 */ { "x" : 400, "y" : -190, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "color" : "1e252a" },
  3137.  
  3138. /* 28 */ { "x" : 0, "y" : -190, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573" },
  3139. /* 29 */ { "x" : 0, "y" : -62, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573" },
  3140. /* 30 */ { "x" : 0, "y" : 62, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573" },
  3141. /* 31 */ { "x" : 0, "y" : 190, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "737573" },
  3142. /* 32 */ { "x" : 0, "y" : -62, "bCoef" : 0.1, "cMask" : ["red","blue" ], "trait" : "kickOffBarrier", "vis" : true, "color" : "F8F8F8" },
  3143. /* 33 */ { "x" : 0, "y" : 62, "bCoef" : 0.1, "cMask" : ["red","blue" ], "trait" : "kickOffBarrier", "vis" : true, "color" : "F8F8F8" },
  3144. /* 34 */ { "x" : 0, "y" : 62, "trait" : "kickOffBarrier", "color" : "F8F8F8", "vis" : true, "curve" : -180 },
  3145. /* 35 */ { "x" : 0, "y" : -62, "trait" : "kickOffBarrier", "color" : "F8F8F8", "vis" : true, "curve" : -180 },
  3146. /* 36 */ { "x" : 0, "y" : 62, "trait" : "kickOffBarrier", "color" : "F8F8F8", "vis" : true, "curve" : 0 },
  3147. /* 37 */ { "x" : 0, "y" : -62, "trait" : "kickOffBarrier", "color" : "F8F8F8", "vis" : true, "curve" : 0 },
  3148.  
  3149. /* 38 */ { "x" : -407.5, "y" : 70, "bCoef" : 0.1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false, "pos" : [-700,80 ] },
  3150. /* 39 */ { "x" : -407.5, "y" : 190, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false },
  3151. /* 40 */ { "x" : -407.5, "y" : -190, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 },
  3152. /* 41 */ { "x" : -407.5, "y" : -70, "bCoef" : 0.1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0, "pos" : [-700,-80 ] },
  3153. /* 42 */ { "x" : 407.5, "y" : -190, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 },
  3154. /* 43 */ { "x" : 407.5, "y" : -70, "bCoef" : 0.1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0, "pos" : [700,-80 ] },
  3155. /* 44 */ { "x" : 407.5, "y" : 70, "bCoef" : 0.1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false, "pos" : [700,80 ] },
  3156. /* 45 */ { "x" : 407.5, "y" : 190, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false },
  3157.  
  3158. /* 46 */ { "x" : 0, "y" : 62, "bCoef" : 0.1, "trait" : "line", "color" : "afa370" },
  3159. /* 47 */ { "x" : -400, "y" : -70, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  3160. /* 48 */ { "x" : -400, "y" : 70, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  3161. /* 49 */ { "x" : 400, "y" : -70, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  3162. /* 50 */ { "x" : 400, "y" : 70, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  3163. /* 51 */ { "x" : 0, "y" : -2, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  3164. /* 52 */ { "x" : 0, "y" : 2, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  3165. /* 53 */ { "x" : 0, "y" : -2, "bCoef" : 0.1, "trait" : "line", "curve" : 180, "color" : "737573" },
  3166. /* 54 */ { "x" : 0, "y" : 2, "bCoef" : 0.1, "trait" : "line", "curve" : 180, "color" : "737573" },
  3167. /* 55 */ { "x" : -398, "y" : -130, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  3168. /* 56 */ { "x" : -398, "y" : 130, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  3169. /* 57 */ { "x" : 398, "y" : -130, "bCoef" : 0.1, "trait" : "line", "curve" : -180, "color" : "737573" },
  3170. /* 58 */ { "x" : 398, "y" : 130, "bCoef" : 0.1, "trait" : "line", "curve" : -180, "color" : "737573" },
  3171. /* 59 */ { "x" : 350, "y" : -2, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  3172. /* 60 */ { "x" : 350, "y" : 2, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  3173. /* 61 */ { "x" : 350, "y" : -2, "bCoef" : 0.1, "trait" : "line", "curve" : 180, "color" : "737573" },
  3174. /* 62 */ { "x" : 350, "y" : 2, "bCoef" : 0.1, "trait" : "line", "curve" : 180, "color" : "737573" },
  3175. /* 63 */ { "x" : -350, "y" : -2, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  3176. /* 64 */ { "x" : -350, "y" : 2, "bCoef" : 0.1, "trait" : "line", "color" : "737573" },
  3177. /* 65 */ { "x" : -350, "y" : -2, "bCoef" : 0.1, "trait" : "line", "curve" : 180, "color" : "737573" },
  3178. /* 66 */ { "x" : -350, "y" : 2, "bCoef" : 0.1, "trait" : "line", "curve" : 180, "color" : "737573" }
  3179.  
  3180. ],
  3181.  
  3182. "segments" : [
  3183. { "v0" : 6, "v1" : 7, "curve" : 0, "color" : "DA4D4B", "cMask" : ["ball" ], "trait" : "goalNet", "pos" : [-700,-80 ], "y" : -70 },
  3184. { "v0" : 7, "v1" : 8, "curve" : -23, "color" : "DA4D4B", "cMask" : ["ball" ], "trait" : "goalNet", "x" : -440, "bCoef" : 0.8 },
  3185. { "v0" : 8, "v1" : 9, "curve" : 0, "color" : "DA4D4B", "cMask" : ["ball" ], "trait" : "goalNet", "pos" : [-700,80 ], "y" : 70 },
  3186. { "v0" : 10, "v1" : 11, "curve" : 0, "color" : "3377ae", "cMask" : ["ball" ], "trait" : "goalNet", "pos" : [700,-80 ], "y" : -70 },
  3187. { "v0" : 11, "v1" : 12, "curve" : 23, "color" : "3377ae", "cMask" : ["ball" ], "trait" : "goalNet", "x" : 440, "bCoef" : 0.8 },
  3188. { "v0" : 12, "v1" : 13, "curve" : 0, "color" : "3377ae", "cMask" : ["ball" ], "trait" : "goalNet", "pos" : [700,80 ], "y" : 70 },
  3189.  
  3190. { "v0" : 2, "v1" : 3, "trait" : "kickOffBarrier" },
  3191. { "v0" : 3, "v1" : 4, "curve" : 180, "vis" : true, "color" : "DA4D4B", "cGroup" : ["blueKO" ], "trait" : "kickOffBarrier" },
  3192. { "v0" : 3, "v1" : 4, "curve" : -180, "vis" : true, "color" : "3377ae", "cGroup" : ["redKO" ], "trait" : "kickOffBarrier" },
  3193. { "v0" : 4, "v1" : 5, "trait" : "kickOffBarrier" },
  3194.  
  3195. { "v0" : 14, "v1" : 15, "vis" : true, "color" : "1e252a", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : -400 },
  3196. { "v0" : 16, "v1" : 17, "vis" : true, "color" : "1e252a", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : -400 },
  3197. { "v0" : 18, "v1" : 19, "curve" : 0, "vis" : true, "color" : "1e252a", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "y" : 190 },
  3198. { "v0" : 20, "v1" : 21, "vis" : true, "color" : "1e252a", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 400 },
  3199. { "v0" : 22, "v1" : 23, "vis" : true, "color" : "1e252a", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 400 },
  3200. { "v0" : 24, "v1" : 25, "vis" : true, "color" : "F8F8F8", "bCoef" : 0, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 400, "y" : -190 },
  3201. { "v0" : 26, "v1" : 27, "curve" : 0, "vis" : true, "color" : "1e252a", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "y" : -190 },
  3202.  
  3203. { "v0" : 28, "v1" : 29, "vis" : true, "color" : "737573", "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier" },
  3204. { "v0" : 30, "v1" : 31, "vis" : true, "color" : "737573", "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier" },
  3205.  
  3206. { "v0" : 38, "v1" : 39, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "x" : -407.5 },
  3207. { "v0" : 40, "v1" : 41, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "x" : -407.5 },
  3208. { "v0" : 42, "v1" : 43, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 407.5 },
  3209. { "v0" : 44, "v1" : 45, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 407.5 },
  3210.  
  3211. { "v0" : 47, "v1" : 48, "curve" : 0, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line", "x" : -400 },
  3212. { "v0" : 49, "v1" : 50, "curve" : 0, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line", "x" : 400 },
  3213. { "v0" : 51, "v1" : 52, "curve" : -180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line" },
  3214. { "v0" : 53, "v1" : 54, "curve" : 180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line" },
  3215. { "v0" : 55, "v1" : 56, "curve" : 180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line" },
  3216. { "v0" : 57, "v1" : 58, "curve" : -180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line", "x" : 400 },
  3217. { "v0" : 59, "v1" : 60, "curve" : -180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line", "x" : 350 },
  3218. { "v0" : 61, "v1" : 62, "curve" : 180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line", "x" : 350 },
  3219. { "v0" : 63, "v1" : 64, "curve" : -180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line", "x" : -350 },
  3220. { "v0" : 65, "v1" : 66, "curve" : 180, "vis" : true, "color" : "737573", "bCoef" : 0.1, "trait" : "line", "x" : -350 }
  3221.  
  3222. ],
  3223.  
  3224. "goals" : [
  3225. { "p0" : [-406.3,-70 ], "p1" : [-406.3,70 ], "team" : "red" },
  3226. { "p0" : [406.3,70 ], "p1" : [406.3,-70 ], "team" : "blue" }
  3227.  
  3228. ],
  3229.  
  3230. "discs" : [
  3231. { "radius" : 5, "pos" : [-400,70 ], "color" : "ce9e9e", "trait" : "goalPost", "y" : 80 },
  3232. { "radius" : 5, "pos" : [-400,-70 ], "color" : "ce9e9e", "trait" : "goalPost", "y" : -80, "x" : -560 },
  3233. { "radius" : 5, "pos" : [400,70 ], "color" : "9eafce", "trait" : "goalPost", "y" : 80 },
  3234. { "radius" : 5, "pos" : [400,-70 ], "color" : "9eafce", "trait" : "goalPost", "y" : -80 }
  3235.  
  3236. ],
  3237.  
  3238. "planes" : [
  3239. { "normal" : [0,1 ], "dist" : -190, "bCoef" : 1, "trait" : "ballArea", "vis" : false, "curve" : 0 },
  3240. { "normal" : [0,-1 ], "dist" : -190, "bCoef" : 1, "trait" : "ballArea" },
  3241.  
  3242. { "normal" : [0,1 ], "dist" : -220, "bCoef" : 0.1 },
  3243. { "normal" : [0,-1 ], "dist" : -220, "bCoef" : 0.1 },
  3244. { "normal" : [1,0 ], "dist" : -492, "bCoef" : 0.1 },
  3245. { "normal" : [-1,0 ], "dist" : -492, "bCoef" : 0.1 },
  3246.  
  3247. { "normal" : [1,0 ], "dist" : -490, "bCoef" : 0.1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 },
  3248. { "normal" : [-1,0 ], "dist" : -490, "bCoef" : 0.1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 }
  3249.  
  3250. ],
  3251.  
  3252. "traits" : {
  3253. "ballArea" : { "vis" : false, "bCoef" : 1, "cMask" : ["ball" ] },
  3254. "goalPost" : { "radius" : 8, "invMass" : 0, "bCoef" : 0.5 },
  3255. "goalNet" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["ball" ] },
  3256. "line" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["" ] },
  3257. "kickOffBarrier" : { "vis" : false, "bCoef" : 0.1, "cGroup" : ["redKO","blueKO" ], "cMask" : ["red","blue" ] }
  3258.  
  3259. },
  3260.  
  3261. "playerPhysics" : {
  3262. "bCoef" : 0,
  3263. "acceleration" : 0.11,
  3264. "kickingAcceleration" : 0.083,
  3265. "kickStrength" : 4.2
  3266.  
  3267. },
  3268.  
  3269. "ballPhysics" : {
  3270. "radius" : 5.8,
  3271. "bCoef" : 0.412,
  3272. "invMass" : 1.5,
  3273. "damping" : 0.99,
  3274. "color" : "ffd133"
  3275.  
  3276. }
  3277. }`;
  3278.  
  3279.  
  3280. var maps = {
  3281. "big": bigmap,
  3282. "medium": mediummap,
  3283. "small": smallmap
  3284. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement