// ==EMEVD==
// @docs    er-common.emedf.json
// @compress    DCX_KRAK
// @game    Sekiro
// @string    
// @linked    []
// @version    3.3.1
// ==/EMEVD==

$Event(0, Default, function() {
    InitializeEvent(0, 701, 0);
    InitializeEvent(0, 705, 0);
    InitializeEvent(0, 900, 0);
    InitializeEvent(0, 901, 0);
    InitializeEvent(0, 902, 0);
    InitializeEvent(0, 910, 0);
    InitializeEvent(0, 1040, 0);
    InitializeEvent(0, 1030, 0);
    InitializeEvent(0, 1050, 0);
    InitializeEvent(0, 930, 60380000, 60380001, 1038501500, 9700, 8105, 8106, 60385000, 1038502500, 0, 62001);
    InitializeEvent(1, 930, 60380010, 60380011, 1038501502, 9700, 8105, 8106, 60385000, 1038502502, 0, 63000);
    InitializeEvent(3, 930, 60490010, 60490011, 1049531502, 9700, 8107, 0, 60495300, 1049532502, 0, 65000);
    InitializeEvent(5, 930, 60490030, 60490031, 1049531506, 9701, 8175, 8176, 60495300, 1049532506, 0, 65002);
    InitializeEvent(0, 936, 60490000, 60490001, 1049532500, 60495300, 1049532500, 63003, 0, -1082130432);
    InitializeEvent(1, 936, 60490020, 60490021, 1049532504, 60485400, 1049532504, 63003, 0, -1082130432);
    InitializeEvent(0, 970, 0);
    InitializeEvent(0, 9820, 8820, 4820, 3600);
    InitializeEvent(0, 1020, 0);
    InitializeEvent(0, 9945, 0);
    InitializeEvent(0, 1400, 0);
    InitializeEvent(0, 1401, 0);
    InitializeEvent(0, 1410, 60804, 4, 1000, 11100785, 11102180);
    InitializeEvent(0, 1411, 60808, 8, 1001, 39200700, 39202160, 1052380260, 1252382699, 1045520730, 1045522170);
    InitializeEvent(0, 1412, 60823, 53, 1002, 1050560700, 1050562140);
    InitializeEvent(0, 1600, 62010, 63010, 1042371690, 1042371691);
    InitializeEvent(1, 1600, 62011, 63011, 1044321690, 1044321691);
    InitializeEvent(2, 1600, 62012, 63012, 1045371690, 1045371691);
    InitializeEvent(3, 1600, 62020, 63020, 1038411690, 1038411691);
    InitializeEvent(4, 1600, 62021, 63021, 1037441690, 1037441691);
    InitializeEvent(5, 1600, 62022, 63022, 1034481690, 1034481691);
    InitializeEvent(6, 1600, 62030, 63030, 1040521690, 1040521691);
    InitializeEvent(7, 1600, 62031, 63031, 1042511690, 1042511691);
    InitializeEvent(8, 1600, 62032, 63032, 1036541690, 1036541691);
    InitializeEvent(9, 1600, 62040, 63040, 1049371690, 1049371691);
    InitializeEvent(10, 1600, 62041, 63041, 1049401690, 1049401691);
    InitializeEvent(11, 1600, 62050, 63050, 1049531690, 1049531691);
    InitializeEvent(12, 1600, 62051, 63051, 1052541690, 1052541691);
    InitializeEvent(13, 1600, 62052, 63052, 1048561690, 1048561691);
    InitializeEvent(14, 1600, 62060, 63060, 0, 0);
    InitializeEvent(15, 1600, 62061, 63061, 0, 0);
    InitializeEvent(16, 1600, 62063, 63063, 0, 0);
    InitializeEvent(17, 1600, 62062, 63062, 0, 0);
    InitializeEvent(18, 1600, 62064, 63064, 0, 0);
    InitializeEvent(0, 1630, 62004, 62010, 62012, 62020, 62030, 62031, 62041, 62050, 0);
    InitializeEvent(1, 1630, 62005, 62010, 62011, 62022, 0, 0, 0, 0, 0);
    InitializeEvent(2, 1630, 62006, 62022, 62032, 0, 0, 0, 0, 0, 0);
    InitializeEvent(3, 1630, 62007, 62011, 62040, 62041, 0, 0, 0, 0, 0);
    InitializeEvent(4, 1630, 62008, 62050, 62051, 0, 0, 0, 0, 0, 0);
    InitializeEvent(5, 1630, 62009, 62050, 62052, 0, 0, 0, 0, 0, 0);
    EndIf(!PlayerIsInOwnWorld());
    InitializeEvent(0, 945, 0);
    InitializeEvent(0, 920, 0);
    InitializeEvent(0, 921, 0);
    InitializeEvent(0, 922, 0);
    InitializeEvent(2, 130, 14004100);
    InitializeEvent(4, 9300, 4, 10000800, 0);
    InitializeEvent(5, 9300, 5, 9130, 0);
    InitializeEvent(6, 9300, 6, 11000800, 0);
    InitializeEvent(7, 9300, 7, 16000800, 0);
    InitializeEvent(8, 9300, 8, 15000800, 0);
    InitializeEvent(9, 9300, 9, 12050800, 0);
    InitializeEvent(10, 9300, 10, 13000800, 0);
    InitializeEvent(11, 9300, 11, 11050800, 0);
    InitializeEvent(12, 9300, 12, 13000830, 0);
    InitializeEvent(18, 9300, 18, 14000800, 0);
    InitializeEvent(19, 9300, 19, 12030850, 0);
    InitializeEvent(20, 9300, 20, 13000850, 0);
    InitializeEvent(21, 9300, 21, 1052520800, 0);
    InitializeEvent(22, 9300, 22, 12010800, 0);
    InitializeEvent(23, 9300, 23, 12090800, 0);
    InitializeEvent(24, 9300, 24, 12020800, 0);
    InitializeEvent(25, 9300, 25, 10000850, 0);
    InitializeEvent(26, 9300, 26, 14000850, 0);
    InitializeEvent(27, 9300, 27, 16000850, 0);
    InitializeEvent(28, 9300, 28, 39200800, 0);
    InitializeEvent(29, 9300, 29, 11000850, 0);
    InitializeEvent(30, 9300, 30, 35000800, 0);
    InitializeEvent(31, 9300, 31, 12020850, 0);
    InitializeEvent(32, 9300, 32, 15000850, 0);
    InitializeEvent(33, 9300, 33, 12040800, 0);
    InitializeEvent(34, 9300, 34, 1043300800, 0);
    InitializeEvent(35, 9300, 35, 1035500800, 0);
    InitializeEvent(36, 9300, 36, 1039540800, 0);
    InitializeEvent(37, 9300, 37, 12080800, 0);
    InitializeEvent(38, 9300, 38, 1051570800, 0);
    InitializeEvent(39, 9300, 39, 105, 0);
    InitializeEvent(41, 9300, 41, 110, 0);
    InitializeEvent(0, 9360, 0, 100, 0);
    InitializeEvent(1, 9360, 1, 9390, 0);
    InitializeEvent(2, 9360, 2, 9392, 0);
    InitializeEvent(3, 9360, 3, 11000801, 0);
    InitializeEvent(4, 9360, 4, 1252520801, 0);
    InitializeEvent(5, 9360, 5, 13000801, 0);
    InitializeEvent(6, 9360, 6, 19000802, 0);
    InitializeEvent(0, 9375, 0, 120, 0);
    InitializeEvent(1, 9375, 1, 9391, 0);
    InitializeEvent(2, 9375, 2, 9393, 0);
    InitializeEvent(3, 9375, 3, 11000800, 0);
    InitializeEvent(4, 9375, 4, 1252520800, 0);
    InitializeEvent(5, 9375, 5, 13000800, 0);
    InitializeEvent(6, 9375, 6, 19000800, 0);
    InitializeEvent(0, 9390, 6001, 10000801, 1252380801, 16000801, 12050801, 0);
    InitializeEvent(1, 9390, 6001, 10000800, 1252380800, 16000800, 12050800, 0);
    InitializeEvent(2, 9390, 9390, 10000801, 1252380801, 16000801, 12050801, 11000801);
    InitializeEvent(3, 9390, 9391, 10000800, 1252380800, 16000800, 12050800, 11000800);
    InitializeEvent(0, 1800, 0);
    InitializeEvent(0, 1801, 0);
    InitializeEvent(0, 1450, 65610, 65620, 65630, 0);
    InitializeEvent(1, 1450, 65640, 65650, 0, 0);
    InitializeEvent(2, 1450, 65660, 65670, 0, 0);
    InitializeEvent(4, 1450, 65680, 65690, 0, 0);
    InitializeEvent(3, 1450, 65720, 65700, 65710, 0);
    InitializeEvent(0, 1460, 0);
    InitializeEvent(0, 1461, 0);
    InitializeEvent(0, 1462, 0);
    InitializeEvent(0, 1700, 0);
    InitializeEvent(0, 1701, 0);
    InitializeEvent(0, 1703, 0);
    InitializeEvent(0, 1704, 0);
    InitializeEvent(0, 1705, 0);
    InitializeEvent(0, 1750, 0);
    InitializeEvent(0, 1751, 0);
    InitializeEvent(0, 1752, 0);
    InitializeEvent(0, 1720, 69170, 710610, 1610, 9117);
    InitializeEvent(1, 1720, 69180, 710620, 1620, 9118);
    InitializeEvent(2, 1720, 69190, 710630, 1630, 9119);
    InitializeEvent(3, 1720, 69010, 710060, 1060, 9101);
    InitializeEvent(4, 1720, 69020, 710130, 1130, 9102);
    InitializeEvent(5, 1720, 69110, 710550, 1550, 9111);
    InitializeEvent(6, 1720, 69340, 710560, 1560, 9134);
    InitializeEvent(9, 1720, 69360, 710750, 1750, 9136);
    InitializeEvent(10, 1720, 69200, 710640, 1640, 9120);
    InitializeEvent(11, 1720, 69260, 710690, 1690, 9126);
    InitializeEvent(12, 1720, 69270, 710710, 1710, 9127);
    InitializeEvent(13, 1720, 69210, 710650, 1650, 9121);
    InitializeEvent(14, 1720, 69390, 710810, 1810, 9141);
    InitializeEvent(15, 1720, 69420, 710820, 1820, 9142);
    InitializeEvent(0, 1790, 0);
    InitializeEvent(0, 1770, 700800, 710800, 1800);
    InitializeEvent(0, 950, 0);
    InitializeEvent(0, 960, 76100);
    InitializeEvent(1, 960, 76108);
    InitializeEvent(2, 960, 76104);
    InitializeEvent(3, 960, 76102);
    InitializeEvent(4, 960, 76106);
    InitializeEvent(6, 960, 76111);
    InitializeEvent(7, 960, 76157);
    InitializeEvent(8, 960, 76113);
    InitializeEvent(0, 720, 160, 0);
    InitializeEvent(1, 720, 161, 1);
    InitializeEvent(2, 720, 162, 2);
    InitializeEvent(3, 720, 163, 3);
    InitializeEvent(4, 720, 164, 4);
    InitializeEvent(5, 720, 165, 5);
    InitializeEvent(6, 720, 166, 6);
    InitializeEvent(7, 720, 167, 7);
    InitializeEvent(0, 730, 180, 0);
    InitializeEvent(1, 730, 181, 1);
    InitializeEvent(2, 730, 182, 2);
    InitializeEvent(3, 730, 183, 3);
    InitializeEvent(4, 730, 184, 4);
    InitializeEvent(5, 730, 185, 5);
    InitializeEvent(6, 730, 186, 6);
    InitializeEvent(7, 730, 187, 7);
    InitializeEvent(0, 1100, 9100, 10000, 0, 60510);
    InitializeEvent(1, 1100, 9101, 10010, 0, 510010);
    InitializeEvent(2, 1100, 9102, 10020, 0, 510020);
    InitializeEvent(3, 1100, 9103, 10030, 0, 510030);
    InitializeEvent(4, 1100, 9104, 10040, 0, 510040);
    InitializeEvent(5, 1100, 9105, 10050, 0, 60520);
    InitializeEvent(6, 1100, 9106, 10060, 0, 510060);
    InitializeEvent(7, 1100, 9107, 10070, 0, 510070);
    InitializeEvent(8, 1100, 9108, 10080, 0, 510080);
    InitializeEvent(9, 1100, 9109, 10090, 0, 510090);
    InitializeEvent(10, 1100, 9110, 10100, 0, 510100);
    InitializeEvent(11, 1100, 9111, 10110, 0, 510110);
    InitializeEvent(12, 1100, 9112, 10120, 0, 510120);
    InitializeEvent(13, 1100, 9113, 10130, 0, 510130);
    InitializeEvent(14, 1100, 9114, 10140, 0, 510140);
    InitializeEvent(15, 1100, 9115, 10150, 0, 510150);
    InitializeEvent(16, 1100, 9116, 10160, 0, 510160);
    InitializeEvent(17, 1100, 9117, 10170, 0, 60440);
    InitializeEvent(18, 1100, 9118, 10180, 0, 197);
    InitializeEvent(19, 1100, 9119, 10190, 0, 510190);
    InitializeEvent(20, 1100, 9120, 10200, 0, 510200);
    InitializeEvent(21, 1100, 9121, 10210, 0, 510210);
    InitializeEvent(22, 1100, 9122, 10220, 0, 510220);
    InitializeEvent(23, 1100, 9123, 10230, 0, 510230);
    InitializeEvent(24, 1100, 9124, 10240, 0, 510240);
    InitializeEvent(25, 1100, 9125, 10250, 0, 510250);
    InitializeEvent(26, 1100, 9126, 10260, 0, 510260);
    InitializeEvent(27, 1100, 9127, 10270, 0, 510270);
    InitializeEvent(28, 1100, 9128, 10280, 0, 510280);
    InitializeEvent(29, 1100, 9129, 10290, 0, 510290);
    InitializeEvent(30, 1100, 9130, 10300, 0, 510300);
    InitializeEvent(31, 1100, 9131, 10310, 0, 510310);
    InitializeEvent(32, 1100, 9132, 10320, 0, 510320);
    InitializeEvent(33, 1100, 9133, 10330, 0, 510330);
    InitializeEvent(34, 1100, 9134, 10340, 0, 510340);
    InitializeEvent(35, 1100, 9135, 10350, 0, 510350);
    InitializeEvent(73, 1100, 9173, 10730, 0, 510730);
    InitializeEvent(74, 1100, 9174, 10740, 0, 510740);
    InitializeEvent(80, 1100, 9180, 10800, 0, 510800);
    InitializeEvent(81, 1100, 9181, 10810, 0, 510810);
    InitializeEvent(82, 1100, 9182, 10820, 0, 510820);
    InitializeEvent(83, 1100, 9183, 10830, 0, 510830);
    InitializeEvent(84, 1100, 9184, 10840, 0, 510840);
    InitializeEvent(0, 1200, 9200, 20000, 0, 520000);
    InitializeEvent(1, 1200, 9201, 20010, 0, 520010);
    InitializeEvent(2, 1200, 9202, 20020, 0, 520020);
    InitializeEvent(3, 1200, 9203, 20030, 0, 520030);
    InitializeEvent(4, 1200, 9204, 20040, 0, 520040);
    InitializeEvent(5, 1200, 9205, 20050, 0, 520050);
    InitializeEvent(6, 1200, 9206, 20060, 0, 520060);
    InitializeEvent(7, 1200, 9207, 20070, 0, 520070);
    InitializeEvent(8, 1200, 9208, 20080, 0, 520080);
    InitializeEvent(9, 1200, 9209, 20090, 0, 520090);
    InitializeEvent(10, 1200, 9210, 20100, 0, 520100);
    InitializeEvent(11, 1200, 9211, 20110, 0, 520110);
    InitializeEvent(12, 1200, 9212, 20120, 0, 520120);
    InitializeEvent(13, 1200, 9213, 20130, 0, 520130);
    InitializeEvent(14, 1200, 9214, 20140, 0, 520140);
    InitializeEvent(15, 1200, 9215, 20150, 0, 520150);
    InitializeEvent(16, 1200, 9216, 20160, 0, 520160);
    InitializeEvent(17, 1200, 9217, 20170, 0, 520170);
    InitializeEvent(18, 1200, 9218, 20180, 0, 520180);
    InitializeEvent(19, 1200, 9219, 20190, 0, 520190);
    InitializeEvent(20, 1200, 9220, 20200, 0, 520200);
    InitializeEvent(21, 1200, 9221, 20210, 0, 520210);
    InitializeEvent(22, 1200, 9222, 20220, 0, 520220);
    InitializeEvent(30, 1200, 9230, 20300, 0, 520300);
    InitializeEvent(31, 1200, 9231, 20310, 0, 520310);
    InitializeEvent(32, 1200, 9232, 20320, 0, 520320);
    InitializeEvent(33, 1200, 9233, 20330, 0, 520330);
    InitializeEvent(34, 1200, 9234, 20340, 0, 520340);
    InitializeEvent(35, 1200, 9235, 20350, 0, 520350);
    InitializeEvent(36, 1200, 9236, 20360, 0, 520360);
    InitializeEvent(37, 1200, 9237, 20370, 0, 520370);
    InitializeEvent(38, 1200, 9238, 20380, 0, 520380);
    InitializeEvent(39, 1200, 9239, 20390, 0, 520390);
    InitializeEvent(40, 1200, 9240, 20400, 0, 520400);
    InitializeEvent(41, 1200, 9241, 20410, 0, 520410);
    InitializeEvent(42, 1200, 9242, 20420, 0, 520420);
    InitializeEvent(43, 1200, 9243, 20430, 0, 520430);
    InitializeEvent(44, 1200, 9244, 20440, 0, 520440);
    InitializeEvent(45, 1200, 9245, 20450, 0, 520450);
    InitializeEvent(46, 1200, 9246, 20460, 0, 520460);
    InitializeEvent(47, 1200, 9247, 20470, 0, 520470);
    InitializeEvent(48, 1200, 9248, 20480, 0, 520480);
    InitializeEvent(49, 1200, 9249, 20490, 0, 520490);
    InitializeEvent(60, 1200, 9260, 20600, 0, 520600);
    InitializeEvent(61, 1200, 9261, 20610, 0, 520610);
    InitializeEvent(62, 1200, 9262, 20620, 0, 520620);
    InitializeEvent(63, 1200, 9263, 20630, 0, 520630);
    InitializeEvent(64, 1200, 9264, 20640, 0, 520640);
    InitializeEvent(65, 1200, 9265, 20650, 0, 520650);
    InitializeEvent(66, 1200, 9266, 20660, 0, 520660);
    InitializeEvent(67, 1200, 9267, 20670, 0, 520670);
    InitializeEvent(68, 1200, 9268, 20680, 0, 520680);
    InitializeEvent(0, 65810, 65810, 100750, 0, 0, 0, 0);
    InitializeEvent(1, 65810, 65811, 400163, 0, 0, 0, 0);
    InitializeEvent(2, 65810, 65812, 100760, 0, 0, 0, 0);
    InitializeEvent(3, 65810, 65813, 1043377400, 0, 0, 0, 0);
    InitializeEvent(4, 65810, 65814, 540418, 0, 0, 0, 0);
    InitializeEvent(5, 65810, 65815, 540112, 0, 0, 0, 0);
    InitializeEvent(6, 65810, 65816, 540238, 0, 0, 0, 0);
    InitializeEvent(8, 65810, 65818, 100770, 0, 0, 0, 0);
    InitializeEvent(9, 65810, 65819, 1052417100, 0, 0, 0, 0);
    InitializeEvent(10, 65810, 65820, 1047387700, 0, 0, 0, 0);
    InitializeEvent(11, 65810, 65821, 100780, 0, 0, 0, 0);
    InitializeEvent(12, 65810, 65822, 540120, 0, 0, 0, 0);
    InitializeEvent(13, 65810, 65823, 540104, 0, 0, 0, 0);
    InitializeEvent(14, 65810, 65824, 540304, 0, 0, 0, 0);
    InitializeEvent(15, 65810, 65825, 100790, 0, 0, 0, 0);
    InitializeEvent(16, 65810, 65826, 540116, 0, 0, 0, 0);
    InitializeEvent(17, 65810, 65827, 290150, 0, 0, 0, 0);
    InitializeEvent(18, 65810, 65828, 540224, 0, 0, 0, 0);
    InitializeEvent(19, 65810, 65829, 100800, 0, 0, 0, 0);
    InitializeEvent(20, 65810, 65830, 1051537600, 0, 0, 0, 0);
    InitializeEvent(21, 65810, 65831, 400309, 0, 0, 0, 0);
    InitializeEvent(22, 65810, 65832, 100810, 0, 0, 0, 0);
    InitializeEvent(23, 65810, 65833, 540202, 0, 0, 0, 0);
    InitializeEvent(24, 65810, 65834, 540630, 0, 0, 0, 0);
    InitializeEvent(25, 65810, 65835, 1036487400, 0, 0, 0, 0);
    InitializeEvent(26, 65810, 65836, 400061, 0, 0, 0, 0);
    InitializeEvent(27, 65810, 65837, 540170, 0, 0, 0, 0);
    InitializeEvent(28, 65810, 65838, 540172, 0, 0, 0, 0);
    InitializeEvent(29, 65810, 65839, 100830, 0, 0, 0, 0);
    InitializeEvent(30, 65810, 65840, 510100, 0, 0, 0, 0);
    InitializeEvent(31, 65810, 65841, 1042377110, 0, 0, 0, 0);
    InitializeEvent(32, 65810, 65842, 540108, 0, 0, 0, 0);
    InitializeEvent(33, 65810, 65843, 16007020, 0, 0, 0, 0);
    InitializeEvent(34, 65810, 65844, 540516, 0, 0, 0, 0);
    InitializeEvent(35, 65810, 65845, 100840, 0, 0, 0, 0);
    InitializeEvent(36, 65810, 65846, 540408, 0, 0, 0, 0);
    InitializeEvent(37, 65810, 65847, 510140, 0, 0, 0, 0);
    InitializeEvent(38, 65810, 65848, 540410, 0, 0, 0, 0);
    InitializeEvent(39, 65810, 65849, 540372, 0, 0, 0, 0);
    InitializeEvent(40, 65810, 65850, 540318, 0, 0, 0, 0);
    InitializeEvent(41, 65810, 65851, 540310, 0, 0, 0, 0);
    InitializeEvent(42, 65810, 65852, 510810, 0, 0, 0, 0);
    InitializeEvent(43, 65810, 65853, 120000, 0, 0, 0, 0);
    InitializeEvent(44, 65810, 65854, 400358, 0, 0, 0, 0);
    InitializeEvent(45, 65810, 65855, 120010, 0, 0, 0, 0);
    InitializeEvent(46, 65810, 65856, 1043357500, 0, 0, 0, 0);
    InitializeEvent(47, 65810, 65857, 1035507090, 0, 0, 0, 0);
    InitializeEvent(48, 65810, 65858, 120020, 0, 0, 0, 0);
    InitializeEvent(49, 65810, 65859, 290290, 0, 0, 0, 0);
    InitializeEvent(50, 65810, 65860, 540414, 0, 0, 0, 0);
    InitializeEvent(51, 65810, 65861, 540118, 0, 0, 0, 0);
    InitializeEvent(52, 65810, 65862, 540314, 0, 0, 0, 0);
    InitializeEvent(53, 65810, 65863, 540660, 0, 0, 0, 0);
    InitializeEvent(54, 65810, 65864, 540404, 0, 0, 0, 0);
    InitializeEvent(55, 65810, 65865, 540308, 0, 0, 0, 0);
    InitializeEvent(56, 65810, 65866, 1043397500, 0, 0, 0, 0);
    InitializeEvent(57, 65810, 65867, 540300, 0, 0, 0, 0);
    InitializeEvent(58, 65810, 65868, 1039517200, 0, 0, 0, 0);
    InitializeEvent(59, 65810, 65869, 400235, 0, 0, 0, 0);
    InitializeEvent(60, 65810, 65870, 1048517700, 0, 0, 0, 0);
    InitializeEvent(61, 65810, 65871, 540272, 0, 0, 0, 0);
    InitializeEvent(62, 65810, 65872, 1035467700, 0, 0, 0, 0);
    InitializeEvent(63, 65810, 65873, 540524, 0, 0, 0, 0);
    InitializeEvent(64, 65810, 65874, 1049377100, 0, 0, 0, 0);
    InitializeEvent(65, 65810, 65875, 540406, 0, 0, 0, 0);
    InitializeEvent(66, 65810, 65876, 540686, 0, 0, 0, 0);
    InitializeEvent(67, 65810, 65877, 1046367700, 0, 0, 0, 0);
    InitializeEvent(68, 65810, 65878, 540402, 0, 0, 0, 0);
    InitializeEvent(69, 65810, 65879, 540306, 0, 0, 0, 0);
    InitializeEvent(70, 65810, 65880, 100850, 0, 0, 0, 0);
    InitializeEvent(71, 65810, 65881, 540510, 0, 0, 0, 0);
    InitializeEvent(72, 65810, 65882, 1039437400, 0, 0, 0, 0);
    InitializeEvent(73, 65810, 65883, 540200, 0, 0, 0, 0);
    InitializeEvent(74, 65810, 65884, 540204, 0, 0, 0, 0);
    InitializeEvent(75, 65810, 65885, 100860, 0, 0, 0, 0);
    InitializeEvent(76, 65810, 65886, 540210, 0, 0, 0, 0);
    InitializeEvent(77, 65810, 65887, 540302, 0, 0, 0, 0);
    InitializeEvent(78, 65810, 65888, 1044327410, 0, 0, 0, 0);
    InitializeEvent(79, 65810, 65889, 100820, 0, 0, 0, 0);
    InitializeEvent(80, 65810, 65890, 130340, 0, 0, 0, 0);
    InitializeEvent(81, 65810, 65891, 540100, 0, 0, 0, 0);
    InitializeEvent(82, 65810, 65892, 540316, 0, 0, 0, 0);
    InitializeEvent(83, 65810, 65893, 540206, 0, 0, 0, 0);
    InitializeEvent(84, 65810, 65894, 30107100, 0, 0, 0, 0);
    InitializeEvent(85, 65810, 65895, 540208, 0, 0, 0, 0);
    InitializeEvent(86, 65810, 65896, 540332, 0, 0, 0, 0);
    InitializeEvent(87, 65810, 65897, 540140, 0, 0, 0, 0);
    InitializeEvent(88, 65810, 65898, 540412, 0, 0, 0, 0);
    InitializeEvent(89, 65810, 65899, 540334, 0, 0, 0, 0);
    InitializeEvent(90, 65810, 65900, 540646, 0, 0, 0, 0);
    InitializeEvent(91, 65810, 65901, 580360, 0, 0, 0, 0);
    InitializeEvent(0, 1080, 0);
    InitializeEvent(0, 841, 0);
    InitializeEvent(0, 9910, 3005);
    InitializeEvent(0, 750, 0);
    InitializeEvent(0, 9941, 0);
    InitializeEvent(0, 9943, 0);
    InitializeEvent(0, 9940, 0);
    InitializeEvent(0, 1700, 0);
    InitializeEvent(0, 1055550010, 0);
});

$Event(50, Default, function() {
    InitializeEvent(0, 700, 0);
    InitializeEvent(0, 710, 0);
    InitializeEvent(0, 711, 0);
    InitializeEvent(0, 715, 0);
    InitializeEvent(0, 716, 0);
    SetEventFlagID(6000, OFF);
    SetEventFlagID(6001, ON);
    SetEventFlagID(9000, OFF);
    SetEventFlagID(9001, OFF);
    InitializeEvent(0, 740, 0);
    InitializeEvent(0, 810, 0);
    InitializeEvent(0, 820, 550, 5);
    InitializeEvent(1, 820, 551, 0);
    InitializeEvent(2, 820, 552, 6);
    InitializeEvent(3, 820, 553, 7);
    InitializeEvent(4, 820, 554, 1);
    InitializeEvent(5, 820, 555, 8);
    InitializeEvent(6, 820, 556, 3);
    InitializeEvent(7, 820, 557, 9);
    InitializeEvent(8, 820, 558, 2);
    InitializeEvent(9, 820, 559, 10);
    InitializeEvent(10, 820, 560, 4);
    InitializeEvent(11, 820, 561, 11);
    InitializeEvent(12, 820, 562, 15);
    InitializeEvent(13, 820, 563, 12);
    InitializeEvent(0, 839, 0);
    InitializeEvent(0, 840, 0);
    InitializeEvent(0, 980, 0);
    SetEventFlagID(909, OFF);
    InitializeEvent(0, 3040, 0);
    InitializeEvent(0, 3041, 0);
    InitializeEvent(0, 3042, 0);
    InitializeEvent(0, 3043, 0);
    InitializeEvent(0, 3044, 0);
    InitializeEvent(0, 3045, 0);
    InitializeEvent(0, 3046, 0);
    InitializeEvent(0, 3056, 0);
    InitializeEvent(0, 3080, 0);
    InitializeEvent(0, 3179, 0);
    InitializeEvent(0, 3499, 0);
    InitializeEvent(0, 3659, 0);
    InitializeEvent(0, 3239, 0);
    InitializeEvent(0, 3619, 0);
    InitializeEvent(0, 3559, 0);
    InitializeEvent(0, 3679, 0);
    InitializeEvent(0, 3959, 0);
    InitializeEvent(0, 3779, 0);
    InitializeEvent(0, 3839, 0);
    InitializeEvent(0, 3859, 0);
    InitializeEvent(0, 4119, 0);
    InitializeEvent(0, 3119, 0);
    InitializeEvent(0, 3199, 0);
    InitializeEvent(0, 3279, 0);
    InitializeEvent(0, 3299, 0);
    InitializeEvent(0, 3579, 0);
    InitializeEvent(0, 3699, 0);
    InitializeEvent(0, 3399, 0);
    InitializeEvent(0, 3419, 0);
    InitializeEvent(0, 3379, 0);
    InitializeEvent(0, 3439, 0);
    InitializeEvent(0, 3459, 0);
    InitializeEvent(0, 3479, 0);
    InitializeEvent(0, 3639, 0);
    InitializeEvent(0, 3719, 0);
    InitializeEvent(0, 3599, 0);
    InitializeEvent(0, 4259, 0);
    InitializeEvent(0, 3979, 0);
    InitializeEvent(0, 3919, 0);
    InitializeEvent(0, 3899, 0);
    InitializeEvent(0, 3739, 0);
    InitializeEvent(0, 4159, 0);
    InitializeEvent(0, 3799, 0);
    InitializeEvent(0, 3819, 0);
    InitializeEvent(0, 4239, 0);
    InitializeEvent(0, 3879, 0);
    InitializeEvent(0, 4199, 0);
    InitializeEvent(0, 4179, 0);
    InitializeEvent(0, 4219, 0);
    InitializeEvent(0, 4719, 0);
    InitializeEvent(0, 4739, 0);
    InitializeEvent(0, 4059, 0);
    InitializeEvent(0, 4139, 0);
    InitializeEvent(0, 4079, 0);
    InitializeEvent(0, 3759, 0);
    InitializeEvent(0, 3049, 0);
    InitializeEvent(0, 3050, 0);
    InitializeEvent(0, 3051, 0);
    InitializeEvent(0, 3052, 0);
    InitializeEvent(0, 3053, 0);
    InitializeEvent(0, 3054, 0);
    InitializeEvent(0, 3055, 0);
    InitializeEvent(0, 3058, 0);
    InitializeEvent(0, 3059, 0);
    InitializeEvent(0, 3089, 0);
    InitializeEvent(0, 4612, 0);
    InitializeEvent(0, 60701, 11109751, 60701);
    InitializeEvent(1, 60701, 11109752, 60702);
    InitializeEvent(2, 60701, 11109753, 60703);
    InitializeEvent(3, 60701, 11109754, 60704);
    InitializeEvent(4, 60701, 11109755, 60705);
    InitializeEvent(5, 60701, 11109756, 60706);
    InitializeEvent(6, 60701, 11109757, 60707);
    InitializeEvent(7, 60701, 11109758, 60708);
    InitializeEvent(8, 60701, 11109759, 60709);
    InitializeEvent(9, 60701, 11109760, 60710);
    InitializeEvent(10, 60701, 11109761, 60711);
    InitializeEvent(11, 60701, 11109762, 60712);
    InitializeEvent(12, 60701, 11109763, 60713);
    InitializeEvent(13, 60701, 11109764, 60714);
    InitializeEvent(14, 60701, 11109765, 60715);
    InitializeEvent(29, 60701, 11109745, 60730);
    InitializeEvent(30, 60701, 11109746, 60731);
    InitializeEvent(31, 60701, 11109747, 60732);
    InitializeEvent(32, 60701, 11109748, 60733);
    InitializeEvent(0, 3081, 1037429202, 1038519202, 1038509202, 16009302, 16009312, 16009322, 16009313);
    InitializeEvent(0, 3082, 1042369202, 1035449202, 12059163);
    InitializeEvent(0, 3083, 16009202, 16009252);
    InitializeEvent(0, 3084, 1036419202, 1036419213, 1047589202);
    InitializeEvent(0, 3085, 1037549202, 1039549203);
    InitializeEvent(0, 3086, 1044389202, 1043359252, 1035469202, 1039529202);
    InitializeEvent(0, 3087, 1042389252, 1042389263, 16009452);
    InitializeEvent(0, 3088, 1036439202, 1036439218, 1044529252, 1044529253);
    InitializeEvent(0, 3090, 1034449200, 11059400);
    InitializeEvent(0, 3091, 1034509400);
    InitializeEvent(0, 3092, 1034499200);
    InitializeEvent(0, 3093, 1034509300);
    InitializeEvent(0, 3094, 12039150);
    InitializeEvent(0, 3095, 1045399200);
    InitializeEvent(0, 3096, 1038439200, 35009200);
    InitializeEvent(0, 3097, 1051369222);
    InitializeEvent(0, 4600, 10009549, 10009506);
    InitializeEvent(0, 4601, 14009202);
    InitializeEvent(0, 4602, 1037449202, 16009412, 1039449302);
    InitializeEvent(0, 4603, 35009302);
    InitializeEvent(0, 4604, 1050389252, 1050389262, 1038519252);
    InitializeEvent(0, 4606, 1050389202);
    InitializeEvent(0, 4607, 1043399302, 1039449202, 1035539202, 13009262);
    InitializeEvent(0, 4608, 1039449252);
    InitializeEvent(0, 4609, 1039409252, 1036489202, 1039519202, 11109802);
    InitializeEvent(0, 4611, 11009452, 1040549202);
    InitializeEvent(0, 3098, 0);
    InitializeEvent(0, 3099, 0);
    if (EventFlag(6010) && !EventFlag(100)) {
        SetEventFlagID(6010, OFF);
    }
L0:
    EndIf(!PlayerIsInOwnWorld());
    InitializeEvent(0, 6901, 0);
    InitializeEvent(0, 6902, 0);
    InitializeEvent(0, 6903, 0);
    InitializeEvent(0, 6904, 0);
    InitializeEvent(0, 6905, 0);
    InitializeEvent(0, 6906, 0);
    InitializeEvent(0, 6907, 0);
    InitializeEvent(0, 6908, 0);
    EndEvent();
});

