Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 112.24 KB | None | 0 0
  1. // Stats: "Auth" : '["0-Games", "1-Wins", "2-Draws", "3-Losses", "4-Winrate", "5-Goals", "6-Assists", "7-GK", "8-CS", "9-CS%", "10-Role", "11-Nick"]'
  2.  
  3. /* VARIABLES */
  4.  
  5. /* ROOM */
  6.  
  7. const roomName = "🔴(S.L.H) Gold";
  8. const botName = "LProject";
  9. const maxPlayers = 16;
  10. const roomPublic = true;
  11. const geo = [{"code": "", "lat": 52, "lon": 19}, {"code": "FR", "lat": 46.2, "lon": 2.2}, {"code": "PL", "lat": 51.9, "lon": 19.1}, {"code": "GB", "lat": 55.3, "lon": -3.4}, {"code": "PT", "lat": 39.3, "lon": -8.2}];
  12.  
  13. const room = HBInit({ roomName: roomName, maxPlayers: maxPlayers, public: roomPublic, playerName: botName, geo: geo[0] });
  14.  
  15. const scoreLimitClassic = 3;
  16. const scoreLimitBig = 3;
  17. const timeLimitClassic = 3;
  18. const timeLimitBig = 3;
  19.  
  20. room.setTeamsLock(true);
  21.  
  22. var adminPassword = 1000 + getRandomInt(9000);
  23. console.log("adminPassword : " + adminPassword);
  24.  
  25. /* STADIUM */
  26.  
  27. const playerRadius = 15;
  28. var ballRadius = 10;
  29. const triggerDistance = playerRadius + ballRadius + 0.01;
  30. var aloneMap = '{"name" : "Futsal 1v SP", "width" : 420, "height" : 200, "spawnDistance" : 180, "bg" : { "type" : "hockey", "width" : 0, "height" : 0, "kickOffRadius" : 50, "cornerRadius" : 0 }, "vertexes" : [ /* 0 */ { "x" : -368, "y" : 171, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "color" : "000000" }, /* 1 */ { "x" : -368, "y" : 50, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "color" : "000000", "curve" : 0 }, /* 2 */ { "x" : -368, "y" : -50, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "color" : "000000", "curve" : 0 }, /* 3 */ { "x" : -368, "y" : -171, "trait" : "ballArea", "bCoef" : 1, "cMask" : ["ball" ], "color" : "000000" }, /* 4 */ { "x" : 368, "y" : 171, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "color" : "000000" }, /* 5 */ { "x" : 368, "y" : 50, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "color" : "000000", "curve" : 0 }, /* 6 */ { "x" : 368, "y" : -50, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "color" : "000000", "curve" : 0 }, /* 7 */ { "x" : 368, "y" : -171, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "color" : "000000" }, /* 8 */ { "x" : 0, "y" : 176, "trait" : "kickOffBarrier" }, /* 9 */ { "x" : 0, "y" : 50, "trait" : "kickOffBarrier", "color" : "686763" }, /* 10 */ { "x" : 0, "y" : -50, "trait" : "line", "color" : "686763" }, /* 11 */ { "x" : 0, "y" : -176, "trait" : "kickOffBarrier" }, /* 12 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : -416, "y" : -50, "color" : "FF0000", "curve" : 0 }, /* 13 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : 416, "y" : -49, "color" : "006FFF", "curve" : 0 }, /* 14 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : -416, "y" : 50, "color" : "FF0000", "curve" : 0 }, /* 15 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : 416, "y" : 51, "color" : "006FFF", "curve" : 0 }, /* 16 */ { "trait" : "line", "x" : -368, "y" : -127 }, /* 17 */ { "trait" : "line", "x" : 368, "y" : -127 }, /* 18 */ { "trait" : "line", "x" : -368, "y" : 127 }, /* 19 */ { "trait" : "line", "x" : 368, "y" : 127 }, /* 20 */ { "bCoef" : 0, "trait" : "line", "x" : -350, "y" : -171 }, /* 21 */ { "bCoef" : 0, "trait" : "line", "x" : -368, "y" : -163 }, /* 22 */ { "bCoef" : 0, "trait" : "line", "x" : 350, "y" : -171 }, /* 23 */ { "bCoef" : 0, "trait" : "line", "x" : 368, "y" : -163 }, /* 24 */ { "bCoef" : 0, "trait" : "line", "x" : -350, "y" : 171 }, /* 25 */ { "bCoef" : 0, "trait" : "line", "x" : -368, "y" : 163 }, /* 26 */ { "bCoef" : 0, "trait" : "line", "x" : 350, "y" : 171 }, /* 27 */ { "bCoef" : 0, "trait" : "line", "x" : 368, "y" : 163 }, /* 28 */ { "bCoef" : 1, "trait" : "ballArea", "x" : 368, "y" : 171, "color" : "000000" }, /* 29 */ { "bCoef" : 1, "trait" : "ballArea", "x" : 368, "y" : -171, "color" : "000000" }, /* 30 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : 171, "color" : "686763" }, /* 31 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -171, "color" : "686763" }, /* 32 */ { "x" : 0, "y" : 50, "trait" : "kickOffBarrier", "color" : "686763" }, /* 33 */ { "x" : 0, "y" : -50, "trait" : "kickOffBarrier", "color" : "686763" }, /* 34 */ { "x" : 377, "y" : -49, "trait" : "line", "cMask" : ["red" ], "bCoef" : 1, "curve" : 0 }, /* 35 */ { "x" : 377, "y" : -170, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1 }, /* 36 */ { "x" : -377, "y" : -50, "trait" : "line", "cMask" : ["blue" ], "bCoef" : 1, "curve" : 0 }, /* 37 */ { "x" : -377, "y" : -171, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1 }, /* 38 */ { "x" : -377, "y" : 50, "trait" : "line", "cMask" : ["blue" ], "bCoef" : 1, "curve" : 0 }, /* 39 */ { "x" : -377, "y" : 171, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1 }, /* 40 */ { "x" : 377, "y" : 50, "trait" : "line", "cMask" : ["red" ], "bCoef" : 1, "curve" : 0 }, /* 41 */ { "x" : 377, "y" : 171, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1 }, /* 42 */ { "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "x" : -48.75, "y" : -176.5, "color" : "0088FF" }, /* 43 */ { "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "x" : -33.75, "y" : -177.5, "color" : "0088FF" }, /* 44 */ { "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "x" : -34.75, "y" : -186.5, "color" : "0088FF" }, /* 45 */ { "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "x" : -46.75, "y" : -186.5, "color" : "0088FF" }, /* 46 */ { "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "x" : -46.75, "y" : -195.5, "color" : "0088FF" }, /* 47 */ { "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "x" : -32.75, "y" : -195.5, "color" : "0088FF" }, /* 48 */ { "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "x" : -15.75, "y" : -195.5, "color" : "0088FF" }, /* 49 */ { "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "x" : -15.75, "y" : -175.5, "color" : "0088FF" }, /* 50 */ { "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "x" : -0.75, "y" : -175.5, "color" : "0088FF" }, /* 51 */ { "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "x" : 22.25, "y" : -196.5, "color" : "0088FF" }, /* 52 */ { "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "x" : 23.25, "y" : -175.5, "color" : "0088FF" }, /* 53 */ { "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "x" : 10.25, "y" : -196.5, "color" : "0088FF" }, /* 54 */ { "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "x" : 11.25, "y" : -174.5, "color" : "0088FF" }, /* 55 */ { "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "x" : 11.25, "y" : -186.5, "color" : "0088FF" }, /* 56 */ { "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "x" : 22.25, "y" : -186.5, "color" : "0088FF" }, /* 57 */ { "bCoef" : 0, "trait" : "line", "x" : -279, "y" : -169.33334350585938, "cMask" : ["wall" ], "color" : "686763" }, /* 58 */ { "bCoef" : 0, "trait" : "line", "x" : -279, "y" : 169.66665649414062, "cMask" : ["wall" ], "color" : "686763" }, /* 59 */ { "bCoef" : 0, "trait" : "line", "x" : 265, "y" : -169.33334350585938, "curve" : 0, "cMask" : ["wall" ], "color" : "686763" }, /* 60 */ { "bCoef" : 0, "trait" : "line", "x" : 265, "y" : 169.66665649414062, "curve" : 0, "cMask" : ["wall" ], "color" : "686763" } ], "segments" : [ { "v0" : 0, "v1" : 1, "trait" : "ballArea" }, { "v0" : 2, "v1" : 3, "trait" : "ballArea" }, { "v0" : 4, "v1" : 5, "trait" : "ballArea" }, { "v0" : 6, "v1" : 7, "trait" : "ballArea" }, { "v0" : 8, "v1" : 9, "trait" : "kickOffBarrier" }, { "v0" : 9, "v1" : 10, "trait" : "kickOffBarrier", "curve" : 180, "cGroup" : ["blueKO" ] }, { "v0" : 9, "v1" : 10, "trait" : "kickOffBarrier", "curve" : -180, "cGroup" : ["redKO" ] }, { "v0" : 10, "v1" : 11, "trait" : "kickOffBarrier" }, { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 2, "v1" : 12, "color" : "FF0000", "curve" : 0 }, { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 6, "v1" : 13, "color" : "006FFF", "curve" : 0 }, { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 1, "v1" : 14, "color" : "FF0000", "curve" : 0 }, { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 5, "v1" : 15, "color" : "006FFF", "curve" : 0 }, { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 12, "v1" : 14, "x" : -585, "color" : "FF0000", "curve" : 0 }, { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 13, "v1" : 15, "x" : 585, "color" : "006FFF", "curve" : 0 }, { "vis" : true, "color" : "000000", "bCoef" : 1, "trait" : "ballArea", "v0" : 1, "v1" : 0, "cMask" : ["ball" ], "x" : -368 }, { "vis" : true, "color" : "000000", "bCoef" : 1, "trait" : "ballArea", "v0" : 5, "v1" : 4, "cMask" : ["ball" ], "x" : 368 }, { "vis" : true, "color" : "000000", "bCoef" : 1, "trait" : "ballArea", "v0" : 2, "v1" : 3, "cMask" : ["ball" ], "x" : -368 }, { "vis" : true, "color" : "000000", "bCoef" : 1, "trait" : "ballArea", "v0" : 6, "v1" : 7, "cMask" : ["ball" ], "x" : 368 }, { "vis" : true, "color" : "000000", "bCoef" : 1, "trait" : "ballArea", "v0" : 0, "v1" : 28, "y" : 171 }, { "vis" : true, "color" : "000000", "bCoef" : 1, "trait" : "ballArea", "v0" : 3, "v1" : 29, "y" : -171 }, { "curve" : 0, "vis" : true, "color" : "686763", "bCoef" : 0, "trait" : "line", "v0" : 30, "v1" : 31 }, { "curve" : -180, "vis" : true, "color" : "686763", "bCoef" : 0, "trait" : "line", "v0" : 10, "v1" : 9 }, { "curve" : 180, "vis" : true, "color" : "686763", "bCoef" : 0, "trait" : "line", "v0" : 33, "v1" : 32 }, { "curve" : 0, "vis" : true, "color" : "A80000", "bCoef" : 0, "trait" : "line", "v0" : 2, "v1" : 1 }, { "curve" : 0, "vis" : true, "color" : "0044FF", "bCoef" : 0, "trait" : "line", "v0" : 6, "v1" : 5 }, { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 34, "v1" : 35, "cMask" : ["ball" ], "x" : 330 }, { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 36, "v1" : 37, "cMask" : ["ball" ], "x" : -330 }, { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 38, "v1" : 39, "cMask" : ["ball" ], "x" : -330 }, { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 40, "v1" : 41, "cMask" : ["ball" ], "x" : 330 }, { "vis" : true, "color" : "0088FF", "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "v0" : 42, "v1" : 43 }, { "vis" : true, "color" : "0088FF", "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "v0" : 43, "v1" : 44 }, { "vis" : true, "color" : "0088FF", "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "v0" : 44, "v1" : 45 }, { "vis" : true, "color" : "0088FF", "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "v0" : 45, "v1" : 46 }, { "vis" : true, "color" : "0088FF", "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "v0" : 46, "v1" : 47 }, { "vis" : true, "color" : "0088FF", "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "v0" : 48, "v1" : 49 }, { "vis" : true, "color" : "0088FF", "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "v0" : 49, "v1" : 50 }, { "vis" : true, "color" : "0088FF", "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "v0" : 51, "v1" : 52 }, { "vis" : true, "color" : "0088FF", "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "v0" : 53, "v1" : 54 }, { "vis" : true, "color" : "0088FF", "bCoef" : 1, "cMask" : ["wall" ], "trait" : "ballArea", "v0" : 55, "v1" : 56 }, { "curve" : 0, "vis" : true, "color" : "686763", "bCoef" : 0, "trait" : "line", "v0" : 57, "v1" : 58, "cMask" : ["wall" ] }, { "curve" : 0, "vis" : true, "color" : "686763", "bCoef" : 0, "trait" : "line", "v0" : 59, "v1" : 60, "cMask" : ["wall" ] } ], "goals" : [ { "p0" : [-377,-49 ], "p1" : [-377,51 ], "team" : "red" }, { "p0" : [377,51 ], "p1" : [377,-49 ], "team" : "blue" } ], "discs" : [ { "pos" : [-368,50 ], "trait" : "goalPost", "color" : "FF0000", "radius" : 4 }, { "pos" : [-367,-50 ], "trait" : "goalPost", "color" : "FF0000", "radius" : 4 }, { "pos" : [368,50 ], "trait" : "goalPost", "color" : "006FFF", "radius" : 4 }, { "pos" : [368,-50 ], "trait" : "goalPost", "color" : "006FFF", "radius" : 4 }, { "pos" : [415,-50 ], "trait" : "goalPost", "color" : "006FFF", "radius" : 4 }, { "pos" : [415,51 ], "trait" : "goalPost", "color" : "006FFF", "radius" : 4 }, { "pos" : [-415,-49 ], "trait" : "goalPost", "color" : "FF0000", "radius" : 4 }, { "pos" : [-415,50 ], "trait" : "goalPost", "color" : "FF0000", "radius" : 4 } ], "planes" : [ { "normal" : [0,1 ], "dist" : -171, "trait" : "ballArea" }, { "normal" : [0,-1 ], "dist" : -171, "trait" : "ballArea" }, { "normal" : [0,1 ], "dist" : -200, "bCoef" : 0.2, "cMask" : ["all" ] }, { "normal" : [0,-1 ], "dist" : -200, "bCoef" : 0.2, "cMask" : ["all" ] }, { "normal" : [1,0 ], "dist" : -420, "bCoef" : 0.2, "cMask" : ["all" ] }, { "normal" : [-1,0 ], "dist" : -420, "bCoef" : 0.2, "cMask" : ["all" ] } ], "traits" : { "ballArea" : { "vis" : false, "bCoef" : 1, "cMask" : ["ball" ] }, "goalPost" : { "radius" : 8, "invMass" : 0, "bCoef" : 1 }, "goalNet" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ] }, "kickOffBarrier" : { "vis" : false, "bCoef" : 0.1, "cGroup" : ["redKO","blueKO" ], "cMask" : ["red","blue" ] }, "line" : { "vis" : true, "bCoef" : 0, "cMask" : ["" ] }, "arco" : { "radius" : 2, "cMask" : ["n/d" ], "color" : "cccccc" } }, "playerPhysics" : { "acceleration" : 0.11, "kickingAcceleration" : 0.1, "kickStrength" : 7 }, "ballPhysics" : { "radius" : 6.1, "color" : "fff40d"}}'
  31. var classicMap = '{"name" : "Futsal v2 SP", "width" : 625, "height" : 280, "spawnDistance" : 280, "bg" : { "type" : "hockey", "width" : 0, "height" : 0, "kickOffRadius" : 80, "cornerRadius" : 0 }, "vertexes" : [ /* 0 */ { "x" : -550, "y" : 240, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "color" : "000000" }, /* 1 */ { "x" : -550, "y" : 80, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "color" : "000000", "curve" : 0 }, /* 2 */ { "x" : -550, "y" : -80, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "color" : "000000", "curve" : 0 }, /* 3 */ { "x" : -550, "y" : -240, "trait" : "ballArea", "bCoef" : 1, "cMask" : ["ball" ], "color" : "000000" }, /* 4 */ { "x" : 550, "y" : 240, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "color" : "000000" }, /* 5 */ { "x" : 550, "y" : 80, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "color" : "000000", "curve" : 0 }, /* 6 */ { "x" : 550, "y" : -80, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "color" : "000000", "curve" : 0 }, /* 7 */ { "x" : 550, "y" : -240, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "color" : "000000" }, /* 8 */ { "x" : 0, "y" : 280, "trait" : "kickOffBarrier" }, /* 9 */ { "x" : 0, "y" : 80, "trait" : "kickOffBarrier", "color" : "686763" }, /* 10 */ { "x" : 0, "y" : -80, "trait" : "line", "color" : "686763" }, /* 11 */ { "x" : 0, "y" : -280, "trait" : "kickOffBarrier" }, /* 12 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : -604, "y" : -79, "color" : "FF0800", "curve" : 0 }, /* 13 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : 603, "y" : -80, "color" : "0044FF", "curve" : 0 }, /* 14 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : -604, "y" : 79, "color" : "FF0800", "curve" : 0 }, /* 15 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : 603, "y" : 81, "color" : "0044FF", "curve" : 0 }, /* 16 */ { "trait" : "line", "x" : -550, "y" : -195, "color" : "686763" }, /* 17 */ { "trait" : "line", "x" : 550, "y" : -195, "color" : "686763" }, /* 18 */ { "trait" : "line", "x" : -550, "y" : 195, "color" : "686763" }, /* 19 */ { "trait" : "line", "x" : 550, "y" : 195, "color" : "686763" }, /* 20 */ { "bCoef" : 0, "trait" : "line", "x" : -530, "y" : -240 }, /* 21 */ { "bCoef" : 0, "trait" : "line", "x" : -550, "y" : -220 }, /* 22 */ { "bCoef" : 0, "trait" : "line", "x" : 530, "y" : -240 }, /* 23 */ { "bCoef" : 0, "trait" : "line", "x" : 550, "y" : -220 }, /* 24 */ { "bCoef" : 0, "trait" : "line", "x" : -530, "y" : 240 }, /* 25 */ { "bCoef" : 0, "trait" : "line", "x" : -550, "y" : 220 }, /* 26 */ { "bCoef" : 0, "trait" : "line", "x" : 530, "y" : 240 }, /* 27 */ { "bCoef" : 0, "trait" : "line", "x" : 550, "y" : 220 }, /* 28 */ { "bCoef" : 1, "trait" : "ballArea", "x" : 550, "y" : 240, "color" : "000000" }, /* 29 */ { "bCoef" : 1, "trait" : "ballArea", "x" : 550, "y" : -240, "color" : "000000" }, /* 30 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : 238, "color" : "686763" }, /* 31 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -237, "color" : "686763" }, /* 32 */ { "x" : 0, "y" : 80, "trait" : "kickOffBarrier", "color" : "686763" }, /* 33 */ { "x" : 0, "y" : -80, "trait" : "kickOffBarrier", "color" : "686763" }, /* 34 */ { "bCoef" : 0, "trait" : "ballArea", "x" : -550, "y" : -130 }, /* 35 */ { "bCoef" : 0, "trait" : "ballArea", "x" : 550, "y" : -130 }, /* 36 */ { "bCoef" : 0, "trait" : "ballArea", "x" : -550, "y" : 130 }, /* 37 */ { "bCoef" : 0, "trait" : "ballArea", "x" : 550, "y" : 130 }, /* 38 */ { "x" : 559, "y" : -80, "trait" : "line", "cMask" : ["red" ], "bCoef" : 1 }, /* 39 */ { "x" : 559, "y" : -240, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1 }, /* 40 */ { "x" : -559, "y" : -80, "trait" : "line", "cMask" : ["blue" ], "bCoef" : 1 }, /* 41 */ { "x" : -559, "y" : -240, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1 }, /* 42 */ { "x" : -559, "y" : 80, "trait" : "line", "cMask" : ["blue" ], "bCoef" : 1 }, /* 43 */ { "x" : -559, "y" : 240, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1 }, /* 44 */ { "x" : 559, "y" : 80, "trait" : "line", "cMask" : ["red" ], "bCoef" : 1 }, /* 45 */ { "x" : 559, "y" : 240, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1 }, /* 46 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -3 }, /* 47 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -3 }, /* 48 */ { "bCoef" : 0, "trait" : "line", "x" : -63.18181610107422, "y" : -248.53976440429688, "color" : "0088FF", "cMask" : ["wall" ] }, /* 49 */ { "bCoef" : 0, "trait" : "line", "x" : -44.18181610107422, "y" : -248.53976440429688, "color" : "0088FF", "cMask" : ["wall" ] }, /* 50 */ { "bCoef" : 0, "trait" : "line", "x" : -45.66666793823242, "y" : -261.3333435058594, "cMask" : ["wall" ], "color" : "0088FF" }, /* 51 */ { "bCoef" : 0, "trait" : "line", "x" : -63.66666793823242, "y" : -261.3333435058594, "cMask" : ["wall" ], "color" : "0088FF" }, /* 52 */ { "bCoef" : 0, "trait" : "line", "x" : -63.66666793823242, "y" : -275.3333435058594, "color" : "0088FF", "cMask" : ["wall" ] }, /* 53 */ { "bCoef" : 0, "trait" : "line", "x" : -45.66666793823242, "y" : -275.3333435058594, "color" : "0088FF", "cMask" : ["wall" ] }, /* 54 */ { "bCoef" : 0, "trait" : "line", "x" : -15.666667938232422, "y" : -276.3333435058594, "cMask" : ["wall" ], "color" : "0088FF" }, /* 55 */ { "bCoef" : 0, "trait" : "line", "x" : -14.666667938232422, "y" : -247.33334350585938, "cMask" : ["wall" ], "color" : "0088FF" }, /* 56 */ { "bCoef" : 0, "trait" : "line", "x" : 9.333332061767578, "y" : -247.33334350585938, "cMask" : ["wall" ], "color" : "0088FF" }, /* 57 */ { "bCoef" : 0, "trait" : "line", "x" : 64.33333206176758, "y" : -275.3333435058594, "cMask" : ["wall" ], "color" : "0088FF" }, /* 58 */ { "bCoef" : 0, "trait" : "line", "x" : 64.33333206176758, "y" : -246.33334350585938, "cMask" : ["wall" ], "color" : "0088FF" }, /* 59 */ { "bCoef" : 0, "trait" : "line", "x" : 43.33333206176758, "y" : -275.3333435058594, "color" : "0088FF", "cMask" : ["wall" ] }, /* 60 */ { "bCoef" : 0, "trait" : "line", "x" : 43.33333206176758, "y" : -246.33334350585938, "color" : "0088FF", "cMask" : ["wall" ] }, /* 61 */ { "bCoef" : 0, "trait" : "line", "x" : 44.33333206176758, "y" : -260.3333435058594, "cMask" : ["wall" ], "color" : "0088FF" }, /* 62 */ { "bCoef" : 0, "trait" : "line", "x" : 64.33333206176758, "y" : -260.3333435058594, "cMask" : ["wall" ], "color" : "0088FF" }, /* 63 */ { "bCoef" : 0, "trait" : "line", "x" : -443, "y" : 238, "color" : "686763" }, /* 64 */ { "bCoef" : 0, "trait" : "line", "x" : -442.79999923706055, "y" : 237.5999984741211 }, /* 65 */ { "bCoef" : 0, "trait" : "line", "x" : -440.79999923706055, "y" : -234.4000015258789 } ], "segments" : [ { "v0" : 0, "v1" : 1, "trait" : "ballArea" }, { "v0" : 2, "v1" : 3, "trait" : "ballArea" }, { "v0" : 4, "v1" : 5, "trait" : "ballArea" }, { "v0" : 6, "v1" : 7, "trait" : "ballArea" }, { "v0" : 8, "v1" : 9, "trait" : "kickOffBarrier" }, { "v0" : 9, "v1" : 10, "trait" : "kickOffBarrier", "curve" : 180, "cGroup" : ["blueKO" ] }, { "v0" : 9, "v1" : 10, "trait" : "kickOffBarrier", "curve" : -180, "cGroup" : ["redKO" ] }, { "v0" : 10, "v1" : 11, "trait" : "kickOffBarrier" }, { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 2, "v1" : 12, "color" : "FF0800", "curve" : 0 }, { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 6, "v1" : 13, "color" : "0044FF", "curve" : 0 }, { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 1, "v1" : 14, "color" : "FF0800", "curve" : 0 }, { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 5, "v1" : 15, "color" : "0044FF", "curve" : 0 }, { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 12, "v1" : 14, "x" : -585, "color" : "FF0800", "curve" : 0 }, { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 13, "v1" : 15, "x" : 585, "color" : "0044FF", "curve" : 0 }, { "vis" : true, "color" : "000000", "bCoef" : 1, "trait" : "ballArea", "v0" : 1, "v1" : 0, "cMask" : ["ball" ] }, { "vis" : true, "color" : "000000", "bCoef" : 1, "trait" : "ballArea", "v0" : 5, "v1" : 4, "cMask" : ["ball" ] }, { "vis" : true, "color" : "000000", "bCoef" : 1, "trait" : "ballArea", "v0" : 2, "v1" : 3, "cMask" : ["ball" ] }, { "vis" : true, "color" : "000000", "bCoef" : 1, "trait" : "ballArea", "v0" : 6, "v1" : 7, "cMask" : ["ball" ] }, { "vis" : true, "color" : "000000", "bCoef" : 1, "trait" : "ballArea", "v0" : 0, "v1" : 28 }, { "vis" : true, "color" : "000000", "bCoef" : 1, "trait" : "ballArea", "v0" : 3, "v1" : 29 }, { "curve" : 0, "vis" : true, "color" : "686763", "bCoef" : 0, "trait" : "line", "v0" : 30, "v1" : 31 }, { "curve" : -180, "vis" : true, "color" : "686763", "bCoef" : 0, "trait" : "line", "v0" : 10, "v1" : 9 }, { "curve" : 180.44089219744086, "vis" : true, "color" : "686763", "bCoef" : 0, "trait" : "line", "v0" : 33, "v1" : 32 }, { "curve" : 0, "vis" : true, "color" : "9E0500", "bCoef" : 0, "trait" : "line", "v0" : 2, "v1" : 1 }, { "curve" : 0, "vis" : true, "color" : "0011FF", "bCoef" : 0, "trait" : "line", "v0" : 6, "v1" : 5 }, { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 38, "v1" : 39, "cMask" : ["ball" ], "x" : 559 }, { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 40, "v1" : 41, "cMask" : ["ball" ], "x" : -565 }, { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 42, "v1" : 43, "cMask" : ["ball" ], "x" : -565 }, { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 44, "v1" : 45, "cMask" : ["ball" ], "x" : 559 }, { "vis" : true, "color" : "0088FF", "bCoef" : 0, "trait" : "line", "v0" : 48, "v1" : 49, "cMask" : ["wall" ] }, { "vis" : true, "color" : "0088FF", "bCoef" : 0, "trait" : "line", "v0" : 49, "v1" : 50, "cMask" : ["wall" ] }, { "vis" : true, "color" : "0088FF", "bCoef" : 0, "trait" : "line", "v0" : 50, "v1" : 51, "cMask" : ["wall" ] }, { "vis" : true, "color" : "0088FF", "bCoef" : 0, "trait" : "line", "v0" : 51, "v1" : 52, "cMask" : ["wall" ] }, { "vis" : true, "color" : "0088FF", "bCoef" : 0, "trait" : "line", "v0" : 52, "v1" : 53, "cMask" : ["wall" ] }, { "vis" : true, "color" : "0088FF", "bCoef" : 0, "trait" : "line", "v0" : 54, "v1" : 55, "cMask" : ["wall" ] }, { "vis" : true, "color" : "0088FF", "bCoef" : 0, "trait" : "line", "v0" : 55, "v1" : 56, "cMask" : ["wall" ] }, { "vis" : true, "color" : "0088FF", "bCoef" : 0, "trait" : "line", "v0" : 57, "v1" : 58, "cMask" : ["wall" ] }, { "vis" : true, "color" : "0088FF", "bCoef" : 0, "trait" : "line", "v0" : 59, "v1" : 60, "cMask" : ["wall" ] }, { "vis" : true, "color" : "0088FF", "bCoef" : 0, "trait" : "line", "v0" : 61, "v1" : 62, "cMask" : ["wall" ] } ], "goals" : [ { "p0" : [-559,-80 ], "p1" : [-559,80 ], "team" : "red" }, { "p0" : [559,80 ], "p1" : [559,-80 ], "team" : "blue" } ], "discs" : [ { "pos" : [-550,80 ], "trait" : "goalPost", "color" : "e56e56", "radius" : 7 }, { "pos" : [-550,-80 ], "trait" : "goalPost", "color" : "e56e56", "radius" : 7 }, { "pos" : [550,80 ], "trait" : "goalPost", "color" : "5689e5", "radius" : 7 }, { "pos" : [550,-80 ], "trait" : "goalPost", "color" : "5689e5", "radius" : 7 }, { "pos" : [-604,78 ], "trait" : "goalPost", "color" : "e56e56", "radius" : 7 }, { "pos" : [-603,-79 ], "trait" : "goalPost", "color" : "e56e56", "radius" : 7 }, { "pos" : [602,-79 ], "trait" : "goalPost", "color" : "5689e5", "radius" : 7 }, { "pos" : [602,80 ], "trait" : "goalPost", "color" : "5689e5", "radius" : 7 } ], "planes" : [ { "normal" : [0,1 ], "dist" : -240, "trait" : "ballArea" }, { "normal" : [0,-1 ], "dist" : -240, "trait" : "ballArea" }, { "normal" : [0,1 ], "dist" : -280, "bCoef" : 0.2, "cMask" : ["all" ] }, { "normal" : [0,-1 ], "dist" : -280, "bCoef" : 0.2, "cMask" : ["all" ] }, { "normal" : [1,0 ], "dist" : -625, "bCoef" : 0.2, "cMask" : ["all" ] }, { "normal" : [-1,0 ], "dist" : -625, "bCoef" : 0.2, "cMask" : ["all" ] } ], "traits" : { "ballArea" : { "vis" : false, "bCoef" : 1, "cMask" : ["ball" ] }, "goalPost" : { "radius" : 8, "invMass" : 0, "bCoef" : 1 }, "goalNet" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ] }, "kickOffBarrier" : { "vis" : false, "bCoef" : 0.1, "cGroup" : ["redKO","blueKO" ], "cMask" : ["red","blue" ] }, "line" : { "vis" : true, "bCoef" : 0, "cMask" : ["" ] }, "arco" : { "radius" : 2, "cMask" : ["n/d" ], "color" : "cccccc" } }, "playerPhysics" : { "acceleration" : 0.11, "kickingAcceleration" : 0.1, "kickStrength" : 8 }, "ballPhysics" : { "radius" : 6.2, "color" : "fff40d"}}'
  32. var bigMap = '{"name" : "4v4 Futsal Big SP", "width" : 800, "height" : 350, "spawnDistance" : 350, "bg" : { "type" : "hockey", "width" : 0, "height" : 0, "kickOffRadius" : 80, "cornerRadius" : 0 }, "vertexes" : [ /* 0 */ { "x" : -700, "y" : 320, "trait" : "ballArea" }, /* 1 */ { "x" : -700, "y" : -320, "trait" : "ballArea" }, /* 2 */ { "x" : 700, "y" : 320, "trait" : "ballArea" }, /* 3 */ { "x" : 700, "y" : -320, "trait" : "ballArea" }, /* 4 */ { "x" : 0, "y" : 350, "trait" : "kickOffBarrier" }, /* 5 */ { "x" : 0, "y" : 80, "trait" : "kickOffBarrier", "color" : "686763", "vis" : true, "curve" : 180 }, /* 6 */ { "x" : 0, "y" : -80, "trait" : "kickOffBarrier", "color" : "686763", "vis" : true, "curve" : 180 }, /* 7 */ { "x" : 0, "y" : -350, "trait" : "kickOffBarrier" }, /* 8 */ { "x" : -700, "y" : -85, "trait" : "goalNet", "curve" : 0, "color" : "FF1100" }, /* 9 */ { "x" : -741, "y" : -85, "trait" : "goalNet", "curve" : 0, "color" : "FF1100", "cMask" : ["ball" ], "vis" : true }, /* 10 */ { "x" : -741, "y" : 85, "trait" : "goalNet", "curve" : 0, "color" : "FF1100", "cMask" : ["ball" ], "vis" : true }, /* 11 */ { "x" : -700, "y" : 85, "trait" : "goalNet", "curve" : 0, "color" : "FF1100" }, /* 12 */ { "x" : 700, "y" : -85, "trait" : "goalNet", "curve" : 0, "color" : "2200FF" }, /* 13 */ { "x" : 743, "y" : -85, "trait" : "goalNet", "curve" : 0, "color" : "2200FF" }, /* 14 */ { "x" : 743, "y" : 84, "trait" : "goalNet", "curve" : 0, "color" : "2200FF" }, /* 15 */ { "x" : 700, "y" : 85, "trait" : "goalNet", "curve" : 0, "color" : "2200FF" }, /* 16 */ { "x" : -700, "y" : 85, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "000000", "curve" : 0 }, /* 17 */ { "x" : -700, "y" : 320, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "000000", "curve" : 0 }, /* 18 */ { "x" : -700, "y" : -85, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "000000" }, /* 19 */ { "x" : -700, "y" : -320, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "000000" }, /* 20 */ { "x" : -700, "y" : 320, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "000000" }, /* 21 */ { "x" : 700, "y" : 320, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "000000" }, /* 22 */ { "x" : 700, "y" : 85, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "000000" }, /* 23 */ { "x" : 700, "y" : 320, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "000000" }, /* 24 */ { "x" : 700, "y" : -320, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "000000" }, /* 25 */ { "x" : 700, "y" : -85, "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "000000" }, /* 26 */ { "x" : 700, "y" : -320, "bCoef" : 0, "cMask" : ["ball" ], "trait" : "ballArea" }, /* 27 */ { "x" : 700, "y" : -320, "bCoef" : 0, "cMask" : ["ball" ], "trait" : "ballArea" }, /* 28 */ { "x" : -700, "y" : -320, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "000000" }, /* 29 */ { "x" : 700, "y" : -320, "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea", "color" : "000000" }, /* 30 */ { "x" : 0, "y" : -318, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "686763" }, /* 31 */ { "x" : 0, "y" : -80, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "686763" }, /* 32 */ { "x" : 0, "y" : 80, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "686763" }, /* 33 */ { "x" : 0, "y" : 318, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "686763" }, /* 34 */ { "x" : 0, "y" : -80, "bCoef" : 0.1, "cMask" : ["red","blue" ], "trait" : "kickOffBarrier", "vis" : true, "color" : "F8F8F8" }, /* 35 */ { "x" : 0, "y" : 80, "bCoef" : 0.1, "cMask" : ["red","blue" ], "trait" : "kickOffBarrier", "vis" : true, "color" : "F8F8F8" }, /* 36 */ { "x" : 0, "y" : -150, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier" }, /* 37 */ { "x" : 0, "y" : 80, "trait" : "kickOffBarrier", "color" : "F8F8F8", "vis" : true, "curve" : -180 }, /* 38 */ { "x" : 0, "y" : -80, "trait" : "kickOffBarrier", "color" : "F8F8F8", "vis" : true, "curve" : -180 }, /* 39 */ { "x" : 0, "y" : 80, "trait" : "kickOffBarrier", "color" : "F8F8F8", "vis" : true, "curve" : 0 }, /* 40 */ { "x" : -698, "y" : 84, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false }, /* 41 */ { "x" : -697, "y" : 347, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false }, /* 42 */ { "x" : -697, "y" : 85, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false, "color" : "000000" }, /* 43 */ { "x" : -697, "y" : 348, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false, "color" : "000000" }, /* 44 */ { "x" : -697, "y" : -344, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 }, /* 45 */ { "x" : -697, "y" : -85, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 }, /* 46 */ { "x" : 697, "y" : -85, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea" }, /* 47 */ { "x" : 696, "y" : -348, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 }, /* 48 */ { "x" : 697, "y" : -87, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 }, /* 49 */ { "x" : 696, "y" : 84, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false }, /* 50 */ { "x" : 697, "y" : 348, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false }, /* 51 */ { "x" : -699, "y" : -86, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "C5FF05" }, /* 52 */ { "x" : -699, "y" : 81, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "C5FF05" }, /* 53 */ { "x" : 699, "y" : -83, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "C5FF05" }, /* 54 */ { "x" : 699, "y" : 84, "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier", "color" : "C5FF05" }, /* 55 */ { "x" : -385.5, "y" : 318, "bCoef" : 0, "cMask" : ["wall" ], "color" : "686763" }, /* 56 */ { "x" : -385.5, "y" : -319, "bCoef" : 0, "cMask" : ["wall" ], "color" : "686763" }, /* 57 */ { "x" : 385.5, "y" : 318, "bCoef" : 0, "cMask" : ["wall" ], "color" : "686763" }, /* 58 */ { "x" : 385.5, "y" : -319, "bCoef" : 0, "cMask" : ["wall" ], "color" : "686763" }, /* 59 */ { "cMask" : ["ball" ], "x" : -191.5, "y" : -327, "color" : "1499FF" }, /* 60 */ { "cMask" : ["ball" ], "x" : -172.5, "y" : -327, "color" : "1499FF" }, /* 61 */ { "cMask" : ["ball" ], "x" : -173, "y" : -335.5, "color" : "1499FF" }, /* 62 */ { "cMask" : ["ball" ], "x" : -190, "y" : -334.5, "color" : "1499FF" }, /* 63 */ { "cMask" : ["ball" ], "x" : -191, "y" : -345.5, "color" : "1499FF" }, /* 64 */ { "cMask" : ["ball" ], "x" : -172, "y" : -345.5, "color" : "1499FF" }, /* 65 */ { "cMask" : ["ball" ], "x" : -158, "y" : -347.5, "color" : "1499FF" }, /* 66 */ { "cMask" : ["ball" ], "x" : -158, "y" : -326.5, "color" : "1499FF" }, /* 67 */ { "cMask" : ["ball" ], "x" : -142, "y" : -327.5, "color" : "1499FF" }, /* 68 */ { "cMask" : ["ball" ], "x" : -142, "y" : -346.5, "color" : "1499FF" }, /* 69 */ { "cMask" : ["ball" ], "x" : -129, "y" : -327.5, "color" : "1499FF" }, /* 70 */ { "cMask" : ["ball" ], "x" : -129, "y" : -347.5, "color" : "1499FF" }, /* 71 */ { "cMask" : ["ball" ], "x" : -116, "y" : -346.5, "color" : "1499FF" }, /* 72 */ { "cMask" : ["ball" ], "x" : -116, "y" : -338.5, "color" : "1499FF" }, /* 73 */ { "cMask" : ["ball" ], "x" : -129, "y" : -338.5, "color" : "1499FF" }, /* 74 */ { "bCoef" : 0.1, "x" : -106, "y" : -348.5, "color" : "1499FF", "cMask" : ["ball" ] }, /* 75 */ { "bCoef" : 0.1, "x" : -106, "y" : -328.5, "color" : "1499FF", "cMask" : ["ball" ] }, /* 76 */ { "bCoef" : 0.1, "x" : -91, "y" : -347.5, "color" : "1499FF", "cMask" : ["ball" ] }, /* 77 */ { "bCoef" : 0.1, "x" : -106, "y" : -337.5, "color" : "1499FF", "cMask" : ["ball" ] }, /* 78 */ { "bCoef" : 0.1, "x" : -92, "y" : -337.5, "color" : "1499FF", "cMask" : ["ball" ] }, /* 79 */ { "bCoef" : 0.1, "x" : -89, "y" : -329.5, "color" : "1499FF", "cMask" : ["ball" ] }, /* 80 */ { "bCoef" : 0.1, "x" : -79, "y" : -328.5, "color" : "1499FF", "cMask" : ["ball" ] }, /* 81 */ { "bCoef" : 0.1, "x" : -78, "y" : -348.5, "color" : "1499FF", "cMask" : ["ball" ] }, /* 82 */ { "bCoef" : 0.1, "x" : -64, "y" : -344.5, "color" : "1499FF", "cMask" : ["ball" ] }, /* 83 */ { "bCoef" : 0.1, "x" : -76, "y" : -341.5, "color" : "1499FF", "cMask" : ["ball" ] }, /* 84 */ { "bCoef" : 0.1, "x" : -65, "y" : -328.5, "color" : "1499FF", "cMask" : ["ball" ] }, /* 85 */ { "bCoef" : 0.1, "x" : 71.33333206176758, "y" : -349.3333435058594, "cMask" : ["ball" ] }, /* 86 */ { "bCoef" : 0.1, "x" : 71.33333206176758, "y" : -327.3333435058594, "cMask" : ["ball" ] }, /* 87 */ { "bCoef" : 0.1, "x" : 92.33333206176758, "y" : -327.3333435058594, "cMask" : ["ball" ] }, /* 88 */ { "bCoef" : 0.1, "x" : 105.33333206176758, "y" : -349.3333435058594, "cMask" : ["ball" ] }, /* 89 */ { "bCoef" : 0.1, "x" : 105.33333206176758, "y" : -326.3333435058594, "cMask" : ["ball" ] }, /* 90 */ { "bCoef" : 0.1, "x" : 122.33333206176758, "y" : -348.3333435058594, "cMask" : ["ball" ] }, /* 91 */ { "bCoef" : 0.1, "x" : 106.33333206176758, "y" : -336.3333435058594, "cMask" : ["ball" ] }, /* 92 */ { "bCoef" : 0.1, "x" : 121.33333206176758, "y" : -336.3333435058594, "cMask" : ["ball" ] }, /* 93 */ { "bCoef" : 0.1, "x" : 121.33333206176758, "y" : -325.3333435058594, "cMask" : ["ball" ] }, /* 94 */ { "bCoef" : 0.1, "x" : 142.33333206176758, "y" : -349.3333435058594, "cMask" : ["ball" ] }, /* 95 */ { "bCoef" : 0.1, "x" : 135.33333206176758, "y" : -325.3333435058594, "cMask" : ["ball" ] }, /* 96 */ { "bCoef" : 0.1, "x" : 152.33333206176758, "y" : -325.3333435058594, "cMask" : ["ball" ] }, /* 97 */ { "bCoef" : 0.1, "x" : 139.33333206176758, "y" : -333.3333435058594, "cMask" : ["ball" ] }, /* 98 */ { "bCoef" : 0.1, "x" : 148.33333206176758, "y" : -332.3333435058594, "cMask" : ["ball" ] }, /* 99 */ { "bCoef" : 0.1, "x" : 166.33333206176758, "y" : -350.3333435058594, "cMask" : ["ball" ] }, /* 100 */ { "bCoef" : 0.1, "x" : 166.33333206176758, "y" : -325.3333435058594, "cMask" : ["ball" ] }, /* 101 */ { "bCoef" : 0.1, "x" : 187.33333206176758, "y" : -348.3333435058594, "cMask" : ["ball" ] }, /* 102 */ { "bCoef" : 0.1, "x" : 187.33333206176758, "y" : -325.3333435058594, "cMask" : ["ball" ] }, /* 103 */ { "bCoef" : 0.1, "x" : 187.33333206176758, "y" : -337.3333435058594, "cMask" : ["ball" ] }, /* 104 */ { "bCoef" : 0.1, "x" : 176.33333206176758, "y" : -337.3333435058594, "cMask" : ["ball" ] }, /* 105 */ { "bCoef" : 0.1, "x" : 238.33333206176758, "y" : -348.3333435058594, "cMask" : ["ball" ] }, /* 106 */ { "bCoef" : 0.1, "x" : 239.33333206176758, "y" : -323.3333435058594, "cMask" : ["ball" ] }, /* 107 */ { "bCoef" : 0.1, "x" : 257.3333320617676, "y" : -323.3333435058594, "cMask" : ["ball" ] }, /* 108 */ { "bCoef" : 0.1, "x" : 240.33333206176758, "y" : -335.3333435058594, "cMask" : ["ball" ] }, /* 109 */ { "bCoef" : 0.1, "x" : 256.3333320617676, "y" : -335.3333435058594, "cMask" : ["ball" ] }, /* 110 */ { "bCoef" : 0.1, "x" : 256.3333320617676, "y" : -347.3333435058594, "cMask" : ["ball" ] }, /* 111 */ { "bCoef" : 0.1, "x" : 201.33333206176758, "y" : -347.3333435058594, "cMask" : ["ball" ] }, /* 112 */ { "bCoef" : 0.1, "x" : 202.33333206176758, "y" : -324.3333435058594, "cMask" : ["ball" ] }, /* 113 */ { "bCoef" : 0.1, "x" : 221.33333206176758, "y" : -324.3333435058594, "cMask" : ["ball" ] }, /* 114 */ { "bCoef" : 0.1, "x" : 221.33333206176758, "y" : -347.3333435058594, "cMask" : ["ball" ] }, /* 115 */ { "cMask" : ["wall" ], "x" : -385.4545440673828, "y" : -83.53976440429688, "color" : "686763" }, /* 116 */ { "cMask" : ["wall" ], "x" : -385.4545440673828, "y" : 89.46023559570312, "color" : "686763" }, /* 117 */ { "cMask" : ["wall" ], "x" : 385.5454559326172, "y" : -83.53976440429688, "color" : "686763" }, /* 118 */ { "cMask" : ["wall" ], "x" : 384.5454559326172, "y" : 91.46023559570312, "color" : "686763" }, /* 119 */ { "x" : -700, "y" : -344, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 }, /* 120 */ { "x" : -705, "y" : -91, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 }, /* 121 */ { "x" : -706, "y" : 348, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false, "color" : "000000" }, /* 122 */ { "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : -700.4545440673828, "y" : 345.2784090042114, "curve" : 0 }, /* 123 */ { "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : -700.4545440673828, "y" : 79.27840900421143, "curve" : 0 }, /* 124 */ { "x" : 700, "y" : -347, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 }, /* 125 */ { "x" : 705, "y" : -87, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "vis" : false, "curve" : 0 }, /* 126 */ { "x" : 700, "y" : 83, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false }, /* 127 */ { "x" : 701, "y" : 347, "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0, "vis" : false }, /* 128 */ { "bCoef" : 0.5, "trait" : "goalNet", "x" : -782.6666679382324, "y" : 127.33334350585938, "cMask" : ["ball" ], "color" : "FF1100", "vis" : true }, /* 129 */ { "x" : -784.6666679382324, "y" : -119.33332824707031, "cMask" : ["ball" ], "trait" : "goalNet", "vis" : true, "color" : "FF1100" }, /* 130 */ { "x" : 787, "y" : -128, "trait" : "goalNet", "curve" : 0, "color" : "2200FF", "cMask" : ["ball" ], "vis" : true }, /* 131 */ { "bCoef" : 0.5, "trait" : "goalNet", "x" : 745.3333320617676, "y" : -85.66665649414062, "cMask" : ["ball" ], "color" : "2200FF", "vis" : true }, /* 132 */ { "x" : 790, "y" : 121, "trait" : "goalNet", "curve" : 0, "color" : "2200FF", "cMask" : ["ball" ], "vis" : true }, /* 133 */ { "x" : 746.3333320617676, "y" : 86.66667175292969, "cMask" : ["ball" ], "trait" : "goalNet", "vis" : true, "color" : "2200FF" } ], "segments" : [ { "v0" : 8, "v1" : 9, "curve" : 0, "color" : "FF1100", "trait" : "goalNet" }, { "v0" : 9, "v1" : 10, "curve" : 0, "color" : "FF1100", "trait" : "goalNet" }, { "v0" : 10, "v1" : 11, "curve" : 0, "color" : "FF1100", "trait" : "goalNet" }, { "v0" : 12, "v1" : 13, "curve" : 0, "color" : "2200FF", "trait" : "goalNet" }, { "v0" : 13, "v1" : 14, "curve" : 0, "color" : "2200FF", "trait" : "goalNet" }, { "v0" : 14, "v1" : 15, "curve" : 0, "color" : "2200FF", "trait" : "goalNet" }, { "v0" : 4, "v1" : 5, "trait" : "kickOffBarrier" }, { "v0" : 5, "v1" : 6, "curve" : 180, "vis" : true, "color" : "686763", "cGroup" : ["blueKO" ], "trait" : "kickOffBarrier" }, { "v0" : 5, "v1" : 6, "curve" : -180, "vis" : true, "color" : "686763", "cGroup" : ["redKO" ], "trait" : "kickOffBarrier" }, { "v0" : 6, "v1" : 7, "trait" : "kickOffBarrier" }, { "v0" : 16, "v1" : 17, "vis" : true, "color" : "000000", "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea", "curve" : 0 }, { "v0" : 18, "v1" : 19, "vis" : true, "color" : "000000", "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea" }, { "v0" : 20, "v1" : 21, "vis" : true, "color" : "000000", "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea" }, { "v0" : 22, "v1" : 23, "vis" : true, "color" : "000000", "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea" }, { "v0" : 24, "v1" : 25, "vis" : true, "color" : "000000", "bCoef" : 1.25, "cMask" : ["ball" ], "trait" : "ballArea" }, { "v0" : 26, "v1" : 27, "vis" : true, "color" : "F8F8F8", "bCoef" : 0, "cMask" : ["ball" ], "trait" : "ballArea" }, { "v0" : 28, "v1" : 29, "vis" : true, "color" : "000000", "bCoef" : 2, "cMask" : ["ball" ], "trait" : "ballArea" }, { "v0" : 30, "v1" : 31, "vis" : true, "color" : "686763", "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier" }, { "v0" : 32, "v1" : 33, "vis" : true, "color" : "686763", "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier" }, { "v0" : 40, "v1" : 41, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea" }, { "v0" : 42, "v1" : 43, "curve" : 2.50208708167, "vis" : false, "color" : "000000", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea" }, { "v0" : 44, "v1" : 45, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea" }, { "v0" : 47, "v1" : 48, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 710 }, { "v0" : 49, "v1" : 50, "curve" : 2.50208708167, "vis" : false, "color" : "F8F8F8", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 710 }, { "v0" : 51, "v1" : 52, "vis" : true, "color" : "C5FF05", "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier" }, { "v0" : 53, "v1" : 54, "vis" : true, "color" : "C5FF05", "bCoef" : 0.1, "cMask" : ["red","blue" ], "cGroup" : ["redKO","blueKO" ], "trait" : "kickOffBarrier" }, { "v0" : 55, "v1" : 56, "curve" : 0, "vis" : true, "color" : "686763", "bCoef" : 0.1, "cMask" : ["wall" ], "trait" : "goalNet" }, { "v0" : 57, "v1" : 58, "curve" : 0, "vis" : true, "color" : "686763", "bCoef" : 0.1, "cMask" : ["wall" ], "trait" : "goalNet", "x" : 385.5 }, { "curve" : 0, "vis" : true, "color" : "1499FF", "cMask" : ["ball" ], "v0" : 59, "v1" : 60 }, { "curve" : 0, "vis" : true, "color" : "1499FF", "cMask" : ["wall" ], "v0" : 60, "v1" : 61 }, { "curve" : 0, "vis" : true, "color" : "1499FF", "cMask" : ["ball" ], "v0" : 61, "v1" : 62 }, { "curve" : 0, "vis" : true, "color" : "1499FF", "cMask" : ["ball" ], "v0" : 62, "v1" : 63 }, { "curve" : 0, "vis" : true, "color" : "1499FF", "cMask" : ["ball" ], "v0" : 63, "v1" : 64 }, { "curve" : 0, "vis" : true, "color" : "1499FF", "cMask" : ["ball" ], "v0" : 65, "v1" : 66 }, { "curve" : 0, "vis" : true, "color" : "1499FF", "cMask" : ["ball" ], "v0" : 66, "v1" : 67 }, { "curve" : 0, "vis" : true, "color" : "1499FF", "cMask" : ["ball" ], "v0" : 67, "v1" : 68 }, { "curve" : 0, "vis" : true, "color" : "1499FF", "cMask" : ["ball" ], "v0" : 69, "v1" : 70 }, { "curve" : 0, "vis" : true, "color" : "1499FF", "cMask" : ["ball" ], "v0" : 70, "v1" : 71 }, { "curve" : 0, "vis" : true, "color" : "1499FF", "cMask" : ["wall" ], "v0" : 71, "v1" : 72 }, { "curve" : 0, "vis" : true, "color" : "1499FF", "cMask" : ["ball" ], "v0" : 73, "v1" : 72 }, { "curve" : 0, "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 74, "v1" : 75, "cMask" : ["ball" ] }, { "curve" : 0, "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 74, "v1" : 76, "cMask" : ["ball" ] }, { "curve" : 0, "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 77, "v1" : 78, "cMask" : ["ball" ] }, { "curve" : 0, "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 75, "v1" : 79, "cMask" : ["ball" ] }, { "curve" : 0, "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 80, "v1" : 81, "cMask" : ["ball" ] }, { "curve" : 0, "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 81, "v1" : 82, "cMask" : ["ball" ] }, { "curve" : 0, "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 82, "v1" : 83, "cMask" : ["ball" ] }, { "curve" : 0, "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 83, "v1" : 84, "cMask" : ["ball" ] }, { "curve" : 0, "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 85, "v1" : 86, "cMask" : ["ball" ] }, { "curve" : 0, "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 87, "v1" : 86, "cMask" : ["ball" ] }, { "curve" : 0, "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 88, "v1" : 89, "cMask" : ["ball" ] }, { "curve" : 0, "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 90, "v1" : 88, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 91, "v1" : 92, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 89, "v1" : 93, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 94, "v1" : 95, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 94, "v1" : 96, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 97, "v1" : 98, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 99, "v1" : 100, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 99, "v1" : 101, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 100, "v1" : 102, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 102, "v1" : 103, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 103, "v1" : 104, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 105, "v1" : 106, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 106, "v1" : 107, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 108, "v1" : 109, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 105, "v1" : 110, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 111, "v1" : 112, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 112, "v1" : 113, "cMask" : ["ball" ] }, { "vis" : true, "color" : "1499FF", "bCoef" : 0.1, "v0" : 113, "v1" : 114, "cMask" : ["ball" ] }, { "curve" : 136.66108325685727, "vis" : true, "color" : "686763", "cMask" : ["wall" ], "v0" : 115, "v1" : 116 }, { "curve" : -143.29182782796718, "vis" : true, "color" : "686763", "cMask" : ["wall" ], "v0" : 117, "v1" : 118 }, { "v0" : 119, "v1" : 120, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea" }, { "curve" : 0, "vis" : false, "color" : "000000", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "v0" : 122, "v1" : 123 }, { "v0" : 124, "v1" : 125, "curve" : 0, "vis" : false, "color" : "F8F8F8", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 710 }, { "v0" : 126, "v1" : 127, "curve" : 2.50208708167, "vis" : false, "color" : "F8F8F8", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "x" : 710 }, { "curve" : 0, "vis" : true, "color" : "FF1100", "bCoef" : 0.5, "trait" : "goalNet", "v0" : 10, "v1" : 128, "cMask" : ["ball" ] }, { "curve" : 0, "vis" : true, "color" : "FF1100", "v0" : 9, "v1" : 129, "cMask" : ["ball" ], "trait" : "goalNet" }, { "curve" : 0, "vis" : true, "color" : "2200FF", "bCoef" : 0.5, "trait" : "goalNet", "v0" : 130, "v1" : 131, "cMask" : ["ball" ] }, { "curve" : 0, "vis" : true, "color" : "2200FF", "v0" : 132, "v1" : 133, "cMask" : ["ball" ], "trait" : "goalNet" } ], "goals" : [ { "p0" : [-707,83 ], "p1" : [-707,-87 ], "team" : "red" }, { "p0" : [707,88 ], "p1" : [707,-82 ], "team" : "blue" } ], "discs" : [ { "radius" : 5.4, "pos" : [-700,85 ], "color" : "292929", "trait" : "goalPost" }, { "radius" : 5.4, "pos" : [-700,-85 ], "color" : "292929", "trait" : "goalPost" }, { "radius" : 5.4, "pos" : [699,85 ], "color" : "292929", "trait" : "goalPost" }, { "radius" : 5.4, "pos" : [699,-84 ], "color" : "292929", "trait" : "goalPost" }, { "radius" : 5.4, "pos" : [-741,-84 ], "color" : "292929", "trait" : "goalPost" }, { "radius" : 5.4, "pos" : [-740,86 ], "color" : "292929", "trait" : "goalPost" }, { "radius" : 5.4, "pos" : [743,-85 ], "color" : "292929", "trait" : "goalPost" }, { "radius" : 5.4, "pos" : [743,85 ], "color" : "292929", "trait" : "goalPost" }, { "radius" : 5.4, "pos" : [-785,-119 ], "color" : "292929", "trait" : "goalPost" }, { "radius" : 5.4, "pos" : [-784,129 ], "color" : "292929", "trait" : "goalPost" }, { "radius" : 5.4, "pos" : [787,-128 ], "color" : "292929", "trait" : "goalPost" }, { "radius" : 5.4, "pos" : [789,120 ], "color" : "292929", "trait" : "goalPost" } ], "planes" : [ { "normal" : [0,1 ], "dist" : -320, "trait" : "ballArea", "vis" : false, "curve" : 0 }, { "normal" : [0,-1 ], "dist" : -320, "trait" : "ballArea" }, { "normal" : [0,1 ], "dist" : -350, "bCoef" : 0.1 }, { "normal" : [0,-1 ], "dist" : -350, "bCoef" : 0.1 }, { "normal" : [-1,0 ], "dist" : -744, "bCoef" : 0.1 }, { "normal" : [1,0 ], "dist" : -743, "bCoef" : 0.1 } ], "traits" : { "ballArea" : { "vis" : false, "bCoef" : 1, "cMask" : ["ball" ] }, "goalPost" : { "radius" : 8, "invMass" : 0, "bCoef" : 0.5 }, "goalNet" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["ball" ] }, "kickOffBarrier" : { "vis" : false, "bCoef" : 0.1, "cGroup" : ["redKO","blueKO" ], "cMask" : ["red","blue" ] } }, "playerPhysics" : { "bCoef" : 0.1, "acceleration" : 0.11, "kickingAcceleration" : 0.082, "kickStrength" : 4.575 }, "ballPhysics" : { "radius" : 5.8, "bCoef" : 0.412, "invMass" : 1.6, "damping" : 0.99, "color" : "fff40d"}}';
  33.  
  34. /* OPTIONS */
  35.  
  36. var afkLimit = 12;
  37. var drawTimeLimit = Infinity;
  38. var maxTeamSize = 4; // This works for 1 (you might want to adapt things to remove some useless stats in 1v1 like assist or cs), 2, 3 or 4
  39. var slowMode = 0;
  40.  
  41. /* PLAYERS */
  42.  
  43. const Team = { SPECTATORS: 0, RED: 1, BLUE: 2 };
  44. var extendedP = [];
  45. const eP = { ID: 0, AUTH: 1, CONN: 2, AFK: 3, ACT: 4, GK: 5, MUTE: 6 };
  46. const Ss = { GA: 0, WI: 1, DR: 2, LS: 3, WR: 4, GL: 5, AS: 6, GK: 7, CS: 8, CP: 9, RL: 10, NK: 11}
  47. var players;
  48. var teamR;
  49. var teamB;
  50. var teamS;
  51.  
  52. /* GAME */
  53.  
  54. var lastTeamTouched;
  55. var lastPlayersTouched; // These allow to get good goal notifications (it should be lastPlayersKicked, waiting on a next update to get better track of shots on target)
  56. var countAFK = false; // Created to get better track of activity
  57. var activePlay = false; // Created to get better track of the possession
  58. var goldenGoal = false;
  59. var SMSet = new Set(); // Set created to get slow mode which is useful in chooseMode
  60. var banList = []; // Getting track of the bans, so we can unban ppl if we want
  61.  
  62. /* STATS */
  63.  
  64. var game;
  65. var GKList = ["",""];
  66. var Rposs = 0;
  67. var Bposs = 0;
  68. var point = [{"x": 0, "y": 0}, {"x": 0, "y": 0}]; // created to get ball speed
  69. var ballSpeed;
  70. var lastWinner = Team.SPECTATORS;
  71. var streak = 0;
  72. var allBlues = []; // This is to count the players who should be counted for the stats. This includes players who left after the game has started, doesn't include those who came too late or ...
  73. var allReds = []; // ... those who came in a very unequal game.
  74.  
  75. /* BALANCE & CHOOSE */
  76.  
  77. var inChooseMode = false; // This variable enables to distinguish the 2 phases of playing and choosing which should be dealt with very differently
  78. var redCaptainChoice = "";
  79. var blueCaptainChoice = "";
  80. var chooseTime = 20;
  81. var timeOutCap;
  82.  
  83. /* AUXILIARY */
  84.  
  85. var checkTimeVariable = false; // This is created so the chat doesn't get spammed when a game is ending via timeLimit
  86. var statNumber = 0; // This allows the room to be given stat information every X minutes
  87. var endGameVariable = false; // This variable with the one below helps distinguish the cases where games are stopped because they have finished to the ones where games are stopped due to player movements or resetting teams
  88. var resettingTeams = false;
  89. var capLeft = false;
  90. var statInterval = 6;
  91.  
  92. loadMap(aloneMap, 3, 3);
  93.  
  94. /* OBJECTS */
  95.  
  96. function Goal(time, team, striker, assist) {
  97. this.time = time;
  98. this.team = team;
  99. this.striker = striker;
  100. this.assist = assist;
  101. }
  102.  
  103. function Game(date, scores, goals) {
  104. this.date = date;
  105. this.scores = scores;
  106. this.goals = goals;
  107. }
  108.  
  109. /* FUNCTIONS */
  110.  
  111. /* AUXILIARY FUNCTIONS */
  112.  
  113. function getRandomInt(max) { // returns a random number from 0 to max-1
  114. return Math.floor(Math.random() * Math.floor(max));
  115. }
  116.  
  117. function getTime(scores) { // returns the current time of the game
  118. return "[" + Math.floor(Math.floor(scores.time/60)/10).toString() + Math.floor(Math.floor(scores.time/60)%10).toString() + ":" + Math.floor(Math.floor(scores.time - (Math.floor(scores.time/60) * 60))/10).toString() + Math.floor(Math.floor(scores.time - (Math.floor(scores.time/60) * 60))%10).toString() + "]"
  119. }
  120.  
  121. function pointDistance(p1, p2) {
  122. var d1 = p1.x - p2.x;
  123. var d2 = p1.y - p2.y;
  124. return Math.sqrt(d1 * d1 + d2 * d2);
  125. }
  126.  
  127. /* BUTTONS */
  128.  
  129. function topBtn() {
  130. if (teamS.length == 0) {
  131. return;
  132. }
  133. else {
  134. if (teamR.length == teamB.length) {
  135. if (teamS.length > 1) {
  136. room.setPlayerTeam(teamS[0].id, Team.RED);
  137. room.setPlayerTeam(teamS[1].id, Team.BLUE);
  138. }
  139. return;
  140. }
  141. else if (teamR.length < teamB.length) {
  142. room.setPlayerTeam(teamS[0].id, Team.RED);
  143. }
  144. else {
  145. room.setPlayerTeam(teamS[0].id, Team.BLUE);
  146. }
  147. }
  148. }
  149.  
  150. function randomBtn() {
  151. if (teamS.length == 0) {
  152. return;
  153. }
  154. else {
  155. if (teamR.length == teamB.length) {
  156. if (teamS.length > 1) {
  157. var r = getRandomInt(teamS.length);
  158. room.setPlayerTeam(teamS[r].id, Team.RED);
  159. teamS = teamS.filter((spec) => spec.id != teamS[r].id);
  160. room.setPlayerTeam(teamS[getRandomInt(teamS.length)].id, Team.BLUE);
  161. }
  162. return;
  163. }
  164. else if (teamR.length < teamB.length) {
  165. room.setPlayerTeam(teamS[getRandomInt(teamS.length)].id, Team.RED);
  166. }
  167. else {
  168. room.setPlayerTeam(teamS[getRandomInt(teamS.length)].id, Team.BLUE);
  169. }
  170. }
  171. }
  172.  
  173. function blueToSpecBtn() {
  174. resettingTeams = true;
  175. setTimeout(() => { resettingTeams = false; }, 100);
  176. for (var i = 0; i < teamB.length; i++) {
  177. room.setPlayerTeam(teamB[teamB.length - 1 - i].id, Team.SPECTATORS);
  178. }
  179. }
  180.  
  181. function redToSpecBtn() {
  182. resettingTeams = true;
  183. setTimeout(() => { resettingTeams = false; }, 100);
  184. for (var i = 0; i < teamR.length; i++) {
  185. room.setPlayerTeam(teamR[teamR.length - 1 - i].id, Team.SPECTATORS);
  186. }
  187. }
  188.  
  189. function resetBtn() {
  190. resettingTeams = true;
  191. setTimeout(() => { resettingTeams = false; }, 100);
  192. if (teamR.length <= teamB.length) {
  193. for (var i = 0; i < teamR.length; i++) {
  194. room.setPlayerTeam(teamB[teamB.length - 1 - i].id, Team.SPECTATORS);
  195. room.setPlayerTeam(teamR[teamR.length - 1 - i].id, Team.SPECTATORS);
  196. }
  197. for (var i = teamR.length; i < teamB.length; i++) {
  198. room.setPlayerTeam(teamB[teamB.length - 1 - i].id, Team.SPECTATORS);
  199. }
  200. }
  201. else {
  202. for (var i = 0; i < teamB.length; i++) {
  203. room.setPlayerTeam(teamB[teamB.length - 1 - i].id, Team.SPECTATORS);
  204. room.setPlayerTeam(teamR[teamR.length - 1 - i].id, Team.SPECTATORS);
  205. }
  206. for (var i = teamB.length; i < teamR.length; i++) {
  207. room.setPlayerTeam(teamR[teamR.length - 1 - i].id, Team.SPECTATORS);
  208. }
  209. }
  210. }
  211.  
  212. function blueToRedBtn() {
  213. resettingTeams = true;
  214. setTimeout(() => { resettingTeams = false; }, 100);
  215. for (var i = 0; i < teamB.length; i++) {
  216. room.setPlayerTeam(teamB[i].id, Team.RED);
  217. }
  218. }
  219.  
  220. /* GAME FUNCTIONS */
  221.  
  222. function checkTime() {
  223. const scores = room.getScores();
  224. game.scores = scores;
  225. if (Math.abs(scores.time - scores.timeLimit) <= 0.01 && scores.timeLimit != 0) {
  226. if (scores.red != scores.blue) {
  227. if (checkTimeVariable == false) {
  228. checkTimeVariable = true;
  229. setTimeout(() => { checkTimeVariable = false; }, 3000);
  230. scores.red > scores.blue ? endGame(Team.RED) : endGame(Team.BLUE);
  231. setTimeout(() => { room.stopGame(); }, 2000);
  232. }
  233. return;
  234. }
  235. goldenGoal = true;
  236. room.sendChat("⚽ First goal wins !");
  237. }
  238. if (Math.abs(drawTimeLimit * 60 - scores.time - 60) <= 0.01 && players.length > 2) {
  239. if (checkTimeVariable == false) {
  240. checkTimeVariable = true;
  241. setTimeout(() => { checkTimeVariable = false; }, 10);
  242. room.sendChat("⌛ 60 seconds left until draw !");
  243. }
  244. }
  245. if (Math.abs(scores.time - drawTimeLimit * 60) <= 0.01 && players.length > 2) {
  246. if (checkTimeVariable == false) {
  247. checkTimeVariable = true;
  248. setTimeout(() => { checkTimeVariable = false; }, 10);
  249. endGame(Team.SPECTATORS);
  250. room.stopGame();
  251. goldenGoal = false;
  252. }
  253. }
  254. }
  255.  
  256. function endGame(winner) { // handles the end of a game : no stopGame function inside
  257. players.length >= 2 * maxTeamSize - 1 ? activateChooseMode() : null;
  258. const scores = room.getScores();
  259. game.scores = scores;
  260. Rposs = Rposs/(Rposs+Bposs);
  261. Bposs = 1 - Rposs;
  262. lastWinner = winner;
  263. endGameVariable = true;
  264. if (winner == Team.RED) {
  265. streak++;
  266. room.sendChat("🔴 Red Team won " + scores.red + "-" + scores.blue + " ! Current streak : " + streak + " 🏆");
  267. }
  268. else if (winner == Team.BLUE) {
  269. streak = 1;
  270. room.sendChat("🔵 Blue Team won " + scores.blue + "-" + scores.red + " ! Current streak : " + streak + " 🏆");
  271. }
  272. else {
  273. streak = 0;
  274. room.sendChat("💤 Draw limit reached! 💤");
  275. }
  276. room.sendChat("⭐ Possession : 🔴 " + (Rposs*100).toPrecision(3).toString() + "% : " + (Bposs*100).toPrecision(3).toString() + "% 🔵");
  277. scores.red == 0 ? (scores.blue == 0 ? room.sendChat("🏆 " + GKList[0].name + " and " + GKList[1].name + " kept a CS ! ") : room.sendChat("🏆 " + GKList[1].name + " kept a CS ! ")) : scores.blue == 0 ? room.sendChat("🏆 " + GKList[0].name + " kept a CS ! ") : null;
  278. updateStats();
  279. }
  280.  
  281. function quickRestart() {
  282. room.stopGame();
  283. setTimeout(() => { room.startGame(); }, 2000);
  284. }
  285.  
  286. function resumeGame() {
  287. setTimeout(() => { room.startGame(); }, 2000);
  288. setTimeout(() => { room.pauseGame(false); }, 1000);
  289. }
  290.  
  291. function activateChooseMode() {
  292. inChooseMode = true;
  293. slowMode = 2;
  294. room.sendChat("2 seconds slow mode enabled !");
  295. }
  296.  
  297. function deactivateChooseMode() {
  298. inChooseMode = false;
  299. clearTimeout(timeOutCap);
  300. if (slowMode != 0) {
  301. slowMode = 0;
  302. room.sendChat("Slow mode terminated.");
  303. }
  304. redCaptainChoice = "";
  305. blueCaptainChoice = "";
  306. }
  307.  
  308. function loadMap(map, scoreLim, timeLim) {
  309. if (map == aloneMap) {
  310. room.setCustomStadium(aloneMap);
  311. }
  312. else if (map == classicMap) {
  313. (classicMap != '') ? room.setCustomStadium(classicMap) : room.setDefaultStadium("Classic");
  314. }
  315. else if (map == bigMap) {
  316. (bigMap != '.') ? room.setCustomStadium(bigMap) : room.setDefaultStadium("Big");
  317. }
  318. else {
  319. room.setCustomStadium(map);
  320. }
  321. room.setScoreLimit(scoreLim);
  322. room.setTimeLimit(timeLim);
  323. }
  324.  
  325. /* PLAYER FUNCTIONS */
  326.  
  327. function updateTeams() { // update the players' list and all the teams' list
  328. players = room.getPlayerList().filter((player) => player.id != 0 && !getAFK(player));
  329. teamR = players.filter(p => p.team === Team.RED);
  330. teamB = players.filter(p => p.team === Team.BLUE);
  331. teamS = players.filter(p => p.team === Team.SPECTATORS);
  332. }
  333.  
  334. function handleInactivity() { // handles inactivity : players will be kicked after afkLimit
  335. if (countAFK && (teamR.length + teamB.length) > 1) {
  336. for (var i = 0; i < teamR.length ; i++) {
  337. setActivity(teamR[i], getActivity(teamR[i]) + 1);
  338. }
  339. for (var i = 0; i < teamB.length ; i++) {
  340. setActivity(teamB[i], getActivity(teamB[i]) + 1);
  341. }
  342. }
  343. for (var i = 0; i < extendedP.length ; i++) {
  344. if (extendedP[i][eP.ACT] == 60 * (2/3 * afkLimit)) {
  345. room.sendChat("⛔ @" + room.getPlayer(extendedP[i][eP.ID]).name + ", if you don't move or send a message in the next " + Math.floor(afkLimit / 3) + " seconds, you will be kicked !", extendedP[i][eP.ID]);
  346. }
  347. if (extendedP[i][eP.ACT] >= 60 * afkLimit) {
  348. extendedP[i][eP.ACT] = 0;
  349. if (room.getScores().time <= afkLimit - 0.5) {
  350. setTimeout(() => { !inChooseMode ? quickRestart() : room.stopGame(); }, 10);
  351. }
  352. room.kickPlayer(extendedP[i][eP.ID], "AFK", false);
  353. }
  354. }
  355. }
  356.  
  357. function getAuth(player) {
  358. return extendedP.filter((a) => a[0] == player.id) != null ? extendedP.filter((a) => a[0] == player.id)[0][eP.AUTH] : null;
  359. }
  360.  
  361. function getAFK(player) {
  362. return extendedP.filter((a) => a[0] == player.id) != null ? extendedP.filter((a) => a[0] == player.id)[0][eP.AFK] : null;
  363. }
  364.  
  365. function setAFK(player, value) {
  366. extendedP.filter((a) => a[0] == player.id).forEach((player) => player[eP.AFK] = value);
  367. }
  368.  
  369. function getActivity(player) {
  370. return extendedP.filter((a) => a[0] == player.id) != null ? extendedP.filter((a) => a[0] == player.id)[0][eP.ACT] : null;
  371. }
  372.  
  373. function setActivity(player, value) {
  374. extendedP.filter((a) => a[0] == player.id).forEach((player) => player[eP.ACT] = value);
  375. }
  376.  
  377. function getGK(player) {
  378. return extendedP.filter((a) => a[0] == player.id) != null ? extendedP.filter((a) => a[0] == player.id)[0][eP.GK] : null;
  379. }
  380.  
  381. function setGK(player, value) {
  382. extendedP.filter((a) => a[0] == player.id).forEach((player) => player[eP.GK] = value);
  383. }
  384.  
  385. function getMute(player) {
  386. return extendedP.filter((a) => a[0] == player.id) != null ? extendedP.filter((a) => a[0] == player.id)[0][eP.MUTE] : null;
  387. }
  388.  
  389. function setMute(player, value) {
  390. extendedP.filter((a) => a[0] == player.id).forEach((player) => player[eP.MUTE] = value);
  391. }
  392.  
  393. /* BALANCE & CHOOSE FUNCTIONS */
  394.  
  395. function updateRoleOnPlayerIn() {
  396. updateTeams();
  397. if (inChooseMode) {
  398. if (players.length == 8) {
  399. loadMap(bigMap, scoreLimitBig, timeLimitBig);
  400. }
  401. getSpecList(teamR.length <= teamB.length ? teamR[0] : teamB[0]);
  402. }
  403. balanceTeams();
  404. }
  405.  
  406. function updateRoleOnPlayerOut() {
  407. updateTeams();
  408. if (room.getScores() != null) {
  409. var scores = room.getScores();
  410. if (players.length >= 2 * maxTeamSize && scores.time >= (5/6) * game.scores.timeLimit && teamR.length != teamB.length) {
  411. if (teamR.length < teamB.length) {
  412. if (scores.blue - scores.red == 2) {
  413. endGame(Team.BLUE);
  414. room.sendChat("🤖 Ragequit detected. Game ended 🤖");
  415. setTimeout(() => { room.stopGame(); }, 100);
  416. return;
  417. }
  418. }
  419. else {
  420. if (scores.red - scores.blue == 2) {
  421. endGame(Team.RED);
  422. room.sendChat("🤖 Ragequit detected. Game ended 🤖");
  423. setTimeout(() => { room.stopGame(); }, 100);
  424. return;
  425. }
  426. }
  427. }
  428. }
  429. if (inChooseMode) {
  430. if (players.length == 4) {
  431. loadMap(classicMap, scoreLimitClassic, timeLimitClassic);
  432. }
  433. if (teamR.length == 0 || teamB.length == 0) {
  434. teamR.length == 0 ? room.setPlayerTeam(teamS[0].id, Team.RED) : room.setPlayerTeam(teamS[0].id, Team.BLUE);
  435. return;
  436. }
  437. if (Math.abs(teamR.length - teamB.length) == teamS.length) {
  438. room.sendChat("🤖 No choices left, let me handle this situation... 🤖");
  439. deactivateChooseMode();
  440. resumeGame();
  441. var b = teamS.length;
  442. if (teamR.length > teamB.length) {
  443. for (var i = 0 ; i < b ; i++) {
  444. setTimeout(() => { room.setPlayerTeam(teamS[0].id, Team.BLUE); }, 5*i);
  445. }
  446. }
  447. else {
  448. for (var i = 0 ; i < b ; i++) {
  449. setTimeout(() => { room.setPlayerTeam(teamS[0].id, Team.RED); }, 5*i);
  450. }
  451. }
  452. return;
  453. }
  454. if (streak == 0 && room.getScores() == null) {
  455. if (Math.abs(teamR.length - teamB.length) == 2) { // if someone left a team has 2 more players than the other one, put the last chosen guy back in his place so it's fair
  456. room.sendChat("🤖 Balancing teams... 🤖");
  457. teamR.length > teamB.length ? room.setPlayerTeam(teamR[teamR.length - 1].id, Team.SPECTATORS) : room.setPlayerTeam(teamB[teamB.length - 1].id, Team.SPECTATORS);
  458. }
  459. }
  460. if (teamR.length == teamB.length && teamS.length < 2) {
  461. deactivateChooseMode();
  462. resumeGame();
  463. return;
  464. }
  465. capLeft ? choosePlayer() : getSpecList(teamR.length <= teamB.length ? teamR[0] : teamB[0]);
  466. }
  467. balanceTeams();
  468. }
  469.  
  470. function balanceTeams() {
  471. if (!inChooseMode) {
  472. if (players.length == 1 && teamR.length == 0) {
  473. quickRestart();
  474. loadMap(aloneMap, 0, 0);
  475. room.setPlayerTeam(players[0].id, Team.RED);
  476. }
  477. else if (Math.abs(teamR.length - teamB.length) == teamS.length && teamS.length > 0) {
  478. const n = Math.abs(teamR.length - teamB.length);
  479. if (players.length == 4) {
  480. quickRestart();
  481. loadMap(classicMap, scoreLimitClassic, timeLimitClassic);
  482. }
  483. if (teamR.length > teamB.length) {
  484. for (var i = 0 ; i < n ; i++) {
  485. room.setPlayerTeam(teamS[i].id, Team.BLUE);
  486. }
  487. }
  488. else {
  489. for (var i = 0 ; i < n ; i++) {
  490. room.setPlayerTeam(teamS[i].id, Team.RED);
  491. }
  492. }
  493. }
  494. else if (Math.abs(teamR.length - teamB.length) > teamS.length) {
  495. const n = Math.abs(teamR.length - teamB.length);
  496. if (players.length == 1) {
  497. quickRestart();
  498. loadMap(aloneMap, 3, 3);
  499. room.setPlayerTeam(players[0].id, Team.RED);
  500. return;
  501. }
  502. else if (players.length == 5) {
  503. quickRestart();
  504. loadMap(classicMap, scoreLimitClassic, timeLimitClassic);
  505. }
  506. if (players.length == maxTeamSize * 2 - 1) {
  507. allReds = [];
  508. allBlues = [];
  509. }
  510. if (teamR.length > teamB.length) {
  511. for (var i = 0 ; i < n ; i++) {
  512. room.setPlayerTeam(teamR[teamR.length - 1 - i].id, Team.SPECTATORS);
  513. }
  514. }
  515. else {
  516. for (var i = 0 ; i < n ; i++) {
  517. room.setPlayerTeam(teamB[teamB.length - 1 - i].id, Team.SPECTATORS);
  518. }
  519. }
  520. }
  521. else if (Math.abs(teamR.length - teamB.length) < teamS.length && teamR.length != teamB.length) {
  522. room.pauseGame(true);
  523. activateChooseMode();
  524. choosePlayer();
  525. }
  526. else if (teamS.length >= 2 && teamR.length == teamB.length && teamR.length < maxTeamSize) {
  527. if (teamR.length == 2) {
  528. quickRestart();
  529. loadMap(bigMap, scoreLimitBig, timeLimitBig);
  530. }
  531. topBtn();
  532. }
  533. }
  534. }
  535.  
  536. function choosePlayer() {
  537. clearTimeout(timeOutCap);
  538. if (teamR.length <= teamB.length && teamR.length != 0) {
  539. room.sendChat("[PV] To choose a player, enter his number in the list given or use 'top', 'random' or 'bottom'.", teamR[0].id);
  540. timeOutCap = setTimeout(function (player) { room.sendChat("[PV] Hurry up @" + player.name + ", only " + Number.parseInt(chooseTime / 2) + " seconds left to choose !", player.id); timeOutCap = setTimeout(function (player) { room.kickPlayer(player.id, "You didn't choose in time !", false); }, chooseTime * 500, teamR[0]); }, chooseTime * 1000, teamR[0]);
  541. }
  542. else if (teamB.length < teamR.length && teamB.length != 0) {
  543. room.sendChat("[PV] To choose a player, enter his number in the list given or use 'top', 'random' or 'bottom'.", teamB[0].id);
  544. timeOutCap = setTimeout(function (player) { room.sendChat("[PV] Hurry up @" + player.name + ", only " + Number.parseInt(chooseTime / 2) + " seconds left to choose !", player.id); timeOutCap = setTimeout(function (player) { room.kickPlayer(player.id, "You didn't choose in time !", false); }, chooseTime * 500, teamB[0]); }, chooseTime * 1000, teamB[0]);
  545. }
  546. if (teamR.length != 0 && teamB.length != 0) getSpecList(teamR.length <= teamB.length ? teamR[0] : teamB[0]);
  547. }
  548.  
  549. function getSpecList(player) {
  550. var cstm = "[PV] Players : ";
  551. for (var i = 0 ; i < teamS.length ; i++) {
  552. if (140 - cstm.length < (teamS[i].name + "[" + (i+1) + "], ").length) {
  553. room.sendChat(cstm, player.id);
  554. cstm = "... ";
  555. }
  556. cstm += teamS[i].name + "[" + (i+1) + "], ";
  557. }
  558. cstm = cstm.substring(0,cstm.length - 2);
  559. cstm += ".";
  560. room.sendChat(cstm, player.id);
  561. }
  562.  
  563. /* STATS FUNCTIONS */
  564.  
  565. function getLastTouchOfTheBall() {
  566. const ballPosition = room.getBallPosition();
  567. updateTeams();
  568. for (var i = 0; i < players.length; i++) {
  569. if (players[i].position != null) {
  570. var distanceToBall = pointDistance(players[i].position, ballPosition);
  571. if (distanceToBall < triggerDistance) {
  572. !activePlay ? activePlay = true : null;
  573. if (lastTeamTouched == players[i].team && lastPlayersTouched[0] != null && lastPlayersTouched[0].id != players[i].id) {
  574. lastPlayersTouched[1] = lastPlayersTouched[0];
  575. lastPlayersTouched[0] = players[i];
  576. }
  577. lastTeamTouched = players[i].team;
  578. }
  579. }
  580. }
  581. }
  582.  
  583. function getStats() { // gives possession, ball speed and GK of each team
  584. if (activePlay) {
  585. updateTeams();
  586. lastTeamTouched == Team.RED ? Rposs++ : Bposs++;
  587. var ballPosition = room.getBallPosition();
  588. point[1] = point[0];
  589. point[0] = ballPosition;
  590. ballSpeed = (pointDistance(point[0], point[1]) * 60 * 60 * 60)/15000;
  591. var k = [-1, Infinity];
  592. for (var i = 0; i < teamR.length; i++) {
  593. if (teamR[i].position.x < k[1]) {
  594. k[0] = teamR[i];
  595. k[1] = teamR[i].position.x;
  596. }
  597. }
  598. k[0] != -1 ? setGK(k[0], getGK(k[0]) + 1) : null;
  599. k = [-1, -Infinity];
  600. for (var i = 0; i < teamB.length; i++) {
  601. if (teamB[i].position.x > k[1]) {
  602. k[0] = teamB[i];
  603. k[1] = teamB[i].position.x;
  604. }
  605. }
  606. k[0] != -1 ? setGK(k[0], getGK(k[0]) + 1) : null;
  607. findGK();
  608. }
  609. }
  610.  
  611. function updateStats() {
  612. if (players.length >= 2 * maxTeamSize && (game.scores.time >= (5 / 6) * game.scores.timeLimit || game.scores.red == game.scores.scoreLimit || game.scores.blue == game.scores.scoreLimit) && allReds.length >= maxTeamSize && allBlues.length >= maxTeamSize) {
  613. var stats;
  614. for (var i = 0; i < allReds.length; i++) {
  615. localStorage.getItem(getAuth(allReds[i])) ? stats = JSON.parse(localStorage.getItem(getAuth(allReds[i]))) : stats = [0, 0, 0, 0, "0.00", 0, 0, 0, 0, "0.00", "player", allReds[i].name];
  616. stats[Ss.GA]++;
  617. lastWinner == Team.RED ? stats[Ss.WI]++ : lastWinner == Team.BLUE ? stats[Ss.LS]++ : stats[Ss.DR]++;
  618. stats[Ss.WR] = (100 * stats[Ss.WI] / stats[Ss.GA]).toPrecision(3);
  619. localStorage.setItem(getAuth(allReds[i]), JSON.stringify(stats));
  620. }
  621. for (var i = 0; i < allBlues.length; i++) {
  622. localStorage.getItem(getAuth(allBlues[i])) ? stats = JSON.parse(localStorage.getItem(getAuth(allBlues[i]))) : stats = [0, 0, 0, 0, "0.00", 0, 0, 0, 0, "0.00", "player", allBlues[i].name];
  623. stats[Ss.GA]++;
  624. lastWinner == Team.BLUE ? stats[Ss.WI]++ : lastWinner == Team.RED ? stats[Ss.LS]++ : stats[Ss.DR]++;
  625. stats[Ss.WR] = (100 * stats[Ss.WI] / stats[Ss.GA]).toPrecision(3);
  626. localStorage.setItem(getAuth(allBlues[i]), JSON.stringify(stats));
  627. }
  628. for (var i = 0; i < game.goals.length; i++) {
  629. if (game.goals[i].striker != null) {
  630. if ((allBlues.concat(allReds)).findIndex((player) => player.id == game.goals[i].striker.id) != -1) {
  631. stats = JSON.parse(localStorage.getItem(getAuth(game.goals[i].striker)));
  632. stats[Ss.GL]++;
  633. localStorage.setItem(getAuth(game.goals[i].striker), JSON.stringify(stats));
  634. }
  635. }
  636. if (game.goals[i].assist != null) {
  637. if ((allBlues.concat(allReds)).findIndex((player) => player.name == game.goals[i].assist.name) != -1) {
  638. stats = JSON.parse(localStorage.getItem(getAuth(game.goals[i].assist)));
  639. stats[Ss.AS]++;
  640. localStorage.setItem(getAuth(game.goals[i].assist), JSON.stringify(stats));
  641. }
  642. }
  643. }
  644. if (allReds.findIndex((player) => player.id == GKList[0].id) != -1) {
  645. stats = JSON.parse(localStorage.getItem(getAuth(GKList[0])));
  646. stats[Ss.GK]++;
  647. game.scores.blue == 0 ? stats[Ss.CS]++ : null;
  648. stats[Ss.CP] = (100 * stats[Ss.CS] / stats[Ss.GK]).toPrecision(3);
  649. localStorage.setItem(getAuth(GKList[0]), JSON.stringify(stats));
  650. }
  651. if (allBlues.findIndex((player) => player.id == GKList[1].id) != -1) {
  652. stats = JSON.parse(localStorage.getItem(getAuth(GKList[1])));
  653. stats[Ss.GK]++;
  654. game.scores.red == 0 ? stats[Ss.CS]++ : null;
  655. stats[Ss.CP] = (100 * stats[Ss.CS] / stats[Ss.GK]).toPrecision(3);
  656. localStorage.setItem(getAuth(GKList[1]), JSON.stringify(stats));
  657. }
  658. }
  659. }
  660.  
  661. function findGK() {
  662. var tab = [[-1,""], [-1,""]];
  663. for (var i = 0; i < extendedP.length ; i++) {
  664. if (room.getPlayer(extendedP[i][eP.ID]) != null && room.getPlayer(extendedP[i][eP.ID]).team == Team.RED) {
  665. if (tab[0][0] < extendedP[i][eP.GK]) {
  666. tab[0][0] = extendedP[i][eP.GK];
  667. tab[0][1] = room.getPlayer(extendedP[i][eP.ID]);
  668. }
  669. }
  670. else if (room.getPlayer(extendedP[i][eP.ID]) != null && room.getPlayer(extendedP[i][eP.ID]).team == Team.BLUE) {
  671. if (tab[1][0] < extendedP[i][eP.GK]) {
  672. tab[1][0] = extendedP[i][eP.GK];
  673. tab[1][1] = room.getPlayer(extendedP[i][eP.ID]);
  674. }
  675. }
  676. }
  677. GKList = [tab[0][1], tab[1][1]];
  678. }
  679.  
  680. setInterval(() => {
  681. var tableau = [];
  682. if (statNumber % 5 == 0) {
  683. Object.keys(localStorage).forEach(function (key) { if (!["player_name", "view_mode", "geo", "avatar", "player_auth_key"].includes(key)) { tableau.push([(JSON.parse(localStorage.getItem(key))[Ss.NK]), (JSON.parse(localStorage.getItem(key))[Ss.GA])]); } });
  684. if (tableau.length < 5) {
  685. return false;
  686. }
  687. tableau.sort(function (a, b) { return b[1] - a[1]; });
  688. room.sendChat("Games> #1 " + tableau[0][0] + ": " + tableau[0][1] + " #2 " + tableau[1][0] + ": " + tableau[1][1] + " #3 " + tableau[2][0] + ": " + tableau[2][1] + " #4 " + tableau[3][0] + ": " + tableau[3][1] + " #5 " + tableau[4][0] + ": " + tableau[4][1]);
  689. }
  690. if (statNumber % 5 == 1) {
  691. Object.keys(localStorage).forEach(function (key) { if (!["player_name", "view_mode", "geo", "avatar", "player_auth_key"].includes(key)) { tableau.push([(JSON.parse(localStorage.getItem(key))[Ss.NK]), (JSON.parse(localStorage.getItem(key))[Ss.WI])]); } });
  692. if (tableau.length < 5) {
  693. return false;
  694. }
  695. tableau.sort(function (a, b) { return b[1] - a[1]; });
  696. room.sendChat("Wins> #1 " + tableau[0][0] + ": " + tableau[0][1] + " #2 " + tableau[1][0] + ": " + tableau[1][1] + " #3 " + tableau[2][0] + ": " + tableau[2][1] + " #4 " + tableau[3][0] + ": " + tableau[3][1] + " #5 " + tableau[4][0] + ": " + tableau[4][1]);
  697. }
  698. if (statNumber % 5 == 2) {
  699. Object.keys(localStorage).forEach(function (key) { if (!["player_name", "view_mode", "geo", "avatar", "player_auth_key"].includes(key)) { tableau.push([(JSON.parse(localStorage.getItem(key))[Ss.NK]), (JSON.parse(localStorage.getItem(key))[Ss.GL])]); } });
  700. if (tableau.length < 5) {
  701. return false;
  702. }
  703. tableau.sort(function (a, b) { return b[1] - a[1]; });
  704. room.sendChat("Goals> #1 " + tableau[0][0] + ": " + tableau[0][1] + " #2 " + tableau[1][0] + ": " + tableau[1][1] + " #3 " + tableau[2][0] + ": " + tableau[2][1] + " #4 " + tableau[3][0] + ": " + tableau[3][1] + " #5 " + tableau[4][0] + ": " + tableau[4][1]);
  705. }
  706. if (statNumber % 5 == 3) {
  707. Object.keys(localStorage).forEach(function (key) { if (!["player_name", "view_mode", "geo", "avatar", "player_auth_key"].includes(key)) { tableau.push([(JSON.parse(localStorage.getItem(key))[Ss.NK]), (JSON.parse(localStorage.getItem(key))[Ss.AS])]); } });
  708. if (tableau.length < 5) {
  709. return false;
  710. }
  711. tableau.sort(function (a, b) { return b[1] - a[1]; });
  712. room.sendChat("Assists> #1 " + tableau[0][0] + ": " + tableau[0][1] + " #2 " + tableau[1][0] + ": " + tableau[1][1] + " #3 " + tableau[2][0] + ": " + tableau[2][1] + " #4 " + tableau[3][0] + ": " + tableau[3][1] + " #5 " + tableau[4][0] + ": " + tableau[4][1]);
  713. }
  714. if (statNumber % 5 == 4) {
  715. Object.keys(localStorage).forEach(function (key) { if (!["player_name", "view_mode", "geo", "avatar", "player_auth_key"].includes(key)) { tableau.push([(JSON.parse(localStorage.getItem(key))[Ss.NK]), (JSON.parse(localStorage.getItem(key))[Ss.CS])]); } });
  716. if (tableau.length < 5) {
  717. return false;
  718. }
  719. tableau.sort(function (a, b) { return b[1] - a[1]; });
  720. room.sendChat("CS> #1 " + tableau[0][0] + ": " + tableau[0][1] + " #2 " + tableau[1][0] + ": " + tableau[1][1] + " #3 " + tableau[2][0] + ": " + tableau[2][1] + " #4 " + tableau[3][0] + ": " + tableau[3][1] + " #5 " + tableau[4][0] + ": " + tableau[4][1]);
  721. }
  722. statNumber++;
  723. }, statInterval * 60 * 1000);
  724.  
  725. /* EVENTS */
  726.  
  727. /* PLAYER MOVEMENT */
  728.  
  729. room.onPlayerJoin = function(player) {
  730. extendedP.push([player.id, player.auth, player.conn, false, 0, 0, false]);
  731. updateRoleOnPlayerIn();
  732. room.sendChat("⭕️ " + player.name + " Welcome to SuperLeague Gold! Community Discord: https://discord.gg/uraCH7y ⭕️", player.id);
  733. if (localStorage.getItem(player.auth) != null) {
  734. if (JSON.parse(localStorage.getItem(player.auth))[Ss.RL] != "player") {
  735. room.setPlayerAdmin(player.id, true);
  736. room.sendChat((JSON.parse(localStorage.getItem(player.auth))[Ss.RL] == "master" ? "Master " : "Admin ") + player.name + " has connected to the room !");
  737. }
  738. }
  739. }
  740.  
  741. room.onPlayerTeamChange = function(changedPlayer, byPlayer) {
  742. if (changedPlayer.id == 0) {
  743. room.setPlayerTeam(0, Team.SPECTATORS);
  744. return;
  745. }
  746. if (getAFK(changedPlayer) && changedPlayer.team != Team.SPECTATORS) {
  747. room.setPlayerTeam(changedPlayer.id, Team.SPECTATORS);
  748. room.sendChat(changedPlayer.name + " is AFK !");
  749. return;
  750. }
  751. updateTeams();
  752. if (room.getScores() != null) {
  753. var scores = room.getScores();
  754. if (changedPlayer.team != Team.SPECTATORS && scores.time <= (3/4) * scores.timeLimit && Math.abs(scores.blue - scores.red) < 2) {
  755. (changedPlayer.team == Team.RED) ? allReds.push(changedPlayer) : allBlues.push(changedPlayer);
  756. }
  757. }
  758. if (changedPlayer.team == Team.SPECTATORS) {
  759. setActivity(changedPlayer, 0);
  760. }
  761. if (inChooseMode && resettingTeams == false && byPlayer.id == 0) {
  762. if (Math.abs(teamR.length - teamB.length) == teamS.length) {
  763. deactivateChooseMode();
  764. resumeGame();
  765. var b = teamS.length;
  766. if (teamR.length > teamB.length) {
  767. for (var i = 0 ; i < b ; i++) {
  768. setTimeout(() => { room.setPlayerTeam(teamS[0].id, Team.BLUE); }, 200*i);
  769. }
  770. }
  771. else {
  772. for (var i = 0 ; i < b ; i++) {
  773. setTimeout(() => { room.setPlayerTeam(teamS[0].id, Team.RED); }, 200*i);
  774. }
  775. }
  776. return;
  777. }
  778. else if ((teamR.length == maxTeamSize && teamB.length == maxTeamSize) || (teamR.length == teamB.length && teamS.length < 2)) {
  779. deactivateChooseMode();
  780. resumeGame();
  781. }
  782. else if (teamR.length <= teamB.length && redCaptainChoice != "") { // choice remembered
  783. redCaptainChoice == "top" ? room.setPlayerTeam(teamS[0].id, Team.RED) : redCaptainChoice == "random" ? room.setPlayerTeam(teamS[getRandomInt(teamS.length)].id, Team.RED) : room.setPlayerTeam(teamS[teamS.length - 1].id, Team.RED);
  784. return;
  785. }
  786. else if (teamB.length < teamR.length && blueCaptainChoice != "") {
  787. blueCaptainChoice == "top" ? room.setPlayerTeam(teamS[0].id, Team.BLUE) : blueCaptainChoice == "random" ? room.setPlayerTeam(teamS[getRandomInt(teamS.length)].id, Team.BLUE) : room.setPlayerTeam(teamS[teamS.length - 1].id, Team.BLUE);
  788. return;
  789. }
  790. else {
  791. choosePlayer();
  792. }
  793. }
  794. }
  795.  
  796. room.onPlayerLeave = function(player) {
  797. if (teamR.findIndex((red) => red.id == player.id) == 0 && inChooseMode && teamR.length <= teamB.length) {
  798. choosePlayer();
  799. capLeft = true; setTimeout(() => { capLeft = false; }, 10);
  800. }
  801. if (teamB.findIndex((blue) => blue.id == player.id) == 0 && inChooseMode && teamB.length < teamR.length) {
  802. choosePlayer();
  803. capLeft = true; setTimeout(() => { capLeft = false; }, 10);
  804. }
  805. setActivity(player, 0);
  806. updateRoleOnPlayerOut();
  807. }
  808.  
  809. room.onPlayerKicked = function(kickedPlayer, reason, ban, byPlayer) {
  810. ban == true ? banList.push([kickedPlayer.name, kickedPlayer.id]) : null;
  811. }
  812.  
  813. /* PLAYER ACTIVITY */
  814.  
  815. room.onPlayerChat = function (player, message) {
  816. message = message.split(/ +/);
  817. player.team != Team.SPECTATORS ? setActivity(player, 0) : null;
  818. if (["!help"].includes(message[0].toLowerCase())) {
  819. room.sendChat(" Player commands : !me, !games, !wins, !goals, !assists, !cs, !afks, !mutes, !bans.", player.id);
  820. player.admin ? room.sendChat(" Admin : !mute <duration = 3> #<id>, !unmute all/#<id>, !clearbans <number = all>, !slow <duration>, !endslow", player.id) : null;
  821. }
  822. else if (["!afk"].includes(message[0].toLowerCase())) {
  823. if (players.length != 1 && player.team != Team.SPECTATORS) {
  824. if (player.team == Team.RED && streak > 0 && room.getScores() == null) {
  825. room.setPlayerTeam(player.id, Team.SPECTATORS);
  826. }
  827. else {
  828. room.sendChat("You can't go AFK while you're in a team !", player.id);
  829. return false;
  830. }
  831. }
  832. else if (players.length == 1 && !getAFK(player)) {
  833. room.setPlayerTeam(player.id, Team.SPECTATORS);
  834. }
  835. setAFK(player, !getAFK(player));
  836. room.sendChat(player.name + (getAFK(player) ? " is now AFK !" : " is not AFK anymore !"));
  837. getAFK(player) ? updateRoleOnPlayerOut() : updateRoleOnPlayerIn();
  838. }
  839. else if (["!afks", "!afklist"].includes(message[0].toLowerCase())) {
  840. var cstm = "[PV] AFK List : ";
  841. for (var i = 0; i < extendedP.length; i++) {
  842. if (room.getPlayer(extendedP[i][eP.ID]) != null && getAFK(room.getPlayer(extendedP[i][eP.ID]))) {
  843. if (140 - cstm.length < (room.getPlayer(extendedP[i][eP.ID]).name + ", ").length) {
  844. room.sendChat(cstm, player.id);
  845. cstm = "... ";
  846. }
  847. cstm += room.getPlayer(extendedP[i][eP.ID]).name + ", ";
  848. }
  849.  
  850. if (message == "!cya") {
  851. room.kickPlayer(player.id , true);
  852. return false;
  853.  
  854. }
  855. }
  856. if (cstm == "[PV] AFK List : ") {
  857. room.sendChat("[PV] There's nobody in the AFK List !", player.id);
  858. return false;
  859. }
  860. cstm = cstm.substring(0, cstm.length - 2);
  861. cstm += ".";
  862. room.sendChat(cstm, player.id);
  863. }
  864. else if (["!me"].includes(message[0].toLowerCase())) {
  865. var stats;
  866. localStorage.getItem(getAuth(player)) ? stats = JSON.parse(localStorage.getItem(getAuth(player))) : stats = [0, 0, 0, 0, "0.00", 0, 0, 0, 0, "0.00"];
  867. room.sendChat("[PV] " + player.name + "> Game: " + stats[Ss.GA] + ", Win: " + stats[Ss.WI] + ", Draw: " + stats[Ss.DR] + ", Loss: " + stats[Ss.LS] + ", WR: " + stats[Ss.WR] + "%, Goal: " + stats[Ss.GL] + ", Assist: " + stats[Ss.AS] + ", GK: " + stats[Ss.GK] + ", CS: " + stats[Ss.CS] + ", CS%: " + stats[Ss.CP] + "%", player.id);
  868. }
  869. else if (["!games"].includes(message[0].toLowerCase())) {
  870. var tableau = [];
  871. Object.keys(localStorage).forEach(function (key) { if (!["player_name", "view_mode", "geo", "avatar", "player_auth_key"].includes(key)) { tableau.push([(JSON.parse(localStorage.getItem(key))[Ss.NK]), (JSON.parse(localStorage.getItem(key))[Ss.GA])]); } });
  872. if (tableau.length < 5) {
  873. room.sendChat("[PV] Not enough games played yet.", player.id);
  874. return false;
  875. }
  876. tableau.sort(function (a, b) { return b[1] - a[1]; });
  877. room.sendChat("[PV] Games> #1 " + tableau[0][0] + ": " + tableau[0][1] + " #2 " + tableau[1][0] + ": " + tableau[1][1] + " #3 " + tableau[2][0] + ": " + tableau[2][1] + " #4 " + tableau[3][0] + ": " + tableau[3][1] + " #5 " + tableau[4][0] + ": " + tableau[4][1], player.id);
  878. }
  879. else if (["!wins"].includes(message[0].toLowerCase())) {
  880. var tableau = [];
  881. Object.keys(localStorage).forEach(function (key) { if (!["player_name", "view_mode", "geo", "avatar", "player_auth_key"].includes(key)) { tableau.push([(JSON.parse(localStorage.getItem(key))[Ss.NK]), (JSON.parse(localStorage.getItem(key))[Ss.WI])]); } });
  882. if (tableau.length < 5) {
  883. room.sendChat("[PV] Not enough games played yet.", player.id);
  884. return false;
  885. }
  886. tableau.sort(function (a, b) { return b[1] - a[1]; });
  887. room.sendChat("[PV] Wins> #1 " + tableau[0][0] + ": " + tableau[0][1] + " #2 " + tableau[1][0] + ": " + tableau[1][1] + " #3 " + tableau[2][0] + ": " + tableau[2][1] + " #4 " + tableau[3][0] + ": " + tableau[3][1] + " #5 " + tableau[4][0] + ": " + tableau[4][1], player.id);
  888. }
  889. else if (["!goals"].includes(message[0].toLowerCase())) {
  890. var tableau = [];
  891. Object.keys(localStorage).forEach(function (key) { if (!["player_name", "view_mode", "geo", "avatar", "player_auth_key"].includes(key)) { tableau.push([(JSON.parse(localStorage.getItem(key))[Ss.NK]), (JSON.parse(localStorage.getItem(key))[Ss.GL])]); } });
  892. if (tableau.length < 5) {
  893. room.sendChat("[PV] Not enough games played yet.", player.id);
  894. return false;
  895. }
  896. tableau.sort(function (a, b) { return b[1] - a[1]; });
  897. room.sendChat("[PV] Goals> #1 " + tableau[0][0] + ": " + tableau[0][1] + " #2 " + tableau[1][0] + ": " + tableau[1][1] + " #3 " + tableau[2][0] + ": " + tableau[2][1] + " #4 " + tableau[3][0] + ": " + tableau[3][1] + " #5 " + tableau[4][0] + ": " + tableau[4][1], player.id);
  898. }
  899. else if (["!assists"].includes(message[0].toLowerCase())) {
  900. var tableau = [];
  901. Object.keys(localStorage).forEach(function (key) { if (!["player_name", "view_mode", "geo", "avatar", "player_auth_key"].includes(key)) { tableau.push([(JSON.parse(localStorage.getItem(key))[Ss.NK]), (JSON.parse(localStorage.getItem(key))[Ss.AS])]); } });
  902. if (tableau.length < 5) {
  903. room.sendChat("[PV] Not enough games played yet.", player.id);
  904. return false;
  905. }
  906. tableau.sort(function (a, b) { return b[1] - a[1]; });
  907. room.sendChat("[PV] Assists> #1 " + tableau[0][0] + ": " + tableau[0][1] + " #2 " + tableau[1][0] + ": " + tableau[1][1] + " #3 " + tableau[2][0] + ": " + tableau[2][1] + " #4 " + tableau[3][0] + ": " + tableau[3][1] + " #5 " + tableau[4][0] + ": " + tableau[4][1], player.id);
  908. }
  909. else if (["!cs"].includes(message[0].toLowerCase())) {
  910. var tableau = [];
  911. Object.keys(localStorage).forEach(function (key) { if (!["player_name", "view_mode", "geo", "avatar", "player_auth_key"].includes(key)) { tableau.push([(JSON.parse(localStorage.getItem(key))[Ss.NK]), (JSON.parse(localStorage.getItem(key))[Ss.CS])]); } });
  912. if (tableau.length < 5) {
  913. room.sendChat("[PV] Not enough games played yet.", player.id);
  914. return false;
  915. }
  916. tableau.sort(function (a, b) { return b[1] - a[1]; });
  917. room.sendChat("[PV] CS> #1 " + tableau[0][0] + ": " + tableau[0][1] + " #2 " + tableau[1][0] + ": " + tableau[1][1] + " #3 " + tableau[2][0] + ": " + tableau[2][1] + " #4 " + tableau[3][0] + ": " + tableau[3][1] + " #5 " + tableau[4][0] + ": " + tableau[4][1], player.id);
  918. }
  919. else if (["!claim"].includes(message[0].toLowerCase())) {
  920. if (message[1] == adminPassword) {
  921. room.setPlayerAdmin(player.id, true);
  922. var stats;
  923. localStorage.getItem(getAuth(player)) ? stats = JSON.parse(localStorage.getItem(getAuth(player))) : stats = [0, 0, 0, 0, "0.00", 0, 0, 0, 0, "0.00", "LuciferGRE", player.name];
  924. if (stats[Ss.RL] != "master") {
  925. stats[Ss.RL] = "master";
  926. room.sendChat(player.name + " is now a room master !");
  927. localStorage.setItem(getAuth(player), JSON.stringify(stats));
  928. }
  929. }
  930. }
  931. else if (["!claim", "!claim"].includes(message[0].toLowerCase())) {
  932. if (localStorage.getItem(getAuth(player)) && JSON.parse(localStorage.getItem(getAuth(player)))[Ss.RL] == "master") {
  933. if (message.length >= 2 && message[1][0] == "#") {
  934. message[1] = message[1].substring(1, message[1].length);
  935. if (!Number.isNaN(Number.parseInt(message[1])) && room.getPlayer(Number.parseInt(message[1])) != null) {
  936. var stats;
  937. localStorage.getItem(getAuth(room.getPlayer(Number.parseInt(message[1])))) ? stats = JSON.parse(localStorage.getItem(getAuth(room.getPlayer(Number.parseInt(message[1]))))) : stats = [0, 0, 0, 0, "0.00", 0, 0, 0, 0, "0.00", "player", room.getPlayer(Number.parseInt(message[1])).name];
  938. if (stats[Ss.RL] == "player") {
  939. stats[Ss.RL] = "admin";
  940. localStorage.setItem(getAuth(room.getPlayer(Number.parseInt(message[1]))), JSON.stringify(stats));
  941. room.setPlayerAdmin(room.getPlayer(Number.parseInt(message[1])).id, true);
  942. room.sendChat(room.getPlayer(Number.parseInt(message[1])).name + " is now an administrator of the room !");
  943. }
  944. }
  945. }
  946. }
  947. }
  948. else if (["!setplayer", "!removeadmin"].includes(message[0].toLowerCase())) {
  949. if (localStorage.getItem(getAuth(player)) && JSON.parse(localStorage.getItem(getAuth(player)))[Ss.RL] == "master") {
  950. if (message.length >= 2 && message[1][0] == "#") {
  951. message[1] = message[1].substring(1, message[1].length);
  952. if (!Number.isNaN(Number.parseInt(message[1])) && room.getPlayer(Number.parseInt(message[1])) != null) {
  953. var stats;
  954. localStorage.getItem(getAuth(room.getPlayer(Number.parseInt(message[1])))) ? stats = JSON.parse(localStorage.getItem(getAuth(room.getPlayer(Number.parseInt(message[1]))))) : stats = [0, 0, 0, 0, "0.00", 0, 0, 0, 0, "0.00", "player", room.getPlayer(Number.parseInt(message[1])).name];
  955. if (stats[Ss.RL] == "admin") {
  956. room.sendChat(room.getPlayer(Number.parseInt(message[1])).name + " is not an administrator of the room anymore !");
  957. stats[Ss.RL] = "player";
  958. localStorage.setItem(getAuth(room.getPlayer(Number.parseInt(message[1]))), JSON.stringify(stats));
  959. room.setPlayerAdmin(room.getPlayer(Number.parseInt(message[1])).id, false);
  960. }
  961. }
  962. }
  963. }
  964. }
  965. else if (["!mutes", "!mutelist"].includes(message[0].toLowerCase())) {
  966. var cstm = " Mute List : ";
  967. for (var i = 0; i < extendedP.length; i++) {
  968. if (room.getPlayer(extendedP[i][eP.ID]) != null && getMute(room.getPlayer(extendedP[i][eP.ID]))) {
  969. if (140 - cstm.length < (room.getPlayer(extendedP[i][eP.ID]).name + "[" + (extendedP[i][eP.ID]) + "], ").length) {
  970. room.sendChat(cstm, player.id);
  971. cstm = "... ";
  972. }
  973. cstm += room.getPlayer(extendedP[i][eP.ID]).name + "[" + (extendedP[i][eP.ID]) + "], ";
  974. }
  975. }
  976. if (cstm == " Mute List : ") {
  977. room.sendChat(" There's nobody in the Mute List !", player.id);
  978. return false;
  979. }
  980. cstm = cstm.substring(0, cstm.length - 2);
  981. cstm += ".";
  982. room.sendChat(cstm, player.id);
  983. }
  984. else if (["!mute"].includes(message[0].toLowerCase())) {
  985. if (player.admin) {
  986. updateTeams();
  987. var timeOut;
  988. if (!Number.isNaN(Number.parseInt(message[1])) && message.length > 1) {
  989. if (Number.parseInt(message[1]) > 0) {
  990. timeOut = Number.parseInt(message[1]) * 60 * 1000;
  991. }
  992. else {
  993. timeOut = 3 * 60 * 1000;
  994. }
  995. if (message[2].length > 1 && message[2][0] == "#") {
  996. message[2] = message[2].substring(1, message[2].length);
  997. if (!Number.isNaN(Number.parseInt(message[2])) && room.getPlayer(Number.parseInt(message[2])) != null) {
  998. if (room.getPlayer(Number.parseInt(message[2])).admin || getMute(room.getPlayer(Number.parseInt(message[2])))) {
  999. return false;
  1000. }
  1001. setTimeout(function (player) { setMute(player, false); }, timeOut, room.getPlayer(Number.parseInt(message[2])));
  1002. setMute(room.getPlayer(Number.parseInt(message[2])), true);
  1003. room.sendChat(room.getPlayer(Number.parseInt(message[2])).name + " has been muted for " + (timeOut / 60000) + " minutes!");
  1004. }
  1005. }
  1006. }
  1007. else if (Number.isNaN(Number.parseInt(message[1]))) {
  1008. if (message[1].length > 1 && message[1][0] == "#") {
  1009. message[1] = message[1].substring(1, message[1].length);
  1010. if (!Number.isNaN(Number.parseInt(message[1])) && room.getPlayer(Number.parseInt(message[1])) != null) {
  1011. if (room.getPlayer(Number.parseInt(message[1])).admin || getMute(room.getPlayer(Number.parseInt(message[1])))) {
  1012. return false;
  1013. }
  1014. setTimeout(function (player) { setMute(player, false); }, 3 * 60 * 1000, room.getPlayer(Number.parseInt(message[1])));
  1015. setMute(room.getPlayer(Number.parseInt(message[1])), true);
  1016. room.sendChat(room.getPlayer(Number.parseInt(message[1])).name + " has been muted for 3 minutes!");
  1017. }
  1018. }
  1019. }
  1020. }
  1021. }
  1022. else if (["!unmute"].includes(message[0].toLowerCase())) {
  1023. if (player.admin && message.length >= 2) {
  1024. if (message[1] == "all") {
  1025. extendedP.forEach((ePlayer) => { ePlayer[eP.MUTE] = false; });
  1026. room.sendChat("Mutes cleared.");
  1027. }
  1028. else if (!Number.isNaN(Number.parseInt(message[1])) && room.getPlayer(Number.parseInt(message[1])) != null && getMute(room.getPlayer(Number.parseInt(message[1])))) {
  1029. setMute(room.getPlayer(Number.parseInt(message[1])), false);
  1030. room.sendChat(room.getPlayer(Number.parseInt(message[1])).name + " has been unmuted !");
  1031. }
  1032. else if (Number.isNaN(Number.parseInt(message[1]))) {
  1033. if (message[1].length > 1 && message[1][0] == "#") {
  1034. message[1] = message[1].substring(1, message[1].length);
  1035. if (!Number.isNaN(Number.parseInt(message[1])) && room.getPlayer(Number.parseInt(message[1])) != null && getMute(room.getPlayer(Number.parseInt(message[1])))) {
  1036. setMute(room.getPlayer(Number.parseInt(message[1])), false);
  1037. room.sendChat(room.getPlayer(Number.parseInt(message[1])).name + " has been unmuted !");
  1038. }
  1039. }
  1040. }
  1041. }
  1042. }
  1043. else if (["!slow"].includes(message[0].toLowerCase())) {
  1044. if (player.admin) {
  1045. if (message.length == 1) {
  1046. slowMode = 2;
  1047. room.sendChat("2 seconds slow mode enabled !");
  1048. }
  1049. else if (message.length == 2) {
  1050. if (!Number.isNaN(Number.parseInt(message[1]))) {
  1051. if (Number.parseInt(message[1]) > 0) {
  1052. slowMode = Number.parseInt(message[1]);
  1053. room.sendChat(slowMode + " seconds slow mode enabled !");
  1054. return false;
  1055. }
  1056. }
  1057. slowMode = 2;
  1058. room.sendChat("2 seconds slow mode enabled !");
  1059. }
  1060. }
  1061. }
  1062. else if (["!endslow"].includes(message[0].toLowerCase())) {
  1063. if (player.admin) {
  1064. slowMode != 0 ? room.sendChat("Slow mode terminated.") : null;
  1065. slowMode = 0;
  1066. }
  1067. }
  1068. else if (["!banlist", "!bans"].includes(message[0].toLowerCase())) {
  1069. if (banList.length == 0) {
  1070. room.sendChat("[PV] There's nobody in the Ban List !", player.id);
  1071. return false;
  1072. }
  1073. var cstm = "[PV] Ban List : ";
  1074. for (var i = 0; i < banList.length; i++) {
  1075. if (140 - cstm.length < (banList[i][0] + "[" + (banList[i][1]) + "], ").length) {
  1076. room.sendChat(cstm, player.id);
  1077. cstm = "... ";
  1078. }
  1079. cstm += banList[i][0] + "[" + (banList[i][1]) + "], ";
  1080. }
  1081. cstm = cstm.substring(0, cstm.length - 2);
  1082. cstm += ".";
  1083. room.sendChat(cstm, player.id);
  1084. }
  1085. else if (["!clearbans"].includes(message[0].toLowerCase())) {
  1086. if (player.admin) {
  1087. if (message.length == 1) {
  1088. room.clearBans();
  1089. room.sendChat("Bans cleared !");
  1090. banList = [];
  1091. }
  1092. if (message.length == 2) {
  1093. if (!Number.isNaN(Number.parseInt(message[1]))) {
  1094. if (Number.parseInt(message[1]) > 0) {
  1095. ID = Number.parseInt(message[1]);
  1096. room.clearBan(ID);
  1097. if (banList.length != banList.filter((array) => array[1] != ID)) {
  1098. room.sendChat(banList.filter((array) => array[1] == ID)[0][0] + " has been unbanned from the room !");
  1099. }
  1100. setTimeout(() => { banList = banList.filter((array) => array[1] != ID); }, 20);
  1101. }
  1102. }
  1103. }
  1104. }
  1105. }
  1106. else if (["!bb", "!bye", "!cya", "!gn"].includes(message[0].toLowerCase())) {
  1107. room.kickPlayer(player.id, "Bye !", false);
  1108. }
  1109. if (teamR.length != 0 && teamB.length != 0 && inChooseMode) {
  1110. if (player.id == teamR[0].id || player.id == teamB[0].id) { // we care if it's one of the captains choosing
  1111. if (teamR.length <= teamB.length && player.id == teamR[0].id) { // we care if it's red turn && red cap talking
  1112. if (["top", "auto"].includes(message[0].toLowerCase())) {
  1113. room.setPlayerTeam(teamS[0].id, Team.RED);
  1114. redCaptainChoice = "top";
  1115. clearTimeout(timeOutCap);
  1116. room.sendChat(player.name + " chose Top !");
  1117. return false;
  1118. }
  1119. else if (["random", "rand"].includes(message[0].toLowerCase())) {
  1120. var r = getRandomInt(teamS.length);
  1121. room.setPlayerTeam(teamS[r].id, Team.RED);
  1122. redCaptainChoice = "random";
  1123. clearTimeout(timeOutCap);
  1124. room.sendChat(player.name + " chose Random !");
  1125. return false;
  1126. }
  1127. else if (["bottom", "bot"].includes(message[0].toLowerCase())) {
  1128. room.setPlayerTeam(teamS[teamS.length - 1].id, Team.RED);
  1129. redCaptainChoice = "bottom";
  1130. clearTimeout(timeOutCap);
  1131. room.sendChat(player.name + " chose Bottom !");
  1132. return false;
  1133. }
  1134. else if (!Number.isNaN(Number.parseInt(message[0]))) {
  1135. if (Number.parseInt(message[0]) > teamS.length || Number.parseInt(message[0]) < 1) {
  1136. room.sendChat("[PV] Your number is invalid !", player.id);
  1137. return false;
  1138. }
  1139. else {
  1140. room.setPlayerTeam(teamS[Number.parseInt(message[0]) - 1].id, Team.RED);
  1141. room.sendChat(player.name + " chose " + teamS[Number.parseInt(message[0]) - 1].name + " !");
  1142. return false;
  1143. }
  1144. }
  1145. }
  1146. if (teamR.length > teamB.length && player.id == teamB[0].id) { // we care if it's red turn && red cap talking
  1147. if (["top", "auto"].includes(message[0].toLowerCase())) {
  1148. room.setPlayerTeam(teamS[0].id, Team.BLUE);
  1149. blueCaptainChoice = "top";
  1150. clearTimeout(timeOutCap);
  1151. room.sendChat(player.name + " chose Top !");
  1152. return false;
  1153. }
  1154. else if (["random", "rand"].includes(message[0].toLowerCase())) {
  1155. room.setPlayerTeam(teamS[getRandomInt(teamS.length)].id, Team.BLUE);
  1156. blueCaptainChoice = "random";
  1157. clearTimeout(timeOutCap);
  1158. room.sendChat(player.name + " chose Random !");
  1159. return false;
  1160. }
  1161. else if (["bottom", "bot"].includes(message[0].toLowerCase())) {
  1162. room.setPlayerTeam(teamS[teamS.length - 1].id, Team.BLUE);
  1163. blueCaptainChoice = "bottom";
  1164. clearTimeout(timeOutCap);
  1165. room.sendChat(player.name + " chose Bottom !");
  1166. return false;
  1167. }
  1168. else if (!Number.isNaN(Number.parseInt(message[0]))) {
  1169. if (Number.parseInt(message[0]) > teamS.length || Number.parseInt(message[0]) < 1) {
  1170. room.sendChat("[PV] Your number is invalid !", player.id);
  1171. return false;
  1172. }
  1173. else {
  1174. room.setPlayerTeam(teamS[Number.parseInt(message[0]) - 1].id, Team.BLUE);
  1175. room.sendChat(player.name + " chose " + teamS[Number.parseInt(message[0]) - 1].name + " !");
  1176. return false;
  1177. }
  1178. }
  1179. }
  1180. }
  1181. }
  1182. if (message[0][0] == "!") {
  1183. return false;
  1184. }
  1185. if (getMute(player)) {
  1186. room.sendChat("You are muted.", player.id);
  1187. return false;
  1188. }
  1189. if (slowMode > 0) {
  1190. if (!player.admin) {
  1191. if (!SMSet.has(player.id)) {
  1192. SMSet.add(player.id);
  1193. setTimeout((number) => { SMSet.delete(number); }, slowMode * 1000, player.id);
  1194. }
  1195. else {
  1196. return false;
  1197. }
  1198. }
  1199. }
  1200. }
  1201.  
  1202. room.onPlayerActivity = function(player) {
  1203. setActivity(player, 0);
  1204. }
  1205.  
  1206. room.onPlayerBallKick = function(player) {
  1207. if (lastPlayersTouched[0] == null || player.id != lastPlayersTouched[0].id) {
  1208. !activePlay ? activePlay = true : null;
  1209. lastTeamTouched = player.team;
  1210. lastPlayersTouched[1] = lastPlayersTouched[0];
  1211. lastPlayersTouched[0] = player;
  1212. }
  1213. }
  1214.  
  1215. /* GAME MANAGEMENT */
  1216.  
  1217. room.onGameStart = function(byPlayer) {
  1218. game = new Game(Date.now(), room.getScores(), []);
  1219. countAFK = true;
  1220. activePlay = false;
  1221. goldenGoal = false;
  1222. endGameVariable = false;
  1223. lastPlayersTouched = [null, null];
  1224. Rposs = 0;
  1225. Bposs = 0;
  1226. GKList = [];
  1227. allReds = [];
  1228. allBlues = [];
  1229. if (teamR.length == maxTeamSize && teamB.length == maxTeamSize) {
  1230. for (var i = 0; i < maxTeamSize; i++) {
  1231. allReds.push(teamR[i]);
  1232. allBlues.push(teamB[i]);
  1233. }
  1234. }
  1235. for (var i = 0; i < extendedP.length; i++) {
  1236. extendedP[i][eP.GK] = 0;
  1237. extendedP[i][eP.ACT] = 0;
  1238. room.getPlayer(extendedP[i][eP.ID]) == null ? extendedP.splice(i, 1) : null;
  1239. }
  1240. deactivateChooseMode();
  1241. }
  1242.  
  1243. room.onGameStop = function(byPlayer) {
  1244. if (byPlayer.id == 0 && endGameVariable) {
  1245. updateTeams();
  1246. if (inChooseMode) {
  1247. if (players.length == 2 * maxTeamSize) {
  1248. inChooseMode = false;
  1249. resetBtn();
  1250. for (var i = 0; i < maxTeamSize; i++) {
  1251. setTimeout(() => { randomBtn(); }, 400*i);
  1252. }
  1253. setTimeout(() => { room.startGame(); }, 2000);
  1254. }
  1255. else {
  1256. if (lastWinner == Team.RED) {
  1257. blueToSpecBtn();
  1258. }
  1259. else if (lastWinner == Team.BLUE) {
  1260. redToSpecBtn();
  1261. blueToRedBtn();
  1262. }
  1263. else {
  1264. resetBtn();
  1265. }
  1266. setTimeout(() => { topBtn(); }, 500);
  1267. }
  1268. }
  1269. else {
  1270. if (players.length == 2) {
  1271. if (lastWinner == Team.BLUE) {
  1272. room.setPlayerTeam(teamB[0].id, Team.RED);
  1273. room.setPlayerTeam(teamR[0].id, Team.BLUE);
  1274. }
  1275. setTimeout(() => { room.startGame(); }, 2000);
  1276. }
  1277. else if (players.length == 3 || players.length >= 2 * maxTeamSize + 1) {
  1278. if (lastWinner == Team.RED) {
  1279. blueToSpecBtn();
  1280. }
  1281. else {
  1282. redToSpecBtn();
  1283. blueToRedBtn();
  1284. }
  1285. setTimeout(() => { topBtn(); }, 200);
  1286. setTimeout(() => { room.startGame(); }, 2000);
  1287. }
  1288. else if (players.length == 4) {
  1289. resetBtn();
  1290. setTimeout(() => { randomBtn(); setTimeout(() => { randomBtn(); }, 500); }, 500);
  1291. setTimeout(() => { room.startGame(); }, 2000);
  1292. }
  1293. else if (players.length == 5 || players.length >= 2 * maxTeamSize + 1) {
  1294. if (lastWinner == Team.RED) {
  1295. blueToSpecBtn();
  1296. }
  1297. else {
  1298. redToSpecBtn();
  1299. blueToRedBtn();
  1300. }
  1301. setTimeout(() => { topBtn(); }, 200);
  1302. activateChooseMode();
  1303. }
  1304. else if (players.length == 6) {
  1305. resetBtn();
  1306. setTimeout(() => { randomBtn(); setTimeout(() => { randomBtn(); setTimeout(() => { randomBtn(); }, 500); }, 500); }, 500);
  1307. setTimeout(() => { room.startGame(); }, 2000);
  1308. }
  1309. }
  1310. }
  1311. }
  1312.  
  1313. room.onGamePause = function(byPlayer) {
  1314. }
  1315.  
  1316. room.onGameUnpause = function (byPlayer) {
  1317. if (teamR.length == 4 && teamB.length == 4 && inChooseMode || (teamR.length == teamB.length && teamS.length < 2 && inChooseMode)) {
  1318. deactivateChooseMode();
  1319. }
  1320. }
  1321.  
  1322. room.onTeamGoal = function(team) {
  1323. activePlay = false;
  1324. countAFK = false;
  1325. const scores = room.getScores();
  1326. game.scores = scores;
  1327. if (lastPlayersTouched[0] != null && lastPlayersTouched[0].team == team) {
  1328. if (lastPlayersTouched[1] != null && lastPlayersTouched[1].team == team) {
  1329. room.sendChat("⚽ " + getTime(scores) + " Goal by " + lastPlayersTouched[0].name + " ! Assist by " + lastPlayersTouched[1].name + ". Goal speed : " + ballSpeed.toPrecision(4).toString() + "km/h " + (team == Team.RED ? "🔴" : "🔵"));
  1330. game.goals.push(new Goal(scores.time, team, lastPlayersTouched[0], lastPlayersTouched[1]));
  1331. }
  1332. else {
  1333. room.sendChat("⚽ " + getTime(scores) + " Goal by " + lastPlayersTouched[0].name + " ! Goal speed : " + ballSpeed.toPrecision(4).toString() + "km/h " + (team == Team.RED ? "🔴" : "🔵"));
  1334. game.goals.push(new Goal(scores.time, team, lastPlayersTouched[0], null));
  1335. }
  1336. }
  1337. else {
  1338. room.sendChat("😂 " + getTime(scores) + " Own Goal by " + lastPlayersTouched[0].name + " ! Goal speed : " + ballSpeed.toPrecision(4).toString() + "km/h " + (team == Team.RED ? "🔴" : "🔵"));
  1339. game.goals.push(new Goal(scores.time, team, null, null));
  1340. }
  1341. if (scores.scoreLimit != 0 && (scores.red == scores.scoreLimit || scores.blue == scores.scoreLimit && scores.blue > 0 || goldenGoal == true)) {
  1342. endGame(team);
  1343. goldenGoal = false;
  1344. setTimeout(() => { room.stopGame(); }, 1000);
  1345. }
  1346. }
  1347.  
  1348. room.onPositionsReset = function() {
  1349. countAFK = true;
  1350. lastPlayersTouched = [null, null];
  1351. }
  1352.  
  1353. /* MISCELLANEOUS */
  1354.  
  1355. room.onRoomLink = function(url) {
  1356. }
  1357.  
  1358. room.onPlayerAdminChange = function (changedPlayer, byPlayer) {
  1359. if (getMute(changedPlayer) && changedPlayer.admin) {
  1360. room.sendChat(changedPlayer.name + " has been unmuted.");
  1361. setMute(changedPlayer, false);
  1362. }
  1363. if (byPlayer.id != 0 && localStorage.getItem(getAuth(byPlayer)) && JSON.parse(localStorage.getItem(getAuth(byPlayer)))[Ss.RL] == "claim") {
  1364. room.sendChat("", byPlayer.id);
  1365. room.setPlayerAdmin(changedPlayer.id, false);
  1366. }
  1367. }
  1368.  
  1369. room.onStadiumChange = function(newStadiumName, byPlayer) {
  1370. }
  1371.  
  1372. room.onGameTick = function() {
  1373. checkTime();
  1374. getLastTouchOfTheBall();
  1375. getStats();
  1376. handleInactivity();
  1377. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement