GrandTabernacleAutoVI/public_html/js/global.js
Killian Marty 5759f39bb8 final code
2024-01-01 12:55:28 +01:00

231 lines
No EOL
27 KiB
JavaScript

let player = null;
let players = [];
let renderer = new Render("canvas");
let LB = new LeaderBoard("canvas");
let bulletSound = new Sound("./assets/sounds/shoot.mp3");
let driftSound = new Sound("./assets/sounds/drift.mp3");
let notificationSound = new Sound("./assets/sounds/notification.mp3");
let net = new Network("wss://ws.gta6.insat.fr:8080?name=" + getCookie("pseudo"));
let inp = new Input("canvas");
let phone = new Phone();
let bullets = [];
let circles = [];
let squares = [];
let PNJS = [new PNJ(500, 100,0),
new PNJ(700, 100,0),
new PNJ(500, 600,0),
new PNJ(200, 700,0)];
let cars = [new Car(1, 7),
new Car(1, 34),
new Car(0, 20),
new Car(0, 52)];
let portals = [new Portal(250,457,0,516,789,1),//O
new Portal(344,758,0,50,852,4), // SO
new Portal(1190,211,0,871,856,9),// NE
new Portal(862,213,0,200,147,5), // N
new Portal(1126,472,0,583,800,3),// E
new Portal(1076,768,0,484,898,2),// SE
new Portal(721,767,0,917,547,7), // S -> grotte chelou
new Portal(970,476,0,1056,449,8),//Mid -> Poudlar
new Portal(617,154,1,274,244,0),//out map 1
new Portal(95,561,2,989,694,0), //out map 2
new Portal(569,810,3,1152,519,0),//out map 3
new Portal(105, 852,4,365,800,0), //out map 4
new Portal(110,122,5,880,255,0), //out map 5
new Portal(231,475,5,131,313,6), //pour aller a l'étage (map6)
new Portal(115,353,6,317,493,5), //out map6 (pour aller a map5)
new Portal(948,517,7,740,815,0), //out map7
new Portal(1075,421,8,985,520,0), //out map8
new Portal(209,731,8,235,182,8), //troll map8
new Portal(209,110,8,235,730,8), //troll map8
new Portal(500,340,9,58,269,10), //out map 9 (vers suite du donjon map 10)
new Portal(786,254,10,276,860,11), //out map 10 (vers suite du donjon map 11)
new Portal(260,399,11,1089,227,0) //sortie vers la map 0
];
let map0Squares = [new Square(1,2,0,135,924),new Square(1337,0,0,132,929),new Square(124,0,0,1235,13),new Square(125,908,0,1218,18),new Square(169,240,0,63,258),new Square(313,241,0,63,257),new Square(231,258,0,82,222),new Square(297,112,0,80,97),new Square(527,129,0,100,13),new Square(792,112,0,177,129),new Square(1018,112,0,151,81),new Square(1161,112,0,145,129),new Square(1020,192,0,8,48),new Square(1020,226,0,55,15),new Square(1104,226,0,58,14),new Square(1065,370,0,126,128),new Square(1001,626,0,192,159),new Square(697,626,0,159,158),new Square(696,370,0,160,240),new Square(853,370,0,165,127),new Square(281,627,0,176,158),new Square(656,129,0,97,14),new Square(750,128,0,5,49),new Square(749,193,0,7,48),new Square(655,224,0,101,17),new Square(527,226,0,100,15),new Square(527,193,0,4,47),new Square(527,129,0,5,47),new Square(590,155,0,7,20),new Square(654,156,0,7,20),new Square(701,186,0,9,22)]
let map1Squares = [new Square(1,164,1,171,833),new Square(157,847,1,864,175),new Square(855,260,1,168,608),new Square(533,2,1,489,168),new Square(354,3,1,183,169),new Square(3,3,1,361,135),new Square(203,819,1,134,40),new Square(683,816,1,217,36)]
let map2Squares = [new Square(2,4,2,101,949),new Square(89,2,2,703,193),new Square(286,185,2,496,80),new Square(289,242,2,280,83),new Square(411,302,2,189,107),new Square(563,263,2,50,43),new Square(246,180,2,54,84),new Square(91,277,2,138,96),new Square(95,417,2,152,86),new Square(220,402,2,32,60),new Square(767,278,2,157,130),new Square(770,400,2,39,69),new Square(870,424,2,50,43),new Square(774,2,2,247,208),new Square(922,202,2,100,816),new Square(911,424,2,22,226),new Square(895,532,2,32,97),new Square(819,614,2,103,184),new Square(781,758,2,26,62),new Square(1,934,2,928,85),new Square(195,829,2,42,36),new Square(129,809,2,12,54),new Square(223,874,2,60,42),new Square(221,758,2,44,42),new Square(203,775,2,39,38)]
let map3Squares = [new Square(3,367,3,94,526),new Square(86,829,3,807,64),new Square(703,365,3,188,479),new Square(640,318,3,253,61),new Square(831,18,3,63,310),new Square(2,0,3,839,64),new Square(1,58,3,62,314),new Square(57,322,3,103,62),new Square(69,130,3,54,85),new Square(257,142,3,103,36),new Square(351,57,3,99,282),new Square(255,319,3,288,159),new Square(289,470,3,223,26),new Square(637,370,3,76,109),new Square(83,370,3,80,109),new Square(287,554,3,225,38),new Square(707,137,3,88,79),new Square(672,54,3,182,129),new Square(442,136,3,98,40),new Square(441,54,3,233,106),new Square(443,254,3,32,28),new Square(802,237,3,31,58),new Square(453,645,3,54,45),new Square(576,645,3,94,45),new Square(145,679,3,127,69),new Square(132,690,3,20,43),new Square(267,689,3,17,39),new Square(161,738,3,91,28),new Square(164,653,3,88,26),new Square(85,754,3,40,84),new Square(59,57,3,326,102),new Square(320,206,3,35,61),new Square(116,150,3,41,33)]
let map4Squares = [new Square(101,64,4,47,45),new Square(281,46,4,42,39),new Square(343,58,4,47,41),new Square(334,237,4,37,38),new Square(383,209,4,39,39),new Square(516,53,4,91,91),new Square(531,139,4,65,11),new Square(605,68,4,11,59),new Square(510,70,4,8,60),new Square(531,45,4,66,16),new Square(700,48,4,85,39),new Square(854,159,4,50,67),new Square(528,377,4,45,26),new Square(944,109,4,25,273),new Square(1106,137,4,47,122),new Square(1107,302,4,46,125),new Square(611,674,4,46,122),new Square(617,810,4,128,48),new Square(847,52,4,11,39),new Square(857,35,4,64,74),new Square(919,34,4,23,409),new Square(921,432,4,100,16),new Square(1102,432,4,89,16),new Square(661,39,4,19,252),new Square(665,278,4,97,19),new Square(839,279,4,84,15),new Square(28,279,4,93,19),new Square(198,279,4,246,19),new Square(429,32,4,18,266),new Square(1,1,4,39,904),new Square(32,1,4,6,0),new Square(35,0,4,1181,36),new Square(1184,22,4,32,882),new Square(0,872,4,1,0),new Square(0,870,4,1215,35),new Square(481,354,4,119,16),new Square(177,650,4,98,15),new Square(175,650,4,20,223),new Square(356,647,4,246,15),new Square(584,647,4,22,223),new Square(478,640,4,123,7),new Square(681,443,4,15,126),new Square(502,546,4,84,46),new Square(525,596,4,46,46),new Square(403,432,4,18,19),new Square(412,418,4,20,21),new Square(426,401,4,24,23),new Square(442,386,4,21,21),new Square(456,367,4,28,25),new Square(593,359,4,0,0),new Square(593,359,4,19,16),new Square(603,366,4,22,20),new Square(616,381,4,23,17),new Square(626,386,4,25,23),new Square(641,401,4,25,23),new Square(659,418,4,22,16),new Square(675,427,4,12,19),new Square(601,634,4,18,15),new Square(611,618,4,21,21),new Square(627,600,4,22,22),new Square(643,591,4,18,14),new Square(655,571,4,23,24),new Square(671,561,4,15,19),new Square(401,563,4,17,16),new Square(411,572,4,19,23),new Square(422,586,4,19,17),new Square(437,598,4,22,17),new Square(448,610,4,17,16),new Square(463,622,4,15,16),new Square(470,629,4,16,14)]
let map5Squares = [new Square(520,51,5,84,114),new Square(639,52,5,80,115),new Square(750,51,5,81,116),new Square(641,395,5,79,116),new Square(752,396,5,86,126),new Square(846,7,5,49,547),new Square(10,3,5,840,53),new Square(221,44,5,228,60),new Square(10,0,5,101,356),new Square(502,221,5,35,200),new Square(386,396,5,151,29),new Square(102,213,5,214,15),new Square(9,349,5,343,100),new Square(11,447,5,74,108),new Square(206,506,5,688,51),new Square(13,520,5,193,35),new Square(76,432,5,223,44)]
let map6Squares = [new Square(8,27,6,103,510),new Square(99,509,6,789,27),new Square(851,30,6,47,501),new Square(100,28,6,755,24),new Square(103,255,6,29,53),new Square(561,253,6,174,58),new Square(744,269,6,25,26),new Square(697,224,6,22,23),new Square(694,315,6,22,26),new Square(641,314,6,25,29),new Square(638,224,6,30,24),new Square(579,223,6,27,24),new Square(106,177,6,53,45),new Square(97,42,6,50,42),new Square(130,79,6,32,25),new Square(167,46,6,67,36),new Square(201,68,6,34,26),new Square(381,66,6,34,21),new Square(509,46,6,55,49),new Square(524,88,6,34,31),new Square(555,46,6,49,28),new Square(787,63,6,30,27),new Square(813,43,6,40,65),new Square(601,461,6,91,44),new Square(583,482,6,131,27),new Square(155,481,6,182,31),new Square(157,341,6,21,146),new Square(232,208,6,28,79),new Square(232,207,6,103,13),new Square(347,349,6,69,24)]
let map7Squares = [new Square(865,306,7,5,356),new Square(289,60,7,667,32),new Square(934,59,7,27,445),new Square(292,635,7,579,31),new Square(867,653,7,89,13),new Square(933,579,7,24,85),new Square(934,577,7,79,16),new Square(936,490,7,76,13),new Square(58,296,7,149,54),new Square(44,377,7,165,50),new Square(175,654,7,118,14),new Square(178,56,7,113,17),new Square(289,84,7,4,136),new Square(287,506,7,8,148),new Square(289,214,7,49,7),new Square(288,505,7,48,6),new Square(427,90,7,92,50),new Square(566,90,7,94,54),new Square(711,89,7,93,53),new Square(715,585,7,90,49),new Square(572,585,7,93,52),new Square(427,585,7,93,53),new Square(31,248,7,51,250),new Square(1001,497,7,10,93)]
let map8Squares = [new Square(180,739,8,245,12),new Square(328,508,8,9,232),new Square(325,126,8,11,238),new Square(1118,176,8,17,588),new Square(1099,117,8,45,62),new Square(1000,115,8,101,24),new Square(995,106,8,27,41),new Square(1060,113,8,28,35),new Square(989,91,8,12,32),new Square(1002,85,8,0,0),new Square(1002,85,8,0,0),new Square(1002,85,8,0,0),new Square(756,75,8,268,25),new Square(661,71,8,92,77),new Square(405,68,8,260,32),new Square(395,72,8,37,52),new Square(400,111,8,26,35),new Square(325,106,8,77,29),new Square(328,109,8,29,37),new Square(180,108,8,167,26),new Square(1123,727,8,5,37),new Square(1101,694,8,43,80),new Square(1058,725,8,31,33),new Square(1082,735,8,41,16),new Square(995,727,8,29,44),new Square(1000,736,8,62,27),new Square(986,750,8,26,31),new Square(762,771,8,276,30),new Square(664,725,8,23,28),new Square(680,735,8,64,19),new Square(734,726,8,19,77),new Square(424,769,8,260,27),new Square(401,726,8,24,31),new Square(407,750,8,22,39),new Square(335,728,8,21,11),new Square(371,573,8,286,28),new Square(755,574,8,289,28),new Square(756,655,8,288,28),new Square(373,656,8,284,25),new Square(373,187,8,283,29),new Square(757,187,8,287,28),new Square(756,269,8,288,29),new Square(372,269,8,287,28),new Square(388,179,8,254,46),new Square(770,176,8,261,51),new Square(773,260,8,257,48),new Square(388,259,8,256,50),new Square(386,565,8,258,47),new Square(387,641,8,255,49),new Square(660,745,8,20,46),new Square(772,561,8,253,49),new Square(774,643,8,255,50),new Square(272,158,8,28,169),new Square(270,541,8,29,173),new Square(244,675,8,31,17),new Square(243,617,8,33,18),new Square(246,559,8,30,20),new Square(246,174,8,33,21),new Square(244,231,8,32,21),new Square(244,281,8,32,25),new Square(145,694,8,35,75),new Square(144,91,8,37,84),new Square(132,169,8,25,561),new Square(153,323,8,14,221)]
let map9Squares = [new Square(1,2,9,15,429),new Square(55,179,9,16,303),new Square(2,469,9,67,14),new Square(13,424,9,46,5),new Square(55,110,9,15,31),new Square(71,69,9,0,0),new Square(57,1,9,14,68),new Square(15,0,9,883,14),new Square(885,1,9,15,823),new Square(863,810,9,36,15),new Square(808,755,9,21,70),new Square(629,755,9,268,17),new Square(702,702,9,16,57),new Square(704,810,9,71,16),new Square(704,816,9,12,71),new Square(709,864,9,190,32),new Square(1,880,9,711,16),new Square(164,829,9,31,53),new Square(182,809,9,15,72),new Square(628,756,9,37,87),new Square(0,471,9,16,418),new Square(468,7,9,16,61),new Square(468,53,9,68,16),new Square(522,52,9,16,189),new Square(449,234,9,0,0),new Square(450,232,9,216,19),new Square(577,158,9,15,75),new Square(576,53,9,15,72),new Square(577,52,9,195,17),new Square(813,10,9,13,105),new Square(813,74,9,32,51),new Square(108,52,9,324,18),new Square(415,61,9,15,53),new Square(397,107,9,87,17),new Square(468,107,9,17,63),new Square(450,163,9,34,15),new Square(397,161,9,15,132),new Square(402,178,9,65,18),new Square(162,108,9,195,16),new Square(343,116,9,16,133),new Square(108,56,9,15,192),new Square(110,234,9,87,16),new Square(165,181,9,14,53),new Square(164,180,9,106,16),new Square(254,160,9,16,36),new Square(181,162,9,33,19),new Square(52,521,9,199,17),new Square(217,504,9,34,34),new Square(216,360,9,17,160),new Square(232,341,9,18,87),new Square(578,111,9,85,14),new Square(703,109,9,14,31),new Square(703,109,9,68,13),new Square(755,63,9,18,131),new Square(756,177,9,63,18),new Square(812,160,9,34,33),new Square(810,186,9,15,51),new Square(758,234,9,85,16),new Square(758,244,9,14,175),new Square(630,118,9,14,77),new Square(631,181,9,89,13),new Square(639,163,9,25,22),new Square(702,191,9,15,110),new Square(340,289,9,377,12),new Square(576,298,9,14,122),new Square(632,343,9,31,30),new Square(661,342,9,56,14),new Square(703,342,9,14,34),new Square(703,412,9,139,17),new Square(812,394,9,31,31),new Square(829,396,9,13,320),new Square(758,702,9,83,15),new Square(757,632,9,13,75),new Square(757,577,9,75,13),new Square(810,584,9,25,61),new Square(648,648,9,112,14),new Square(648,648,9,15,67),new Square(525,703,9,139,14),new Square(632,666,9,21,40),new Square(704,520,9,12,130),new Square(705,520,9,86,17),new Square(654,468,9,118,15),new Square(648,369,9,15,167),new Square(812,289,9,12,61),new Square(811,342,9,36,16),new Square(813,287,9,76,15),new Square(52,521,9,19,53),new Square(111,579,9,13,83),new Square(111,576,9,83,14),new Square(182,585,9,11,24),new Square(118,587,9,22,20),new Square(54,648,9,69,15),new Square(53,647,9,17,120),new Square(10,757,9,60,15),new Square(110,288,9,14,233),new Square(162,294,9,17,189),new Square(112,287,9,135,16),new Square(236,235,9,13,64),new Square(237,233,9,121,16),new Square(290,244,9,14,119),new Square(290,357,9,119,22),new Square(345,342,9,64,33),new Square(397,342,9,14,130),new Square(451,413,9,200,15),new Square(290,415,9,15,110),new Square(290,414,9,69,16),new Square(290,523,9,242,15),new Square(344,468,9,266,16),new Square(524,482,9,14,114),new Square(524,595,9,67,15),new Square(577,595,9,14,68),new Square(526,651,9,12,66),new Square(472,651,9,66,12),new Square(472,577,9,11,86),new Square(416,577,9,67,33),new Square(414,577,9,14,139),new Square(416,704,9,68,14),new Square(470,704,9,14,85),new Square(524,756,9,15,77),new Square(577,711,9,16,131),new Square(234,826,9,358,20),new Square(235,811,9,86,18),new Square(234,721,9,18,118),new Square(289,758,9,14,55),new Square(294,758,9,31,13),new Square(109,755,9,131,17),new Square(219,702,9,15,54),new Square(107,700,9,71,17),new Square(162,648,9,14,55),new Square(162,649,9,90,15),new Square(236,579,9,16,85),new Square(290,578,9,15,31),new Square(245,594,9,60,15),new Square(126,716,9,17,39),new Square(107,757,9,18,89),new Square(55,830,9,70,16),new Square(74,809,9,40,25),new Square(291,650,9,14,66),new Square(290,702,9,63,16),new Square(363,773,9,68,16),new Square(414,757,9,16,16),new Square(362,668,9,14,120),new Square(343,535,9,21,182),new Square(359,533,9,18,78),new Square(579,522,9,13,31),new Square(588,522,9,74,14),new Square(631,533,9,15,74),new Square(632,576,9,34,32),new Square(894,822,9,5,44)]
let map10Squares = [new Square(0,0,10,32,560),new Square(30,0,10,76,70),new Square(105,0,10,705,33),new Square(2,493,10,104,69),new Square(103,528,10,706,32),new Square(212,492,10,69,36),new Square(353,492,10,77,44),new Square(421,457,10,37,72),new Square(69,315,10,37,143),new Square(71,104,10,33,142),new Square(599,29,10,35,25),new Square(352,26,10,105,43),new Square(211,28,10,70,42),new Square(422,29,10,35,76),new Square(455,105,10,37,35),new Square(527,106,10,103,34),new Square(599,86,10,36,90),new Square(563,136,10,71,41),new Square(775,31,10,35,119),new Square(740,100,10,70,110),new Square(740,206,10,34,40),new Square(740,316,10,34,46),new Square(740,352,10,70,108),new Square(776,458,10,32,72),new Square(456,422,10,37,36),new Square(528,421,10,79,37),new Square(598,388,10,36,87),new Square(563,387,10,70,36),new Square(598,509,10,35,21),new Square(806,206,10,4,148)]
let map11Squares = [new Square(1,2,11,555,89),new Square(1,57,11,117,86),new Square(446,2,11,117,140),new Square(2,625,11,101,354),new Square(2,979,11,0,0),new Square(460,625,11,104,357),new Square(97,908,11,371,72),new Square(187,884,11,189,31),new Square(0,137,11,6,490),new Square(556,136,11,7,494)]
let map0Circles = [new Circle(609,190,0,16),new Circle(729,164,0,11),new Circle(569,213,0,10),new Circle(552,165,0,11),new Circle(680,211,0,10)]
let map1Circles = [new Circle(142,100,1,151),new Circle(66,806,1,155),new Circle(377,902,1,104),new Circle(441,895,1,74),new Circle(155,502,1,51),new Circle(650,869,1,63),new Circle(609,870,1,49),new Circle(965,946,1,248),new Circle(864,244,1,64),new Circle(841,190,1,64),new Circle(374,184,1,28),new Circle(497,172,1,31),new Circle(439,145,1,62),new Circle(391,167,1,42)]
let map2Circles = [new Circle(132,874,2,17),new Circle(812,767,2,29),new Circle(183,212,2,21),new Circle(101,187,2,57),new Circle(111,298,2,42),new Circle(131,795,2,34),new Circle(217,824,2,26)]
let map3Circles = [new Circle(687,517,3,14),new Circle(710,485,3,35),new Circle(690,813,3,13),new Circle(54,210,3,37),new Circle(87,467,3,39)]
let map4Circles = [new Circle(1057.96875,16,4,61.07372593840988),new Circle(962.96875,54,4,14.866068747318506),new Circle(404.96875,132,4,22.02271554554524),new Circle(184.96875,69,4,20.024984394500787),new Circle(59.96875,67,4,20),new Circle(882.96875,133,4,14.142135623730951),new Circle(890.96875,249,4,17.029386365926403)]
let map5Circles = [new Circle(389.96875,280,5,71.06335201775947),new Circle(346.96875,280,5,77.92945527847606),new Circle(425.96875,439,5,8),new Circle(470.96875,438,5,12),new Circle(518.96875,438,5,9.055385138137417),new Circle(552.96875,397,5,11.045361017187261),new Circle(551.96875,362,5,13.038404810405298),new Circle(299.96875,447,5,25.238858928247925),new Circle(324.96875,443,5,18.867962264113206)]
let map6Circles = [new Circle(599.96875,330,6,13.892443989449804),new Circle(366.96875,278,6,76.00657866263946),new Circle(386.96875,284,6,73.10950690573696),new Circle(142.96875,178,6,12.041594578792296),new Circle(130.04409510198778,174.0078125,6,13.601480697536704),new Circle(232.0449785630765,60.0078125,6,20.518379508122223),new Circle(419.0465982417392,62.0078125,6,17.117244792645977),new Circle(415.04656359620634,90.0078125,6,22.803582948232627),new Circle(659.0486769737126,63.0078125,6,13.152949072028138),new Circle(690.0489454765926,61.0078125,6,13.928403823519659),new Circle(607.0482265817851,68.0078125,6,16.031220082165973),new Circle(628.0484084708328,75.0078125,6,14),new Circle(584.048027369971,81.0078125,6,16.124517645231),new Circle(831.0501667316271,454.0078125,6,28.42548828525679),new Circle(765.0495950803344,490.0078125,6,22.472229721633212),new Circle(808.0499675198129,492.0078125,6,45.65094067218403),new Circle(684.0488935082933,463.0078125,6,14.866127010225155),new Circle(744.0494131912867,479.0078125,6,11.313757495273405),new Circle(394.0463817071586,497.0078125,6,14.56022929645903),new Circle(256.04518643627387,475.0078125,6,17.20470087749703),new Circle(229.04495257892685,467.0078125,6,17.00003260767031),new Circle(194.04464943051406,475.0078125,6,20.808711985348125),new Circle(382.04627777056,380.0078125,6,15.264373837857004),new Circle(409.04651162790697,370.0078125,6,15.000083149408585),new Circle(252.045151790741,298.0078125,6,13.45367619463759),new Circle(260.04522108180674,319.0078125,6,12.530047727914598),new Circle(265.0452643887229,337.0078125,6,13.000095941537126)]
let map7Circles = [new Circle(829.96875,545,7,17.204650534085253),new Circle(253.96875,491,7,25.079872407968907),new Circle(256.96875,227,7,22),new Circle(686.96875,541,7,19.026297590440446),new Circle(540.96875,181,7,18.110770276274835),new Circle(395.96875,180,7,19),new Circle(251.96875,178,7,21.37755832643195),new Circle(251.96875,542,7,20),new Circle(395.96875,542,7,20.223748416156685),new Circle(541.96875,543,7,18.027756377319946),new Circle(686.96875,182,7,17.029386365926403),new Circle(827.96875,183,7,19),new Circle(75.96875,233,7,23.08679276123039),new Circle(91.96875,171,7,27.80287754891569),new Circle(127.96875,131,7,19.1049731745428),new Circle(168.96875,86,7,20.591260281974),new Circle(74.96875,494,7,21.18962010041709),new Circle(93.96875,551,7,21.095023109728988),new Circle(127.96875,603,7,17.804493814764857),new Circle(175.96875,647,7,17.69180601295413),new Circle(53.96875,353,7,52.773099207835045),new Circle(70.96875,191,7,29.68164415931166),new Circle(92.96875,125,7,37.48332962798263),new Circle(128.96875,81,7,38.8329756778952),new Circle(177.96875,45,7,41.182520563948),new Circle(59.96875,531,7,34.92849839314596),new Circle(89.96875,595,7,36.40054944640259),new Circle(128.96875,649,7,39.6232255123179),new Circle(190.96875,668,7,21.470910553583888)]
let map8Circles = [new Circle(746,80.79999923706055,8,31.304951684997057),new Circle(740,789.2000045776367,8,32.64965543462902),new Circle(158,176.79999923706055,8,18.439088914585774),new Circle(157,257.79999923706055,8,16.0312195418814),new Circle(160,341.79999923706055,8,16.0312195418814),new Circle(160,531.2000045776367,8,14.035668847618199),new Circle(150,615.2000045776367,8,26.076809620810597),new Circle(152,701.2000045776367,8,26.1725046566048),new Circle(505,767.2000045776367,8,7.0710678118654755),new Circle(587,765.2000045776367,8,5),new Circle(831,772.2000045776367,8,11),new Circle(916,772.2000045776367,8,8.246211251235321),new Circle(503,100.79999923706055,8,10),new Circle(585,98.79999923706055,8,12.041594578792296),new Circle(830,96.79999923706055,8,13),new Circle(920,95.79999923706055,8,16.76305461424021),new Circle(445,365.79999923706055,8,15.033296378372908),new Circle(587,366.79999923706055,8,12.041594578792296),new Circle(447,503.79999923706055,8,14.035668847618199),new Circle(587,505.79999923706055,8,12),new Circle(830,366.79999923706055,8,12),new Circle(970,366.79999923706055,8,15.620499351813308),new Circle(969,506.79999923706055,8,14.422205101855956),new Circle(836,506.79999923706055,8,15.231546211727817),new Circle(984,361.79999923706055,8,12),new Circle(985,506.79999923706055,8,12.165525060596439),new Circle(840,363.79999923706055,8,13),new Circle(1120,196.79999923706055,8,13),new Circle(1114,270.79999923706055,8,10),new Circle(1116,346.79999923706055,8,12),new Circle(1118,526.2000045776367,8,13.038404810405298),new Circle(1120,602.2000045776367,8,13.038404810405298),new Circle(1115,680.2000045776367,8,10)]
let map10Circles = [new Circle(448,448,10,10),new Circle(436,458,10,9),new Circle(459,440,10,12),new Circle(446,113,10,11),new Circle(436,99,10,13),new Circle(457,121,10,11),new Circle(316,174,10,20),new Circle(316,386,10,20),new Circle(475,228,10,10),new Circle(687,156,10,10),new Circle(686,403,10,11),new Circle(686,333,10,9),new Circle(687,228,10,10),new Circle(582,228,10,10),new Circle(581,333,10,11),new Circle(474,334,10,10)]
let map11Circles = [new Circle(281,240,11,20),new Circle(282,210,11,14),new Circle(104,342,11,14),new Circle(461,339,11,14),new Circle(457,505,11,12),new Circle(104,505,11,13),new Circle(189,908,11,17),new Circle(373,907,11,19),new Circle(99,63,11,74),new Circle(460,76,11,60),new Circle(255,349,11,9),new Circle(309,348,11,8),new Circle(236,529,11,7),new Circle(327,530,11,7),new Circle(328,623,11,5),new Circle(236,624,11,7),new Circle(237,716,11,5),new Circle(328,718,11,5),new Circle(328,811,11,5),new Circle(236,812,11,7)]
let maps = [new Game_Map(portals.slice(0,8),0,map0Squares,map0Circles),
new Game_Map(portals.slice(8,9),1,map1Squares,map1Circles),
new Game_Map(portals.slice(9,10),2,map2Squares,map2Circles),
new Game_Map(portals.slice(10,11),3,map3Squares,map3Circles),
new Game_Map(portals.slice(11,12),4,map4Squares,map4Circles),
new Game_Map(portals.slice(12,14),5,map5Squares,map5Circles),
new Game_Map(portals.slice(14,15),6,map6Squares,map6Circles),
new Game_Map(portals.slice(15,16),7,map7Squares,map7Circles),
new Game_Map(portals.slice(16,19),8,map8Squares,map8Circles),
new Game_Map(portals.slice(19,20),9,map9Squares,[]),
new Game_Map(portals.slice(20,21),10,map10Squares,map10Circles),
new Game_Map(portals.slice(21,22),11,map11Squares,map11Circles)];
maps[-1]=maps[0]
players.push(new Player(-1,-50,-50,-1,"VOITURES",0));
players.push(new Player(-2,-50,-50,-1,"DONJON",0));
function updatePlayer(data)
{
if(data.id==player.id)
{
player.x=data.x;
player.y=data.y;
if(data.z==undefined){
player.z=0;
} else {
player.z=data.z;
}
}
else
{
for(let i=0;i<players.length;i++)
{
if(data.id==players[i].id)
{
players[i].x=data.x;
players[i].y=data.y;
if(data.z==undefined){
players[i].z=0;
} else {
players[i].z=data.z;
}
players[i].dir=data.dir;
players[i].visibleDir=data.visibleDir;
break;
}
}
}
}
function addPlayer(data)
{
let np = new Player(data.id, data.x, data.y, 0, data.name, data.dir);
players.push(np);
}
function removePlayer(id)
{
for(let i=0;i<players.length;i++)
{
if(players[i].id==id)
{
players.splice(i,1);
break;
}
}
}
function addKill(idKilled,idKiller)
{
if(player.id==idKiller){
player.kill++;
}
if(player.id==idKilled){
player.death++;
}
players.forEach((p) => {
if(p.id==idKilled) {
p.death++;
}
if(p.id==idKiller) {
p.kill++;
}
});
}
function updateBullets(dt)
{
for(let i = bullets.length-1;i>=0;i--)
{
bullets[i].update(dt);
bullets[i].checkCollisions(maps[bullets[i].z].squares,maps[bullets[i].z].circles);
if(bullets[i].deleted)
{
bullets.splice(i,1);
}
}
}
let lastbulletdonjon=[0,0]
function Donjon() {
if(player.z==10) {
if(lastbulletdonjon[1]>=7) {
lastbulletdonjon[1]=0;
bullets.push(new Bullet(107,95+(Date.now()*0.1)%365,10,1,0,-2, true));
bullets.push(new Bullet(107,460-(Date.now()*0.1)%365,10,1,0,-2, true));
} else {
lastbulletdonjon[1]++;
}
if(lastbulletdonjon[0]==59 && Math.floor(Date.now()/1000)%60 !=59) { lastbulletdonjon[0]=0 }
if(Math.floor(Date.now()/1000)%60 > lastbulletdonjon[0]) {
lastbulletdonjon[0]=Math.floor(Date.now()/1000)%60;
for(let i=0;i<5;i++){
bullets.push(new Bullet(235,65,10,0,2,-2, true));
bullets.push(new Bullet(235,491,10,0,-2,-2, true));
bullets.push(new Bullet(395,65,10,0,2,-2, true));
bullets.push(new Bullet(395,491,10,0,-2,-2, true));
bullets.push(new Bullet(615,178,10,0,2,-2, true));
bullets.push(new Bullet(615,385,10,0,-2,-2, true));
}
}
}
}
function Lester(type, data) {
switch(type) {
case 1:
player.x=data[0];
player.y=data[1];
player.z=data[2];
net.update(player);
break;
case 2:
player.health=defaulthealth;
break;
case 3:
addKill(data, player.id);
net.died(data, player.id);
break;
case 4:
players.forEach((p) => {
if(p.id>0) {
net.died(p.id, player.id);
addKill(data, player.id);
p.death++;
}
});
break;
case 5:
if(drawCollisions) {
drawCollisions=false;
} else {
drawCollisions=true;
}
break;
}
}