$Event(130, Default, function(X0_4) {
    EndIf(ThisEventSlot());
    WaitFor(PlayerIsInOwnWorld() && PlayerStandingOnHit(X0_4));
    SetThisEventSlot(ON);
});

$Event(700, Default, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(ThisEventSlot());
    SetEventFlagID(62000, ON);
    SetEventFlagID(710580, ON);
    SetEventFlagID(720000, ON);
    SetEventFlagID(720010, ON);
    SetEventFlagID(720020, ON);
    SetEventFlagID(720030, ON);
    SetEventFlagID(720040, ON);
    SetEventFlagID(720050, ON);
    SetEventFlagID(720060, ON);
    SetEventFlagID(720090, ON);
    SetEventFlagID(720100, ON);
    SetEventFlagID(720110, ON);
    SetEventFlagID(720120, ON);
    SetEventFlagID(720130, ON);
    SetEventFlagID(720140, ON);
    SetEventFlagID(720150, ON);
    SetEventFlagID(720160, ON);
    SetEventFlagID(720170, ON);
    SetEventFlagID(720180, ON);
    SetEventFlagID(720190, ON);
    SetEventFlagID(720200, ON);
    SetEventFlagID(720210, ON);
    SetEventFlagID(720220, ON);
    GotoIf(L1, EventFlag(2001));
    GotoIf(L0, EventFlag(2000));
    SetEventFlagID(60200, ON);
    SetEventFlagID(60210, ON);
    SetEventFlagID(60220, ON);
    SetEventFlagID(60230, ON);
    SetEventFlagID(60240, ON);
    SetEventFlagID(60250, ON);
    SetEventFlagID(60260, ON);
    SetEventFlagID(60270, ON);
    SetEventFlagID(60280, ON);
    SetEventFlagID(60290, ON);
    SetEventFlagID(60300, ON);
    SetEventFlagID(60310, ON);
    SetEventFlagID(1650, OFF);
    SetEventFlagID(1651, ON);
    SetEventFlagID(1652, OFF);
    SetEventFlagID(1653, ON);
    SetEventFlagID(1650, ON);
    SetEventFlagID(1651, ON);
    SetEventFlagID(1652, OFF);
    SetEventFlagID(1653, OFF);
    SetEventFlagID(1654, OFF);
    SetEventFlagID(1655, ON);
    SetEventFlagID(1656, ON);
    SetEventFlagID(65600, ON);
    SetEventFlagID(65610, ON);
    SetEventFlagID(65620, ON);
    SetEventFlagID(65630, ON);
    SetEventFlagID(65640, ON);
    SetEventFlagID(65650, ON);
    SetEventFlagID(65660, ON);
    SetEventFlagID(65670, ON);
    SetEventFlagID(65680, ON);
    SetEventFlagID(65690, ON);
    SetEventFlagID(65700, ON);
    SetEventFlagID(65710, ON);
    SetEventFlagID(65720, ON);
    SetEventFlagID(65730, ON);
    SetEventFlagID(65740, ON);
    SetEventFlagID(65750, ON);
    SetEventFlagID(65760, ON);
    SetEventFlagID(65770, ON);
    SetEventFlagID(65780, ON);
    SetEventFlagID(65790, ON);
    SetEventFlagID(6500, ON);
    SetEventFlagID(60120, ON);
    Goto(L9);
L1:
    SetEventFlagID(60200, ON);
    SetEventFlagID(60210, ON);
    SetEventFlagID(60220, ON);
    SetEventFlagID(60240, ON);
    SetEventFlagID(60260, ON);
    SetEventFlagID(60270, ON);
    SetEventFlagID(60280, ON);
    SetEventFlagID(60290, ON);
    SetEventFlagID(60300, ON);
    SetEventFlagID(60310, ON);
    SetEventFlagID(1650, ON);
    SetEventFlagID(1651, ON);
    SetEventFlagID(1652, OFF);
    SetEventFlagID(1653, OFF);
    SetEventFlagID(1654, OFF);
    SetEventFlagID(1655, ON);
    SetEventFlagID(1656, ON);
    SetEventFlagID(82102, ON);
    SetEventFlagID(65600, ON);
    Goto(L9);
L0:
    SetEventFlagID(65600, ON);
    SetEventFlagID(60800, ON);
    SetEventFlagID(60807, ON);
    SetEventFlagID(60811, ON);
    SetEventFlagID(60820, ON);
    SetEventFlagID(60827, ON);
    SetEventFlagID(60834, ON);
    SetEventFlagID(60806, ON);
    SetEventFlagID(60812, ON);
    SetEventFlagID(60813, ON);
    SetEventFlagID(60814, ON);
    SetEventFlagID(60815, ON);
    SetEventFlagID(60831, ON);
L9:
    if (GameCycle() >= 7) {
        SetEventFlagID(57, ON);
        EndEvent();
    }
    if (GameCycle() == 6) {
        SetEventFlagID(56, ON);
        EndEvent();
    }
    if (GameCycle() == 5) {
        SetEventFlagID(55, ON);
        EndEvent();
    }
    if (GameCycle() == 4) {
        SetEventFlagID(54, ON);
        EndEvent();
    }
    if (GameCycle() == 3) {
        SetEventFlagID(53, ON);
        EndEvent();
    }
    if (GameCycle() == 2) {
        SetEventFlagID(52, ON);
        EndEvent();
    }
    if (GameCycle() == 1) {
        SetEventFlagID(51, ON);
        EndEvent();
    }
    SetEventFlagID(50, ON);
    EndEvent();
});

$Event(701, Default, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(ThisEventSlot());
    GotoIf(L1, EventFlag(2001));
    GotoIf(L0, EventFlag(2000));
    EndIf(!EventFlag(50));
    DirectlyGivePlayerItem(ItemType.Goods, 106, 60210, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 100, 60220, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 109, 60230, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 101, 60240, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 110, 60250, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 112, 60260, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 102, 60270, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 104, 60280, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 105, 60290, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 108, 60300, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 103, 60310, 1);
    if (!PlayerHasItem(ItemType.Goods, 150)) {
        DirectlyGivePlayerItem(ItemType.Goods, 150, 1650, 4);
    }
    if (!PlayerHasItem(ItemType.Goods, 111)) {
        DirectlyGivePlayerItem(ItemType.Goods, 111, 1660, 8);
    }
    EndEvent();
L1:
    EndIf(!EventFlag(50));
    DirectlyGivePlayerItem(ItemType.Goods, 106, 60210, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 100, 60220, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 109, 60230, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 101, 60240, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 110, 60250, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 112, 60260, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 102, 60270, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 104, 60280, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 105, 60290, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 108, 60300, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 103, 60310, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 150, 1650, 8);
    DirectlyGivePlayerItem(ItemType.Goods, 8500, 60120, 1);
    SetPlayerRespawnPoint(18002020);
    SaveRequest();
    SetEventFlagID(100, ON);
    EndEvent();
L0:
    EndIf(!EventFlag(50));
    DirectlyGivePlayerItem(ItemType.Goods, 106, 60210, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 100, 60220, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 109, 60230, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 101, 60240, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 110, 60250, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 112, 60260, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 102, 60270, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 104, 60280, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 105, 60290, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 108, 60300, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 103, 60310, 1);
    AwardGesture(6);
    AwardGesture(21);
    AwardGesture(22);
    AwardGesture(23);
    AwardGesture(24);
    AwardGesture(80);
    SetEventFlagID(100, ON);
    WaitFixedTimeSeconds(3);
});

$Event(702, Default, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(ThisEventSlot());
    if (!EventFlag(2000)) {
        EndEvent();
    }
L0:
    ChangeWeather(Weather.PuffyClouds, -1, true);
    WaitFor(EventFlag(1042368540));
    ChangeWeather(Weather.Default, 3600, true);
    FreezeTime(false);
    SetEventFlagID(101, ON);
});

$Event(703, Default, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (!EventFlag(2000)) {
        EndEvent();
    }
L0:
    EndIf(EventFlag(101));
    WaitFor(EventFlag(100));
    SetEventFlagID(101, ON);
    if (EventFlag(9990)) {
        ChangeWeather(Weather.Default, 6000, false);
    }
    SetCurrentTime(23, 45, 0, false, false, false, 0, 0, 0);
});

$Event(705, Restart, function() {
    SetEventFlagID(9290, OFF);
    SetEventFlagID(9291, OFF);
    EndIf(!PlayerIsInOwnWorld());
});

$Event(710, Restart, function() {
    DisableNetworkSync();
    if (PlayerIsInOwnWorld()) {
        SetEventFlagID(200, ON);
        SetEventFlagID(201, OFF);
        EndEvent();
    }
L0:
    SetEventFlagID(200, OFF);
    SetEventFlagID(201, ON);
    EndEvent();
});

$Event(711, Restart, function() {
    DisableNetworkSync();
    SetEventFlagID(202, OFF);
    WaitFor(
        HasMultiplayerState(MultiplayerState.MultiplayerPending)
            || HasMultiplayerState(MultiplayerState.Multiplayer));
    SetEventFlagID(202, ON);
    WaitFor(
        !(HasMultiplayerState(MultiplayerState.MultiplayerPending)
            || HasMultiplayerState(MultiplayerState.Multiplayer)));
    SetEventFlagID(202, OFF);
    RestartEvent();
});

$Event(715, Default, function() {
    DisableNetworkSync();
    if (PlayerIsInOwnWorld()) {
        SetNetworkconnectedEventFlagID(210, OFF);
    }
    SetEventFlagID(211, OFF);
    WaitFor(
        PlayerInMap(10, 0, 0, 0)
            || PlayerInMap(11, 0, 0, 0)
            || PlayerInMap(12, 0, 0, 0)
            || PlayerInMap(13, 0, 0, 0)
            || PlayerInMap(14, 0, 0, 0)
            || PlayerInMap(15, 0, 0, 0)
            || PlayerInMap(16, 0, 0, 0));
    if (PlayerIsInOwnWorld()) {
        SetNetworkconnectedEventFlagID(210, ON);
    }
    SetEventFlagID(211, ON);
    WaitFor(
        !(PlayerInMap(10, 0, 0, 0)
            || PlayerInMap(11, 0, 0, 0)
            || PlayerInMap(12, 0, 0, 0)
            || PlayerInMap(13, 0, 0, 0)
            || PlayerInMap(14, 0, 0, 0)
            || PlayerInMap(15, 0, 0, 0)
            || PlayerInMap(16, 0, 0, 0)));
    RestartEvent();
});

$Event(716, Default, function() {
    DisableNetworkSync();
    if (PlayerIsInOwnWorld()) {
        SetNetworkconnectedEventFlagID(220, OFF);
    }
    SetEventFlagID(221, OFF);
    WaitFor(
        PlayerInMap(10, 0, 0, 0)
            || PlayerInMap(11, 0, 0, 0)
            || PlayerInMap(12, 0, 0, 0)
            || PlayerInMap(13, 0, 0, 0)
            || PlayerInMap(14, 0, 0, 0)
            || PlayerInMap(15, 0, 0, 0)
            || PlayerInMap(16, 0, 0, 0));
    if (PlayerIsInOwnWorld()) {
        SetNetworkconnectedEventFlagID(220, ON);
    }
    SetEventFlagID(221, ON);
    WaitFor(
        !(PlayerInMap(10, 0, 0, 0)
            || PlayerInMap(11, 0, 0, 0)
            || PlayerInMap(12, 0, 0, 0)
            || PlayerInMap(13, 0, 0, 0)
            || PlayerInMap(14, 0, 0, 0)
            || PlayerInMap(15, 0, 0, 0)
            || PlayerInMap(16, 0, 0, 0)));
    RestartEvent();
});

$Event(720, Restart, function(X0_4, X4_4) {
    EndIf(EventFlag(X0_4));
    WaitFor(
        PlayerIsInOwnWorld() && CountEventFlags(TargetEventFlagType.EventFlag, 190, 199) >= X4_4);
    SetEventFlagID(X0_4, ON);
});

$Event(730, Restart, function(X0_4, X4_4) {
    EndIf(EventFlag(X0_4));
    WaitFor(
        PlayerIsInOwnWorld() && CountEventFlags(TargetEventFlagType.EventFlag, 170, 179) >= X4_4);
    SetEventFlagID(X0_4, ON);
});

$Event(740, Default, function() {
    DisableNetworkSync();
    ChangeCamera(-1, -1);
});

$Event(750, Default, function() {
    DisableNetworkSync();
    EndIf(!EventFlag(9295));
    SetEventFlagID(9295, OFF);
    ForceAnimationPlayback(10000, 60456, false, false, false);
});

$Event(810, Restart, function() {
    GotoIf(L1, TimeOfDayInRange(5, 30, 0, 11, 59, 59));
    GotoIf(L2, TimeOfDayInRange(12, 0, 0, 19, 59, 59));
    GotoIf(L3, TimeOfDayInRange(20, 0, 0, 5, 29, 59));
L1:
    SetEventFlagID(530, ON);
    SetEventFlagID(531, OFF);
    SetEventFlagID(532, OFF);
    WaitFor(!TimeOfDayInRange(6, 0, 0, 11, 59, 59));
    RestartEvent();
L2:
    SetEventFlagID(530, OFF);
    SetEventFlagID(531, ON);
    SetEventFlagID(532, OFF);
    WaitFor(!TimeOfDayInRange(12, 0, 0, 19, 59, 59));
    RestartEvent();
L3:
    SetEventFlagID(530, OFF);
    SetEventFlagID(531, OFF);
    SetEventFlagID(532, ON);
    WaitFor(!TimeOfDayInRange(20, 0, 0, 5, 59, 59));
    RestartEvent();
});

$Event(820, Default, function(X0_4, X4_1) {
    DisableNetworkSync();
    SetEventFlagID(X0_4, OFF);
    WaitFor(WeatherActive(X4_1, 0, 0));
    WaitFixedTimeFrames(1);
    SetEventFlagID(X0_4, ON);
    WaitFor(!WeatherActive(X4_1, 0, 0));
    WaitFixedTimeFrames(1);
    RestartEvent();
});

$Event(839, Restart, function() {
    DisableNetworkSync();
    GotoIf(L0, WeatherActive(Weather.Cloudless, 0, 0));
    GotoIf(L1, 
        WeatherActive(Weather.Default, 0, 0)
            || WeatherActive(Weather.FlatClouds, 0, 0)
            || WeatherActive(Weather.PuffyClouds, 0, 0));
    GotoIf(L2, 
        WeatherActive(Weather.Rain, 0, 0)
            || WeatherActive(Weather.RainyClouds, 0, 0)
            || WeatherActive(Weather.WindyRain, 0, 0)
            || WeatherActive(Weather.RainyHeavyFog, 0, 0));
    GotoIf(L3, WeatherActive(Weather.Snow, 0, 0) || WeatherActive(Weather.HeavySnow, 0, 0));
    GotoIf(L4, WeatherActive(Weather.Fog, 0, 0) || WeatherActive(Weather.HeavyFog, 0, 0));
    GotoIf(L5, 
        WeatherActive(Weather.WindyFog, 0, 0) || WeatherActive(Weather.WindyPuffyClouds, 0, 0));
    SetEventFlagID(570, OFF);
    SetEventFlagID(571, OFF);
    SetEventFlagID(572, OFF);
    SetEventFlagID(573, OFF);
    SetEventFlagID(574, OFF);
    SetEventFlagID(575, OFF);
    WaitFixedTimeSeconds(3);
    RestartEvent();
L0:
    SetEventFlagID(570, ON);
    SetEventFlagID(571, OFF);
    SetEventFlagID(572, OFF);
    SetEventFlagID(573, OFF);
    SetEventFlagID(574, OFF);
    SetEventFlagID(575, OFF);
    WaitFor(!WeatherActive(Weather.Cloudless, 0, 0));
    RestartEvent();
L1:
    SetEventFlagID(570, OFF);
    SetEventFlagID(571, ON);
    SetEventFlagID(572, OFF);
    SetEventFlagID(573, OFF);
    SetEventFlagID(574, OFF);
    SetEventFlagID(575, OFF);
    WaitFor(
        !(WeatherActive(Weather.Default, 0, 0)
            || WeatherActive(Weather.FlatClouds, 0, 0)
            || WeatherActive(Weather.PuffyClouds, 0, 0)));
    RestartEvent();
L2:
    SetEventFlagID(570, OFF);
    SetEventFlagID(571, OFF);
    SetEventFlagID(572, ON);
    SetEventFlagID(573, OFF);
    SetEventFlagID(574, OFF);
    SetEventFlagID(575, OFF);
    WaitFor(
        !(WeatherActive(Weather.Rain, 0, 0)
            || WeatherActive(Weather.RainyClouds, 0, 0)
            || WeatherActive(Weather.WindyRain, 0, 0)
            || WeatherActive(Weather.RainyHeavyFog, 0, 0)));
    RestartEvent();
L3:
    SetEventFlagID(570, OFF);
    SetEventFlagID(571, OFF);
    SetEventFlagID(572, OFF);
    SetEventFlagID(573, ON);
    SetEventFlagID(574, OFF);
    SetEventFlagID(575, OFF);
    WaitFor(!(WeatherActive(Weather.Snow, 0, 0) || WeatherActive(Weather.HeavySnow, 0, 0)));
    RestartEvent();
L4:
    SetEventFlagID(570, OFF);
    SetEventFlagID(571, OFF);
    SetEventFlagID(572, OFF);
    SetEventFlagID(573, OFF);
    SetEventFlagID(574, ON);
    SetEventFlagID(575, OFF);
    WaitFor(!(WeatherActive(Weather.Fog, 0, 0) || WeatherActive(Weather.HeavyFog, 0, 0)));
    RestartEvent();
L5:
    SetEventFlagID(570, OFF);
    SetEventFlagID(571, OFF);
    SetEventFlagID(572, OFF);
    SetEventFlagID(573, OFF);
    SetEventFlagID(574, OFF);
    SetEventFlagID(575, ON);
    WaitFor(
        !(WeatherActive(Weather.WindyFog, 0, 0) || WeatherActive(Weather.WindyPuffyClouds, 0, 0)));
    RestartEvent();
});

$Event(840, Default, function() {
    WaitFor(CharacterHasSpEffect(10000, 8998));
    DeactivateGparamOverride(3);
    ChangeWeather(Weather.Default, 1, false);
    ClearSpEffect(10000, 8998);
    WaitFixedTimeSeconds(1.2);
    RestartEvent();
});

$Event(841, Restart, function() {
    WaitFor(CharacterHasSpEffect(10000, 8990));
    ChangeWeather(Weather.Fog, -1, false);
    WaitFor(!CharacterHasSpEffect(10000, 8990));
    RestartEvent();
});

$Event(900, Default, function() {
    EndIf(!PlayerIsInOwnWorld());
    GotoIf(L0, !EventFlag(9116));
    GotoIf(L1, !EventFlag(118));
    EndEvent();
L0:
    WaitFor(PlayerIsInOwnWorld() && EventFlag(9116));
    SetSpEffect(10000, 4280);
    SetSpEffect(10000, 4282);
    SetPlayerRespawnPoint(13002020);
    SaveRequest();
    WaitFixedTimeSeconds(5.2);
L1:
    EndIf(CharacterDead(10000));
    DisableCharacterDefaultBackread(13000800);
    SetEventFlagID(300, ON);
    SetEventFlagID(301, ON);
    SetEventFlagID(302, OFF);
    SetEventFlagID(71300, ON);
    BatchSetEventFlags(71100, 71110, OFF);
    DisableTextOnLoadingScreen();
    PlayCutsceneToPlayerAndWarp(13000050, CutscenePlayMode.Skippable, 11052010, 11050000, 10000, 13000, true);
    WaitFixedTimeRealFrames(1);
    SetPlayerRespawnPoint(11052010);
    SaveRequest();
    SetEventFlagID(118, ON);
});

$Event(901, Restart, function() {
    EndIf(EventFlag(110));
    WaitFor(
        PlayerIsInOwnWorld()
            && EventFlag(1054539205)
            && (EventFlag(1054539200) || EventFlag(1054539201)));
    WaitFixedTimeSeconds(2);
    SetEventFlagID(9001, ON);
    WaitFixedTimeFrames(1);
    SetPlayerRespawnPoint(13002500);
    SaveRequest();
    SetEventFlagID(110, ON);
    SetEventFlagID(302, ON);
    SetEventFlagID(9021, ON);
    if (!EventFlag(1054539201)) {
        if (!(PlayerHasArmorEquipped(ArmorType.Head, 150000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 640000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 910000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 760000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 440000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 470000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 820000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 1010000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 1760000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 1770000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 1780000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 2010000, -1)
            || PlayerHasArmorEquipped(ArmorType.Body, 330100, -1)
            || PlayerHasArmorEquipped(ArmorType.Body, 1810100, -1)
            || PlayerHasArmorEquipped(ArmorType.Body, 1811100, -1))) {
            SetEventFlagID(780010, ON);
            SetEventFlagID(780011, OFF);
        } else {
            SetEventFlagID(780010, OFF);
            SetEventFlagID(780011, ON);
        }
        SetEventFlagID(111, ON);
        PlayCutsceneToPlayerAndWarpWithWeatherAndTime(60540000, CutscenePlayMode.Skippable, 13002500, 13000000, 10000, 0, false, true, Weather.Default, 300, false, 0, 0, 0);
        WaitFixedTimeRealFrames(1);
        PlayCutsceneToPlayerWithWeatherAndTime(60540010, CutscenePlayMode.SkippableWithFadeOutSkip, 10000, true, Weather.Default, 300, true, 6, 30, 0);
        WaitFixedTimeRealFrames(1);
        SetEventFlagID(9001, OFF);
        EndEvent();
    }
L1:
    SetEventFlagID(9000, OFF);
    SetEventFlagID(112, ON);
    PlayCutsceneToPlayerAndWarpWithWeatherAndTime(60540001, CutscenePlayMode.Skippable, 13002500, 13000000, 10000, 0, false, true, Weather.Default, 200, false, 0, 0, 0);
    WaitFixedTimeRealFrames(1);
    PlayCutsceneToPlayerWithWeatherAndTime(60540011, CutscenePlayMode.SkippableWithFadeOutSkip, 10000, true, Weather.Default, 300, true, 6, 30, 0);
    WaitFixedTimeRealFrames(1);
    SetEventFlagID(9001, OFF);
    EndEvent();
});

$Event(902, Restart, function() {
    WaitFor(
        PlayerIsInOwnWorld()
            && EventFlag(1054539206)
            && EventFlag(110)
            && PlayerInMap(60, 54, 53, -1));
    SetEventFlagID(9001, ON);
    WaitFixedTimeFrames(1);
    SetPlayerRespawnPoint(13002500);
    SaveRequest();
    SetEventFlagID(1054539206, OFF);
    SetEventFlagID(302, ON);
    SetEventFlagID(9021, ON);
    if (!EventFlag(112)) {
        if (!(PlayerHasArmorEquipped(ArmorType.Head, 150000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 640000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 910000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 760000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 440000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 470000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 820000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 1010000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 1760000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 1770000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 1780000, -1)
            || PlayerHasArmorEquipped(ArmorType.Head, 2010000, -1)
            || PlayerHasArmorEquipped(ArmorType.Body, 330100, -1)
            || PlayerHasArmorEquipped(ArmorType.Body, 1810100, -1)
            || PlayerHasArmorEquipped(ArmorType.Body, 1811100, -1))) {
            SetEventFlagID(780010, ON);
            SetEventFlagID(780011, OFF);
        } else {
            SetEventFlagID(780010, OFF);
            SetEventFlagID(780011, ON);
        }
        SetEventFlagID(111, ON);
        PlayCutsceneToPlayerAndWarpWithWeatherAndTime(60540000, CutscenePlayMode.Skippable, 13002500, 13000000, 10000, 0, false, true, Weather.Default, 300, false, 0, 0, 0);
        WaitFixedTimeRealFrames(1);
        PlayCutsceneToPlayerWithWeatherAndTime(60540010, CutscenePlayMode.SkippableWithFadeOutSkip, 10000, true, Weather.Default, 300, true, 6, 30, 0);
        WaitFixedTimeRealFrames(1);
        SetEventFlagID(9001, OFF);
        EndEvent();
    }
L1:
    SetEventFlagID(9000, OFF);
    SetEventFlagID(112, ON);
    PlayCutsceneToPlayerAndWarpWithWeatherAndTime(60540001, CutscenePlayMode.Skippable, 13002500, 13000000, 10000, 0, false, true, Weather.Default, 200, false, 0, 0, 0);
    WaitFixedTimeRealFrames(1);
    PlayCutsceneToPlayerWithWeatherAndTime(60540011, CutscenePlayMode.SkippableWithFadeOutSkip, 10000, true, Weather.Default, 300, true, 6, 30, 0);
    WaitFixedTimeRealFrames(1);
    SetEventFlagID(9001, OFF);
    EndEvent();
});

$Event(910, Default, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(9415));
    if (EventFlag(310)) {
        if (!EventFlag(9416)) {
            DisableAreaWelcomeMessage();
            SetEventFlagID(9416, ON);
        }
        SetCurrentTime(22, 30, 0, false, false, false, 0, 0, 0);
        ChangeWeather(Weather.Cloudless, -1, true);
        SetSpEffect(10000, 4280);
        SetSpEffect(10000, 4282);
        if (!EventFlag(9417)) {
            WaitFixedTimeSeconds(0.5);
            DisplayGenericDialog(30140, PromptType.OKCANCEL, NumberofOptions.OneButton, 0, 5);
            SetEventFlagID(9417, ON);
        }
        WaitFor(EventFlag(76422) || EventFlag(73016));
        ChangeWeather(Weather.Cloudless, 15000, false);
        SetSpEffect(10000, 4281);
        SetSpEffect(10000, 4283);
        SetEventFlagID(9415, ON);
        EndEvent();
    }
L0:
    WaitFor(PlayerIsInOwnWorld() && EventFlag(9130));
    SetSpEffect(10000, 4280);
    SetSpEffect(10000, 4282);
    SetPlayerRespawnPoint(1052382020);
    SaveRequest();
    if (!EventFlag(9414)) {
        SetEventFlagID(9414, ON);
        WaitFixedTimeSeconds(10);
    }
    EndIf(CharacterDead(10000));
    if (!(MapLoaded(60, 52, 39, 0) || MapLoaded(60, 51, 38, 0))) {
        WarpPlayer(60, 51, 38, 0, 1051382020, 0);
        EndEvent();
    }
L9:
    SetEventFlagID(9001, ON);
    WaitFixedTimeFrames(1);
    DisableTextOnLoadingScreen();
    if (!MapLoaded(60, 52, 39, 0)) {
        PlayCutsceneToPlayerWithWeatherAndTime(60510011, CutscenePlayMode.Skippable, 10000, true, Weather.Cloudless, -1, true, 22, 30, 0);
    } else {
        PlayCutsceneToPlayerWithWeatherAndTime(60510010, CutscenePlayMode.Skippable, 10000, true, Weather.Cloudless, -1, true, 22, 30, 0);
    }
    WaitFixedTimeRealFrames(1);
    FadeToBlack(1, 0, false, -1);
    SetEventFlagID(310, ON);
    DisableNetworkInteraction();
    EndEvent();
});

$Event(920, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(116));
    WaitFor(PlayerIsInOwnWorld() && CharacterHasSpEffect(10000, 502190));
    SetEventFlagID(116, ON);
    SetEventFlagID(7500, OFF);
    SetEventFlagID(9431, OFF);
});

$Event(921, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(116));
    WaitFor(PlayerIsInOwnWorld() && EventFlag(108) && EventFlag(9120) && InArea(10000, 13002050));
    SetSpEffect(10000, 4230);
});

$Event(922, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    WaitFor(PlayerIsInOwnWorld() && CharacterHasSpEffect(10000, 502160));
    WarpPlayer(12, 5, 0, 0, 12052021, 0);
});

$Event(930, Default, function(X0_4, X4_4, X8_4, X12_4, X16_4, X20_4, X24_4, X28_4, X32_4, X36_4) {
    onlineItemAct &= !(HasMultiplayerState(MultiplayerState.Multiplayer)
        || HasMultiplayerState(MultiplayerState.MultiplayerPending))
        && PlayerIsInOwnWorld();
    if (Signed(X16_4) != 0) {
        onlineItemAct &= PlayerHasItem(ItemType.Goods, X16_4);
    }
    if (Signed(X20_4) != 0) {
        onlineItemAct &= PlayerHasItem(ItemType.Goods, X20_4);
    }
    onlineItemAct &= ActionButtonInArea(X12_4, X8_4);
    WaitFor(onlineItemAct);
    SetEventFlagID(9021, ON);
    PlayCutsceneToPlayerAndWarp(X0_4, CutscenePlayMode.Skippable, X28_4, X24_4, 10000, X36_4, false);
    WaitFixedTimeRealFrames(1);
    PlayCutsceneToPlayer(X4_4, CutscenePlayMode.SkippableWithFadeOutSkip, 10000);
    WaitFixedTimeRealFrames(1);
    RestartEvent();
    if (PlayerIsInOwnWorld()) {
        PlayCutsceneToPlayerAndWarp(X0_4, CutscenePlayMode.Skippable, X28_4, X24_4, 10000, 0, false);
    } else {
        if (X32_4 != 0) {
            PlayCutsceneToPlayerAndWarp(X0_4, CutscenePlayMode.Skippable, X32_4, X24_4, 10000, 0, false);
        } else {
            PlayCutsceneToPlayerAndWarp(X0_4, CutscenePlayMode.Skippable, X28_4, X24_4, 10000, 0, false);
        }
    }
    WaitFixedTimeRealFrames(1);
    if (PlayerIsInOwnWorld()) {
        PlayCutsceneToPlayerAndWarp(X4_4, CutscenePlayMode.SkippableWithFadeOutSkip, X28_4, X24_4, 10000, 0, false);
    } else {
        if (X32_4 != 0) {
            PlayCutsceneToPlayerAndWarp(X4_4, CutscenePlayMode.SkippableWithFadeOutSkip, X32_4, X24_4, 10000, 0, false);
        } else {
            PlayCutsceneToPlayerAndWarp(X4_4, CutscenePlayMode.SkippableWithFadeOutSkip, X28_4, X24_4, 10000, 0, false);
        }
    }
    WaitFixedTimeRealFrames(1);
    RestartEvent();
});

$Event(936, Default, function(X0_4, X4_4, X8_4, X12_4, X16_4, X20_4, X24_1, X25_1, X28_4) {
    WaitFor(
        !(HasMultiplayerState(MultiplayerState.Multiplayer)
            || HasMultiplayerState(MultiplayerState.MultiplayerPending))
            && EventFlag(X8_4));
    SetEventFlagID(X8_4, OFF);
    SetEventFlagID(9021, ON);
    PlayCutsceneToPlayerAndWarpWithWeatherAndTime(X0_4, CutscenePlayMode.Skippable, X16_4, X12_4, 10000, X20_4, false, X24_1, X25_1, X28_4, false, 0, 0, 0);
    WaitFixedTimeRealFrames(1);
    PlayCutsceneToPlayer(X4_4, CutscenePlayMode.SkippableWithFadeOutSkip, 10000);
    WaitFixedTimeRealFrames(1);
    RestartEvent();
});

$Event(945, Default, function() {
    DisableNetworkSync();
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(105));
    WaitFor(PlayerIsInOwnWorld() && EventFlag(104));
    WarpPlayer(11, 10, 0, 0, 11100980, 61000);
    SetThisEventSlot(ON);
});

$Event(950, Restart, function() {
    EndIf(EventFlag(951));
    online = PlayerIsInOwnWorld();
    area = EntityInRadiusOfEntity(10000, 1042361950, 2, 1);
    area2 = EntityInRadiusOfEntity(10000, 1043371950, 2, 1);
    area3 = EntityInRadiusOfEntity(10000, 1046381950, 2, 1);
    area4 = EntityInRadiusOfEntity(10000, 1041381950, 2, 1);
    area5 = EntityInRadiusOfEntity(10000, 1044351950, 2, 1);
    area6 = EntityInRadiusOfEntity(10000, 1042371950, 2, 1);
    area7 = EntityInRadiusOfEntity(10000, 1044341950, 2, 1);
    area8 = EntityInRadiusOfEntity(10000, 1043351950, 2, 1);
    areaFlag = (area || area2 || area3 || area4 || area5 || area6 || area7 || area8) && EventFlag(9000);
    flag = EventValue(955, 3) == 2;
    flag2 = EventValue(955, 3) >= 3;
    onlineAreaFlag = online && areaFlag && (flag || flag2 || area2 || area6);
    WaitFor(onlineAreaFlag || ElapsedSeconds(3));
    EndIf(!onlineAreaFlag.Passed);
    SetEventFlagID(9001, ON);
    WaitFixedTimeFrames(1);
    SetEventFlagID(951, ON);
    SetEventFlagID(953, ON);
    SetEventFlagID(9021, ON);
    if (!area8.Passed) {
        GotoIf(L7, area7.Passed);
        GotoIf(L6, area6.Passed);
        GotoIf(L5, area5.Passed);
        GotoIf(L4, area4.Passed);
        GotoIf(L3, area3.Passed);
        GotoIf(L2, area2.Passed);
        GotoIf(L1, area.Passed);
        Goto(L10);
        EndEvent();
L1:
        PlayCutsceneToPlayer(60420000, CutscenePlayMode.SkippableWithFadeOutSkip, 10000);
        WaitFixedTimeRealFrames(1);
        IssueShortWarpRequest(10000, TargetEntityType.Area, 1042362980, -1);
        SetCameraAngle(5, -150.63);
        ChangeWeather(Weather.Default, 300, true);
        Goto(L10);
L2:
        PlayCutsceneToPlayer(60420001, CutscenePlayMode.SkippableWithFadeOutSkip, 10000);
        WaitFixedTimeRealFrames(1);
        IssueShortWarpRequest(10000, TargetEntityType.Area, 1043372980, -1);
        SetCameraAngle(5, 108.82);
        ChangeWeather(Weather.Default, 300, true);
        Goto(L10);
L3:
        PlayCutsceneToPlayer(60420002, CutscenePlayMode.SkippableWithFadeOutSkip, 10000);
        WaitFixedTimeRealFrames(1);
        IssueShortWarpRequest(10000, TargetEntityType.Area, 1046382980, -1);
        SetCameraAngle(5, -155.69);
        ChangeWeather(Weather.Default, 300, true);
        Goto(L10);
L4:
        PlayCutsceneToPlayer(60420003, CutscenePlayMode.SkippableWithFadeOutSkip, 10000);
        WaitFixedTimeRealFrames(1);
        IssueShortWarpRequest(10000, TargetEntityType.Area, 1041382980, -1);
        SetCameraAngle(5, 49.13);
        ChangeWeather(Weather.Default, 300, true);
        Goto(L10);
L5:
        PlayCutsceneToPlayer(60420004, CutscenePlayMode.SkippableWithFadeOutSkip, 10000);
        WaitFixedTimeRealFrames(1);
        IssueShortWarpRequest(10000, TargetEntityType.Area, 1044352980, -1);
        SetCameraAngle(5, -144.18);
        ChangeWeather(Weather.Default, 300, true);
        Goto(L10);
L6:
        PlayCutsceneToPlayer(60420005, CutscenePlayMode.SkippableWithFadeOutSkip, 10000);
        WaitFixedTimeRealFrames(1);
        IssueShortWarpRequest(10000, TargetEntityType.Area, 1042372980, -1);
        SetCameraAngle(4.02, 18.7);
        ChangeWeather(Weather.Default, 300, true);
        Goto(L10);
L7:
        PlayCutsceneToPlayer(60420006, CutscenePlayMode.SkippableWithFadeOutSkip, 10000);
        WaitFixedTimeRealFrames(1);
        IssueShortWarpRequest(10000, TargetEntityType.Area, 1044342980, -1);
        SetCameraAngle(5, 17.42);
        ChangeWeather(Weather.Default, 300, true);
    } else {
L8:
        PlayCutsceneToPlayer(60420007, CutscenePlayMode.SkippableWithFadeOutSkip, 10000);
        WaitFixedTimeRealFrames(1);
        IssueShortWarpRequest(10000, TargetEntityType.Area, 1043352980, -1);
        SetCameraAngle(5, -126.77);
        ChangeWeather(Weather.Default, 300, true);
        Goto(L10);
    }
L10:
    SetEventFlagID(9001, OFF);
});

$Event(960, Default, function(X0_4) {
    EndIf(EventFlag(951));
    EndIf(EventFlag(X0_4));
    WaitFor(EventFlag(951) || EventFlag(X0_4));
    EndIf(EventFlag(951));
    IncrementEventValue(955, 3, 7);
});

$Event(970, Default, function() {
    DisableNetworkSync();
    EndIf(EventFlag(82001));
    WaitFor(PlayerIsInOwnWorld() && PlayerInMap(12, -1, -1, -1));
    SetEventFlagID(82001, ON);
});

$Event(980, Restart, function() {
    EndIf(EventFlag(1099002980));
    BatchSetEventFlags(9800, 9809, OFF);
    RandomlySetEventFlagInRange(9800, 9809, ON);
    SetEventFlagID(1099002980, ON);
});

$Event(1020, Default, function() {
    DisableNetworkSync();
    GotoIf(L0, EventFlag(9021));
    GotoIf(L1, EventFlag(1099002100));
    SuppressSE(SoundType.BGM, 0, false);
    WaitFor(EventFlag(1099002100) || EventFlag(9021));
    RestartEvent();
L0:
    SuppressSE(SoundType.BGM, 0, true);
    SetEventFlagID(9021, OFF);
    WaitFor(ElapsedSeconds(1) || EventFlag(1099002100));
    GotoIf(L2, EventFlag(1099002100));
    RestartEvent();
L1:
    SuppressSE(SoundType.BGM, 0, true);
L2:
    WaitFor(!EventFlag(1099002100));
    WaitFixedTimeFrames(1);
    RestartEvent();
});

$Event(1030, Default, function() {
    DisableNetworkSync();
    WaitFor(
        WeatherLotActive(1000)
            || WeatherLotActive(2000)
            || WeatherLotActive(2010)
            || WeatherLotActive(2020)
            || WeatherLotActive(3000)
            || WeatherLotActive(3010)
            || WeatherLotActive(3020)
            || WeatherLotActive(3021)
            || WeatherLotActive(3022)
            || WeatherLotActive(4000)
            || WeatherLotActive(4001)
            || WeatherLotActive(4010)
            || WeatherLotActive(4020)
            || WeatherLotActive(5000)
            || WeatherLotActive(5010)
            || WeatherLotActive(5011)
            || WeatherLotActive(6000)
            || ((WeatherLotActive(620000100) || WeatherLotActive(620000101)) && !EventFlag(9840)));
    if (WeatherLotActive(1000)) {
        ChangeWeather(Weather.Cloudless, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(1000));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(2000)) {
        ChangeWeather(Weather.Default, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(2000));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(2010)) {
        ChangeWeather(Weather.FlatClouds, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(2010));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(2020)) {
        ChangeWeather(Weather.PuffyClouds, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(2020));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(3000)) {
        ChangeWeather(Weather.Rain, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(3000));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(3010)) {
        ChangeWeather(Weather.RainyClouds, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(3010));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(3020)) {
        ChangeWeather(Weather.WindyRain, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(3020));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(3021)) {
        ChangeWeather(Weather.WindyFog, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(3021));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(3022)) {
        ChangeWeather(Weather.ScatteredRain, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(3022));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(4000)) {
        ChangeWeather(Weather.Snow, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(4000));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(4001)) {
        ChangeWeather(Weather.Unknown18, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(4001));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(4010)) {
        ChangeWeather(Weather.HeavySnow, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(4010));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(4020)) {
        ChangeWeather(Weather.SnowyHeavyFog, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(4020));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(5000)) {
        ChangeWeather(Weather.Fog, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(5000));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(5010)) {
        ChangeWeather(Weather.HeavyFog, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(5010));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(5011)) {
        ChangeWeather(Weather.RainyHeavyFog, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(5011));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    if (WeatherLotActive(6000)) {
        ChangeWeather(Weather.WindyPuffyClouds, -1, false);
        WaitFixedTimeSeconds(1);
        WaitFor(!WeatherLotActive(6000));
        ChangeWeather(Weather.None, -1, false);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    cond &= !WeatherLotActive(620000100) && !WeatherLotActive(620000101);
    if (!cond) {
        ChangeWeather(Weather.Default, -1, false);
        WaitFixedTimeSeconds(1);
        cond &= !WeatherLotActive(620000100) && !WeatherLotActive(620000101);
        WaitFor(cond);
        ChangeWeather(Weather.None, -1, false);
        SetEventFlagID(9840, ON);
        WaitFixedTimeSeconds(1);
        RestartEvent();
    }
L1:
    WaitFixedTimeSeconds(1);
    RestartEvent();
});

$Event(1040, Restart, function() {
    DisableNetworkSync();
    DeleteAssetfollowingSFX(1060001500, true);
    ClearSpEffect(10000, 4200);
    ClearSpEffect(10000, 4201);
    SetWindSFX(-1);
    timeMap = TimeOfDayInRange(0, 0, 0, 2, 59, 59)
        && WeatherActive(Weather.Default, 0, 0)
        && PlayerInMap(60, -1, -1, -1);
    mapFlagOnline = PlayerInMap(10, 1, -1, -1) && !EventFlag(102) && PlayerIsInOwnWorld();
    online = MultiplayerEvent(0);
    online2 = MultiplayerEvent(10);
    online3 = MultiplayerEvent(20);
    online4 = MultiplayerEvent(30);
    online5 = MultiplayerEvent(40);
    online6 = MultiplayerEvent(50);
    online7 = MultiplayerEvent(60);
    online8 = MultiplayerEvent(70);
    cond |= MultiplayerEvent(80);
    online9 = online || online2 || online3 || online4 || online5 || online6 || online7 || online8 || cond;
    WaitFor(timeMap || mapFlagOnline || online9 || EventFlag(9989));
    if (!online9.Passed) {
        if (!mapFlagOnline.Passed) {
            SetWindSFX(808004);
            WaitFixedTimeSeconds(5);
            CreateAssetfollowingSFX(1060001500, 200, 806800);
            WaitFixedTimeSeconds(14);
            SetSpEffect(10000, 4200);
            SetSpEffect(10000, 4201);
            cond |= (!(TimeOfDayInRange(0, 0, 0, 3, 29, 59)
                && WeatherActive(Weather.Default, 0, 0)
                && PlayerInMap(60, -1, -1, -1))
                && !EventFlag(9989))
                || ElapsedSeconds(300);
            WaitFor(cond);
            SetWindSFX(-1);
            DeleteAssetfollowingSFX(1060001500, true);
            ClearSpEffect(10000, 4200);
            ClearSpEffect(10000, 4201);
            WaitFixedTimeSeconds(120);
            RestartEvent();
        }
L1:
        SetWindSFX(808004);
        SetSpEffect(10000, 4200);
        WaitFor(!(PlayerInMap(10, 1, -1, -1) && !EventFlag(102) && PlayerIsInOwnWorld()));
        SetWindSFX(-1);
        ClearSpEffect(10000, 4200);
        WaitFixedTimeSeconds(10);
        RestartEvent();
    }
L0:
    if (PlayerInMap(60, -1, -1, -1)) {
        SetWindSFX(808004);
        WaitFixedTimeSeconds(5);
        CreateAssetfollowingSFX(1060001500, 200, 806800);
        WaitFixedTimeSeconds(14);
    }
L2:
    SetSpEffect(10000, 4200);
    SetSpEffect(10000, 4201);
    if (online.Passed) {
        DisplayNetworkMessage(3000201, false);
    } else {
        if (online2.Passed) {
            DisplayNetworkMessage(3000211, false);
        } else {
            if (online3.Passed) {
                DisplayNetworkMessage(3000221, false);
            } else {
                if (online4.Passed) {
                    DisplayNetworkMessage(3000231, false);
                } else {
                    if (online5.Passed) {
                        DisplayNetworkMessage(3000241, false);
                    } else {
                        if (online6.Passed) {
                            DisplayNetworkMessage(3000251, false);
                        } else {
                            if (online7.Passed) {
                                DisplayNetworkMessage(3000261, false);
                            } else {
                                if (online8.Passed) {
                                    DisplayNetworkMessage(3000271, false);
                                } else {
                                    GotoIf(S0, !cond.Passed);
                                    DisplayNetworkMessage(3000281, false);
                                    Goto(L15);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
S0:
L15:
    WaitFixedTimeSeconds(300);
    SetWindSFX(-1);
    DeleteAssetfollowingSFX(1060001500, true);
    ClearSpEffect(10000, 4200);
    ClearSpEffect(10000, 4201);
    WaitFixedTimeSeconds(150);
    RestartEvent();
});

$Event(1050, Restart, function() {
    DisableNetworkSync();
    flag = EventFlag(7500);
    flagSp = !EventFlag(7500) && CharacterHasSpEffect(20000, 503315);
    WaitFor(flag || flagSp);
    if (!flagSp.Passed) {
        SetSpEffect(20000, 503315);
        WaitFixedTimeSeconds(0.1);
        WaitFor(!EventFlag(7500));
    }
L2:
    SetSpEffect(20000, 503316);
    WaitFixedTimeSeconds(0.1);
    RestartEvent();
});

$Event(1080, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    WaitFor(PlayerIsInOwnWorld() && EventFlag(9080));
    SetSpEffect(10000, 4286);
    WaitFor(
        (PlayerIsInOwnWorld()
            && EventFlag(9000)
            && EventFlag(9080)
            && CharacterHasSpEffect(10000, 4286))
            || !EventFlag(9080));
    SetSpEffect(10000, 4287);
    SetEventFlagID(9080, OFF);
    WaitFixedTimeRealFrames(1);
    RestartEvent();
});

$Event(1100, Default, function(X0_4, X4_4, X8_4, X12_4) {
    Unknown200476(X0_4, X4_4);
    EndIf(EventFlag(X12_4));
    WaitFor(EventFlag(X0_4));
    if (Signed(X4_4) != 0) {
        AwardItemsIncludingClients(X4_4);
    }
    WaitFixedTimeSeconds(5);
    if (Signed(X8_4) != 0) {
        AwardItemsIncludingClients(X8_4);
    }
});

$Event(1200, Default, function(X0_4, X4_4, X8_4, X12_4) {
    Unknown200476(X0_4, X4_4);
    EndIf(EventFlag(X12_4));
    WaitFor(EventFlag(X0_4));
    if (Signed(X4_4) != 0) {
        AwardItemsIncludingClients(X4_4);
    }
    WaitFixedTimeSeconds(5);
    if (Signed(X8_4) != 0) {
        AwardItemsIncludingClients(X8_4);
    }
});

$Event(1400, Default, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (!EventFlag(6950)) {
        EndIf(!EventFlag(60849));
        RemoveGesture(108);
        SetEventFlagID(60849, OFF);
        EndEvent();
    }
L0:
    EndIf(EventFlag(60849));
    AwardGesture(108);
    SetEventFlagID(60849, ON);
});

$Event(1401, Default, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (EventFlag(6950)) {
        if (EventFlag(60850)) {
            RemoveGesture(109);
            SetEventFlagID(60850, OFF);
        }
L15:
        SetEventFlagID(7680, OFF);
        EndEvent();
    }
L0:
    if (!EventFlag(60850)) {
        WaitFor(PlayerIsInOwnWorld() && EventFlag(7680));
        AwardGesture(109);
        SetEventFlagID(60850, ON);
    }
L16:
    SetEventFlagID(7680, OFF);
});

$Event(1410, Restart, function(X0_4, X4_4, X8_4, X12_4, X16_4) {
    EndIf(!PlayerIsInOwnWorld());
    WaitFor(PlayerIsInOwnWorld() && EventFlag(X16_4));
    RequestCharacterAICommand(X12_4, 80, 0);
    RequestCharacterAICommand(X12_4, X4_4, 1);
    RequestCharacterAIReplan(X12_4);
    sp = CharacterHasSpEffect(X12_4, X8_4);
    WaitFor(sp || HasDamageType(X12_4, 10000, DamageType.Unspecified));
    RequestCharacterAICommand(X12_4, -1, 0);
    RequestCharacterAICommand(X12_4, -1, 1);
    RequestCharacterAIReplan(X12_4);
    EndIf(!sp.Passed);
    EndIf(EventFlag(X0_4));
    AwardGesture(X4_4);
    SetEventFlagID(X0_4, ON);
});

$Event(1411, Restart, function(X0_4, X4_4, X8_4, X12_4, X16_4, X20_4, X24_4, X28_4, X32_4) {
    EndIf(!PlayerIsInOwnWorld());
    WaitFor(EventFlag(X16_4) || EventFlag(X24_4) || EventFlag(X32_4));
    if (EventFlag(X16_4)) {
        RequestCharacterAICommand(X12_4, 80, 0);
        RequestCharacterAICommand(X12_4, X4_4, 1);
        RequestCharacterAIReplan(X12_4);
    }
    if (EventFlag(X24_4)) {
        RequestCharacterAICommand(X20_4, 80, 0);
        RequestCharacterAICommand(X20_4, X4_4, 1);
        RequestCharacterAIReplan(X20_4);
    }
    if (EventFlag(X32_4)) {
        RequestCharacterAICommand(X28_4, 80, 0);
        RequestCharacterAICommand(X28_4, X4_4, 1);
        RequestCharacterAIReplan(X28_4);
    }
    WaitFor(
        CharacterHasSpEffect(X12_4, X8_4)
            || CharacterHasSpEffect(X20_4, X8_4)
            || CharacterHasSpEffect(X28_4, X8_4));
    if (EventFlag(X16_4)) {
        RequestCharacterAICommand(X12_4, -1, 0);
        RequestCharacterAICommand(X12_4, -1, 1);
        RequestCharacterAIReplan(X12_4);
    }
    if (EventFlag(X24_4)) {
        RequestCharacterAICommand(X20_4, -1, 0);
        RequestCharacterAICommand(X20_4, -1, 1);
        RequestCharacterAIReplan(X20_4);
    }
    if (EventFlag(X32_4)) {
        RequestCharacterAICommand(X28_4, -1, 0);
        RequestCharacterAICommand(X28_4, -1, 1);
        RequestCharacterAIReplan(X28_4);
    }
    EndIf(EventFlag(X0_4));
    AwardGesture(X4_4);
    SetEventFlagID(X0_4, ON);
});

$Event(1412, Restart, function(X0_4, X4_4, X8_4, X12_4, X16_4) {
    WaitFor(EventFlag(X16_4) && EntityInRadiusOfEntity(10000, X12_4, 18, 1));
    RequestCharacterAICommand(X12_4, 80, 0);
    RequestCharacterAICommand(X12_4, X4_4, 1);
    RequestCharacterAIReplan(X12_4);
    sp = CharacterHasSpEffect(X12_4, X8_4);
    WaitFor(sp || HasDamageType(X12_4, 10000, DamageType.Unspecified));
    RequestCharacterAICommand(X12_4, -1, 0);
    RequestCharacterAICommand(X12_4, -1, 1);
    RequestCharacterAIReplan(X12_4);
    EndIf(!sp.Passed);
    EndIf(EventFlag(X0_4));
    AwardGesture(X4_4);
    SetEventFlagID(X0_4, ON);
});

$Event(1450, Restart, function(X0_4, X4_4, X8_4, X12_4) {
    DisableNetworkSync();
    onlineFlag &= PlayerIsInOwnWorld() && EventFlag(X0_4);
    if (0 != X4_4) {
        onlineFlag &= EventFlag(X4_4);
    }
    if (0 != X8_4) {
        onlineFlag &= EventFlag(X8_4);
    }
    if (0 != X12_4) {
        onlineFlag &= EventFlag(X12_4);
    }
    EndIf(onlineFlag);
    WaitFor(PlayerIsInOwnWorld() && EventFlag(X0_4));
    if (0 != X4_4) {
        SetEventFlagID(X4_4, ON);
    }
    if (0 != X8_4) {
        SetEventFlagID(X8_4, ON);
    }
    if (0 != X12_4) {
        SetEventFlagID(X12_4, ON);
    }
});

$Event(1460, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    WaitFor(
        (EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66000)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66010)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66020)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66030)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66040)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66050)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66060)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66070)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66080)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66090)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66100)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66110)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66120)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66130)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66140)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66150)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66160)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66170)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66180)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66190))
            && PlayerIsInOwnWorld());
    StoreItemAmountHeldInEventValue(ItemType.Goods, 9500, 9560, 5);
    if (EventValue(9560, 5) != 20) {
        WaitFixedTimeFrames(1);
        RestartEvent();
    }
L10:
    if (!EventFlag(6902)) {
        SetEventFlagID(6902, ON);
    }
});

$Event(1461, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    WaitFor(
        (EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66400)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66410)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66420)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66430)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66440)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66450)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66460)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66470)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66480)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66490))
            && PlayerIsInOwnWorld());
    StoreItemAmountHeldInEventValue(ItemType.Goods, 9501, 9565, 5);
    if (EventValue(9565, 5) != 10) {
        WaitFixedTimeFrames(1);
        RestartEvent();
    }
L10:
    if (!EventFlag(6903)) {
        SetEventFlagID(6903, ON);
    }
});

$Event(1462, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    WaitFor(
        (EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66700)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66710)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66720)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66730)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66740)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66750)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66760)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66770)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66780)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 66790))
            && PlayerIsInOwnWorld());
    StoreItemAmountHeldInEventValue(ItemType.Goods, 9510, 9570, 5);
    if (EventValue(9570, 5) != 10) {
        WaitFixedTimeFrames(1);
        RestartEvent();
    }
L10:
    if (!EventFlag(6904)) {
        SetEventFlagID(6904, ON);
    }
});

$Event(1600, Default, function(X0_4, X4_4, X8_4, X12_4) {
    DisableNetworkSync();
    if (!PlayerIsInOwnWorld()) {
        EndIf(0 == X8_4);
        DisableAsset(X12_4);
        EndEvent();
    }
L0:
    if (EventFlag(X0_4)) {
        EndIf(0 == X8_4);
        DisableAsset(X12_4);
        EndEvent();
    }
L1:
    if (0 != X8_4) {
        CreateAssetfollowingSFX(X8_4, 200, 803220);
    }
    WaitFor(PlayerIsInOwnWorld() && EventFlag(X0_4));
    WaitFixedTimeSeconds(1);
    DisplayBanner(TextBannerType.MapFound);
    SetEventFlagID(X4_4, ON);
    WaitFixedTimeSeconds(1);
    if (0 != X8_4) {
        ForceAnimationPlayback(X12_4, 1, false, false, false);
    }
    if (0 != X8_4) {
        DeleteAssetfollowingSFX(X8_4, true);
    }
    EndEvent();
});

$Event(1630, Restart, function(X0_4, X4_4, X8_4, X12_4, X16_4, X20_4, X24_4, X28_4, X32_4) {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(X0_4));
    onlineFlag &= PlayerIsInOwnWorld() && EventFlag(X4_4);
    if (0 != X8_4) {
        onlineFlag &= EventFlag(X8_4);
    }
    if (0 != X12_4) {
        onlineFlag &= EventFlag(X12_4);
    }
    if (0 != X16_4) {
        onlineFlag &= EventFlag(X16_4);
    }
    if (0 != X20_4) {
        onlineFlag &= EventFlag(X20_4);
    }
    if (0 != X24_4) {
        onlineFlag &= EventFlag(X24_4);
    }
    if (0 != X28_4) {
        onlineFlag &= EventFlag(X28_4);
    }
    if (0 != X32_4) {
        onlineFlag &= EventFlag(X32_4);
    }
    WaitFor(onlineFlag);
    SetEventFlagID(X0_4, ON);
});

$Event(1700, Restart, function() {
    DisableNetworkSync();
    EndIf(!PlayerIsInOwnWorld());
    EndIf(!EventFlag(710530));
    EndIf(EventFlag(69100));
    WaitFor(EventFlag(710530) && ElapsedSeconds(2) && !CharacterHasSpEffect(10000, 9640));
    ShowTutorialPopup(1530, true, true);
    SetEventFlagID(700530, ON);
    DirectlyGivePlayerItem(ItemType.Goods, 9110, 700530, 1);
    SetEventFlagID(69100, ON);
});

$Event(1701, Restart, function() {
    DisableNetworkSync();
    EndIf(!PlayerIsInOwnWorld());
    EndIf(ThisEventSlot());
    WaitFor(EventFlag(18000020) && PlayerIsInOwnWorld() && CharacterDead(10000));
    SetEventFlagID(710530, ON);
});

$Event(1702, Restart, function() {
    DisableNetworkSync();
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(700550));
    EndIf(EventFlag(69110));
    WaitFor(
        PlayerIsInOwnWorld()
            && EventFlag(710550)
            && EventFlag(60110)
            && !(HasMultiplayerState(MultiplayerState.Multiplayer)
                || HasMultiplayerState(MultiplayerState.MultiplayerPending))
            && !CharacterHasSpEffect(10000, 9640));
    ShowTutorialPopup(1550, true, true);
    SetEventFlagID(700550, ON);
    DirectlyGivePlayerItem(ItemType.Goods, 9111, 710550, 1);
    SetEventFlagID(69110, ON);
});

$Event(1703, Restart, function() {
    DisableNetworkSync();
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(710570));
    EndIf(EventFlag(69130));
    WaitFor(
        PlayerIsInOwnWorld()
            && EventFlag(60120)
            && !(HasMultiplayerState(MultiplayerState.Multiplayer)
                || HasMultiplayerState(MultiplayerState.MultiplayerPending))
            && !CharacterHasSpEffect(10000, 9640));
    ShowTutorialPopup(1570, true, true);
    SetEventFlagID(710570, ON);
    if (Signed(9113) != 0) {
        DirectlyGivePlayerItem(ItemType.Goods, 9113, 710570, 1);
    }
    SetEventFlagID(69130, ON);
});

$Event(1704, Restart, function() {
    DisableNetworkSync();
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(69350));
    WaitFor(
        PlayerIsInOwnWorld()
            && EventFlag(60120)
            && !(HasMultiplayerState(MultiplayerState.Multiplayer)
                || HasMultiplayerState(MultiplayerState.MultiplayerPending))
            && !CharacterHasSpEffect(10000, 9640));
    WaitFixedTimeSeconds(0.3);
    ShowTutorialPopup(1580, true, true);
    SetEventFlagID(69350, ON);
    if (Signed(9135) != 0) {
        DirectlyGivePlayerItem(ItemType.Goods, 9135, 710580, 1);
    }
});

$Event(1705, Restart, function() {
    DisableNetworkSync();
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(69160));
    WaitFor(
        PlayerIsInOwnWorld()
            && EventFlag(710600)
            && !EventFlag(69160)
            && !(HasMultiplayerState(MultiplayerState.Multiplayer)
                || HasMultiplayerState(MultiplayerState.MultiplayerPending))
            && !CharacterHasSpEffect(10000, 9640));
    ShowTutorialPopup(1600, true, true);
    SetEventFlagID(69160, ON);
    SetEventFlagID(710750, ON);
    if (Signed(9116) != 0) {
        DirectlyGivePlayerItem(ItemType.Goods, 9116, 710600, 1);
    }
});

$Event(1720, Restart, function(X0_4, X4_4, X8_4, X12_4) {
    DisableNetworkSync();
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(X0_4));
    WaitFor(
        PlayerIsInOwnWorld()
            && EventFlag(X4_4)
            && !EventFlag(X0_4)
            && !(HasMultiplayerState(MultiplayerState.Multiplayer)
                || HasMultiplayerState(MultiplayerState.MultiplayerPending))
            && !CharacterHasSpEffect(10000, 9640));
    ShowTutorialPopup(X8_4, true, true);
    SetEventFlagID(X0_4, ON);
    if (Signed(X12_4) != 0) {
        DirectlyGivePlayerItem(ItemType.Goods, X12_4, X4_4, 1);
    }
});

$Event(1750, Restart, function() {
    DisableNetworkSync();
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(710060));
    WaitFor(
        (PlayerHasItem(ItemType.Weapon, 33000000)
            || PlayerHasItem(ItemType.Weapon, 33040000)
            || PlayerHasItem(ItemType.Weapon, 33050000)
            || PlayerHasItem(ItemType.Weapon, 33060000)
            || PlayerHasItem(ItemType.Weapon, 33090000)
            || PlayerHasItem(ItemType.Weapon, 33120000)
            || PlayerHasItem(ItemType.Weapon, 33130000)
            || PlayerHasItem(ItemType.Weapon, 33170000)
            || PlayerHasItem(ItemType.Weapon, 33180000)
            || PlayerHasItem(ItemType.Weapon, 33190000)
            || PlayerHasItem(ItemType.Weapon, 33200000)
            || PlayerHasItem(ItemType.Weapon, 33210000)
            || PlayerHasItem(ItemType.Weapon, 33230000)
            || PlayerHasItem(ItemType.Weapon, 33240000)
            || PlayerHasItem(ItemType.Weapon, 33250000)
            || PlayerHasItem(ItemType.Weapon, 33260000)
            || PlayerHasItem(ItemType.Weapon, 33270000)
            || PlayerHasItem(ItemType.Weapon, 33280000)
            || PlayerHasItem(ItemType.Weapon, 34000000)
            || PlayerHasItem(ItemType.Weapon, 34010000)
            || PlayerHasItem(ItemType.Weapon, 34020000)
            || PlayerHasItem(ItemType.Weapon, 34030000)
            || PlayerHasItem(ItemType.Weapon, 34040000)
            || PlayerHasItem(ItemType.Weapon, 34060000)
            || PlayerHasItem(ItemType.Weapon, 34070000)
            || PlayerHasItem(ItemType.Weapon, 34080000)
            || PlayerHasItem(ItemType.Weapon, 34090000))
            && !PlayerInMap(10, 1, 0, 0)
            && !PlayerInMap(18, 0, 0, 0)
            && PlayerTargeted(1, 31, AIStateType.Combat)
            && PlayerIsInOwnWorld());
    SetEventFlagID(710060, ON);
});

$Event(1751, Restart, function() {
    DisableNetworkSync();
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(710130));
    WaitFor(
        (PlayerHasItem(ItemType.Weapon, 40000000)
            || PlayerHasItem(ItemType.Weapon, 40010000)
            || PlayerHasItem(ItemType.Weapon, 40020000)
            || PlayerHasItem(ItemType.Weapon, 40030000)
            || PlayerHasItem(ItemType.Weapon, 40050000)
            || PlayerHasItem(ItemType.Weapon, 41000000)
            || PlayerHasItem(ItemType.Weapon, 41010000)
            || PlayerHasItem(ItemType.Weapon, 41020000)
            || PlayerHasItem(ItemType.Weapon, 41030000)
            || PlayerHasItem(ItemType.Weapon, 41040000)
            || PlayerHasItem(ItemType.Weapon, 41060000)
            || PlayerHasItem(ItemType.Weapon, 41070000)
            || PlayerHasItem(ItemType.Weapon, 42000000)
            || PlayerHasItem(ItemType.Weapon, 42000000)
            || PlayerHasItem(ItemType.Weapon, 42030000)
            || PlayerHasItem(ItemType.Weapon, 42040000)
            || PlayerHasItem(ItemType.Weapon, 43000000)
            || PlayerHasItem(ItemType.Weapon, 43020000)
            || PlayerHasItem(ItemType.Weapon, 43030000)
            || PlayerHasItem(ItemType.Weapon, 43050000)
            || PlayerHasItem(ItemType.Weapon, 43060000)
            || PlayerHasItem(ItemType.Weapon, 43080000)
            || PlayerHasItem(ItemType.Weapon, 43100000)
            || PlayerHasItem(ItemType.Weapon, 43110000))
            && !PlayerInMap(10, 1, 0, 0)
            && !PlayerInMap(18, 0, 0, 0)
            && PlayerTargeted(1, 31, AIStateType.Combat)
            && PlayerIsInOwnWorld());
    SetEventFlagID(710130, ON);
});

$Event(1752, Restart, function() {
    DisableNetworkSync();
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(710710));
    WaitFor(
        EventFlag(60110)
            && EventFlag(700550)
            && CharacterHasSpEffect(10000, 9530)
            && PlayerIsInOwnWorld());
    SetEventFlagID(710710, ON);
});

$Event(1770, Restart, function(X0_4, X4_4, X8_4) {
    DisableNetworkSync();
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(X0_4));
    WaitFor(
        PlayerIsInOwnWorld()
            && EventFlag(X4_4)
            && !EventFlag(X0_4)
            && !(HasMultiplayerState(MultiplayerState.Multiplayer)
                || HasMultiplayerState(MultiplayerState.MultiplayerPending))
            && !CharacterHasSpEffect(10000, 9640));
    ShowTutorialPopup(X8_4, true, true);
    SetEventFlagID(X0_4, ON);
});

$Event(1790, Restart, function() {
    DisableNetworkSync();
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(710600));
    WaitFor(
        PlayerIsInOwnWorld()
            && !(HasMultiplayerState(MultiplayerState.Multiplayer)
                || HasMultiplayerState(MultiplayerState.MultiplayerPending))
            && CharacterHasSpEffect(10000, 81));
    WaitFixedTimeSeconds(1.5);
    SetEventFlagID(710800, ON);
});

$Event(1800, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(2001));
    flag = EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 9431) && EventFlag(9431);
    flag2 = EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 9431) && !EventFlag(9431);
    flag3 = EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 9432) && EventFlag(9432);
    flag4 = EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 9433) && EventFlag(9433);
    WaitFor((flag || flag3 || flag4 || flag2) && PlayerIsInOwnWorld());
    SetEventFlagID(9420, ON);
    GotoIf(L1, flag.Passed);
    GotoIf(L2, flag3.Passed);
    GotoIf(L3, flag4.Passed);
    if (!flag2.Passed) {
    }
L11:
    GotoIf(L2, EventFlag(9432));
    GotoIf(L3, EventFlag(9433));
    SetCharacterFaceParamOverride(10000, 0, -1);
    SetEventFlagID(9420, OFF);
    Goto(L9);
L1:
    SetCharacterFaceParamOverride(10000, 0, 81000);
    Goto(L9);
L2:
    GotoIf(L9, EventFlag(9431));
    GotoIf(L9, EventFlag(9434));
    SetCharacterFaceParamOverride(10000, 0, 81001);
    Goto(L9);
L3:
    GotoIf(L9, EventFlag(9431));
    GotoIf(L9, EventFlag(9432));
    GotoIf(L9, EventFlag(9434));
    SetCharacterFaceParamOverride(10000, 0, 81002);
    Goto(L9);
L4:
    GotoIf(L9, EventFlag(9431));
    Goto(L9);
L9:
    WaitFixedTimeSeconds(1);
    RestartEvent();
});

$Event(1801, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(2001));
    WaitFor(
        PlayerIsInOwnWorld()
            && EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 9430)
            && EventFlag(9430));
    SetEventFlagID(9421, ON);
    SetCharacterFaceParamOverride(10000, 1, 80000);
});

$Event(6901, Default, function() {
    EndIf(ThisEventSlot());
    if (PlayerIsInOwnWorld()) {
        GotoIf(L1, !(!EventFlag(68000) && !EventFlag(68020)));
        Goto(L0);
L1:
        GotoIf(L2, !(EventFlag(68000) && !EventFlag(68020)));
        RemoveItemFromPlayer(ItemType.Goods, 9402, 1);
        DirectlyGivePlayerItem(ItemType.Goods, 9400, 68000, 1);
        Goto(L0);
L2:
        GotoIf(L3, !(!EventFlag(68000) && EventFlag(68020)));
        Goto(L0);
L3:
        GotoIf(L4, !(EventFlag(68000) && EventFlag(68020)));
        DirectlyGivePlayerItem(ItemType.Goods, 9400, 68000, 1);
        Goto(L0);
L4:
L0:
        ClearCompiledConditionGroupState();
        if (EventFlag(66040)) {
            SetEventFlagID(66000, ON);
            SetEventFlagID(66040, OFF);
        }
        if (EventFlag(66080)) {
            SetEventFlagID(66130, ON);
            SetEventFlagID(66080, OFF);
        }
        if (EventFlag(10019200) && EventFlag(66150) && EventFlag(66181)) {
            SetEventFlagID(66150, ON);
            SetEventFlagID(66170, ON);
            SetEventFlagID(66180, ON);
        } else {
            SetEventFlagID(66180, OFF);
        }
        SetEventFlagID(66100, OFF);
        SetEventFlagID(66101, OFF);
        SetEventFlagID(66102, OFF);
        SetEventFlagID(66130, OFF);
        SetEventFlagID(66131, OFF);
        SetEventFlagID(66160, OFF);
        SetEventFlagID(66161, OFF);
        SetEventFlagID(66181, OFF);
        SetEventFlagID(66200, OFF);
        if (EventFlag(66420)) {
            SetEventFlagID(66400, OFF);
            SetEventFlagID(66410, ON);
            SetEventFlagID(66420, OFF);
        } else {
            SetEventFlagID(66400, OFF);
            SetEventFlagID(66410, OFF);
            SetEventFlagID(66420, OFF);
        }
        SetEventFlagID(66470, OFF);
        SetEventFlagID(66471, OFF);
        SetEventFlagID(66480, OFF);
        if (EventFlag(66710)) {
            SetEventFlagID(66760, ON);
            SetEventFlagID(66710, OFF);
        }
        SetEventFlagID(66730, OFF);
        SetEventFlagID(66731, OFF);
        SetEventFlagID(66750, OFF);
        SetEventFlagID(66751, OFF);
        SetEventFlagID(66780, OFF);
        SetEventFlagID(66781, OFF);
        SetEventFlagID(66104, OFF);
        SetEventFlagID(66202, OFF);
        SetEventFlagID(66204, OFF);
        SetEventFlagID(66300, OFF);
        SetEventFlagID(66302, OFF);
        SetEventFlagID(66304, OFF);
        SetEventFlagID(66402, OFF);
        SetEventFlagID(66404, OFF);
        SetEventFlagID(66502, OFF);
        SetEventFlagID(66510, OFF);
        ClearCompiledConditionGroupState();
        SetEventFlagID(11000389, OFF);
        SetEventFlagID(15000392, OFF);
        SetEventFlagID(15000393, OFF);
        SetEventFlagID(15001270, OFF);
        SetEventFlagID(15001280, OFF);
        SetEventFlagID(1043370340, OFF);
        SetEventFlagID(1044320342, OFF);
        SetEventFlagID(1044327410, OFF);
        SetEventFlagID(1036480340, OFF);
        SetEventFlagID(1036487400, OFF);
        SetEventFlagID(1036480340, OFF);
        SetEventFlagID(1039510451, OFF);
        SetEventFlagID(1049370290, OFF);
        SetEventFlagID(1052410290, OFF);
        SetEventFlagID(1048510300, OFF);
        SetEventFlagID(1248550380, OFF);
        SetEventFlagID(1248550381, OFF);
        SetEventFlagID(1042380340, OFF);
        SetEventFlagID(1044320340, OFF);
        SetEventFlagID(1037420340, OFF);
        SetEventFlagID(1036450340, OFF);
        SetEventFlagID(1044530300, OFF);
        SetEventFlagID(1049370292, OFF);
        SetEventFlagID(1048570320, OFF);
        SetEventFlagID(1043520506, OFF);
        SetEventFlagID(1043520505, OFF);
        SetEventFlagID(1043527500, OFF);
        SetEventFlagID(1038540400, OFF);
        SetEventFlagID(1038547100, OFF);
        SetEventFlagID(1042510300, OFF);
        SetEventFlagID(11000393, OFF);
        SetEventFlagID(13000490, OFF);
        SetEventFlagID(13000495, OFF);
        SetEventFlagID(12020431, OFF);
        SetEventFlagID(10000289, OFF);
        SetEventFlagID(1049370299, OFF);
        SetEventFlagID(1051360291, OFF);
        SetEventFlagID(1051360292, OFF);
        SetEventFlagID(1051570310, OFF);
        SetEventFlagID(1051570311, OFF);
        SetEventFlagID(12010240, OFF);
        SetEventFlagID(12030240, OFF);
        SetEventFlagID(12030241, OFF);
        SetEventFlagID(12030256, OFF);
        SetEventFlagID(12030257, OFF);
        SetEventFlagID(12030297, OFF);
        SetEventFlagID(12030201, OFF);
        SetEventFlagID(1051360290, OFF);
        SetEventFlagID(530140, OFF);
        ClearCompiledConditionGroupState();
        if (EventFlag(82135)) {
            SetEventFlagID(62135, ON);
            SetEventFlagID(82135, OFF);
        }
        if (EventFlag(82137)) {
            SetEventFlagID(62137, ON);
            SetEventFlagID(82137, OFF);
        }
        if (EventFlag(82138)) {
            SetEventFlagID(62138, ON);
            SetEventFlagID(82138, OFF);
        }
        if (EventFlag(95600)) {
            SetEventFlagID(78600, ON);
            SetEventFlagID(95600, OFF);
        }
        SetEventFlagID(82195, OFF);
        SetEventFlagID(82196, OFF);
        SetEventFlagID(82197, OFF);
        SetEventFlagID(82198, OFF);
        ClearCompiledConditionGroupState();
        if (!EventFlag(15000800) && InArea(10000, 15002845)) {
            WarpCharacterAndCopyFloorWithFadeout(10000, TargetEntityType.Area, 15002950, -1, 10000, false, true);
        }
        ClearCompiledConditionGroupState();
        if (!EventFlag(11109213)) {
            SetEventFlagID(10007452, ON);
        } else {
            SetEventFlagID(10007450, ON);
        }
        SetThisEventSlot(ON);
        EndEvent();
    }
L15:
    WaitFor(PlayerIsInOwnWorld());
    WaitFixedTimeSeconds(1);
    RequestCharacterAIReplan(0);
});

$Event(6902, Restart, function() {
    EndIf(ThisEventSlot());
    if (PlayerIsInOwnWorld()) {
        WaitFor(PlayerIsInOwnWorld() && EventFlag(6902));
        SetEventFlagID(66000, ON);
        SetEventFlagID(66010, ON);
        SetEventFlagID(66020, ON);
        SetEventFlagID(66030, ON);
        SetEventFlagID(66031, ON);
        SetEventFlagID(66060, ON);
        SetEventFlagID(66070, ON);
        SetEventFlagID(66080, ON);
        SetEventFlagID(66090, ON);
        SetEventFlagID(66100, ON);
        SetEventFlagID(66110, ON);
        SetEventFlagID(66120, ON);
        SetEventFlagID(66130, ON);
        SetEventFlagID(66140, ON);
        SetEventFlagID(66150, ON);
        SetEventFlagID(66160, ON);
        SetEventFlagID(66170, ON);
        SetEventFlagID(66180, ON);
        SetEventFlagID(66190, ON);
        SetThisEventSlot(ON);
        EndEvent();
    }
L15:
    WaitFor(PlayerIsInOwnWorld());
    WaitFixedTimeSeconds(1);
    RequestCharacterAIReplan(0);
});

$Event(6903, Restart, function() {
    EndIf(ThisEventSlot());
    if (PlayerIsInOwnWorld()) {
        WaitFor(PlayerIsInOwnWorld() && EventFlag(6903));
        SetEventFlagID(66400, ON);
        SetEventFlagID(66410, ON);
        SetEventFlagID(66420, ON);
        SetEventFlagID(66430, ON);
        SetEventFlagID(66440, ON);
        SetEventFlagID(66450, ON);
        SetEventFlagID(66460, ON);
        SetEventFlagID(66470, ON);
        SetEventFlagID(66480, ON);
        SetEventFlagID(66490, ON);
        SetThisEventSlot(ON);
        EndEvent();
    }
L15:
    WaitFor(PlayerIsInOwnWorld());
    WaitFixedTimeSeconds(1);
    RequestCharacterAIReplan(0);
});

$Event(6904, Restart, function() {
    EndIf(ThisEventSlot());
    if (PlayerIsInOwnWorld()) {
        WaitFor(PlayerIsInOwnWorld() && EventFlag(6904));
        SetEventFlagID(66700, ON);
        SetEventFlagID(66710, ON);
        SetEventFlagID(66720, ON);
        SetEventFlagID(66730, ON);
        SetEventFlagID(66740, ON);
        SetEventFlagID(66750, ON);
        SetEventFlagID(66760, ON);
        SetEventFlagID(66770, ON);
        SetEventFlagID(66780, ON);
        SetEventFlagID(66790, ON);
        SetThisEventSlot(ON);
        EndEvent();
    }
L15:
    WaitFor(PlayerIsInOwnWorld());
    WaitFixedTimeSeconds(1);
    RequestCharacterAIReplan(0);
});

$Event(6905, Restart, function() {
    EndIf(ThisEventSlot());
    if (PlayerIsInOwnWorld()) {
        if (EventFlag(510010)) {
            SetEventFlagID(171, ON);
        }
        if (EventFlag(510300)) {
            SetEventFlagID(172, ON);
        }
        if (EventFlag(510040)) {
            SetEventFlagID(173, ON);
        }
        if (EventFlag(510220)) {
            SetEventFlagID(174, ON);
        }
        if (EventFlag(510120)) {
            SetEventFlagID(175, ON);
        }
        if (EventFlag(510200)) {
            SetEventFlagID(176, ON);
        }
        if (EventFlag(197)) {
            SetEventFlagID(177, ON);
        }
        SetThisEventSlot(ON);
        EndEvent();
    }
L15:
    WaitFor(PlayerIsInOwnWorld());
    WaitFixedTimeSeconds(1);
    RequestCharacterAIReplan(0);
});

$Event(6906, Restart, function() {
    EndIf(ThisEventSlot());
    if (PlayerIsInOwnWorld()) {
        if (EventFlag(69390)) {
            DirectlyGivePlayerItem(ItemType.Goods, 9141, 69390, 1);
        }
        if (EventFlag(520040)) {
            DirectlyGivePlayerItem(ItemType.Goods, 202000, 520040, 1);
        }
        if (EventFlag(1039418600)) {
            SetEventFlagID(1039418540, ON);
            ReproduceAssetAnimation(1039411540, 2);
            DisableObjAct(1039411540, -1);
        } else {
            GotoIf(S0, !EventFlag(73006));
            SetEventFlagID(1039418540, ON);
            ReproduceAssetAnimation(1039411540, 2);
            DisableObjAct(1039411540, -1);
        }
S0:
        if (EventFlag(1047408600)) {
            SetEventFlagID(1047408540, ON);
            ReproduceAssetAnimation(1047401540, 2);
            DisableObjAct(1047401540, -1);
        } else {
            GotoIf(S1, !EventFlag(73014));
            SetEventFlagID(1047408540, ON);
            ReproduceAssetAnimation(1047401540, 2);
            DisableObjAct(1047401540, -1);
        }
S1:
        SetThisEventSlot(ON);
        EndEvent();
    }
L15:
    WaitFor(PlayerIsInOwnWorld());
    WaitFixedTimeSeconds(1);
    RequestCharacterAIReplan(0);
});

$Event(6907, Restart, function() {
    EndIf(ThisEventSlot());
    if (PlayerIsInOwnWorld()) {
        if (EventFlag(102)) {
            SetEventFlagID(71801, ON);
        }
        if (EventFlag(1050558600)) {
            SetEventFlagID(1050558540, ON);
            ReproduceAssetAnimation(1050551540, 2);
            DisableObjAct(1050551540, -1);
        } else {
            GotoIf(S0, !EventFlag(73019));
            SetEventFlagID(1050558540, ON);
            ReproduceAssetAnimation(1050551540, 2);
            DisableObjAct(1050551540, -1);
        }
S0:
        if (EventFlag(1039488600)) {
            SetEventFlagID(1039488540, ON);
            ReproduceAssetAnimation(1039481540, 2);
            DisableObjAct(1039481540, -1);
        } else {
            GotoIf(S1, !EventFlag(73005));
            SetEventFlagID(1039488540, ON);
            ReproduceAssetAnimation(1039481540, 2);
            DisableObjAct(1039481540, -1);
        }
S1:
        SetThisEventSlot(ON);
        EndEvent();
    }
L15:
    WaitFor(PlayerIsInOwnWorld());
    WaitFixedTimeSeconds(1);
    RequestCharacterAIReplan(0);
});

$Event(6908, Restart, function() {
    EndIf(ThisEventSlot());
    if (PlayerIsInOwnWorld()) {
        if (EventFlag(73207)) {
            SetEventFlagID(73257, ON);
        }
        SetThisEventSlot(ON);
        EndEvent();
    }
L15:
    WaitFor(PlayerIsInOwnWorld());
    WaitFixedTimeSeconds(1);
    RequestCharacterAIReplan(0);
});

$Event(9300, Restart, function(X0_4, X4_4, X8_4) {
    EndIf(ThisEventSlot());
    WaitFor(PlayerIsInOwnWorld() && EventFlag(X4_4));
    WaitFixedTimeSeconds(X8_4);
    AwardAchievement(X0_4);
});

$Event(9360, Restart, function(X0_4, X4_4, X8_4) {
    EndIf(ThisEventSlot());
    WaitFor(PlayerIsInOwnWorld() && EventFlag(X4_4));
    WaitFixedTimeSeconds(X8_4);
    StartPS5Activity(X0_4);
});

$Event(9375, Restart, function(X0_4, X4_4, X8_4) {
    EndIf(ThisEventSlot());
    WaitFor(PlayerIsInOwnWorld() && EventFlag(X4_4));
    WaitFixedTimeSeconds(X8_4);
    EndPS5Activity(X0_4);
});

$Event(9390, Restart, function(X0_4, X4_4, X8_4, X12_4, X16_4, X20_4) {
    EndIf(ThisEventSlot());
    WaitFor(EventFlag(X0_4));
    GotoIf(S0, 0 == X4_4);
    GotoIf(S0, EventFlag(X4_4));
    flag |= EventFlag(X4_4);
S0:
    GotoIf(S1, 0 == X8_4);
    GotoIf(S1, EventFlag(X8_4));
    flag |= EventFlag(X8_4);
S1:
    GotoIf(S2, 0 == X12_4);
    GotoIf(S2, EventFlag(X12_4));
    flag |= EventFlag(X12_4);
S2:
    GotoIf(S3, 0 == X16_4);
    GotoIf(S3, EventFlag(X16_4));
    flag |= EventFlag(X16_4);
S3:
    GotoIf(S4, 0 == X20_4);
    GotoIf(S4, EventFlag(X20_4));
    flag |= EventFlag(X20_4);
S4:
    WaitFor(flag);
    SetThisEventSlot(ON);
});

$Event(9820, Restart, function(X0_4, X4_4, X8_4) {
    DisableNetworkSync();
    if (0 != X0_4) {
        EndIf(EventFlag(X0_4));
    }
    WaitFor(CharacterHasSpEffect(10000, X8_4));
    SetEventFlagID(X0_4, ON);
    AwardItemsIncludingClients(X4_4);
    WaitFixedTimeSeconds(1.2);
    RestartEvent();
});

$Event(65810, Default, function(X0_4, X4_4, X8_4, X12_4, X16_4, X20_4) {
    if (PlayerIsInOwnWorld()) {
        EndIf(EventFlag(X0_4));
        onlineFlag &= PlayerIsInOwnWorld();
        flag |= EventFlag(X4_4);
        if (0 != X8_4) {
            flag |= EventFlag(X8_4);
        }
        if (0 != X12_4) {
            flag |= EventFlag(X12_4);
        }
        if (0 != X16_4) {
            flag |= EventFlag(X16_4);
        }
        if (0 != X20_4) {
            flag |= EventFlag(X20_4);
        }
        onlineFlag &= flag;
        WaitFor(onlineFlag);
        SetEventFlagID(X0_4, ON);
        if (!EventFlag(65800)) {
            SetEventFlagID(65800, ON);
        }
        EndEvent();
    }
L15:
    WaitFor(PlayerIsInOwnWorld());
    WaitFixedTimeSeconds(1);
});

$Event(1910, Default, function(X0_4, X4_4) {
    WaitFor(FieldBattleBGMActive(X0_4));
    SetEventFlagID(X4_4, ON);
    WaitFor(!FieldBattleBGMActive(X0_4));
    SetEventFlagID(X4_4, OFF);
    RestartEvent();
});

$Event(9910, Restart, function(X0_4) {
    EndIf(!PlayerIsInOwnWorld());
    WaitFor(EventFlag(X0_4) || CharacterDead(10000));
    SetEventFlagID(X0_4, OFF);
    BatchSetEventFlags(1042330101, 1042330102, OFF);
    BatchSetEventFlags(1043330101, 1043330101, OFF);
    BatchSetEventFlags(1044330101, 1044330101, OFF);
    BatchSetEventFlags(1045330101, 1045330102, OFF);
    BatchSetEventFlags(1042320101, 1042320102, OFF);
    BatchSetEventFlags(1043320101, 1043320101, OFF);
    BatchSetEventFlags(1044320101, 1044320101, OFF);
    BatchSetEventFlags(1043360101, 1043360102, OFF);
    BatchSetEventFlags(1042370101, 1042370101, OFF);
    BatchSetEventFlags(1043370101, 1043370101, OFF);
    BatchSetEventFlags(1044370101, 1044370102, OFF);
    BatchSetEventFlags(1042390101, 1042390103, OFF);
    BatchSetEventFlags(1042350101, 1042350102, OFF);
    BatchSetEventFlags(1040370101, 1040370101, OFF);
    BatchSetEventFlags(1045350101, 1045350101, OFF);
    BatchSetEventFlags(1040370111, 1040370111, OFF);
    BatchSetEventFlags(1044370111, 1044370112, OFF);
    BatchSetEventFlags(1043390101, 1043390102, OFF);
    RestartEvent();
});

$Event(3040, Default, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(9413));
    if (!EventFlag(9412)) {
        GotoIf(L20, !EventFlag(9411));
        GotoIf(L20, EventFlag(9130));
        GotoIf(L20, InArea(10000, 1051362220));
        SetNetworkconnectedEventFlagID(9411, OFF);
        FreezeTime(false);
        SetNetworkconnectedEventFlagID(1051362702, OFF);
        SetEventFlagID(3618, ON);
L20:
        if (!EventFlag(9411)) {
            if (!EventFlag(9410)) {
                WaitFor(
                    PlayerIsInOwnWorld()
                        && (EventFlag(1044369223) || EventFlag(1034499224) || EventFlag(3063)));
                if (PlayerIsInOwnWorld()) {
                    SetNetworkconnectedEventFlagID(9410, ON);
                }
            }
L0:
            WaitFor(PlayerIsInOwnWorld() && EventFlag(1051362702));
            if (PlayerIsInOwnWorld()) {
                SetNetworkconnectedEventFlagID(9411, ON);
                SetEventFlagID(3618, ON);
            }
        }
L1:
        FreezeTime(true);
        WaitFor(PlayerIsInOwnWorld() && EventFlag(310));
        FreezeTime(false);
        if (PlayerIsInOwnWorld()) {
            SetNetworkconnectedEventFlagID(9411, ON);
        }
    }
L2:
    flagOnline = EventFlag(9130) && !EventFlag(1051369360) && PlayerIsInOwnWorld();
    area = InArea(10000, 1051362220);
    WaitFor(flagOnline || area);
    EndIf(area.Passed);
    SetNetworkconnectedEventFlagID(9413, ON);
});

$Event(3041, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(!EventFlag(9000));
    EndIf(!EventFlag(11109657));
    EndIf(EventFlag(3002));
    SetEventFlagID(9001, ON);
    WaitFixedTimeFrames(1);
    PlayCutsceneToPlayer(15000020, CutscenePlayMode.Skippable, 10000);
    WaitFixedTimeRealFrames(1);
    SetEventFlagID(9001, OFF);
    SetEventFlagID(3002, ON);
});

$Event(3042, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (AnyBatchEventFlags(76100, 76199)) {
        SetEventFlagID(3061, ON);
        EndEvent();
    }
    SetEventFlagID(3061, OFF);
    WaitFor(AnyBatchEventFlags(76100, 76199));
    SetEventFlagID(3061, ON);
    EndEvent();
});

$Event(3043, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (AnyBatchEventFlags(76200, 76299)) {
        SetEventFlagID(3062, ON);
        EndEvent();
    }
    SetEventFlagID(3062, OFF);
    WaitFor(AnyBatchEventFlags(76200, 76299));
    SetEventFlagID(3062, ON);
    EndEvent();
});

$Event(3044, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (AnyBatchEventFlags(76300, 76399)) {
        SetEventFlagID(3063, ON);
        EndEvent();
    }
    SetEventFlagID(3063, OFF);
    WaitFor(AnyBatchEventFlags(76300, 76399));
    SetEventFlagID(3063, ON);
    EndEvent();
});

$Event(3045, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (AnyBatchEventFlags(76400, 76499)) {
        SetEventFlagID(3064, ON);
        EndEvent();
    }
    SetEventFlagID(3064, OFF);
    WaitFor(AnyBatchEventFlags(76400, 76499));
    SetEventFlagID(3064, ON);
    EndEvent();
});

$Event(3046, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (AnyBatchEventFlags(76500, 76599)) {
        SetEventFlagID(3065, ON);
        EndEvent();
    }
    SetEventFlagID(3065, OFF);
    WaitFor(AnyBatchEventFlags(76500, 76599));
    SetEventFlagID(3065, ON);
    EndEvent();
});

$Event(3049, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    flag = AnyBatchEventFlags(3740, 3748) && EventFlag(3741);
    flag2 = AnyBatchEventFlags(3765, 3767) && EventFlag(3761);
    flag3 = AnyBatchEventFlags(3565, 3568) && EventFlag(3561);
    flag4 = AnyBatchEventFlags(3605, 3616) && (EventFlag(3601) || EventFlag(3603));
    WaitFor(flag || flag2 || flag3 || flag4);
    if (!flag.Passed) {
        SetEventFlagID(1034509403, ON);
    }
L0:
    if (!flag2.Passed) {
        SetEventFlagID(1034499202, ON);
        SetEventFlagID(1034499204, ON);
    }
L1:
    if (!flag3.Passed) {
        SetEventFlagID(1034509302, ON);
    }
L2:
    if (!flag4.Passed) {
        SetEventFlagID(1045379209, ON);
    }
    if (AnyBatchEventFlags(3740, 3748) && EventFlag(3740)) {
        BatchSetNetworkconnectedEventFlags(3740, 3743, OFF);
        SetNetworkconnectedEventFlagID(3741, ON);
    }
    if (AnyBatchEventFlags(3765, 3767) && EventFlag(3760)) {
        BatchSetNetworkconnectedEventFlags(3760, 3763, OFF);
        SetNetworkconnectedEventFlagID(3761, ON);
    }
    if (AnyBatchEventFlags(3565, 3568) && EventFlag(3560)) {
        BatchSetNetworkconnectedEventFlags(3560, 3563, OFF);
        SetNetworkconnectedEventFlagID(3561, ON);
    }
    if (AnyBatchEventFlags(3605, 3616) && EventFlag(3600)) {
        BatchSetNetworkconnectedEventFlags(3600, 3603, OFF);
        SetNetworkconnectedEventFlagID(3601, ON);
    }
    flag5 = AnyBatchEventFlags(3740, 3748) && EventFlag(3741);
    flag6 = AnyBatchEventFlags(3765, 3767)
        && EventFlag(3761)
        && AnyBatchEventFlags(3565, 3568)
        && EventFlag(3561);
    flag7 = AnyBatchEventFlags(3605, 3616) && (EventFlag(3601) || EventFlag(3603));
    WaitFor(!(flag5 || flag6 || flag7 || cond));
    RestartEvent();
});

$Event(3050, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(400159));
    WaitFor(EventFlag(12019280) && !EventFlag(12012716));
    RemoveItemFromPlayer(ItemType.Goods, 8146, 1);
    DirectlyGivePlayerItem(ItemType.Goods, 8187, 12019280, 1);
    AwardItemLot(101590);
    EndEvent();
});

$Event(3051, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(400033));
    EndIf(EventFlag(3383));
    WaitFor(EventFlag(400031) && EventFlag(3383) && !EventFlag(35009209));
    EndIf(EventFlag(400033));
    RemoveItemFromPlayer(ItemType.Goods, 8154, 1);
    AwardItemLot(100330);
    EndEvent();
});

$Event(3052, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(400410));
    EndIf(EventFlag(4103));
    WaitFor(EventFlag(1036419209) && !EventFlag(1036412703));
    AwardItemLot(104100);
    EndEvent();
});

$Event(3053, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(60818));
    EndIf(EventFlag(3683));
    WaitFor(EventFlag(31009218) || EventFlag(1038419267) || EventFlag(1037549213));
    SetEventFlagID(60818, ON);
    AwardGesture(40);
    EndEvent();
});

$Event(3054, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(60830));
    WaitFor(EventFlag(4703));
    EndIf(EventFlag(60830));
    SetEventFlagID(60830, ON);
    AwardGesture(73);
    EndEvent();
});

$Event(3055, Restart, function() {
    DisableNetworkSync();
    if (!CharacterHasSpEffect(10000, 503360)) {
        WaitFor(PlayerHasItem(ItemType.Goods, 3360));
        SetSpEffect(10000, 503360);
    }
L0:
    WaitFor(
        !PlayerHasItem(ItemType.Goods, 3360)
            && !CharacterHasSpEffect(10000, 503355)
            && !CharacterHasSpEffect(10000, 503356));
    SetSpEffect(10000, 503359);
    RestartEvent();
});

$Event(3056, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    DisableNetworkSync();
    flag = EventFlag(1051587800) || EventFlag(400130);
    WaitFor(flag || EventFlag(110));
    GotoIf(L0, flag.Passed);
    Goto(L1);
L0:
    if (!EventFlag(1035429213)) {
        SetEventFlagID(1035429211, ON);
        SetEventFlagID(1035429213, ON);
    }
    WaitFor(EventFlag(110));
L1:
    SetEventFlagID(1035429211, OFF);
    EndEvent();
});

$Event(3058, Restart, function() {
    EndIf(PlayerIsInOwnWorld());
    DisableNetworkSync();
    WaitFor(CharacterHasSpEffect(20000, 9721));
    SetEventFlagID(7700, ON);
});

$Event(3059, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    DisableNetworkSync();
    WaitFor(EventFlag(7700));
    SetEventFlagID(7700, OFF);
    GotoIf(L0, EventFlag(1035449235));
    GotoIf(L0, !EventFlag(1035449207));
    IncrementEventValue(1035449230, 3, 5);
    GotoIf(L0, EventValue(1035449230, 5) < 3);
    SetEventFlagID(1035449235, ON);
    SetEventFlagID(3198, ON);
L0:
    SaveRequest();
    EndEvent();
});

$Event(3080, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(9433));
    WaitFor(CountEventFlags(TargetEventFlagType.EventFlag, 290500, 290999) >= 4);
    SetEventFlagID(9433, ON);
    EndEvent();
});

$Event(3081, Restart, function(X0_4, X4_4, X8_4, X12_4, X16_4, X20_4, X24_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    SetEventFlagID(X4_4, OFF);
    SetEventFlagID(X8_4, OFF);
    SetEventFlagID(X12_4, OFF);
    SetEventFlagID(X16_4, OFF);
    SetEventFlagID(X20_4, OFF);
    SetEventFlagID(X24_4, OFF);
    if (EventFlag(3425) && (EventFlag(1037429207) || EventFlag(1037429209) || EventFlag(1037429205))) {
        SetEventFlagID(X0_4, ON);
    }
    if (EventFlag(3426) && (EventFlag(1038519205) || EventFlag(1038519206)) && EventFlag(1038519207)) {
        SetEventFlagID(X4_4, ON);
    }
    if (EventFlag(3426) && (EventFlag(1038519205) || EventFlag(1038519206)) && EventFlag(1038509205)) {
        SetEventFlagID(X8_4, ON);
    }
    if (EventFlag(3427) && EventFlag(16009305) && !EventFlag(16009306)) {
        SetEventFlagID(X12_4, ON);
    }
    if (EventFlag(3427) && EventFlag(16009305) && EventFlag(16009306)) {
        SetEventFlagID(X16_4, ON);
    }
    if (EventFlag(3428)) {
        SetEventFlagID(X16_4, ON);
    }
    if (EventFlag(3430) && EventFlag(16009335)) {
        SetEventFlagID(X16_4, ON);
    }
    if (EventFlag(3431) && EventFlag(16009335)) {
        SetEventFlagID(X16_4, ON);
    }
    if (EventFlag(3429) && (EventFlag(16009326) || EventFlag(16009327))) {
        SetEventFlagID(X20_4, ON);
    }
    if (EventFlag(3431) && !EventFlag(16009327) && EventFlag(16009328)) {
        SetEventFlagID(X20_4, ON);
    }
    if (EventFlag(3431) && !EventFlag(16009319)) {
        SetEventFlagID(X24_4, ON);
    }
    if (EventFlag(3431) && EventFlag(400091)) {
        SetEventFlagID(X24_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3425)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1037429205)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1037429207)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1037429209)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3426)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1038519205)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1038519206)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1038519207)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1038509205)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3427)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009305)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009306)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3428)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3430)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009335)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3431)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009335)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3429)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009326)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009327)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009328)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009319)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 400091));
    RestartEvent();
});

$Event(3082, Restart, function(X0_4, X4_4, X8_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    SetEventFlagID(X4_4, OFF);
    SetEventFlagID(X8_4, OFF);
    if ((EventFlag(3185) || EventFlag(3187) || EventFlag(3191))
        && (EventFlag(1042369206)
            || EventFlag(1042369225)
            || EventFlag(1042369226)
            || EventFlag(1042369235))) {
        SetEventFlagID(X0_4, ON);
    }
    if ((EventFlag(3188) && (EventFlag(1035449205) || EventFlag(1035449206)))
        || EventFlag(3189)
        || EventFlag(3190)) {
        SetEventFlagID(X4_4, ON);
    }
    flag = EventFlag(3183) || EventFlag(12059166) || flag2;
    flag2 = EventFlag(400036) && EventFlag(400037);
    if (flag2) {
        SetEventFlagID(X8_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3185)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1042369206)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3187)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1042369225)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1042369226)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3191)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1042369235)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3188)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1035449205)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1035449206)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3189)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3190)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3183)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 12059166)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 400036)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 400037));
    RestartEvent();
});

$Event(3083, Restart, function(X0_4, X4_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    SetEventFlagID(X4_4, OFF);
    if ((EventFlag(3105) && (EventFlag(16009208) || EventFlag(16009206)))
        || EventFlag(3106)
        || EventFlag(3107)
        || EventFlag(3108)) {
        SetEventFlagID(X0_4, ON);
    }
    if (((EventFlag(3109) || EventFlag(3110) || EventFlag(3111))
        && (EventFlag(16009255) || EventFlag(16009256) || EventFlag(16009258)))
        || (!EventFlag(16009208) && EventFlag(71600) && EventFlag(3109))) {
        SetEventFlagID(X4_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3105)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009208)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009206)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3106)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3107)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3108)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3109)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3110)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3111)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009255)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009256)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009258)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009208)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 71600));
    RestartEvent();
});

$Event(3084, Restart, function(X0_4, X4_4, X8_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    SetEventFlagID(X4_4, OFF);
    SetEventFlagID(X8_4, OFF);
    if (EventFlag(4105) && (EventFlag(1036419205) || EventFlag(1036419206))) {
        SetEventFlagID(X0_4, ON);
    }
    if (EventFlag(1036419209) || (EventFlag(4103) && EventFlag(400412))) {
        SetEventFlagID(X4_4, ON);
    }
    if (EventFlag(4106) && (EventFlag(1047589206) || EventFlag(1047582700))) {
        SetEventFlagID(X8_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 4105)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1036419205)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1036419206)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1036419209)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 4103)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 400412)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 4106)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1047589206)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1047582700));
    RestartEvent();
});

$Event(3085, Restart, function(X0_4, X4_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    SetEventFlagID(X4_4, OFF);
    if ((EventFlag(3688) || EventFlag(3693)) && (EventFlag(1037549206) || EventFlag(1037549207))) {
        SetEventFlagID(X0_4, ON);
    }
    if (EventFlag(400181) && EventFlag(400189)) {
        SetEventFlagID(X4_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3688)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3693)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1037549206)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1037549207)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 400181)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 400189));
    RestartEvent();
});

$Event(3086, Restart, function(X0_4, X4_4, X8_4, X12_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    SetEventFlagID(X4_4, OFF);
    SetEventFlagID(X8_4, OFF);
    SetEventFlagID(X12_4, OFF);
    if (EventFlag(1044389206) && (EventFlag(3625) || (EventFlag(3631) && EventFlag(1044389209)))) {
        SetEventFlagID(X0_4, ON);
    }
    if ((EventFlag(3626) || (EventFlag(3631) && EventFlag(1043359259)))
        && (EventFlag(1043359255) || EventFlag(1043359256) || EventFlag(1043359257))) {
        SetEventFlagID(X4_4, ON);
    }
    if (EventFlag(1035469208) && (EventFlag(3627) || (EventFlag(3631) && EventFlag(1035469209)))) {
        SetEventFlagID(X8_4, ON);
    }
    if (EventFlag(1039529205) && (EventFlag(3630) || (EventFlag(3631) && EventFlag(1039529209)))) {
        SetEventFlagID(X12_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3625)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3631)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1044389209)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1044389206)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3626)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1043359259)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1043359255)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1043359256)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1043359257)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3627)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1035469209)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1035469208)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3630)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1039529209)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1039529205));
    RestartEvent();
});

$Event(3087, Restart, function(X0_4, X4_4, X8_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    SetEventFlagID(X4_4, OFF);
    SetEventFlagID(X8_4, OFF);
    if (EventFlag(3885) && (EventFlag(1042389255) || EventFlag(1042389256))) {
        SetEventFlagID(X0_4, ON);
    }
    if (EventFlag(400293) && EventFlag(400294) && EventFlag(400299)) {
        SetEventFlagID(X4_4, ON);
    }
    if (EventFlag(3886) && (EventFlag(16009455) || EventFlag(16009456) || EventFlag(16009460))) {
        SetEventFlagID(X8_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3885)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1042389255)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1042389256)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 400293)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 400294)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 400299)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3886)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009455)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009456)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009460));
    RestartEvent();
});

$Event(3088, Restart, function(X0_4, X4_4, X8_4, X12_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    SetEventFlagID(X4_4, OFF);
    SetEventFlagID(X8_4, OFF);
    SetEventFlagID(X12_4, OFF);
    if (EventFlag(4145) && (EventFlag(1036439205) || EventFlag(1036439206))) {
        SetEventFlagID(X0_4, ON);
    }
    if (EventFlag(400300) && EventFlag(400309)) {
        SetEventFlagID(X4_4, ON);
    }
    if ((EventFlag(4146) || EventFlag(4147)) && EventFlag(1044529256)) {
        SetEventFlagID(X8_4, ON);
    }
    if (EventFlag(400308) && EventFlag(400309)) {
        SetEventFlagID(X12_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 4145)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1036439205)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1036439206)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 400300)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 400309)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 4146)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 4147)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1044529256)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 400308));
    RestartEvent();
});

$Event(3089, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(34149201));
    WaitFor(EventFlag(62528) || EventFlag(34149200));
    SetEventFlagID(34149201, ON);
    EndEvent();
});

$Event(3090, Restart, function(X0_4, X4_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    SetEventFlagID(X4_4, OFF);
    if (EventFlag(62022) && EventFlag(3409)) {
        SetEventFlagID(X0_4, ON);
    }
    if (EventFlag(62031) && EventFlag(118)) {
        SetEventFlagID(X4_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 62022)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3409)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 62031)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 118));
    RestartEvent();
});

$Event(3091, Restart, function(X0_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    if (!(EventFlag(1051369358) && EventFlag(9410) && !EventFlag(9412) && EventFlag(3747))
        && (EventFlag(1034509405) || EventFlag(1034509431))) {
        SetEventFlagID(X0_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1051369358)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 9410)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 9412)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3747)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1034509405)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1034509431));
    RestartEvent();
});

$Event(3092, Restart, function(X0_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    if (EventFlag(1034499205) || EventFlag(1034499238) || EventFlag(1034499233)) {
        SetEventFlagID(X0_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1034499205)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1034499238)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1034499233));
    RestartEvent();
});

$Event(3093, Restart, function(X0_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    if (EventFlag(1034509310) || EventFlag(1034509312)) {
        SetEventFlagID(X0_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1034509310)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1034509312));
    RestartEvent();
});

$Event(3094, Restart, function(X0_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    if (EventFlag(12039155) || EventFlag(12039156)) {
        SetEventFlagID(X0_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 12039155)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 12039156));
    RestartEvent();
});

$Event(3095, Restart, function(X0_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    if (EventFlag(1045399205) || EventFlag(1045399206)) {
        SetEventFlagID(X0_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1045399205)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1045399206));
    RestartEvent();
});

$Event(3096, Restart, function(X0_4, X4_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X4_4, OFF);
    if (EventFlag(1038439205)) {
        SetEventFlagID(X0_4, ON);
    }
    if (EventFlag(35009205) || EventFlag(35009206)) {
        SetEventFlagID(X4_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1038439205)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 35009205)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 35009206));
    RestartEvent();
});

$Event(3097, Restart, function(X0_4) {
    EndIf(!PlayerIsInOwnWorld());
    if (EventFlag(1051369227)) {
        SetEventFlagID(X0_4, ON);
    }
    WaitFor(EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1051369227));
    RestartEvent();
});

$Event(3098, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(1051369204));
    WaitFor(EventFlag(3367));
    if (!EventFlag(9118)) {
        flag |= EventFlag(9118);
    }
    if (!EventFlag(9101)) {
        flag |= EventFlag(9101);
    }
    if (!EventFlag(9104)) {
        flag |= EventFlag(9104);
    }
    if (!EventFlag(9122)) {
        flag |= EventFlag(9122);
    }
    if (!EventFlag(9120)) {
        flag |= EventFlag(9120);
    }
    if (!EventFlag(9112)) {
        flag |= EventFlag(9112);
    }
    flag |= EventFlag(6000);
    WaitFor(flag);
    SetNetworkconnectedEventFlagID(1051369204, ON);
    SetEventFlagID(3378, ON);
    EndEvent();
});

$Event(3099, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(11109304));
    WaitForEventFlag(ON, TargetEventFlagType.EventFlag, 11109806);
    if (!EventFlag(11109303)) {
L0:
        if (EventFlag(9130)) {
            SetNetworkconnectedEventFlagID(11109309, ON);
        }
        if (EventFlag(9101)) {
            SetNetworkconnectedEventFlagID(11109310, ON);
        }
        if (EventFlag(9104)) {
            SetNetworkconnectedEventFlagID(11109311, ON);
        }
        if (EventFlag(9122)) {
            SetNetworkconnectedEventFlagID(11109312, ON);
        }
        if (EventFlag(9120)) {
            SetNetworkconnectedEventFlagID(11109313, ON);
        }
        if (EventFlag(9112)) {
            SetNetworkconnectedEventFlagID(11109314, ON);
        }
        SetNetworkconnectedEventFlagID(11109303, ON);
        EndEvent();
    }
L1:
    if (!EventFlag(11109309)) {
        flag |= EventFlag(9130);
    }
    if (!EventFlag(11109310)) {
        flag |= EventFlag(9101);
    }
    if (!EventFlag(11109311)) {
        flag |= EventFlag(9104);
    }
    if (!EventFlag(11109312)) {
        flag |= EventFlag(9122);
    }
    if (!EventFlag(11109313)) {
        flag |= EventFlag(9120);
    }
    if (!EventFlag(11109314)) {
        flag |= EventFlag(9112);
    }
    flag |= (EventFlag(11109309)
        && EventFlag(11109310)
        && EventFlag(11109311)
        && EventFlag(11109312)
        && EventFlag(11109313)
        && EventFlag(11109314))
        || EventFlag(6000);
    WaitFor(flag);
    SetNetworkconnectedEventFlagID(11109304, ON);
    EndEvent();
});

$Event(4600, Restart, function(X0_4, X4_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    if (AnyBatchEventFlags(3265, 3268)
        && (EventFlag(10009351) || EventFlag(10009353) || EventFlag(10009397))) {
        SetEventFlagID(X0_4, ON);
    }
    if (EventFlag(10009399) || EventFlag(10002768)) {
        SetEventFlagID(X4_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3265)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3266)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3267)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3268)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 10009351)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 10009353)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 10009397)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 10009399)
            || (EventFlag(10002768) && !EventFlag(X4_4)));
    RestartEvent();
});

$Event(4601, Restart, function(X0_4) {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(X0_4));
    if (EventFlag(14009205) || EventFlag(14002705) || EventFlag(14002706)) {
        SetEventFlagID(X0_4, ON);
    }
    WaitFor(
        EventFlag(14009205) || ((EventFlag(14002705) || EventFlag(14002706)) && !EventFlag(X0_4)));
    RestartEvent();
});

$Event(4602, Restart, function(X0_4, X4_4, X8_4) {
    EndIf(!PlayerIsInOwnWorld());
    GotoIf(S0, EventFlag(16002731));
    GotoIf(S1, AnyBatchEventFlags(3448, 3449));
S0:
    SetEventFlagID(X4_4, OFF);
S1:
    if (EventFlag(1037449205) || EventFlag(1037442700)) {
        SetEventFlagID(X0_4, ON);
    }
    if (AnyBatchEventFlags(3448, 3449)
        && !EventFlag(16002731)
        && (EventFlag(16009405) || EventFlag(16009415) || EventFlag(16009416))) {
        SetEventFlagID(X4_4, ON);
    }
    if (EventFlag(1039449305) || EventFlag(1039442721)) {
        SetEventFlagID(X8_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1037449205)
            || (EventFlag(1037442700) && !EventFlag(X0_4))
            || EventFlag(3448)
            || EventFlag(3449)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009405)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16009415)
            || (EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 16002731)
                && EventFlag(16009416)
                && !EventFlag(X4_4))
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1039449305)
            || (EventFlag(1039442721) && !EventFlag(X8_4)));
    RestartEvent();
});

$Event(4603, Restart, function(X0_4) {
    EndIf(!PlayerIsInOwnWorld());
    if (EventFlag(35009306) || EventFlag(35009307) || EventFlag(35002724)) {
        SetEventFlagID(X0_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 35009306)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 35009307)
            || (EventFlag(35002724) && !EventFlag(X0_4)));
    RestartEvent();
});

$Event(4604, Restart, function(X0_4, X4_4, X8_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X4_4, OFF);
    SetEventFlagID(X8_4, OFF);
    if (EventFlag(1050389256) || EventFlag(1050382713)) {
        SetEventFlagID(X0_4, ON);
    }
    if (EventFlag(1050389265) && EventFlag(1050389266)) {
        SetEventFlagID(X4_4, ON);
    }
    if (EventFlag(1038519255) && EventFlag(1038519256)) {
        SetEventFlagID(X8_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1050389256)
            || (EventFlag(1050382713) && !EventFlag(X0_4))
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1050389265)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1050389266)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1038519255)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1038519256));
    RestartEvent();
});

$Event(4606, Restart, function(X0_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    if (!EventFlag(7611) && !EventFlag(1050389265) && (EventFlag(1050389205) || EventFlag(1050389206))) {
        SetEventFlagID(X0_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 7611)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1050389265)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1050389205)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1050389206));
    RestartEvent();
});

$Event(4607, Restart, function(X0_4, X4_4, X8_4, X12_4) {
    EndIf(!PlayerIsInOwnWorld());
    if (EventFlag(1035539204)) {
        SetEventFlagID(X4_4, OFF);
    }
    if (EventFlag(1043399305) || EventFlag(1043392713)) {
        SetEventFlagID(X0_4, ON);
    }
    if (!EventFlag(1035539204) && (EventFlag(1039449205) || EventFlag(1039442703))) {
        SetEventFlagID(X4_4, ON);
    }
    if (EventFlag(1035539205) || EventFlag(1035532703)) {
        SetEventFlagID(X8_4, ON);
        flag |= EventFlag(400173);
    }
    flag |= EventFlag(400174) || EventFlag(400175);
    if (flag) {
        SetEventFlagID(X12_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1043399305)
            || (EventFlag(1043392713) && !EventFlag(X0_4))
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1035539204)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1039449205)
            || (EventFlag(1039442703) && !EventFlag(X4_4))
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3669)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3670)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1035539205)
            || (EventFlag(1035532703) && !EventFlag(X8_4))
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 400173)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 400174)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 400175));
    RestartEvent();
});

$Event(4608, Restart, function(X0_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    if (AnyBatchEventFlags(3825, 3829)
        && !AnyBatchEventFlags(3821, 3822)
        && (EventFlag(1039449255) || EventFlag(1039449256))) {
        SetEventFlagID(X0_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3825)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3826)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3827)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3828)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3829)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3821)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3822)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1039449255)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1039449256));
    RestartEvent();
});

$Event(4609, Restart, function(X0_4, X4_4, X8_4, X12_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    SetEventFlagID(X4_4, OFF);
    SetEventFlagID(X8_4, OFF);
    SetEventFlagID(X12_4, OFF);
    if (EventFlag(3947)
        && EventFlag(1039409255)
        && EventFlag(1039409264)
        && !EventFlag(1036489213)
        && !EventFlag(1039519209)
        && !EventFlag(11109819)) {
        SetEventFlagID(X0_4, ON);
    }
    if (EventFlag(3947)
        && EventFlag(1039409255)
        && EventFlag(1036489213)
        && !EventFlag(1039519209)
        && !EventFlag(11109819)) {
        SetEventFlagID(X4_4, ON);
    }
    if (EventFlag(3947) && EventFlag(1039409255) && EventFlag(1039519209) && !EventFlag(11109819)) {
        SetEventFlagID(X8_4, ON);
    }
    if (EventFlag(3947) && EventFlag(1039409255) && EventFlag(11109819)) {
        SetEventFlagID(X12_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 3947)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1039409255)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1039409264)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1036489213)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1039519209)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 11109819));
    RestartEvent();
});

$Event(4611, Restart, function(X0_4, X4_4) {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(X0_4, OFF);
    SetEventFlagID(X4_4, OFF);
    if (AnyBatchEventFlags(4208, 4209)
        && (EventFlag(11009554) || (!EventFlag(11009555) && EventFlag(118)))
        && EventFlag(11009460)
        && !EventFlag(1051569454)) {
        SetEventFlagID(X0_4, ON);
    }
    if (AnyBatchEventFlags(4207, 4208)
        && EventFlag(1040549254)
        && EventFlag(1040549205)
        && !EventFlag(11009554)) {
        SetEventFlagID(X4_4, ON);
    }
    WaitFor(
        EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 4207)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 4208)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 4209)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 11009554)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 11009555)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 118)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 11009460)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1040549254)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1040549205)
            || EventFlagState(CHANGE, TargetEventFlagType.EventFlag, 1051569454));
    RestartEvent();
});

$Event(4612, Default, function() {
    EndIf(!PlayerIsInOwnWorld());
    EndIf(EventFlag(1051579201));
    SetEventFlagID(1051579201, ON);
    EndIf(!EventFlag(1051579200));
    GotoIf(L0, EventFlag(1251570400));
    GotoIf(L1, EventFlag(1247580400));
    Goto(L0);
L0:
    SetEventFlagID(1051579200, ON);
    SetEventFlagID(1047589250, OFF);
    EndEvent();
L1:
    SetEventFlagID(1051579200, OFF);
    SetEventFlagID(1047589250, ON);
    EndEvent();
});

$Event(3179, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (!AnyBatchEventFlags(3160, 3164)) {
        BatchSetNetworkconnectedEventFlags(3160, 3164, OFF);
        SetNetworkconnectedEventFlagID(3160, ON);
    }
    if (!AnyBatchEventFlags(3165, 3178)) {
        BatchSetNetworkconnectedEventFlags(3165, 3178, OFF);
        SetNetworkconnectedEventFlagID(3165, ON);
    }
    if (EventFlag(3160)) {
    }
L0:
    EndEvent();
});

$Event(3239, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3238, OFF);
    if (!AnyBatchEventFlags(3220, 3224)) {
        BatchSetNetworkconnectedEventFlags(3220, 3224, OFF);
        SetNetworkconnectedEventFlagID(3220, ON);
    }
    if (EventFlag(3221) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3220, 3224, OFF);
        SetNetworkconnectedEventFlagID(3220, ON);
    }
    if (!AnyBatchEventFlags(3225, 3228)) {
        BatchSetNetworkconnectedEventFlags(3225, 3228, OFF);
        SetNetworkconnectedEventFlagID(3225, ON);
    }
    if (EventFlag(3220)) {
        if (EventFlag(110)) {
            BatchSetNetworkconnectedEventFlags(3225, 3228, OFF);
            SetNetworkconnectedEventFlagID(3226, ON);
        }
        if (EventFlag(9116)) {
            BatchSetNetworkconnectedEventFlags(3225, 3228, OFF);
            SetNetworkconnectedEventFlagID(3227, ON);
        }
        if (EventFlag(11109246)) {
            BatchSetNetworkconnectedEventFlags(3225, 3228, OFF);
            SetNetworkconnectedEventFlagID(3228, ON);
        }
        WaitFor(EventFlag(3238));
        RestartEvent();
    }
L0:
    EndEvent();
});

$Event(4719, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(4718, OFF);
    if (!AnyBatchEventFlags(4700, 4704)) {
        BatchSetNetworkconnectedEventFlags(4700, 4704, OFF);
        SetNetworkconnectedEventFlagID(4700, ON);
    }
    if (EventFlag(4701) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(4700, 4704, OFF);
        SetNetworkconnectedEventFlagID(4700, ON);
    }
    if (!AnyBatchEventFlags(4705, 4719)) {
        BatchSetNetworkconnectedEventFlags(4705, 4719, OFF);
        SetNetworkconnectedEventFlagID(4705, ON);
    }
    if (EventFlag(4700)) {
        if (EventFlag(4717)) {
            BatchSetNetworkconnectedEventFlags(4705, 4719, OFF);
            SetNetworkconnectedEventFlagID(4705, ON);
        }
        if (EventFlag(4705) && EventFlag(1042369414)) {
            BatchSetNetworkconnectedEventFlags(4705, 4719, OFF);
            SetNetworkconnectedEventFlagID(4717, ON);
        }
    }
L0:
    SetEventFlagID(1042369414, OFF);
    WaitFor(EventFlag(4718));
    RestartEvent();
});

$Event(4739, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (!AnyBatchEventFlags(4720, 4723)) {
        BatchSetNetworkconnectedEventFlags(4720, 4723, OFF);
        SetNetworkconnectedEventFlagID(4720, ON);
    }
    if (!AnyBatchEventFlags(4725, 4728)) {
        BatchSetNetworkconnectedEventFlags(4725, 4728, OFF);
        SetNetworkconnectedEventFlagID(4725, ON);
    }
    if (!AnyBatchEventFlags(4730, 4733)) {
        BatchSetNetworkconnectedEventFlags(4730, 4733, OFF);
        SetNetworkconnectedEventFlagID(4730, ON);
    }
    if (!AnyBatchEventFlags(4735, 4738)) {
        BatchSetNetworkconnectedEventFlags(4735, 4738, OFF);
        SetNetworkconnectedEventFlagID(4735, ON);
    }
    if (!AnyBatchEventFlags(4740, 4743)) {
        BatchSetNetworkconnectedEventFlags(4740, 4743, OFF);
        SetNetworkconnectedEventFlagID(4740, ON);
    }
    if (!AnyBatchEventFlags(4745, 4748)) {
        BatchSetNetworkconnectedEventFlags(4745, 4748, OFF);
        SetNetworkconnectedEventFlagID(4745, ON);
    }
    if (!AnyBatchEventFlags(4750, 4753)) {
        BatchSetNetworkconnectedEventFlags(4750, 4753, OFF);
        SetNetworkconnectedEventFlagID(4750, ON);
    }
    if (!AnyBatchEventFlags(4755, 4758)) {
        BatchSetNetworkconnectedEventFlags(4755, 4758, OFF);
        SetNetworkconnectedEventFlagID(4755, ON);
    }
    if (!AnyBatchEventFlags(4760, 4763)) {
        BatchSetNetworkconnectedEventFlags(4760, 4763, OFF);
        SetNetworkconnectedEventFlagID(4760, ON);
    }
    if (!AnyBatchEventFlags(4765, 4768)) {
        BatchSetNetworkconnectedEventFlags(4765, 4768, OFF);
        SetNetworkconnectedEventFlagID(4765, ON);
    }
    if (!AnyBatchEventFlags(4770, 4773)) {
        BatchSetNetworkconnectedEventFlags(4770, 4773, OFF);
        SetNetworkconnectedEventFlagID(4770, ON);
    }
    if (!AnyBatchEventFlags(4775, 4778)) {
        BatchSetNetworkconnectedEventFlags(4775, 4778, OFF);
        SetNetworkconnectedEventFlagID(4775, ON);
    }
    if (!AnyBatchEventFlags(4780, 4783)) {
        BatchSetNetworkconnectedEventFlags(4780, 4783, OFF);
        SetNetworkconnectedEventFlagID(4780, ON);
    }
    if (!AnyBatchEventFlags(4785, 4788)) {
        BatchSetNetworkconnectedEventFlags(4785, 4788, OFF);
        SetNetworkconnectedEventFlagID(4785, ON);
    }
    if (!AnyBatchEventFlags(4790, 4793)) {
        BatchSetNetworkconnectedEventFlags(4790, 4793, OFF);
        SetNetworkconnectedEventFlagID(4790, ON);
    }
    if (!AnyBatchEventFlags(4795, 4798)) {
        BatchSetNetworkconnectedEventFlags(4795, 4798, OFF);
        SetNetworkconnectedEventFlagID(4795, ON);
    }
    if (!AnyBatchEventFlags(4800, 4803)) {
        BatchSetNetworkconnectedEventFlags(4800, 4803, OFF);
        SetNetworkconnectedEventFlagID(4800, ON);
    }
    if (!AnyBatchEventFlags(4805, 4808)) {
        BatchSetNetworkconnectedEventFlags(4805, 4808, OFF);
        SetNetworkconnectedEventFlagID(4805, ON);
    }
    if (!AnyBatchEventFlags(4810, 4813)) {
        BatchSetNetworkconnectedEventFlags(4810, 4813, OFF);
        SetNetworkconnectedEventFlagID(4810, ON);
    }
    EndEvent();
});

$Event(4759, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (!AnyBatchEventFlags(4740, 4744)) {
        BatchSetNetworkconnectedEventFlags(4740, 4744, OFF);
        SetNetworkconnectedEventFlagID(4740, ON);
    }
    if (EventFlag(4741) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(4740, 4744, OFF);
        SetNetworkconnectedEventFlagID(4740, ON);
    }
    if (!AnyBatchEventFlags(4745, 4758)) {
        BatchSetNetworkconnectedEventFlags(4745, 4758, OFF);
        SetNetworkconnectedEventFlagID(4745, ON);
    }
    if (EventFlag(4740)) {
        if (EventFlag(1041369201) && !EventFlag(1041369202)) {
            BatchSetNetworkconnectedEventFlags(4745, 4758, OFF);
            SetNetworkconnectedEventFlagID(4746, ON);
        }
        if (EventFlag(1041369201) && EventFlag(1041369202)) {
            BatchSetNetworkconnectedEventFlags(4745, 4758, OFF);
            SetNetworkconnectedEventFlagID(4747, ON);
        }
        if (!EventFlag(1041369226)
            && !EventFlag(1044349221)
            && !EventFlag(1045369221)
            && !EventFlag(1043399221)) {
            SetEventFlagID(1041369226, ON);
            SetEventFlagID(1044349221, ON);
            SetEventFlagID(1045369221, ON);
            SetEventFlagID(1043399221, ON);
        }
        if (!(!EventFlag(1041369225)
            && !EventFlag(1044349220)
            && !EventFlag(1045369220)
            && !EventFlag(1043399220))) {
            SetNetworkconnectedEventFlagID(1041369226, ON);
            SetNetworkconnectedEventFlagID(1044349221, ON);
            SetNetworkconnectedEventFlagID(1045369221, ON);
            SetNetworkconnectedEventFlagID(1043399221, ON);
            if (EventFlag(1041369225)) {
                SetNetworkconnectedEventFlagID(1041369226, OFF);
            } else {
                if (EventFlag(1044349220)) {
                    SetNetworkconnectedEventFlagID(1044349221, OFF);
                } else {
                    if (EventFlag(1045369220)) {
                        SetNetworkconnectedEventFlagID(1045369221, OFF);
                    } else {
                        GotoIf(S0, !EventFlag(1043399220));
                        SetNetworkconnectedEventFlagID(1043399221, OFF);
                        Goto(L10);
                    }
                }
            }
S0:
L10:
            SetNetworkconnectedEventFlagID(1041369225, OFF);
            SetNetworkconnectedEventFlagID(1044349220, OFF);
            SetNetworkconnectedEventFlagID(1045369220, OFF);
            SetNetworkconnectedEventFlagID(1043399220, OFF);
            Goto(L0);
        }
    }
L0:
    EndEvent();
});

$Event(4979, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (!AnyBatchEventFlags(4960, 4964)) {
        BatchSetNetworkconnectedEventFlags(4960, 4964, OFF);
        SetNetworkconnectedEventFlagID(4960, ON);
    }
    if (EventFlag(4961) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(4960, 4964, OFF);
        SetNetworkconnectedEventFlagID(4960, ON);
    }
    if (!AnyBatchEventFlags(4965, 4979)) {
        BatchSetNetworkconnectedEventFlags(4965, 4979, OFF);
        SetNetworkconnectedEventFlagID(4965, ON);
    }
    if (EventFlag(4960)) {
        if (EventFlag(1043379201) && !EventFlag(1043379202)) {
            BatchSetNetworkconnectedEventFlags(4965, 4979, OFF);
            SetNetworkconnectedEventFlagID(4966, ON);
        }
        if (EventFlag(1043379201) && EventFlag(1043379202)) {
            BatchSetNetworkconnectedEventFlags(4965, 4979, OFF);
            SetNetworkconnectedEventFlagID(4967, ON);
        }
    }
L0:
    NoOp();
});

$Event(4999, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (!AnyBatchEventFlags(4980, 4984)) {
        BatchSetNetworkconnectedEventFlags(4980, 4984, OFF);
        SetNetworkconnectedEventFlagID(4980, ON);
    }
    BatchSetNetworkconnectedEventFlags(4982, 4983, OFF);
    if (EventFlag(4703)) {
        IncrementEventValue(4982, 2, 2);
    }
    if (EventFlag(4723)) {
        IncrementEventValue(4982, 2, 2);
    }
    if (EventFlag(4743)) {
        IncrementEventValue(4982, 2, 2);
    }
    if (EventFlag(4982)) {
        BatchSetNetworkconnectedEventFlags(4980, 4984, OFF);
        SetNetworkconnectedEventFlagID(4982, ON);
    }
    if (EventFlag(4983)) {
        BatchSetNetworkconnectedEventFlags(4980, 4984, OFF);
        SetNetworkconnectedEventFlagID(4983, ON);
    }
    if (EventFlag(1043379201) || EventFlag(1042389201) || EventFlag(1041369201)) {
        SetNetworkconnectedEventFlagID(4985, ON);
    }
    if (EventFlag(1043379206) || EventFlag(1042389206) || EventFlag(1041369206)) {
        SetNetworkconnectedEventFlagID(4986, ON);
    }
    EndEvent();
});

$Event(3679, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3678, OFF);
    if (!AnyBatchEventFlags(3660, 3663)) {
        BatchSetNetworkconnectedEventFlags(3660, 3663, OFF);
        SetNetworkconnectedEventFlagID(3660, ON);
    }
    if (EventFlag(3661) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3660, 3663, OFF);
        SetNetworkconnectedEventFlagID(3660, ON);
    }
    if (!AnyBatchEventFlags(3665, 3671)) {
        BatchSetNetworkconnectedEventFlags(3665, 3671, OFF);
        SetNetworkconnectedEventFlagID(3665, ON);
    }
    if (EventFlag(3660)) {
        if (EventFlag(3665) && (EventFlag(1043399307) || EventFlag(32009203))) {
            BatchSetNetworkconnectedEventFlags(3665, 3671, OFF);
            SetNetworkconnectedEventFlagID(3666, ON);
        }
        if (EventFlag(9410) && (EventFlag(3665) || EventFlag(3666))) {
            BatchSetNetworkconnectedEventFlags(3665, 3671, OFF);
            SetNetworkconnectedEventFlagID(3667, ON);
            SetEventFlagID(1051369259, ON);
            SetEventFlagID(1051369361, ON);
        }
        if (EventFlag(3667) && EventFlag(9130)) {
            BatchSetNetworkconnectedEventFlags(3665, 3671, OFF);
            SetNetworkconnectedEventFlagID(3668, ON);
        }
        if (EventFlag(3668) && EventFlag(1051369266)) {
            BatchSetNetworkconnectedEventFlags(3665, 3671, OFF);
            SetNetworkconnectedEventFlagID(3669, ON);
            SetEventFlagID(1051369361, OFF);
            SetEventFlagID(1035539208, ON);
        }
        if (EventFlag(3669) && EventFlag(1051369266) && EventFlag(1035539204)) {
            BatchSetNetworkconnectedEventFlags(3665, 3671, OFF);
            SetNetworkconnectedEventFlagID(3670, ON);
            SetEventFlagID(1035539208, ON);
        }
        if (!EventFlag(1052520800) && EventFlag(1035539205)) {
            SetNetworkconnectedEventFlagID(1035539209, ON);
        }
        if (EventFlag(3670) && EventFlag(1052520800) && EventFlag(1035539205)) {
            BatchSetNetworkconnectedEventFlags(3665, 3671, OFF);
            SetNetworkconnectedEventFlagID(3671, ON);
            SetEventFlagID(1035539208, OFF);
        }
        WaitFor(EventFlag(3678));
        RestartEvent();
    }
L0:
    EndEvent();
});

$Event(3199, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3198, OFF);
    if (!AnyBatchEventFlags(3180, 3184)) {
        BatchSetNetworkconnectedEventFlags(3180, 3184, OFF);
        SetNetworkconnectedEventFlagID(3180, ON);
    }
    if (EventFlag(3181) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3180, 3184, OFF);
        SetNetworkconnectedEventFlagID(3180, ON);
    }
    if (!AnyBatchEventFlags(3185, 3199)) {
        BatchSetNetworkconnectedEventFlags(3185, 3199, OFF);
        SetNetworkconnectedEventFlagID(3185, ON);
    }
    if (EventFlag(3180)) {
        if (EventFlag(105)) {
            BatchSetNetworkconnectedEventFlags(3185, 3199, OFF);
            SetNetworkconnectedEventFlagID(3187, ON);
        }
        if (EventFlag(181)) {
            BatchSetNetworkconnectedEventFlags(3185, 3199, OFF);
            SetNetworkconnectedEventFlagID(3191, ON);
        }
        if (EventFlag(11109358)) {
            BatchSetNetworkconnectedEventFlags(3185, 3199, OFF);
            SetNetworkconnectedEventFlagID(3188, ON);
        }
        if (EventFlag(1035449235)) {
            BatchSetNetworkconnectedEventFlags(3185, 3199, OFF);
            SetNetworkconnectedEventFlagID(3189, ON);
        }
        if (EventFlag(400033)) {
            BatchSetNetworkconnectedEventFlags(3185, 3199, OFF);
            SetNetworkconnectedEventFlagID(3190, ON);
        }
        if (EventFlag(1035449226)) {
            BatchSetNetworkconnectedEventFlags(3185, 3199, OFF);
            SetNetworkconnectedEventFlagID(3192, ON);
        }
        if (EventFlag(7601)) {
            BatchSetNetworkconnectedEventFlags(3185, 3199, OFF);
            SetNetworkconnectedEventFlagID(3193, ON);
        }
        if (EventFlag(12059166)) {
            BatchSetNetworkconnectedEventFlags(3180, 3184, OFF);
            SetNetworkconnectedEventFlagID(3183, ON);
            SaveRequest();
        }
    }
L0:
    WaitFor(EventFlag(3198));
    RestartEvent();
});

$Event(3279, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3278, OFF);
    if (!AnyBatchEventFlags(3260, 3264)) {
        BatchSetNetworkconnectedEventFlags(3260, 3264, OFF);
        SetNetworkconnectedEventFlagID(3260, ON);
    }
    if (EventFlag(3261) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3260, 3264, OFF);
        SetNetworkconnectedEventFlagID(3260, ON);
    }
    if (!AnyBatchEventFlags(3265, 3269)) {
        BatchSetNetworkconnectedEventFlags(3265, 3269, OFF);
        SetNetworkconnectedEventFlagID(3265, ON);
    }
    if (EventFlag(3260)) {
        if (EventFlag(10009360) && !EventFlag(10009362)) {
            BatchSetNetworkconnectedEventFlags(3265, 3269, OFF);
            SetNetworkconnectedEventFlagID(3266, ON);
        }
        if (EventFlag(10009360) && EventFlag(10009362)) {
            BatchSetNetworkconnectedEventFlags(3265, 3269, OFF);
            SetEventFlagID(3268, ON);
        }
        if (EventFlag(4229)) {
            BatchSetNetworkconnectedEventFlags(3265, 3270, OFF);
            SetEventFlagID(3270, ON);
        } else {
            if (EventFlag(10000800)) {
                BatchSetNetworkconnectedEventFlags(3265, 3270, OFF);
                SetEventFlagID(3269, ON);
            } else {
L10:
                if (!AnyBatchEventFlags(10009510, 10009514)) {
                    BatchSetNetworkconnectedEventFlags(10009510, 10009514, OFF);
                    SetNetworkconnectedEventFlagID(10009514, ON);
                }
                if (!(!EventFlag(3260) || EventFlag(3268) || EventFlag(3269) || EventFlag(3270))) {
                    if (EventFlag(10002736) && !EventFlag(10009390)) {
                        BatchSetNetworkconnectedEventFlags(10009510, 10009514, OFF);
                        SetNetworkconnectedEventFlagID(10009510, ON);
                    }
                    if (EventFlag(10002737) && !EventFlag(10009391)) {
                        BatchSetNetworkconnectedEventFlags(10009510, 10009514, OFF);
                        SetNetworkconnectedEventFlagID(10009511, ON);
                    }
                    if (EventFlag(10002738) && !EventFlag(10009392)) {
                        BatchSetNetworkconnectedEventFlags(10009510, 10009514, OFF);
                        SetNetworkconnectedEventFlagID(10009512, ON);
                    }
                    if (EventFlag(10002739) && !EventFlag(10009393)) {
                        BatchSetNetworkconnectedEventFlags(10009510, 10009514, OFF);
                        SetNetworkconnectedEventFlagID(10009513, ON);
                    }
                    if (EventFlag(10002765)) {
                        BatchSetNetworkconnectedEventFlags(10009510, 10009514, OFF);
                        SetNetworkconnectedEventFlagID(10009514, ON);
                        Goto(L15);
                    }
L15:
                    BatchSetNetworkconnectedEventFlags(10002736, 10002739, OFF);
                    SetNetworkconnectedEventFlagID(10002765, OFF);
                } else {
L19:
                    BatchSetNetworkconnectedEventFlags(10002732, 10002739, OFF);
                    BatchSetNetworkconnectedEventFlags(10009510, 10009514, OFF);
                    SetNetworkconnectedEventFlagID(10002765, OFF);
                    SetNetworkconnectedEventFlagID(10009514, ON);
                    Goto(L20);
                }
            }
        }
    }
L20:
    SetNetworkconnectedEventFlagID(10009350, ON);
    WaitFor(EventFlag(3278));
    RestartEvent();
L0:
    EndEvent();
});

$Event(3299, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (!AnyBatchEventFlags(3280, 3284)) {
        BatchSetNetworkconnectedEventFlags(3280, 3284, OFF);
        SetNetworkconnectedEventFlagID(3280, ON);
    }
    if (!AnyBatchEventFlags(3285, 3298)) {
        BatchSetNetworkconnectedEventFlags(3285, 3298, OFF);
        SetNetworkconnectedEventFlagID(3285, ON);
    }
    if (EventFlag(3280)) {
        if (EventFlag(1043359201) && EventFlag(1044350800) && !EventFlag(1043359247)) {
            BatchSetNetworkconnectedEventFlags(3285, 3298, OFF);
            SetNetworkconnectedEventFlagID(3286, ON);
        }
        if (EventFlag(4703) || EventFlag(4723) || EventFlag(4743)) {
            BatchSetNetworkconnectedEventFlags(3285, 3298, OFF);
            SetNetworkconnectedEventFlagID(3295, ON);
        }
    }
L0:
    NoOp();
});

$Event(3259, Restart, function(X0_4, X4_4, X8_4, X12_4) {
    if (!AnyBatchEventFlags(X0_4, X4_4)) {
        BatchSetNetworkconnectedEventFlags(X0_4, X4_4, OFF);
        SetNetworkconnectedEventFlagID(X0_4, ON);
    }
    if (!AnyBatchEventFlags(X8_4, X12_4)) {
        BatchSetNetworkconnectedEventFlags(X8_4, X12_4, OFF);
        SetNetworkconnectedEventFlagID(X8_4, ON);
    }
    if (EventFlag(X0_4)) {
    }
L0:
    NoOp();
});

$Event(3119, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3118, OFF);
    if (!AnyBatchEventFlags(3100, 3104)) {
        BatchSetNetworkconnectedEventFlags(3100, 3104, OFF);
        SetNetworkconnectedEventFlagID(3100, ON);
    }
    if (EventFlag(3101) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3100, 3104, OFF);
        SetNetworkconnectedEventFlagID(3100, ON);
    }
    if (!AnyBatchEventFlags(3105, 3119)) {
        BatchSetNetworkconnectedEventFlags(3105, 3119, OFF);
        SetNetworkconnectedEventFlagID(3105, ON);
    }
    if (EventFlag(3100)) {
        if (EventFlag(400073)) {
            BatchSetNetworkconnectedEventFlags(3105, 3119, OFF);
            SetEventFlagID(3106, ON);
        }
        if (EventValue(16009260, 4) >= 3) {
            BatchSetNetworkconnectedEventFlags(3105, 3119, OFF);
            SetEventFlagID(3107, ON);
        }
        if (EventFlag(16000800) && EventFlag(16009208)) {
            BatchSetNetworkconnectedEventFlags(3105, 3119, OFF);
            SetEventFlagID(3108, ON);
        }
        if ((EventFlag(16000800) && !EventFlag(16009208)) || EventFlag(16009246)) {
            BatchSetNetworkconnectedEventFlags(3105, 3119, OFF);
            SetEventFlagID(3109, ON);
        }
        if (EventFlag(16009265)) {
            BatchSetNetworkconnectedEventFlags(3105, 3119, OFF);
            SetEventFlagID(3110, ON);
        }
        if (EventFlag(16009264)) {
            BatchSetNetworkconnectedEventFlags(3105, 3119, OFF);
            SetEventFlagID(3111, ON);
        }
    }
L0:
    WaitFor(EventFlag(3118));
    RestartEvent();
});

$Event(3399, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3398, OFF);
    if (!AnyBatchEventFlags(3380, 3383)) {
        BatchSetNetworkconnectedEventFlags(3380, 3383, OFF);
        SetNetworkconnectedEventFlagID(3380, ON);
    }
    if (!AnyBatchEventFlags(3385, 3397)) {
        BatchSetNetworkconnectedEventFlags(3385, 3397, OFF);
        SetNetworkconnectedEventFlagID(3385, ON);
    }
    if (EventFlag(3380)) {
        if (EventFlag(3385)
            && EventFlag(1045349207)
            && (EventFlag(1043319206) || EventFlag(3403) || EventFlag(3062) || EventFlag(9101))) {
            BatchSetNetworkconnectedEventFlags(3385, 3397, OFF);
            SetNetworkconnectedEventFlagID(3386, ON);
        }
        if (EventFlag(3386)) {
            BatchSetNetworkconnectedEventFlags(3385, 3397, OFF);
            SetNetworkconnectedEventFlagID(3387, ON);
        }
        if (EventFlag(3387) && EventFlag(1039409206)) {
            BatchSetNetworkconnectedEventFlags(3385, 3397, OFF);
            SetNetworkconnectedEventFlagID(3388, ON);
        }
        if (EventFlag(3388) && EventFlag(1038419205)) {
            BatchSetNetworkconnectedEventFlags(3385, 3397, OFF);
            SetNetworkconnectedEventFlagID(3389, ON);
        }
        if (EventFlag(3389) && EventFlag(1038439206)) {
            BatchSetNetworkconnectedEventFlags(3385, 3397, OFF);
            SetNetworkconnectedEventFlagID(3390, ON);
        }
        if (EventFlag(3390) && EventFlag(1038439209)) {
            BatchSetNetworkconnectedEventFlags(3385, 3397, OFF);
            SetNetworkconnectedEventFlagID(3391, ON);
        }
        if (EventFlag(3391) && EventFlag(1036499207)) {
            BatchSetNetworkconnectedEventFlags(3385, 3397, OFF);
            SetNetworkconnectedEventFlagID(3392, ON);
        }
    }
L0:
    if (EventFlag(3392) && EventFlag(35009209)) {
        BatchSetNetworkconnectedEventFlags(3385, 3397, OFF);
        SetNetworkconnectedEventFlagID(3393, ON);
        BatchSetNetworkconnectedEventFlags(3380, 3383, OFF);
        SetNetworkconnectedEventFlagID(3383, ON);
    }
    WaitFor(EventFlag(3398));
    RestartEvent();
});

$Event(3419, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3418, OFF);
    if (!AnyBatchEventFlags(3400, 3403)) {
        BatchSetNetworkconnectedEventFlags(3400, 3403, OFF);
        SetNetworkconnectedEventFlagID(3400, ON);
    }
    if (EventFlag(3402) && !EventFlag(1045349256)) {
        BatchSetNetworkconnectedEventFlags(3400, 3403, OFF);
        SetNetworkconnectedEventFlagID(3400, ON);
    }
    if (!AnyBatchEventFlags(3405, 3417)) {
        BatchSetNetworkconnectedEventFlags(3405, 3417, OFF);
        SetNetworkconnectedEventFlagID(3405, ON);
    }
    if (EventFlag(3400)) {
        if (EventFlag(3408) && !EventFlag(1045349256)) {
            BatchSetNetworkconnectedEventFlags(3405, 3417, OFF);
            SetNetworkconnectedEventFlagID(3407, ON);
        }
        if (EventFlag(3405) && EventFlag(1043319206)) {
            BatchSetNetworkconnectedEventFlags(3405, 3417, OFF);
            SetNetworkconnectedEventFlagID(3406, ON);
            SetEventFlagID(1043319209, ON);
        }
        if (EventFlag(3406) && EventFlag(1043300800)) {
            BatchSetNetworkconnectedEventFlags(3405, 3417, OFF);
            SetNetworkconnectedEventFlagID(3407, ON);
            SetEventFlagID(1043319209, OFF);
        }
        if (EventFlag(3407) && AnyBatchEventFlags(3386, 3397) && EventFlag(1043319207)) {
            BatchSetNetworkconnectedEventFlags(3405, 3417, OFF);
            SetNetworkconnectedEventFlagID(3408, ON);
            SetEventFlagID(1045349256, ON);
        }
        if (EventFlag(3407) && AnyBatchEventFlags(3386, 3397) && EventFlag(1045342719)) {
            BatchSetNetworkconnectedEventFlags(3405, 3417, OFF);
            SetNetworkconnectedEventFlagID(3408, ON);
        }
        if (EventFlag(3408) && EventFlag(1045349255)) {
            BatchSetNetworkconnectedEventFlags(3405, 3417, OFF);
            SetNetworkconnectedEventFlagID(3409, ON);
            SetEventFlagID(1045349259, ON);
        }
        if (AnyBatchEventFlags(3405, 3408) && EventFlag(1039409206)) {
            BatchSetNetworkconnectedEventFlags(3405, 3417, OFF);
            SetNetworkconnectedEventFlagID(3409, ON);
            SetEventFlagID(1045349259, ON);
        }
        if (EventFlag(3407) && EventFlag(3385) && EventFlag(3383) && EventFlag(1043319207)) {
            BatchSetNetworkconnectedEventFlags(3405, 3417, OFF);
            SetNetworkconnectedEventFlagID(3408, ON);
            BatchSetNetworkconnectedEventFlags(3400, 3403, OFF);
            SetNetworkconnectedEventFlagID(3402, ON);
            SetEventFlagID(1045349256, ON);
        }
        if (EventFlag(3407) && EventFlag(3385) && EventFlag(3383) && EventFlag(1045342719)) {
            BatchSetNetworkconnectedEventFlags(3405, 3417, OFF);
            SetNetworkconnectedEventFlagID(3408, ON);
            BatchSetNetworkconnectedEventFlags(3400, 3403, OFF);
            SetNetworkconnectedEventFlagID(3402, ON);
        }
    }
L0:
    WaitFor(EventFlag(3418));
    RestartEvent();
    EndEvent();
});

$Event(3439, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3438, OFF);
    if (!AnyBatchEventFlags(3420, 3424)) {
        BatchSetNetworkconnectedEventFlags(3420, 3424, OFF);
        SetNetworkconnectedEventFlagID(3420, ON);
    }
    if (EventFlag(3421) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3420, 3424, OFF);
        SetNetworkconnectedEventFlagID(3420, ON);
    }
    if (!AnyBatchEventFlags(3425, 3439)) {
        BatchSetNetworkconnectedEventFlags(3425, 3439, OFF);
        SetNetworkconnectedEventFlagID(3425, ON);
    }
    if (EventFlag(3420)) {
        if (EventFlag(1037429210) && !EventFlag(1038519205) && !EventFlag(16009208)) {
            BatchSetNetworkconnectedEventFlags(3425, 3439, OFF);
            SetNetworkconnectedEventFlagID(3426, ON);
        }
        if (EventFlag(1038519205) || EventFlag(16009208)) {
            BatchSetNetworkconnectedEventFlags(3425, 3439, OFF);
            SetEventFlagID(3427, ON);
        }
        if (EventFlag(16009306) && EventValue(16009260, 3) >= 2) {
            BatchSetNetworkconnectedEventFlags(3425, 3439, OFF);
            SetEventFlagID(3428, ON);
        }
        if (EventFlag(16009319)) {
            BatchSetNetworkconnectedEventFlags(3425, 3439, OFF);
            SetEventFlagID(3429, ON);
        }
        if (EventFlag(16009327)
            && ((EventFlag(16000800) && !EventFlag(16009208)) || EventFlag(16009246))
            && !EventFlag(3689)
            && !EventFlag(3448)
            && !EventFlag(3449)
            && !EventFlag(3886)) {
            BatchSetNetworkconnectedEventFlags(3425, 3439, OFF);
            SetEventFlagID(3430, ON);
        }
        if ((EventFlag(16009328) && !EventFlag(16009327))
            || (AnyBatchEventFlags(3425, 3428) && !EventFlag(16009319) && EventFlag(16000800))
            || EventFlag(16009335)) {
            BatchSetNetworkconnectedEventFlags(3425, 3439, OFF);
            SetEventFlagID(3431, ON);
        }
    }
L0:
    WaitFor(EventFlag(3438));
    RestartEvent();
});

$Event(3459, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3458, OFF);
    if (!AnyBatchEventFlags(3440, 3444)) {
        BatchSetNetworkconnectedEventFlags(3440, 3444, OFF);
        SetNetworkconnectedEventFlagID(3440, ON);
    }
    if (EventFlag(3442) && EventFlag(3443)) {
        BatchSetNetworkconnectedEventFlags(3440, 3444, OFF);
        SetNetworkconnectedEventFlagID(3443, ON);
    }
    if (!EventFlag(3450) && EventFlag(3440) && EventFlag(3442)) {
        BatchSetNetworkconnectedEventFlags(3440, 3444, OFF);
        SetNetworkconnectedEventFlagID(3440, ON);
    }
    if (EventFlag(3450) && EventFlag(3440) && EventFlag(3442)) {
        BatchSetNetworkconnectedEventFlags(3440, 3444, OFF);
        SetNetworkconnectedEventFlagID(3442, ON);
    }
    if (EventFlag(3441) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3440, 3444, OFF);
        SetNetworkconnectedEventFlagID(3440, ON);
    }
    if (!AnyBatchEventFlags(3445, 3459)) {
        BatchSetNetworkconnectedEventFlags(3445, 3457, OFF);
        SetNetworkconnectedEventFlagID(3445, ON);
    }
    if (EventFlag(1039449285) && !EventFlag(1039449316)) {
        SetNetworkconnectedEventFlagID(1039449316, ON);
    }
    if (EventFlag(3440)) {
        if (AnyBatchEventFlags(3445, 3447) && EventFlag(9122)) {
            BatchSetNetworkconnectedEventFlags(3445, 3457, OFF);
            SetNetworkconnectedEventFlagID(3457, ON);
            BatchSetNetworkconnectedEventFlags(3440, 3444, OFF);
            SetNetworkconnectedEventFlagID(3443, ON);
        } else {
            if (EventFlag(1037442701) || EventFlag(1037449206) || EventFlag(110)) {
                BatchSetNetworkconnectedEventFlags(3445, 3457, OFF);
                SetNetworkconnectedEventFlagID(3446, ON);
            }
            if (EventFlag(1037449205)) {
                BatchSetNetworkconnectedEventFlags(3445, 3457, OFF);
                SetNetworkconnectedEventFlagID(3447, ON);
            }
            if (EventFlag(11109430)) {
                BatchSetNetworkconnectedEventFlags(3445, 3457, OFF);
                SetNetworkconnectedEventFlagID(3448, ON);
            }
            if ((EventFlag(16009406) && EventValue(16009260, 4) >= 1)
                || (!EventFlag(16009405) && EventFlag(9122))) {
                BatchSetNetworkconnectedEventFlags(3445, 3457, OFF);
                SetNetworkconnectedEventFlagID(3449, ON);
            }
            if ((EventFlag(16009405) && EventFlag(9122)) || EventFlag(16009416)) {
                BatchSetNetworkconnectedEventFlags(3445, 3457, OFF);
                SetNetworkconnectedEventFlagID(3456, ON);
                SetNetworkconnectedEventFlagID(11109430, ON);
            }
            if (EventFlag(3456) && EventFlag(1039449263)) {
                BatchSetNetworkconnectedEventFlags(3445, 3457, OFF);
                SetNetworkconnectedEventFlagID(3450, ON);
            }
            if (EventFlag(3827)) {
                BatchSetNetworkconnectedEventFlags(3445, 3457, OFF);
                SetNetworkconnectedEventFlagID(3451, ON);
            }
        }
    }
L0:
    WaitFor(EventFlag(3458));
    RestartEvent();
});

$Event(3499, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (!AnyBatchEventFlags(3480, 3484)) {
        BatchSetNetworkconnectedEventFlags(3480, 3484, OFF);
        SetNetworkconnectedEventFlagID(3480, ON);
    }
    if (EventFlag(3481) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3480, 3484, OFF);
        SetNetworkconnectedEventFlagID(3480, ON);
    }
    if (!AnyBatchEventFlags(3485, 3499)) {
        BatchSetNetworkconnectedEventFlags(3485, 3499, OFF);
        SetNetworkconnectedEventFlagID(3485, ON);
    }
    GotoIf(L0, !EventFlag(3480));
    if (EventFlag(182)) {
        BatchSetNetworkconnectedEventFlags(3485, 3499, OFF);
        SetEventFlagID(3486, ON);
    }
    if (EventFlag(11000500)) {
        BatchSetNetworkconnectedEventFlags(3485, 3499, OFF);
        SetEventFlagID(3487, ON);
    }
    if (EventFlag(110)) {
        BatchSetNetworkconnectedEventFlags(3485, 3499, OFF);
        SetEventFlagID(3488, ON);
    }
    if (EventFlag(118)) {
        BatchSetNetworkconnectedEventFlags(3485, 3499, OFF);
        SetEventFlagID(3489, ON);
        SaveRequest();
L0:
        EndEvent();
    }
});

$Event(3559, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (!AnyBatchEventFlags(3540, 3544)) {
        BatchSetNetworkconnectedEventFlags(3540, 3544, OFF);
        SetNetworkconnectedEventFlagID(3540, ON);
    }
    if (EventFlag(3541) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3540, 3544, OFF);
        SetNetworkconnectedEventFlagID(3540, ON);
    }
    if (!AnyBatchEventFlags(3545, 3559)) {
        BatchSetNetworkconnectedEventFlags(3545, 3559, OFF);
        SetNetworkconnectedEventFlagID(3545, ON);
    }
    GotoIf(L0, !EventFlag(3540));
    GotoIf(S0, !EventFlag(1035429210));
    BatchSetNetworkconnectedEventFlags(3545, 3559, OFF);
    SetEventFlagID(3546, ON);
    BatchSetNetworkconnectedEventFlags(3540, 3544, OFF);
    SetNetworkconnectedEventFlagID(3543, ON);
    SaveRequest();
S0:
L0:
    EndEvent();
});

$Event(3639, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3638, OFF);
    if (!AnyBatchEventFlags(3620, 3624)) {
        BatchSetNetworkconnectedEventFlags(3620, 3624, OFF);
        SetNetworkconnectedEventFlagID(3620, ON);
    }
    if (EventFlag(3621) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3620, 3624, OFF);
        SetNetworkconnectedEventFlagID(3620, ON);
    }
    if (!AnyBatchEventFlags(3625, 3639)) {
        BatchSetNetworkconnectedEventFlags(3625, 3639, OFF);
        SetNetworkconnectedEventFlagID(3626, ON);
    }
    if (EventFlag(3623) && !EventFlag(3631)) {
        BatchSetNetworkconnectedEventFlags(3620, 3624, OFF);
        SetNetworkconnectedEventFlagID(3620, ON);
        BatchSetNetworkconnectedEventFlags(3625, 3637, OFF);
        SetNetworkconnectedEventFlagID(3631, ON);
        SetEventFlagID(1049539210, ON);
        SaveRequest();
    } else {
        GotoIf(L0, !EventFlag(3620));
        if (EventFlag(1043379263) && !EventFlag(1044389206)) {
            BatchSetNetworkconnectedEventFlags(3625, 3637, OFF);
            SetEventFlagID(3625, ON);
        }
        if ((EventFlag(1043379263) && EventFlag(1044389206)) || !EventFlag(1043379263)) {
            BatchSetNetworkconnectedEventFlags(3625, 3637, OFF);
            SetEventFlagID(3626, ON);
        }
        if (EventFlag(7607)) {
            BatchSetNetworkconnectedEventFlags(3625, 3637, OFF);
            SetNetworkconnectedEventFlagID(3627, ON);
        }
        if (EventFlag(1035469207)) {
            BatchSetNetworkconnectedEventFlags(3625, 3637, OFF);
            SetNetworkconnectedEventFlagID(3630, ON);
        }
        if (EventFlag(1039529206) || EventFlag(1049539210)) {
            BatchSetNetworkconnectedEventFlags(3625, 3637, OFF);
            SetNetworkconnectedEventFlagID(3631, ON);
        }
    }
L0:
    WaitFor(EventFlag(3638));
    RestartEvent();
});

$Event(3659, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3658, OFF);
    if (!AnyBatchEventFlags(3640, 3643)) {
        BatchSetNetworkconnectedEventFlags(3640, 3643, OFF);
        SetNetworkconnectedEventFlagID(3640, ON);
    }
    if (EventFlag(3641)) {
        BatchSetNetworkconnectedEventFlags(3640, 3643, OFF);
        SetNetworkconnectedEventFlagID(3640, ON);
    }
    if (!AnyBatchEventFlags(3645, 3657)) {
        BatchSetNetworkconnectedEventFlags(3645, 3657, OFF);
        SetNetworkconnectedEventFlagID(3645, ON);
    }
    if (EventFlag(3640)) {
        if (EventFlag(3645) && EventValue(1051439235, 5) >= 4) {
            BatchSetNetworkconnectedEventFlags(3645, 3657, OFF);
            SetNetworkconnectedEventFlagID(3646, ON);
            BatchSetNetworkconnectedEventFlags(3640, 3643, OFF);
            SetNetworkconnectedEventFlagID(3642, ON);
            SetEventFlagID(1051439212, ON);
        }
        if (EventFlag(3646) && EventFlag(3640)) {
            BatchSetNetworkconnectedEventFlags(3645, 3657, OFF);
            SetNetworkconnectedEventFlagID(3647, ON);
        }
        if (EventFlag(3647) && EventValue(1051439235, 5) >= 9) {
            BatchSetNetworkconnectedEventFlags(3645, 3657, OFF);
            SetNetworkconnectedEventFlagID(3648, ON);
        }
    }
L0:
    WaitFor(EventFlag(3658));
    RestartEvent();
    EndEvent();
});

$Event(3699, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3698, OFF);
    if (!AnyBatchEventFlags(3680, 3684)) {
        BatchSetNetworkconnectedEventFlags(3680, 3684, OFF);
        SetNetworkconnectedEventFlagID(3680, ON);
    }
    if (EventFlag(3681) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3680, 3684, OFF);
        SetNetworkconnectedEventFlagID(3680, ON);
    }
    if (EventFlag(3681)) {
        BatchSetNetworkconnectedEventFlags(3680, 3684, OFF);
        SetNetworkconnectedEventFlagID(3680, ON);
        SetEventFlagID(31009207, OFF);
        SetEventFlagID(1038419265, OFF);
        SetEventFlagID(1037549209, OFF);
        SetEventFlagID(31009266, OFF);
        WaitFixedTimeFrames(1);
        if (EventFlag(3685) || EventFlag(3686)) {
            SetEventFlagID(31009207, ON);
        } else {
            if (EventFlag(3687)) {
                SetEventFlagID(1038419265, ON);
            } else {
                if (EventFlag(3688) || EventFlag(3693)) {
                    SetEventFlagID(1037549209, ON);
                } else {
                    GotoIf(S0, !(EventFlag(3691) || EventFlag(3692) || EventFlag(3694)));
                    SetEventFlagID(31009266, ON);
                    Goto(L1);
                }
            }
        }
    }
S0:
L1:
    if (!AnyBatchEventFlags(3685, 3699)) {
        BatchSetNetworkconnectedEventFlags(3685, 3699, OFF);
        SetNetworkconnectedEventFlagID(3685, ON);
        SetNetworkconnectedEventFlagID(1038419270, ON);
        SetNetworkconnectedEventFlagID(1038419271, OFF);
        SetEventFlagID(31009219, ON);
    }
    if (EventFlag(3680)) {
        if (!EventFlag(3691)) {
            if (EventFlag(31009206)) {
                BatchSetNetworkconnectedEventFlags(3685, 3699, OFF);
                SetNetworkconnectedEventFlagID(3686, ON);
                SetNetworkconnectedEventFlagID(1038419270, ON);
                SetNetworkconnectedEventFlagID(1038419271, OFF);
            }
            if (EventFlag(31009206) && EventFlag(1038419254) && !EventFlag(16009208)) {
                BatchSetNetworkconnectedEventFlags(3685, 3699, OFF);
                SetNetworkconnectedEventFlagID(3687, ON);
                SetNetworkconnectedEventFlagID(1038419270, OFF);
                SetNetworkconnectedEventFlagID(1038419271, ON);
            }
            if (EventFlag(31009206)
                && EventFlag(1037549211)
                && !EventFlag(16009208)
                && !EventFlag(1037549210)) {
                BatchSetNetworkconnectedEventFlags(3685, 3699, OFF);
                SetNetworkconnectedEventFlagID(3688, ON);
                SetNetworkconnectedEventFlagID(1038419270, OFF);
                SetNetworkconnectedEventFlagID(1038419271, ON);
            }
            if (EventFlag(31009206)
                && EventFlag(1037549211)
                && !EventFlag(16009208)
                && EventFlag(1037549210)) {
                BatchSetNetworkconnectedEventFlags(3685, 3699, OFF);
                SetNetworkconnectedEventFlagID(3693, ON);
                SetNetworkconnectedEventFlagID(1038419270, OFF);
                SetNetworkconnectedEventFlagID(1038419271, ON);
            }
            if (EventFlag(31009206) && EventFlag(16009208)) {
                BatchSetNetworkconnectedEventFlags(3685, 3699, OFF);
                SetNetworkconnectedEventFlagID(3689, ON);
                SetNetworkconnectedEventFlagID(1038419270, OFF);
                SetNetworkconnectedEventFlagID(1038419271, ON);
            }
            if (EventFlag(3697)) {
                BatchSetNetworkconnectedEventFlags(3685, 3699, OFF);
                SetNetworkconnectedEventFlagID(3690, ON);
            }
            if (EventFlag(16009359)) {
                BatchSetNetworkconnectedEventFlags(3685, 3699, OFF);
                SetNetworkconnectedEventFlagID(3690, ON);
                SetNetworkconnectedEventFlagID(1038419270, OFF);
                SetNetworkconnectedEventFlagID(1038419271, ON);
            }
            if (EventFlag(1039549205)) {
                BatchSetNetworkconnectedEventFlags(3685, 3699, OFF);
                SetNetworkconnectedEventFlagID(3696, ON);
                SetNetworkconnectedEventFlagID(1038419270, OFF);
                SetNetworkconnectedEventFlagID(1038419271, ON);
            }
            if ((EventFlag(1039549205) || EventFlag(3696)) && !EventFlag(31002715) && !EventFlag(9000)) {
                BatchSetNetworkconnectedEventFlags(3685, 3699, OFF);
                SetNetworkconnectedEventFlagID(3691, ON);
                SetNetworkconnectedEventFlagID(1038419270, OFF);
                SetNetworkconnectedEventFlagID(1038419271, ON);
                SetEventFlagID(31009269, ON);
            }
        }
L2:
        if (EventFlag(31000850) && !EventFlag(31009256)) {
            BatchSetNetworkconnectedEventFlags(3685, 3699, OFF);
            SetNetworkconnectedEventFlagID(3694, ON);
            SetNetworkconnectedEventFlagID(1038419270, OFF);
            SetNetworkconnectedEventFlagID(1038419271, ON);
        }
        if (EventFlag(31009256)) {
            BatchSetNetworkconnectedEventFlags(3685, 3699, OFF);
            SetNetworkconnectedEventFlagID(3692, ON);
            SetNetworkconnectedEventFlagID(1038419270, OFF);
            SetNetworkconnectedEventFlagID(1038419271, ON);
        }
    }
L0:
    WaitFor(EventFlag(3698));
    RestartEvent();
});

$Event(3719, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3718, OFF);
    if (!AnyBatchEventFlags(3700, 3704)) {
        BatchSetNetworkconnectedEventFlags(3700, 3704, OFF);
        SetNetworkconnectedEventFlagID(3700, ON);
    }
    if (EventFlag(3701) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3700, 3704, OFF);
        SetNetworkconnectedEventFlagID(3700, ON);
    }
    if (!AnyBatchEventFlags(3705, 3719)) {
        BatchSetNetworkconnectedEventFlags(3705, 3719, OFF);
        SetNetworkconnectedEventFlagID(3705, ON);
        SetEventFlagID(10007452, ON);
    }
    if (EventFlag(3700)) {
        if ((EventFlag(3705) && EventFlag(1041389413)) || EventFlag(3062)) {
            BatchSetNetworkconnectedEventFlags(3705, 3719, OFF);
            SetNetworkconnectedEventFlagID(3707, ON);
        }
        if (EventFlag(3707) && EventFlag(11109213)) {
            BatchSetNetworkconnectedEventFlags(3705, 3719, OFF);
            SetNetworkconnectedEventFlagID(3708, ON);
        }
        if (EventFlag(110)) {
            BatchSetNetworkconnectedEventFlags(3705, 3719, OFF);
            SetNetworkconnectedEventFlagID(3709, ON);
        }
    }
L0:
    WaitFor(EventFlag(3718));
    RestartEvent();
    EndEvent();
});

$Event(3879, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3878, OFF);
    if (!AnyBatchEventFlags(3860, 3864)) {
        BatchSetNetworkconnectedEventFlags(3860, 3864, OFF);
        SetNetworkconnectedEventFlagID(3860, ON);
    }
    if (EventFlag(3861) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3860, 3864, OFF);
        SetNetworkconnectedEventFlagID(3860, ON);
    }
    if (!AnyBatchEventFlags(3865, 3879)) {
        BatchSetNetworkconnectedEventFlags(3865, 3879, OFF);
        SetNetworkconnectedEventFlagID(3865, ON);
    }
    GotoIf(L0, !EventFlag(3860));
    GotoIf(S0, !EventFlag(11009210));
    BatchSetNetworkconnectedEventFlags(3865, 3879, OFF);
    SetEventFlagID(3866, ON);
S0:
L0:
    WaitFor(EventFlag(3878));
    RestartEvent();
});

$Event(3899, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3898, OFF);
    if (!AnyBatchEventFlags(3880, 3884)) {
        BatchSetNetworkconnectedEventFlags(3880, 3884, OFF);
        SetNetworkconnectedEventFlagID(3880, ON);
    }
    if (EventFlag(3881) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3880, 3884, OFF);
        SetNetworkconnectedEventFlagID(3880, ON);
    }
    if (!AnyBatchEventFlags(3885, 3899)) {
        BatchSetNetworkconnectedEventFlags(3885, 3899, OFF);
        SetNetworkconnectedEventFlagID(3885, ON);
    }
    if (EventFlag(3880)) {
        if (EventFlag(16009208)) {
            BatchSetNetworkconnectedEventFlags(3885, 3899, OFF);
            SetEventFlagID(3886, ON);
        }
        if (EventFlag(16009460)) {
            BatchSetNetworkconnectedEventFlags(3885, 3899, OFF);
            SetEventFlagID(3887, ON);
        }
        if (!EventFlag(16009208) && EventFlag(16000800)) {
            BatchSetNetworkconnectedEventFlags(3885, 3899, OFF);
            SetEventFlagID(3888, ON);
            BatchSetNetworkconnectedEventFlags(3880, 3884, OFF);
            SetEventFlagID(3883, ON);
        }
        SetEventFlagID(16009464, OFF);
        if (EventFlag(7605) || !EventFlag(3886) || EventFlag(118)) {
            SetEventFlagID(16009464, ON);
        }
    }
L0:
    GotoIf(L1, !(EventFlag(16009460) || EventFlag(3883)));
    GotoIf(L1, !(!EventFlag(16009458) || EventFlag(7605)));
    SetEventFlagID(400295, ON);
L1:
    WaitFor(EventFlag(3898));
    RestartEvent();
});

$Event(3479, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3478, OFF);
    flag = !AnyBatchEventFlags(3460, 3463);
    flag2 = !flag || !flag3;
    flag3 = EventFlag(3461) && EventFlag(3000);
    if (!flag2) {
        BatchSetNetworkconnectedEventFlags(3460, 3463, OFF);
        SetNetworkconnectedEventFlagID(3460, ON);
    }
    if (!AnyBatchEventFlags(3465, 3469)) {
        BatchSetNetworkconnectedEventFlags(3465, 3469, OFF);
        SetNetworkconnectedEventFlagID(3465, ON);
    }
    if (EventFlag(7608)) {
        BatchSetNetworkconnectedEventFlags(3460, 3463, OFF);
        SetNetworkconnectedEventFlagID(3463, ON);
    }
    if (EventFlag(3460)) {
        if (EventFlag(3465) && EventFlag(3369)) {
            BatchSetNetworkconnectedEventFlags(3465, 3469, OFF);
            SetNetworkconnectedEventFlagID(3466, ON);
        }
        if (EventFlag(1034509255) && !EventFlag(3469)) {
            SetNetworkconnectedEventFlagID(1034509259, ON);
        }
        if (EventFlag(3466) && EventFlag(1034509256) && EventFlag(9118)) {
            BatchSetNetworkconnectedEventFlags(3465, 3469, OFF);
            SetNetworkconnectedEventFlagID(3467, ON);
            SetNetworkconnectedEventFlagID(1034509269, ON);
        }
        if ((EventFlag(3363) || EventFlag(7609)) && EventFlag(9118) && EventFlag(1034509256)) {
            BatchSetNetworkconnectedEventFlags(3465, 3469, OFF);
            SetNetworkconnectedEventFlagID(3468, ON);
            SetNetworkconnectedEventFlagID(14009267, ON);
            SetNetworkconnectedEventFlagID(1034509269, OFF);
            SetNetworkconnectedEventFlagID(1051369239, OFF);
            SetNetworkconnectedEventFlagID(1034509267, OFF);
        }
        if (EventFlag(3468) && EventFlag(14009266) && (EventFlag(1044369228) || EventFlag(14009263))) {
            BatchSetNetworkconnectedEventFlags(3465, 3469, OFF);
            SetNetworkconnectedEventFlagID(3469, ON);
            SetNetworkconnectedEventFlagID(1034509259, OFF);
        }
        WaitFor(EventFlag(3478));
        RestartEvent();
    }
L0:
    EndEvent();
});

$Event(3599, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3598, OFF);
    GotoIf(S0, !AnyBatchEventFlags(3580, 3583));
    GotoIf(S1, !(EventFlag(3581) && EventFlag(3000)));
S0:
    BatchSetNetworkconnectedEventFlags(3580, 3583, OFF);
    SetNetworkconnectedEventFlagID(3580, ON);
S1:
    if (!AnyBatchEventFlags(3585, 3587)) {
        BatchSetNetworkconnectedEventFlags(3585, 3587, OFF);
        SetNetworkconnectedEventFlagID(3585, ON);
    }
    if (EventFlag(3580)) {
        if (EventFlag(3585) && EventFlag(1045389222)) {
            BatchSetNetworkconnectedEventFlags(3585, 3587, OFF);
            SetNetworkconnectedEventFlagID(3586, ON);
            SetNetworkconnectedEventFlagID(1046360706, ON);
        }
        if (EventFlag(4229) && EventFlag(1046369205)) {
            BatchSetNetworkconnectedEventFlags(3585, 3587, OFF);
            SetNetworkconnectedEventFlagID(3587, ON);
        }
        WaitFor(EventFlag(3598));
        RestartEvent();
    }
L0:
    EndEvent();
});

$Event(3819, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3818, OFF);
    GotoIf(S0, !AnyBatchEventFlags(3800, 3803));
    GotoIf(S1, !(EventFlag(3801) && EventFlag(3000)));
S0:
    BatchSetNetworkconnectedEventFlags(3800, 3803, OFF);
    SetNetworkconnectedEventFlagID(3800, ON);
S1:
    if (!AnyBatchEventFlags(3805, 3806)) {
        BatchSetNetworkconnectedEventFlags(3805, 3806, OFF);
        SetNetworkconnectedEventFlagID(3805, ON);
    }
    if (EventFlag(3800)) {
        if (EventFlag(3805) && EventFlag(1039399220)) {
            BatchSetNetworkconnectedEventFlags(3805, 3806, OFF);
            SetNetworkconnectedEventFlagID(3806, ON);
            BatchSetNetworkconnectedEventFlags(3800, 3803, OFF);
            SetNetworkconnectedEventFlagID(3803, ON);
        }
        WaitFor(EventFlag(3818));
        RestartEvent();
    }
L0:
    EndEvent();
});

$Event(3379, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3378, OFF);
    if (!AnyBatchEventFlags(3360, 3364)) {
        BatchSetNetworkconnectedEventFlags(3360, 3364, OFF);
        SetNetworkconnectedEventFlagID(3360, ON);
    }
    if (EventFlag(3361) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3360, 3364, OFF);
        SetNetworkconnectedEventFlagID(3360, ON);
    }
    if (EventFlag(7609)) {
        BatchSetNetworkconnectedEventFlags(3360, 3364, OFF);
        SetNetworkconnectedEventFlagID(3363, ON);
    }
    if (EventFlag(3360)) {
        if (!AnyBatchEventFlags(3365, 3377)) {
            BatchSetNetworkconnectedEventFlags(3365, 3377, OFF);
            SetNetworkconnectedEventFlagID(3365, ON);
        }
        if (EventFlag(3365) && EventFlag(9410)) {
            BatchSetNetworkconnectedEventFlags(3365, 3377, OFF);
            SetNetworkconnectedEventFlagID(3366, ON);
            SetEventFlagID(1051369360, ON);
        }
        if (EventFlag(3366) && EventFlag(9130)) {
            BatchSetNetworkconnectedEventFlags(3365, 3377, OFF);
            SetNetworkconnectedEventFlagID(3367, ON);
        }
        if (EventFlag(3367) && (EventFlag(1051369235) || EventFlag(1051369204))) {
            BatchSetNetworkconnectedEventFlags(3365, 3377, OFF);
            SetNetworkconnectedEventFlagID(3368, ON);
            SetEventFlagID(1051369360, OFF);
        }
        if (EventFlag(3368) && EventFlag(1044369231)) {
            BatchSetNetworkconnectedEventFlags(3365, 3377, OFF);
            SetNetworkconnectedEventFlagID(3369, ON);
            SetNetworkconnectedEventFlagID(1041339259, ON);
            SetNetworkconnectedEventFlagID(1034509254, ON);
        }
        if (EventFlag(3369) && EventFlag(1034509256) && EventFlag(9118)) {
            BatchSetNetworkconnectedEventFlags(3365, 3377, OFF);
            SetNetworkconnectedEventFlagID(3370, ON);
            SetNetworkconnectedEventFlagID(1051369239, ON);
            SetNetworkconnectedEventFlagID(1034509267, ON);
        }
        if (EventFlag(3370) && EventFlag(7608)) {
            BatchSetNetworkconnectedEventFlags(3365, 3377, OFF);
            SetNetworkconnectedEventFlagID(3371, ON);
            SetNetworkconnectedEventFlagID(1034509269, OFF);
            SetNetworkconnectedEventFlagID(1051369239, OFF);
            SetNetworkconnectedEventFlagID(1034509267, OFF);
        }
        if ((EventFlag(3371) && EventFlag(14009356))
            || (EventFlag(3463) && AnyBatchEventFlags(3368, 3370))) {
            BatchSetNetworkconnectedEventFlags(3365, 3377, OFF);
            SetNetworkconnectedEventFlagID(3372, ON);
            SetNetworkconnectedEventFlagID(1034509269, OFF);
            SetNetworkconnectedEventFlagID(1051369239, OFF);
        }
        WaitFor(EventFlag(3378));
        RestartEvent();
    }
L0:
    EndEvent();
});

$Event(3739, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3738, OFF);
    if (!AnyBatchEventFlags(3720, 3724)) {
        BatchSetNetworkconnectedEventFlags(3720, 3724, OFF);
        SetNetworkconnectedEventFlagID(3720, ON);
    }
    if (!AnyBatchEventFlags(3725, 3739)) {
        BatchSetNetworkconnectedEventFlags(3725, 3739, OFF);
        SetNetworkconnectedEventFlagID(3725, ON);
    }
    if (EventFlag(3720)) {
    }
L0:
    WaitFor(EventFlag(3738));
    RestartEvent();
    EndEvent();
});

$Event(4159, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(4158, OFF);
    if (!AnyBatchEventFlags(4140, 4144)) {
        BatchSetNetworkconnectedEventFlags(4140, 4144, OFF);
        SetNetworkconnectedEventFlagID(4140, ON);
    }
    if (EventFlag(4141) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(4140, 4144, OFF);
        SetNetworkconnectedEventFlagID(4140, ON);
    }
    if (!AnyBatchEventFlags(4145, 4157)) {
        BatchSetNetworkconnectedEventFlags(4145, 4159, OFF);
        SetNetworkconnectedEventFlagID(4145, ON);
    }
    if (EventFlag(4140)) {
        if ((!EventFlag(35009316) || EventFlag(1045520180))
            && EventFlag(1036439213)
            && EventFlag(3063)
            && !EventFlag(1044522701)) {
            BatchSetNetworkconnectedEventFlags(4145, 4159, OFF);
            SetNetworkconnectedEventFlagID(4146, ON);
        }
        if (EventFlag(1044529259)) {
            BatchSetNetworkconnectedEventFlags(4145, 4159, OFF);
            SetNetworkconnectedEventFlagID(4147, ON);
        }
    }
L0:
    WaitFor(EventFlag(4158));
    RestartEvent();
});

$Event(3799, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3798, OFF);
    GotoIf(S0, !AnyBatchEventFlags(3780, 3783));
    GotoIf(S1, !(EventFlag(3781) && EventFlag(3000)));
S0:
    BatchSetNetworkconnectedEventFlags(3780, 3783, OFF);
    SetNetworkconnectedEventFlagID(3780, ON);
S1:
    if (!AnyBatchEventFlags(3785, 3787)) {
        BatchSetNetworkconnectedEventFlags(3785, 3787, OFF);
        SetNetworkconnectedEventFlagID(3785, ON);
    }
    if (EventFlag(3780)) {
        if (EventFlag(3785) && EventFlag(9122)) {
            BatchSetNetworkconnectedEventFlags(3785, 3787, OFF);
            SetNetworkconnectedEventFlagID(3786, ON);
        }
        WaitFor(EventFlag(3798));
        RestartEvent();
    }
L0:
    EndEvent();
});

$Event(3859, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (!AnyBatchEventFlags(3840, 3844)) {
        BatchSetNetworkconnectedEventFlags(3840, 3844, OFF);
        SetNetworkconnectedEventFlagID(3840, ON);
    }
    if (EventFlag(3841)) {
        BatchSetNetworkconnectedEventFlags(3840, 3844, OFF);
        SetNetworkconnectedEventFlagID(3840, ON);
    }
    if (!AnyBatchEventFlags(3845, 3859)) {
        BatchSetNetworkconnectedEventFlags(3845, 3859, OFF);
        SetNetworkconnectedEventFlagID(3845, ON);
    }
    GotoIf(L0, !EventFlag(3840));
    GotoIf(S0, !EventFlag(1051569206));
    BatchSetNetworkconnectedEventFlags(3845, 3859, OFF);
    SetEventFlagID(3846, ON);
S0:
L0:
    EndEvent();
});

$Event(3959, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3958, OFF);
    if (!AnyBatchEventFlags(3940, 3944)) {
        BatchSetNetworkconnectedEventFlags(3940, 3944, OFF);
        SetNetworkconnectedEventFlagID(3940, ON);
    }
    if (EventFlag(11109306)) {
        BatchSetNetworkconnectedEventFlags(3940, 3944, OFF);
        SetNetworkconnectedEventFlagID(3943, ON);
    }
    if (EventFlag(3941) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3940, 3944, OFF);
        SetNetworkconnectedEventFlagID(3940, ON);
    }
    if (!AnyBatchEventFlags(3945, 3949)) {
        BatchSetNetworkconnectedEventFlags(3945, 3949, OFF);
        SetNetworkconnectedEventFlagID(3945, ON);
    }
    if (EventFlag(3940)) {
        if (EventFlag(3945) && EventFlag(1043379356)) {
            BatchSetNetworkconnectedEventFlags(3945, 3949, OFF);
            SetNetworkconnectedEventFlagID(3946, ON);
        }
        if (EventFlag(3946) && EventFlag(31159206)) {
            BatchSetNetworkconnectedEventFlags(3945, 3949, OFF);
            SetEventFlagID(3947, ON);
        }
        if (EventFlag(3947) && !EventFlag(1039409260) && EventFlag(11109808) && EventFlag(9118)) {
            BatchSetNetworkconnectedEventFlags(3945, 3949, OFF);
            SetEventFlagID(3948, ON);
        }
        if (EventFlag(3947) && !EventFlag(1039409260) && EventFlag(11109812) && EventFlag(9118)) {
            BatchSetNetworkconnectedEventFlags(3945, 3949, OFF);
            SetEventFlagID(3949, ON);
            BatchSetNetworkconnectedEventFlags(3940, 3944, OFF);
            SetNetworkconnectedEventFlagID(3943, ON);
        }
    }
L0:
    EndEvent();
});

$Event(3759, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3758, OFF);
    if (!AnyBatchEventFlags(3740, 3743)) {
        BatchSetNetworkconnectedEventFlags(3740, 3743, OFF);
        SetNetworkconnectedEventFlagID(3740, ON);
    }
    if (EventFlag(3748) && EventFlag(1034509425)) {
        BatchSetNetworkconnectedEventFlags(3740, 3743, OFF);
        SetNetworkconnectedEventFlagID(3741, ON);
        SetEventFlagID(1034509425, OFF);
        SetEventFlagID(1034509403, ON);
    }
    if (!AnyBatchEventFlags(3745, 3757)) {
        BatchSetNetworkconnectedEventFlags(3745, 3757, OFF);
        SetNetworkconnectedEventFlagID(3745, ON);
    }
    if (AnyBatchEventFlags(3745, 3749) && EventFlag(1035420150)) {
        BatchSetNetworkconnectedEventFlags(3740, 3743, OFF);
        SetNetworkconnectedEventFlagID(3740, ON);
        BatchSetNetworkconnectedEventFlags(3745, 3757, OFF);
        SetNetworkconnectedEventFlagID(3750, ON);
        SetEventFlagID(1042369415, OFF);
    }
    if (EventFlag(3746) && !EventFlag(1042369410) && !EventFlag(1042369407)) {
        BatchSetNetworkconnectedEventFlags(3745, 3757, OFF);
        SetNetworkconnectedEventFlagID(3745, ON);
        SetEventFlagID(1042369415, OFF);
    }
    if (EventFlag(3745) && EventFlag(1042369411)) {
        BatchSetNetworkconnectedEventFlags(3745, 3757, OFF);
        SetNetworkconnectedEventFlagID(3746, ON);
        SetEventFlagID(1042369411, OFF);
        SetEventFlagID(1042369414, ON);
        SetEventFlagID(1042369415, ON);
        SetEventFlagID(4718, ON);
    }
    if (EventFlag(3746) && (EventFlag(1042369410) || EventFlag(1042369407))) {
        BatchSetNetworkconnectedEventFlags(3745, 3757, OFF);
        SetNetworkconnectedEventFlagID(3747, ON);
        SetEventFlagID(1042369413, ON);
        SetEventFlagID(1042369415, OFF);
    }
    if (AnyBatchEventFlags(3745, 3746) && (EventFlag(1034509419) || EventFlag(3062))) {
        BatchSetNetworkconnectedEventFlags(3745, 3757, OFF);
        SetNetworkconnectedEventFlagID(3747, ON);
        SetEventFlagID(1042369415, OFF);
        if (!EventFlag(1042369410)) {
            SetEventFlagID(1042369416, ON);
            SetEventFlagID(11109785, ON);
        }
    }
    if (EventFlag(3740)) {
        if (EventFlag(3747) && EventFlag(1034509416)) {
            BatchSetNetworkconnectedEventFlags(3745, 3757, OFF);
            SetNetworkconnectedEventFlagID(3748, ON);
        }
        if (EventFlag(3748) && EventFlag(1034509421)) {
            BatchSetNetworkconnectedEventFlags(3745, 3757, OFF);
            SetNetworkconnectedEventFlagID(3749, ON);
            SetNetworkconnectedEventFlagID(1034510739, ON);
            SetNetworkconnectedEventFlagID(1034500703, ON);
            SetEventFlagID(1034509430, ON);
            SetEventFlagID(1034509433, ON);
            SetEventFlagID(3578, ON);
        }
        if (EventFlag(3750) && EventFlag(1034509406)) {
            BatchSetNetworkconnectedEventFlags(3745, 3757, OFF);
            SetNetworkconnectedEventFlagID(3751, ON);
            SetEventFlagID(1035429255, ON);
        }
    }
L0:
    WaitFor(EventFlag(3758));
    RestartEvent();
});

$Event(3619, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3618, OFF);
    if (!AnyBatchEventFlags(3600, 3603)) {
        BatchSetNetworkconnectedEventFlags(3600, 3603, OFF);
        SetNetworkconnectedEventFlagID(3600, ON);
    }
    if (!AnyBatchEventFlags(3605, 3617)) {
        BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
        SetNetworkconnectedEventFlagID(3605, ON);
    }
    GotoIf(L1, EventFlag(3617));
    GotoIf(L1, !EventFlag(3603));
    BatchSetNetworkconnectedEventFlags(3600, 3603, OFF);
    SetNetworkconnectedEventFlagID(3601, ON);
    SetEventFlagID(1045379207, ON);
    SetEventFlagID(1045379202, OFF);
    SetEventFlagID(1044349252, OFF);
    SetEventFlagID(12029152, OFF);
    SetEventFlagID(1051369352, OFF);
    SetEventFlagID(1052389302, OFF);
L1:
    if (EventFlag(3600)) {
        SetEventFlagID(1045379207, OFF);
        SetEventFlagID(1045379209, OFF);
    }
    if (EventFlag(3600)) {
        if (EventFlag(3612) && !EventFlag(9411)) {
            BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
            SetNetworkconnectedEventFlagID(3611, ON);
            SetEventFlagID(1051369359, OFF);
        }
        if (EventFlag(3611) && !EventFlag(1051369358) && !EventFlag(12029157)) {
            BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
            SetNetworkconnectedEventFlagID(3605, ON);
            SetEventFlagID(1051369357, OFF);
        }
        if (AnyBatchEventFlags(3605, 3610) && EventFlag(9412) && !EventFlag(1051369357)) {
            BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
            SetNetworkconnectedEventFlagID(3614, ON);
        }
        if (EventFlag(3606) && !EventFlag(1044350800)) {
            BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
            SetNetworkconnectedEventFlagID(3605, ON);
            SetEventFlagID(1044349257, OFF);
        }
        if (EventFlag(3605) && EventFlag(1045379205) && EventFlag(1044352717)) {
            BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
            SetNetworkconnectedEventFlagID(3606, ON);
            SetEventFlagID(1044349257, ON);
        }
        if (AnyBatchEventFlags(3605, 3606) && EventFlag(1045379205) && EventFlag(1044350800)) {
            BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
            SetNetworkconnectedEventFlagID(3607, ON);
            SetEventFlagID(1044349257, OFF);
        }
        if (EventFlag(3607) && EventFlag(1044349255)) {
            BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
            SetNetworkconnectedEventFlagID(3608, ON);
        }
        if (AnyBatchEventFlags(3605, 3608) && EventFlag(1034509410)) {
            BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
            SetNetworkconnectedEventFlagID(3609, ON);
        }
        if (EventFlag(3609) && EventFlag(1034509416)) {
            BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
            SetNetworkconnectedEventFlagID(3610, ON);
        }
        if (AnyBatchEventFlags(3605, 3610)
            && EventFlag(9410)
            && (EventFlag(12029157) || EventFlag(1051362739))) {
            BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
            SetNetworkconnectedEventFlagID(3611, ON);
            SetEventFlagID(1051369357, ON);
        }
        if (EventFlag(3611) && EventFlag(9411)) {
            BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
            SetNetworkconnectedEventFlagID(3612, ON);
            SetEventFlagID(1051369359, ON);
            SetEventFlagID(1051369358, ON);
        }
        if (EventFlag(3612) && EventFlag(9412)) {
            BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
            SetNetworkconnectedEventFlagID(3613, ON);
            SetEventFlagID(1051369359, OFF);
        }
        if (EventFlag(3613) && (EventFlag(1052389306) || EventFlag(1034499238) || EventFlag(12027080))) {
            BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
            SetNetworkconnectedEventFlagID(3614, ON);
            SetEventFlagID(1051369357, OFF);
        }
        if (EventFlag(3614) && EventFlag(1044350800) && EventFlag(1034509410)) {
            BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
            SetNetworkconnectedEventFlagID(3615, ON);
            SetEventFlagID(1044359259, ON);
        }
        if (EventFlag(3615) && EventFlag(1044359256)) {
            BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
            SetNetworkconnectedEventFlagID(3616, ON);
            SetEventFlagID(1044359259, OFF);
        }
    }
L0:
    GotoIf(L2, !AnyBatchEventFlags(3605, 3616));
    GotoIf(L2, !EventFlag(9108));
    GotoIf(L2, !EventFlag(114));
    BatchSetNetworkconnectedEventFlags(3605, 3617, OFF);
    SetNetworkconnectedEventFlagID(3617, ON);
    SetEventFlagID(1044359259, OFF);
L2:
    WaitFor(EventFlag(3618));
    RestartEvent();
});

$Event(3579, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3578, OFF);
    if (!AnyBatchEventFlags(3560, 3563)) {
        BatchSetNetworkconnectedEventFlags(3560, 3563, OFF);
        SetNetworkconnectedEventFlagID(3560, ON);
        SetEventFlagID(1034509349, ON);
    }
    if (!AnyBatchEventFlags(3565, 3577)) {
        BatchSetNetworkconnectedEventFlags(3565, 3577, OFF);
        SetNetworkconnectedEventFlagID(3565, ON);
    }
    if (EventFlag(3560)) {
        if (EventFlag(3565) && EventFlag(1034509410)) {
            BatchSetNetworkconnectedEventFlags(3565, 3577, OFF);
            SetNetworkconnectedEventFlagID(3566, ON);
        }
        if (EventFlag(3566) && EventFlag(1034509416)) {
            BatchSetNetworkconnectedEventFlags(3565, 3577, OFF);
            SetNetworkconnectedEventFlagID(3567, ON);
        }
        if (EventFlag(3567) && EventFlag(1034509315)) {
            BatchSetNetworkconnectedEventFlags(3565, 3577, OFF);
            SetNetworkconnectedEventFlagID(3568, ON);
        }
        if (AnyBatchEventFlags(3565, 3568) && EventFlag(1034509424)) {
            BatchSetNetworkconnectedEventFlags(3565, 3577, OFF);
            SetNetworkconnectedEventFlagID(3569, ON);
            if (!EventFlag(11109919)) {
                SetEventFlagID(1035509215, ON);
            } else {
                SetEventFlagID(1035509216, ON);
            }
        }
        if (AnyBatchEventFlags(3565, 3568) && EventFlag(1034509433)) {
            BatchSetNetworkconnectedEventFlags(3565, 3577, OFF);
            SetNetworkconnectedEventFlagID(3569, ON);
            if (!EventFlag(11109919)) {
                SetEventFlagID(1035509215, ON);
            } else {
                SetEventFlagID(1035509216, ON);
            }
        }
    }
L0:
    WaitFor(EventFlag(3578));
    RestartEvent();
});

$Event(3779, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3778, OFF);
    if (!AnyBatchEventFlags(3760, 3763)) {
        BatchSetNetworkconnectedEventFlags(3760, 3763, OFF);
        SetNetworkconnectedEventFlagID(3760, ON);
    }
    if (!AnyBatchEventFlags(3765, 3777)) {
        BatchSetNetworkconnectedEventFlags(3765, 3777, OFF);
        SetNetworkconnectedEventFlagID(3765, ON);
    }
    if (EventFlag(3760)) {
        if (EventFlag(3765) && EventFlag(1034509410)) {
            BatchSetNetworkconnectedEventFlags(3765, 3777, OFF);
            SetNetworkconnectedEventFlagID(3766, ON);
            BatchSetEventFlags(1034509360, 1034509361, ON);
        }
        if (EventFlag(3766) && EventFlag(1034509416)) {
            BatchSetNetworkconnectedEventFlags(3765, 3777, OFF);
            SetNetworkconnectedEventFlagID(3767, ON);
        }
        if (AnyBatchEventFlags(3765, 3767) && EventFlag(1034499242)) {
            BatchSetNetworkconnectedEventFlags(3765, 3777, OFF);
            SetNetworkconnectedEventFlagID(3768, ON);
            BatchSetNetworkconnectedEventFlags(3760, 3763, OFF);
            SetNetworkconnectedEventFlagID(3763, ON);
        }
    }
L0:
    WaitFor(EventFlag(3778));
    RestartEvent();
});

$Event(3919, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3918, OFF);
    if (!AnyBatchEventFlags(3900, 3903)) {
        BatchSetNetworkconnectedEventFlags(3900, 3903, OFF);
        SetNetworkconnectedEventFlagID(3900, ON);
        SetEventFlagID(400357, ON);
    }
    if (!AnyBatchEventFlags(3905, 3917)) {
        BatchSetNetworkconnectedEventFlags(3905, 3917, OFF);
        SetNetworkconnectedEventFlagID(3905, ON);
    }
    if (EventFlag(3900)) {
        if (EventFlag(3905) && (EventFlag(9101) || EventFlag(10009610))) {
            BatchSetNetworkconnectedEventFlags(3905, 3917, OFF);
            SetNetworkconnectedEventFlagID(3906, ON);
        }
        if (EventFlag(3906) && EventFlag(9101)) {
            BatchSetNetworkconnectedEventFlags(3905, 3917, OFF);
            SetNetworkconnectedEventFlagID(3907, ON);
        }
        if (AnyBatchEventFlags(3905, 3907) && (EventFlag(11109532) || EventFlag(1034509421))) {
            BatchSetNetworkconnectedEventFlags(3905, 3917, OFF);
            SetNetworkconnectedEventFlagID(3908, ON);
        }
        if (AnyBatchEventFlags(3905, 3907)
            && EventFlag(110)
            && (!EventFlag(11109506) || EventFlag(1034509410) || EventFlag(1034509431))) {
            BatchSetNetworkconnectedEventFlags(3905, 3917, OFF);
            SetNetworkconnectedEventFlagID(3908, ON);
        }
        if (EventFlag(3908) && EventValue(11109545, 5) >= 2) {
            BatchSetNetworkconnectedEventFlags(3905, 3917, OFF);
            SetNetworkconnectedEventFlagID(3909, ON);
            BatchSetNetworkconnectedEventFlags(3900, 3903, OFF);
            SetNetworkconnectedEventFlagID(3903, ON);
        }
    }
L0:
    SetEventFlagID(10009614, OFF);
    if (EventFlag(3905)) {
        SetEventFlagID(10009614, ON);
    }
    WaitFor(EventFlag(3918));
    RestartEvent();
    EndEvent();
});

$Event(4139, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(4138, OFF);
    if (!AnyBatchEventFlags(4120, 4123)) {
        BatchSetNetworkconnectedEventFlags(4120, 4123, OFF);
        SetNetworkconnectedEventFlagID(4120, ON);
    }
    if (!AnyBatchEventFlags(4125, 4137)) {
        BatchSetNetworkconnectedEventFlags(4125, 4137, OFF);
        SetNetworkconnectedEventFlagID(4125, ON);
    }
    if (EventFlag(4120)) {
        if (EventFlag(4125) && EventFlag(4047) && EventFlag(11109625)) {
            BatchSetNetworkconnectedEventFlags(4125, 4137, OFF);
            SetNetworkconnectedEventFlagID(4126, ON);
            BatchSetNetworkconnectedEventFlags(4045, 4057, OFF);
            SetNetworkconnectedEventFlagID(4048, ON);
            BatchSetNetworkconnectedEventFlags(4040, 4043, OFF);
            SetNetworkconnectedEventFlagID(4043, ON);
            SetEventFlagID(4058, ON);
        }
        if (EventFlag(4126) && EventFlag(11109015)) {
            BatchSetNetworkconnectedEventFlags(4125, 4137, OFF);
            SetNetworkconnectedEventFlagID(4127, ON);
        }
        if (EventFlag(4125) && EventFlag(4043) && (EventFlag(3063) || EventFlag(9410))) {
            BatchSetNetworkconnectedEventFlags(4125, 4137, OFF);
            SetNetworkconnectedEventFlagID(4127, ON);
        }
        if (AnyBatchEventFlags(4125, 4126) && EventFlag(110)) {
            BatchSetNetworkconnectedEventFlags(4125, 4137, OFF);
            SetNetworkconnectedEventFlagID(4127, ON);
            if (!EventFlag(4043)) {
                BatchSetNetworkconnectedEventFlags(4045, 4057, OFF);
                SetNetworkconnectedEventFlagID(4048, ON);
                BatchSetNetworkconnectedEventFlags(4040, 4043, OFF);
                SetNetworkconnectedEventFlagID(4043, ON);
            }
            SetEventFlagID(4058, ON);
        }
        if (EventFlag(4127) && EventFlag(12030800)) {
            BatchSetNetworkconnectedEventFlags(4125, 4137, OFF);
            SetNetworkconnectedEventFlagID(4128, ON);
        }
        if (EventFlag(4128) && EventFlag(12039157)) {
            BatchSetNetworkconnectedEventFlags(4125, 4137, OFF);
            SetNetworkconnectedEventFlagID(4129, ON);
        }
        if (EventFlag(4129) && EventFlag(12039158)) {
            BatchSetNetworkconnectedEventFlags(4125, 4137, OFF);
            SetNetworkconnectedEventFlagID(4130, ON);
        }
        if (EventFlag(4137) && !EventFlag(12030850)) {
            BatchSetNetworkconnectedEventFlags(4125, 4137, OFF);
            SetNetworkconnectedEventFlagID(4130, ON);
        }
        if (EventFlag(4130) && EventFlag(12032870)) {
            BatchSetNetworkconnectedEventFlags(4125, 4137, OFF);
            SetNetworkconnectedEventFlagID(4137, ON);
        }
        if (EventFlag(4130) && EventFlag(12030850)) {
            BatchSetNetworkconnectedEventFlags(4125, 4137, OFF);
            SetNetworkconnectedEventFlagID(4131, ON);
        }
        if (EventFlag(4137) && EventFlag(12030850)) {
            BatchSetNetworkconnectedEventFlags(4125, 4137, OFF);
            SetNetworkconnectedEventFlagID(4131, ON);
        }
    }
L0:
    if (EventFlag(9502) || (AnyBatchEventFlags(4125, 4129) && EventFlag(4123))) {
        SetEventFlagID(12039162, ON);
    }
    WaitFor(EventFlag(4138));
    RestartEvent();
    EndEvent();
});

$Event(4059, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(4058, OFF);
    if (!AnyBatchEventFlags(4040, 4043)) {
        BatchSetNetworkconnectedEventFlags(4040, 4043, OFF);
        SetNetworkconnectedEventFlagID(4040, ON);
    }
    if (!AnyBatchEventFlags(4045, 4057)) {
        BatchSetNetworkconnectedEventFlags(4045, 4057, OFF);
        SetNetworkconnectedEventFlagID(4045, ON);
    }
    if (EventFlag(4040)) {
        if (EventFlag(4045) && EventFlag(1045390800)) {
            BatchSetNetworkconnectedEventFlags(4045, 4057, OFF);
            SetNetworkconnectedEventFlagID(4046, ON);
        }
        if (EventFlag(4046) && (EventFlag(1045399206) || EventFlag(11109609))) {
            BatchSetNetworkconnectedEventFlags(4045, 4057, OFF);
            SetNetworkconnectedEventFlagID(4047, ON);
        }
        if (AnyBatchEventFlags(4045, 4046)
            && (EventFlag(132) || EventFlag(3064) || EventFlag(3063) || EventFlag(1051439205))) {
            BatchSetNetworkconnectedEventFlags(4045, 4057, OFF);
            SetNetworkconnectedEventFlagID(4047, ON);
        }
    }
L0:
    SetEventFlagID(11109648, OFF);
    SetEventFlagID(11109649, OFF);
    if (EventFlag(4040)
        && EventFlag(4047)
        && EventFlag(1044399206)
        && (EventFlag(1045399206) || EventFlag(1051439205))) {
        SetEventFlagID(11109648, ON);
        SetEventFlagID(11109649, ON);
    }
    WaitFor(EventFlag(4058));
    RestartEvent();
    EndEvent();
});

$Event(4079, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(4078, OFF);
    if (!AnyBatchEventFlags(4060, 4063)) {
        BatchSetNetworkconnectedEventFlags(4060, 4063, OFF);
        SetNetworkconnectedEventFlagID(4060, ON);
    }
    if (!AnyBatchEventFlags(4065, 4077)) {
        BatchSetNetworkconnectedEventFlags(4065, 4077, OFF);
        SetNetworkconnectedEventFlagID(4065, ON);
    }
    if (EventFlag(4060)) {
        if (EventFlag(4065) && EventFlag(12029016) && EventFlag(4048)) {
            BatchSetNetworkconnectedEventFlags(4065, 4077, OFF);
            SetNetworkconnectedEventFlagID(4077, ON);
            SetEventFlagID(12029019, ON);
        }
        if (EventFlag(4065) && EventFlag(12029016) && !EventFlag(4048)) {
            BatchSetNetworkconnectedEventFlags(4060, 4063, OFF);
            SetNetworkconnectedEventFlagID(4062, ON);
        }
        if (EventFlag(4077) && EventFlag(9502) && EventFlag(4131)) {
            BatchSetNetworkconnectedEventFlags(4065, 4077, OFF);
            SetNetworkconnectedEventFlagID(4066, ON);
            BatchSetNetworkconnectedEventFlags(4125, 4137, OFF);
            SetNetworkconnectedEventFlagID(4132, ON);
            BatchSetNetworkconnectedEventFlags(4120, 4123, OFF);
            SetNetworkconnectedEventFlagID(4123, ON);
            SetEventFlagID(12029019, OFF);
        }
        if (EventFlag(4066) && EventFlag(12039005)) {
            BatchSetNetworkconnectedEventFlags(4065, 4077, OFF);
            SetNetworkconnectedEventFlagID(4067, ON);
        }
        if (EventFlag(4077) && EventFlag(4123) && AnyBatchEventFlags(4128, 4129)) {
            BatchSetNetworkconnectedEventFlags(4065, 4077, OFF);
            SetNetworkconnectedEventFlagID(4067, ON);
            SetEventFlagID(12029019, OFF);
        }
    }
L0:
    WaitFor(EventFlag(4078));
    RestartEvent();
    EndEvent();
});

$Event(4119, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    if (!AnyBatchEventFlags(4100, 4104)) {
        BatchSetNetworkconnectedEventFlags(4100, 4104, OFF);
        SetNetworkconnectedEventFlagID(4100, ON);
    }
    if (EventFlag(4101) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(4100, 4104, OFF);
        SetNetworkconnectedEventFlagID(4100, ON);
    }
    if (!AnyBatchEventFlags(4105, 4119)) {
        BatchSetNetworkconnectedEventFlags(4105, 4119, OFF);
        SetNetworkconnectedEventFlagID(4105, ON);
    }
    GotoIf(L0, !EventFlag(4100));
    GotoIf(S0, !EventFlag(1036419209));
    BatchSetNetworkconnectedEventFlags(4105, 4119, OFF);
    SetNetworkconnectedEventFlagID(4106, ON);
S0:
L0:
    EndEvent();
});

$Event(4179, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(4178, OFF);
    GotoIf(S0, !AnyBatchEventFlags(4160, 4163));
    GotoIf(S1, !(EventFlag(4161) && EventFlag(3000)));
S0:
    BatchSetNetworkconnectedEventFlags(4160, 4163, OFF);
    SetNetworkconnectedEventFlagID(4160, ON);
S1:
    if (!AnyBatchEventFlags(4165, 4177)) {
        BatchSetNetworkconnectedEventFlags(4165, 4177, OFF);
        SetNetworkconnectedEventFlagID(4165, ON);
        SetNetworkconnectedEventFlagID(1050389209, ON);
    }
    if (AnyBatchEventFlags(4165, 4168) && EventFlag(4163)) {
        SetEventFlagID(1050382702, ON);
    }
    if (!AnyBatchEventFlags(4169, 4170)) {
        BatchSetNetworkconnectedEventFlags(4160, 4163, OFF);
        SetNetworkconnectedEventFlagID(4160, ON);
    }
    if (EventFlag(4160)) {
        if (EventFlag(4165) && EventFlag(1050389207)) {
            BatchSetNetworkconnectedEventFlags(4165, 4177, OFF);
            SetNetworkconnectedEventFlagID(4166, ON);
            SetNetworkconnectedEventFlagID(1050389209, OFF);
        }
        if (EventFlag(4166) && EventFlag(1050389255)) {
            BatchSetNetworkconnectedEventFlags(4165, 4177, OFF);
            SetNetworkconnectedEventFlagID(4167, ON);
            SetNetworkconnectedEventFlagID(1050389209, OFF);
        }
        if (EventFlag(4167) && EventFlag(4193)) {
            BatchSetNetworkconnectedEventFlags(4165, 4177, OFF);
            SetNetworkconnectedEventFlagID(4168, ON);
            SetNetworkconnectedEventFlagID(1050389209, OFF);
        }
        if (AnyBatchEventFlags(4191, 4192)) {
            BatchSetNetworkconnectedEventFlags(4165, 4177, OFF);
            SetNetworkconnectedEventFlagID(4169, ON);
            SetNetworkconnectedEventFlagID(1050389209, OFF);
        }
        if (EventFlag(7611)) {
            BatchSetNetworkconnectedEventFlags(4165, 4177, OFF);
            SetNetworkconnectedEventFlagID(4171, ON);
            SetNetworkconnectedEventFlagID(1050389209, OFF);
            BatchSetNetworkconnectedEventFlags(4160, 4163, OFF);
            SetNetworkconnectedEventFlagID(4163, ON);
        }
        if (!AnyBatchEventFlags(4191, 4192) && EventFlag(4183)) {
            BatchSetNetworkconnectedEventFlags(4165, 4177, OFF);
            SetNetworkconnectedEventFlagID(4170, ON);
            SetNetworkconnectedEventFlagID(1050389209, OFF);
        }
        WaitFor(EventFlag(4178));
        RestartEvent();
    }
L0:
    EndEvent();
});

$Event(4199, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(4198, OFF);
    if (!AnyBatchEventFlags(4180, 4183)) {
        BatchSetNetworkconnectedEventFlags(4180, 4183, OFF);
        SetNetworkconnectedEventFlagID(4180, ON);
    }
    if (EventFlag(4181) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(4180, 4183, OFF);
        SetNetworkconnectedEventFlagID(4180, ON);
    }
L5:
    if (!AnyBatchEventFlags(4185, 4197)) {
        BatchSetNetworkconnectedEventFlags(4185, 4197, OFF);
        SetNetworkconnectedEventFlagID(4185, ON);
        SetNetworkconnectedEventFlagID(1050389259, ON);
    }
    if (EventFlag(4180)) {
        if (EventFlag(4185) && EventFlag(1050389255)) {
            BatchSetNetworkconnectedEventFlags(4185, 4197, OFF);
            SetNetworkconnectedEventFlagID(4186, ON);
            SetNetworkconnectedEventFlagID(1050389259, OFF);
        }
        if (EventFlag(4186) && EventFlag(1050389257)) {
            BatchSetNetworkconnectedEventFlags(4185, 4197, OFF);
            SetNetworkconnectedEventFlagID(4187, ON);
            if (EventFlag(1050389266)) {
                SetNetworkconnectedEventFlagID(4197, ON);
            }
        }
        if (EventFlag(4187) && EventFlag(1050389266) && !EventFlag(1038519257)) {
            SetNetworkconnectedEventFlagID(1042559206, ON);
            SetNetworkconnectedEventFlagID(1042559207, OFF);
            SetNetworkconnectedEventFlagID(1042559208, OFF);
            SetNetworkconnectedEventFlagID(1042559209, OFF);
        }
        if (EventFlag(4187) && EventFlag(1042550800) && EventFlag(1038519257)) {
            BatchSetNetworkconnectedEventFlags(4185, 4197, OFF);
            SetNetworkconnectedEventFlagID(4188, ON);
        }
        if (EventFlag(4188) && EventFlag(1042559205)) {
            BatchSetNetworkconnectedEventFlags(4185, 4197, OFF);
            SetNetworkconnectedEventFlagID(4189, ON);
        }
        if (EventFlag(4189) && EventFlag(1051569256)) {
            BatchSetNetworkconnectedEventFlags(4185, 4197, OFF);
            SetNetworkconnectedEventFlagID(4190, ON);
        }
        if (AnyBatchEventFlags(4187, 4190) && EventFlag(1050389266) && EventFlag(1038519257)) {
            SetNetworkconnectedEventFlagID(1042559206, OFF);
            SetNetworkconnectedEventFlagID(1042559207, ON);
            SetNetworkconnectedEventFlagID(1042559208, ON);
            SetNetworkconnectedEventFlagID(1042559209, ON);
        }
        if (EventFlag(4190)
            && EventFlag(15009206)
            && EventFlag(15000398)
            && (EventFlag(1050389227) || EventFlag(15009213))) {
            BatchSetNetworkconnectedEventFlags(4185, 4197, OFF);
            SetNetworkconnectedEventFlagID(4193, ON);
            SetNetworkconnectedEventFlagID(15009208, ON);
            SetNetworkconnectedEventFlagID(15009209, ON);
            SetNetworkconnectedEventFlagID(1042559206, OFF);
            SetNetworkconnectedEventFlagID(1042559207, OFF);
            SetNetworkconnectedEventFlagID(1042559208, OFF);
            SetNetworkconnectedEventFlagID(1042559209, OFF);
        }
        if (EventFlag(4193) && EventFlag(7610)) {
            BatchSetNetworkconnectedEventFlags(4185, 4197, OFF);
            SetNetworkconnectedEventFlagID(4191, ON);
            SetNetworkconnectedEventFlagID(15009208, OFF);
            SetNetworkconnectedEventFlagID(15009209, OFF);
        }
        if (EventFlag(4193) && EventFlag(7611)) {
            BatchSetNetworkconnectedEventFlags(4185, 4197, OFF);
            SetNetworkconnectedEventFlagID(4194, ON);
            SetNetworkconnectedEventFlagID(15009208, OFF);
            SetNetworkconnectedEventFlagID(15009209, OFF);
        }
        if (EventFlag(4191) && EventFlag(15009211)) {
            BatchSetNetworkconnectedEventFlags(4185, 4197, OFF);
            SetNetworkconnectedEventFlagID(4192, ON);
        }
        WaitFor(EventFlag(4198));
        RestartEvent();
    }
L0:
    EndEvent();
});

$Event(3979, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3978, OFF);
    GotoIf(S0, !AnyBatchEventFlags(3960, 3963));
    GotoIf(S1, !(EventFlag(3961) && EventFlag(3000)));
S0:
    BatchSetNetworkconnectedEventFlags(3960, 3963, OFF);
    SetNetworkconnectedEventFlagID(3960, ON);
S1:
    if (!AnyBatchEventFlags(3965, 3968)) {
        BatchSetNetworkconnectedEventFlags(3965, 3968, OFF);
        SetNetworkconnectedEventFlagID(3965, ON);
    }
    if (EventFlag(3960)) {
        if ((EventFlag(3965) && EventFlag(11109659)) || (EventFlag(181) && EventFlag(11109659))) {
            BatchSetNetworkconnectedEventFlags(3965, 3968, OFF);
            SetNetworkconnectedEventFlagID(3966, ON);
        }
        if (EventFlag(110)
            || (EventFlag(3966) && EventFlag(11109358) && EventFlag(11109660))
            || (EventFlag(181) && EventFlag(11109659))) {
            BatchSetNetworkconnectedEventFlags(3965, 3968, OFF);
            SetNetworkconnectedEventFlagID(3967, ON);
        }
        if (EventFlag(9116)) {
            BatchSetNetworkconnectedEventFlags(3965, 3968, OFF);
            SetNetworkconnectedEventFlagID(3968, ON);
        }
        WaitFor(EventFlag(3978));
        RestartEvent();
    }
L0:
    EndEvent();
});

$Event(4219, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(4218, OFF);
    GotoIf(S0, !AnyBatchEventFlags(4200, 4203));
    GotoIf(S1, !(EventFlag(4201) && EventFlag(3000)));
S0:
    BatchSetNetworkconnectedEventFlags(4200, 4203, OFF);
    SetNetworkconnectedEventFlagID(4200, ON);
S1:
    if (!AnyBatchEventFlags(4205, 4217)) {
        BatchSetNetworkconnectedEventFlags(4205, 4217, OFF);
        SetNetworkconnectedEventFlagID(4205, ON);
    }
    if (EventFlag(4200)) {
        if (!EventFlag(11009555) && EventFlag(110)) {
            BatchSetNetworkconnectedEventFlags(4200, 4203, OFF);
            SetNetworkconnectedEventFlagID(4203, ON);
            SetNetworkconnectedEventFlagID(4217, ON);
        } else {
            if (EventFlag(4205) && EventFlag(11109859)) {
                BatchSetNetworkconnectedEventFlags(4205, 4217, OFF);
                SetNetworkconnectedEventFlagID(4206, ON);
            }
            if (EventFlag(4206) && EventFlag(1040529259)) {
                BatchSetNetworkconnectedEventFlags(4205, 4217, OFF);
                SetNetworkconnectedEventFlagID(4207, ON);
            }
            if (EventFlag(4207) && EventFlag(1040549205)) {
                BatchSetNetworkconnectedEventFlags(4205, 4217, OFF);
                SetNetworkconnectedEventFlagID(4208, ON);
            }
            if (EventFlag(4208) && EventFlag(11009555)) {
                BatchSetNetworkconnectedEventFlags(4205, 4217, OFF);
                SetNetworkconnectedEventFlagID(4209, ON);
            }
            if (EventFlag(4209) && EventFlag(9116) && !EventFlag(1051569361)) {
                BatchSetNetworkconnectedEventFlags(4205, 4217, OFF);
                SetNetworkconnectedEventFlagID(4210, ON);
            }
            if (EventFlag(4209) && EventFlag(9116) && EventFlag(1051569361)) {
                BatchSetNetworkconnectedEventFlags(4205, 4217, OFF);
                SetNetworkconnectedEventFlagID(4211, ON);
            }
            if (!(!EventFlag(1051569362) && !EventFlag(11059207))) {
                BatchSetNetworkconnectedEventFlags(4200, 4203, OFF);
                SetNetworkconnectedEventFlagID(4203, ON);
            }
            WaitFor(EventFlag(4218));
            RestartEvent();
        }
    }
L0:
    EndEvent();
});

$Event(4259, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(4258, OFF);
    GotoIf(S0, !AnyBatchEventFlags(4240, 4243));
    GotoIf(S1, !(EventFlag(4241) && EventFlag(3000)));
S0:
    BatchSetNetworkconnectedEventFlags(4240, 4243, OFF);
    SetNetworkconnectedEventFlagID(4240, ON);
S1:
    if (!AnyBatchEventFlags(4245, 4257)) {
        BatchSetNetworkconnectedEventFlags(4245, 4257, OFF);
        SetNetworkconnectedEventFlagID(4245, ON);
    }
    if (EventFlag(4240)) {
        if (EventFlag(4245) && EventFlag(11109957)) {
            BatchSetNetworkconnectedEventFlags(4245, 4257, OFF);
            SetNetworkconnectedEventFlagID(4246, ON);
        }
        if (EventFlag(4246) && EventFlag(35009306)) {
            BatchSetNetworkconnectedEventFlags(4245, 4257, OFF);
            SetNetworkconnectedEventFlagID(4247, ON);
            SetNetworkconnectedEventFlagID(35009317, ON);
            SetNetworkconnectedEventFlagID(35009318, ON);
        }
        if (EventFlag(4247) && EventFlag(1045520180)) {
            BatchSetNetworkconnectedEventFlags(4245, 4257, OFF);
            SetNetworkconnectedEventFlagID(4248, ON);
            SetNetworkconnectedEventFlagID(35009317, OFF);
            SetNetworkconnectedEventFlagID(35009318, OFF);
        }
        if (EventFlag(4248) && EventFlag(11109959)) {
            BatchSetNetworkconnectedEventFlags(4245, 4257, OFF);
            SetNetworkconnectedEventFlagID(4249, ON);
        }
        if (EventFlag(4249) && EventFlag(35009326)) {
            BatchSetNetworkconnectedEventFlags(4245, 4257, OFF);
            SetNetworkconnectedEventFlagID(4251, ON);
        }
        WaitFor(EventFlag(4258));
        RestartEvent();
    }
L0:
    EndEvent();
});

$Event(4239, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(4238, OFF);
    if (!AnyBatchEventFlags(4220, 4223)) {
        BatchSetNetworkconnectedEventFlags(4220, 4223, OFF);
        SetNetworkconnectedEventFlagID(4220, ON);
    }
    if (EventFlag(4221) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(4220, 4223, OFF);
        SetNetworkconnectedEventFlagID(4220, ON);
    }
    if (!AnyBatchEventFlags(4225, 4237)) {
        BatchSetNetworkconnectedEventFlags(4225, 4237, OFF);
        SetNetworkconnectedEventFlagID(4225, ON);
    }
    if (EventFlag(11109921) && EventFlag(4228)) {
        BatchSetNetworkconnectedEventFlags(4220, 4223, OFF);
        SetNetworkconnectedEventFlagID(4220, ON);
    }
    if (EventFlag(4220)) {
        if (!(!(AnyBatchEventFlags(4225, 4227) && EventFlag(110))
            && !(EventFlag(4228) && EventFlag(9116) && !EventFlag(11109921)))) {
            BatchSetNetworkconnectedEventFlags(4220, 4223, OFF);
            SetNetworkconnectedEventFlagID(4223, ON);
        } else {
            if (EventFlag(4225) && EventFlag(10009706)) {
                SetNetworkconnectedEventFlagID(10009709, ON);
            }
            if (EventFlag(4225) && (EventFlag(9101) || EventFlag(1034509305))) {
                BatchSetNetworkconnectedEventFlags(4225, 4237, OFF);
                SetNetworkconnectedEventFlagID(4226, ON);
                SetNetworkconnectedEventFlagID(10009709, OFF);
            }
            if (EventFlag(4226) && EventFlag(11109909)) {
                BatchSetNetworkconnectedEventFlags(4225, 4237, OFF);
                SetNetworkconnectedEventFlagID(4227, ON);
            }
            if (EventFlag(4227) && EventFlag(1034429205)) {
                SetNetworkconnectedEventFlagID(1034429209, ON);
            }
            if (EventFlag(4227) && EventFlag(1035420800) && EventFlag(1034429205)) {
                BatchSetNetworkconnectedEventFlags(4225, 4237, OFF);
                SetNetworkconnectedEventFlagID(4228, ON);
            }
            if (EventFlag(4228) && EventFlag(9101) && EventFlag(10009722)) {
                BatchSetNetworkconnectedEventFlags(4225, 4237, OFF);
                SetNetworkconnectedEventFlagID(4229, ON);
                SetNetworkconnectedEventFlagID(10009719, ON);
            }
            if (EventFlag(4228) && EventFlag(11109919)) {
                BatchSetNetworkconnectedEventFlags(4225, 4237, OFF);
                SetNetworkconnectedEventFlagID(4230, ON);
            }
            WaitFor(EventFlag(4238));
            RestartEvent();
        }
    }
L0:
    EndEvent();
});

$Event(3839, Restart, function() {
    EndIf(!PlayerIsInOwnWorld());
    SetEventFlagID(3838, OFF);
    if (!AnyBatchEventFlags(3820, 3823)) {
        BatchSetNetworkconnectedEventFlags(3820, 3823, OFF);
        SetNetworkconnectedEventFlagID(3820, ON);
    }
    if (EventFlag(3823)) {
        BatchSetNetworkconnectedEventFlags(3820, 3823, OFF);
        SetNetworkconnectedEventFlagID(3821, ON);
    }
    if (EventFlag(3820) && EventFlag(3822)) {
        BatchSetNetworkconnectedEventFlags(3820, 3823, OFF);
        SetNetworkconnectedEventFlagID(3822, ON);
    }
    if (EventFlag(3821) && EventFlag(3000)) {
        BatchSetNetworkconnectedEventFlags(3820, 3823, OFF);
        SetNetworkconnectedEventFlagID(3820, ON);
    }
    if (!AnyBatchEventFlags(3825, 3829)) {
        BatchSetNetworkconnectedEventFlags(3825, 3829, OFF);
        SetNetworkconnectedEventFlagID(3825, ON);
    }
    if (EventFlag(3820)) {
        if (EventFlag(3825) && EventFlag(1039449258) && (EventFlag(1043399313) || EventFlag(3663))) {
            BatchSetNetworkconnectedEventFlags(3825, 3829, OFF);
            SetNetworkconnectedEventFlagID(3826, ON);
        }
        if (EventFlag(3826) && EventFlag(1039449278)) {
            BatchSetNetworkconnectedEventFlags(3825, 3829, OFF);
            SetNetworkconnectedEventFlagID(3827, ON);
        }
        if (EventFlag(3827) && EventFlag(3443) && EventFlag(1039449270)) {
            BatchSetNetworkconnectedEventFlags(3825, 3829, OFF);
            SetNetworkconnectedEventFlagID(3828, ON);
        }
        if (EventFlag(1039449285)) {
            SetNetworkconnectedEventFlagID(1039449296, ON);
        }
        if (EventFlag(1039449291)) {
            BatchSetNetworkconnectedEventFlags(3825, 3829, OFF);
            SetNetworkconnectedEventFlagID(3829, ON);
        }
        WaitFor(EventFlag(3838));
        RestartEvent();
    }
L0:
    EndEvent();
});

$Event(60701, Default, function(X0_4, X4_4) {
    if (PlayerIsInOwnWorld()) {
        WaitFor(EventFlag(X0_4) || EventFlag(X4_4));
        SetEventFlagID(X0_4, ON);
        SetEventFlagID(X4_4, ON);
        EndEvent();
    }
L15:
    WaitFor(EventFlag(6000) && !EventFlag(6000));
    WaitFixedTimeSeconds(1);
    RequestCharacterAIReplan(0);
});

$Event(9930, Default, function(X0_4, X4_4, X8_4) {
    EndIf(!PlayerIsInOwnWorld());
    WaitFor(PlayerIsInOwnWorld() && EventFlag(X0_4));
    if (!EventFlag(X4_4)) {
        AwardGesture(X8_4);
        SetEventFlagID(X4_4, ON);
    }
    SetEventFlagID(X0_4, OFF);
});

$Event(9940, Default, function() {
    WaitFor(EventFlag(9992));
    SetEventFlagID(82000, ON);
    SetEventFlagID(82010, ON);
    SetEventFlagID(82011, ON);
    SetEventFlagID(82012, ON);
    SetEventFlagID(82020, ON);
    SetEventFlagID(82021, ON);
    SetEventFlagID(82022, ON);
    SetEventFlagID(82030, ON);
    SetEventFlagID(82031, ON);
    SetEventFlagID(82032, ON);
    SetEventFlagID(82040, ON);
    SetEventFlagID(82041, ON);
    SetEventFlagID(82050, ON);
    SetEventFlagID(82051, ON);
    SetEventFlagID(82052, ON);
    SetEventFlagID(82060, ON);
    SetEventFlagID(82061, ON);
    SetEventFlagID(82070, ON);
    SetEventFlagID(82071, ON);
    SetEventFlagID(82080, ON);
    SetEventFlagID(82081, ON);
});

$Event(9941, Default, function() {
    WaitFor(EventFlag(9993));
    BatchSetEventFlags(10000000, 10000004, ON);
    BatchSetEventFlags(11000000, 11000001, ON);
    BatchSetEventFlags(11000003, 11000007, ON);
    BatchSetEventFlags(12010000, 12010003, ON);
    BatchSetEventFlags(12020000, 12020004, ON);
    BatchSetEventFlags(12030000, 12030001, ON);
    BatchSetEventFlags(12040000, 12040001, ON);
    BatchSetEventFlags(13000000, 13000001, ON);
    BatchSetEventFlags(14000000, 14000003, ON);
    BatchSetEventFlags(15000000, 15000004, ON);
    BatchSetEventFlags(16000000, 16000004, ON);
    BatchSetEventFlags(18000000, 16000001, ON);
    BatchSetEventFlags(34120000, 34120001, ON);
    BatchSetEventFlags(35000000, 35000003, ON);
    BatchSetEventFlags(39200000, 39200001, ON);
    SetEventFlagID(30000000, ON);
    SetEventFlagID(30010000, ON);
    SetEventFlagID(30020000, ON);
    SetEventFlagID(30030000, ON);
    SetEventFlagID(30040000, ON);
    SetEventFlagID(30050000, ON);
    SetEventFlagID(30060000, ON);
    SetEventFlagID(30070000, ON);
    SetEventFlagID(30080000, ON);
    SetEventFlagID(30090000, ON);
    SetEventFlagID(30100000, ON);
    SetEventFlagID(30110000, ON);
    SetEventFlagID(30120000, ON);
    SetEventFlagID(30130000, ON);
    SetEventFlagID(30140000, ON);
    SetEventFlagID(30150000, ON);
    SetEventFlagID(30160000, ON);
    SetEventFlagID(30170000, ON);
    SetEventFlagID(30180000, ON);
    SetEventFlagID(30190000, ON);
    SetEventFlagID(1042360000, ON);
    SetEventFlagID(1042370000, ON);
    SetEventFlagID(1042380000, ON);
    SetEventFlagID(1045380000, ON);
    SetEventFlagID(1045350000, ON);
    SetEventFlagID(1044350000, ON);
    SetEventFlagID(1041360000, ON);
    SetEventFlagID(1043340000, ON);
    SetEventFlagID(1041330000, ON);
    SetEventFlagID(1043310000, ON);
    SetEventFlagID(1044330000, ON);
    SetEventFlagID(1044330001, ON);
    SetEventFlagID(1039400000, ON);
    SetEventFlagID(1035420000, ON);
    SetEventFlagID(1039420000, ON);
    SetEventFlagID(1035440000, ON);
    SetEventFlagID(1037440000, ON);
    SetEventFlagID(1033460000, ON);
    SetEventFlagID(1038480000, ON);
    SetEventFlagID(1036490000, ON);
    SetEventFlagID(1036490001, ON);
    SetEventFlagID(1036410000, ON);
    SetEventFlagID(1038510000, ON);
    SetEventFlagID(1042540000, ON);
    SetEventFlagID(1043500000, ON);
    SetEventFlagID(1036540000, ON);
    SetEventFlagID(1037520000, ON);
    BatchSetEventFlags(1099000000, 1099000015, ON);
    BatchSetEventFlags(1099000190, 1099000195, ON);
    WaitFor(!EventFlag(9991));
    BatchSetEventFlags(10000000, 10000004, OFF);
    BatchSetEventFlags(11000000, 11000001, OFF);
    BatchSetEventFlags(11000003, 11000007, OFF);
    BatchSetEventFlags(12010000, 12010003, OFF);
    BatchSetEventFlags(12020000, 12020004, OFF);
    BatchSetEventFlags(12030000, 12030001, OFF);
    BatchSetEventFlags(12040000, 12040001, OFF);
    BatchSetEventFlags(13000000, 13000001, OFF);
    BatchSetEventFlags(14000000, 14000003, OFF);
    BatchSetEventFlags(15000000, 15000004, OFF);
    BatchSetEventFlags(16000000, 16000004, OFF);
    BatchSetEventFlags(18000000, 16000001, OFF);
    BatchSetEventFlags(35000000, 35000003, OFF);
    BatchSetEventFlags(39200000, 39200001, OFF);
    BatchSetEventFlags(1099000000, 1099000015, OFF);
    BatchSetEventFlags(1099000190, 1099000195, OFF);
    SetEventFlagID(30000000, OFF);
    SetEventFlagID(30000001, OFF);
    SetEventFlagID(30000002, OFF);
    SetEventFlagID(30000003, OFF);
    SetEventFlagID(30000004, OFF);
    SetEventFlagID(30050000, OFF);
    SetEventFlagID(30060000, OFF);
    SetEventFlagID(30070000, OFF);
    SetEventFlagID(30080000, OFF);
    SetEventFlagID(30090000, OFF);
    SetEventFlagID(30100000, OFF);
    SetEventFlagID(30110000, OFF);
    SetEventFlagID(30120000, OFF);
    SetEventFlagID(30130000, OFF);
    SetEventFlagID(30140000, OFF);
    SetEventFlagID(30150000, OFF);
    SetEventFlagID(30160000, OFF);
    SetEventFlagID(30170000, OFF);
    SetEventFlagID(30180000, OFF);
    SetEventFlagID(30190000, OFF);
    SetEventFlagID(1042360000, OFF);
    SetEventFlagID(1042370000, OFF);
    SetEventFlagID(1042380000, OFF);
    SetEventFlagID(1045380000, OFF);
    SetEventFlagID(1045350000, OFF);
    SetEventFlagID(1044350000, OFF);
    SetEventFlagID(1041360000, OFF);
    SetEventFlagID(1043340000, OFF);
    SetEventFlagID(1041330000, OFF);
    SetEventFlagID(1043310000, OFF);
    SetEventFlagID(1044330000, OFF);
    SetEventFlagID(1044330001, OFF);
    SetEventFlagID(1039400000, OFF);
    SetEventFlagID(1035420000, OFF);
    SetEventFlagID(1039420000, OFF);
    SetEventFlagID(1035440000, OFF);
    SetEventFlagID(1037440000, OFF);
    SetEventFlagID(1033460000, OFF);
    SetEventFlagID(1038480000, OFF);
    SetEventFlagID(1036490000, OFF);
    SetEventFlagID(1036490001, OFF);
    SetEventFlagID(1036410000, OFF);
    SetEventFlagID(1038510000, OFF);
    SetEventFlagID(1042540000, OFF);
    SetEventFlagID(1043500000, OFF);
    SetEventFlagID(1036540000, OFF);
    SetEventFlagID(1037520000, OFF);
    RestartEvent();
});

$Event(9943, Default, function() {
    WaitFor(EventFlag(9993));
    AwardItemsIncludingClients(100400);
});

$Event(9945, Default, function() {
    WaitFor(PlayerIsInOwnWorld() && EventFlag(9995));
    if (!PlayerIsInOwnWorld()) {
        WarpCharacterAndSetFloor(20000, TargetEntityType.Character, 10000, 260, 10000);
    }
L1:
    WaitFixedTimeSeconds(2.4);
    if (PlayerIsInOwnWorld()) {
        WaitFixedTimeSeconds(0.6);
    }
    RestartEvent();
});

$Event(9946, Default, function(X0_4, X4_4) {
    EndIf(ThisEventSlot());
    WaitFor(EventFlag(X4_4));
    SetEventFlagID(X0_4, ON);
});

$Event(9950, Default, function(X0_4, X4_4) {
    EndIf(EventFlag(X0_4));
    WaitFor(EventFlag(X0_4));
    SetEventFlagID(X4_4, ON);
});

// resets for always night
$Event(1055550010, Default, function() {
    
    // 22 - 5
    WaitFor(TimeOfDayInRange(5, 0, 0, 21, 59, 0));
    SetCurrentTime(22, 0, 0, false, false, false, 0, 0, 0);

    WaitFor(ElapsedSeconds(3));
    RestartEvent();
});
