-- Система Yaojing Yichan - еженедельная активность добычи ресурсов -- Глобальные переменные для отслеживания времени активности YiChan_TimerMin = 0 -- Счетчик минут с момента старта активности Open_Time = 0 -- Время начала активности OpenTimes = 0 -- Количество проведенных активностей ------------------------------Координаты спавна ресурсов по MapID----------------------------- YiChan_Point = {} YiChan_Point[3424071720] = {} -- Карта s05 - Бейджоу YiChan_Point[3424071720][1] = {x=2409 ,y=7628 ,z=1602 } YiChan_Point[3424071720][2] = {x=2554 ,y=7687 ,z=1388 } YiChan_Point[3424071720][3] = {x=2203 ,y=8510 ,z=1001 } YiChan_Point[3424071720][4] = {x=2235 ,y=14350 ,z=3211 } YiChan_Point[3424071720][5] = {x=2598 ,y=13262 ,z=3139 } YiChan_Point[3424071720][6] = {x=2435 ,y=11748 ,z=3493 } YiChan_Point[3424071720][7] = {x=881 ,y=9048 ,z=3359 } YiChan_Point[3424071720][8] = {x=772 ,y=8696 ,z=3271 } YiChan_Point[3424071720][9] = {x=894 ,y=9025 ,z=3126 } YiChan_Point[3424071720][10] = {x=1090 ,y=9064 ,z=3203 } YiChan_Point[3424071720][11] = {x=1359 ,y=8762 ,z=3091 } YiChan_Point[3424071720][12] = {x=1500 ,y=12921 ,z=3270 } YiChan_Point[3424071720][13] = {x=1761 ,y=13305 ,z=3206 } YiChan_Point[3424071720][14] = {x=1890 ,y=13681 ,z=3274 } YiChan_Point[3424071720][15] = {x=1674 ,y=13425 ,z=3233 } YiChan_Point[3424071720][16] = {x=1787 ,y=13301 ,z=3218 } YiChan_Point[3424071720][17] = {x=1179 ,y=8193 ,z=2711 } YiChan_Point[3424071720][18] = {x=1086 ,y=7710 ,z=2433 } YiChan_Point[3424071720][19] = {x=1000 ,y=7964 ,z=2340 } YiChan_Point[3424071720][20] = {x=915 ,y=7413 ,z=2459 } YiChan_Point[3424071720][21] = {x=950 ,y=7400 ,z=2596 } YiChan_Point[3424071720][22] = {x=1069 ,y=7731 ,z=2132 } YiChan_Point[3424071720][23] = {x=1192 ,y=9378 ,z=2013 } YiChan_Point[3424071720][24] = {x=1205 ,y=8785 ,z=2127 } YiChan_Point[3424071720][25] = {x=854 ,y=8855 ,z=1817 } YiChan_Point[3424071720][26] = {x=1064 ,y=9653 ,z=1556 } YiChan_Point[3424071720][27] = {x=1512 ,y=8061 ,z=1577 } YiChan_Point[3424071720][28] = {x=1745 ,y=11754 ,z=1610 } YiChan_Point[3424071720][29] = {x=1580 ,y=14206 ,z=1877 } YiChan_Point[3424071720][30] = {x=1676 ,y=14199 ,z=1992 } YiChan_Point[3424071720][31] = {x=1532 ,y=15571 ,z=2245 } YiChan_Point[3424071720][32] = {x=1248 ,y=17217 ,z=877 } YiChan_Point[3424071720][33] = {x=1196 ,y=16895 ,z=837 } YiChan_Point[3424071720][34] = {x=1365 ,y=17098 ,z=661 } YiChan_Point[3424071720][35] = {x=1362 ,y=17500 ,z=855 } YiChan_Point[3424071720][36] = {x=1275 ,y=16257 ,z=673 } YiChan_Point[3424071720][37] = {x=864 ,y=8116 ,z=788 } YiChan_Point[3424071720][38] = {x=925 ,y=8137 ,z=791 } YiChan_Point[3424071720][39] = {x=1016 ,y=8580 ,z=675 } YiChan_Point[3424071720][40] = {x=995 ,y=8653 ,z=546 } YiChan_Point[3424071720][41] = {x=1159 ,y=9450 ,z=522 } YiChan_Point[3424071720][42] = {x=1628 ,y=9900 ,z=428 } YiChan_Point[3424071720][43] = {x=1842 ,y=8072 ,z=495 } YiChan_Point[3424071720][44] = {x=1937 ,y=7890 ,z=340 } YiChan_Point[3424071720][45] = {x=1786 ,y=8844 ,z=243 } YiChan_Point[3424071720][46] = {x=1762 ,y=9118 ,z=536 } YiChan_Point[3424071720][47] = {x=3111 ,y=7456 ,z=2397 } YiChan_Point[3424071720][48] = {x=3235 ,y=7463 ,z=2340 } YiChan_Point[3424071720][49] = {x=3367 ,y=7387 ,z=2377 } YiChan_Point[3424071720][50] = {x=3235 ,y=7463 ,z=2340 } YiChan_Point[3424072488] = {} -- Карта s06 - Си Чжоу YiChan_Point[3424072488][1] = {x=1090 ,y=4900 ,z=2273 } YiChan_Point[3424072488][2] = {x=1350 ,y=7553 ,z=2273 } YiChan_Point[3424072488][3] = {x=804 ,y=6004 ,z=2057 } YiChan_Point[3424072488][4] = {x=1483 ,y=3046 ,z=578 } YiChan_Point[3424072488][5] = {x=1509 ,y=3093 ,z=252 } YiChan_Point[3424072488][6] = {x=1672 ,y=5802 ,z=1162 } YiChan_Point[3424072488][7] = {x=613 ,y=7050 ,z=481 } YiChan_Point[3424072488][8] = {x=684 ,y=7050 ,z=350 } YiChan_Point[3424072488][9] = {x=823 ,y=5501 ,z=420 } YiChan_Point[3424072488][10] = {x=958 ,y=7461 ,z=696 } YiChan_Point[3424072488][11] = {x=2620 ,y=5000 ,z=566 } YiChan_Point[3424072488][12] = {x=2558 ,y=4997 ,z=416 } YiChan_Point[3424072488][13] = {x=2344 ,y=7255 ,z=553 } YiChan_Point[3424072488][14] = {x=2565 ,y=8167 ,z=1021 } YiChan_Point[3424072488][15] = {x=2777 ,y=8299 ,z=1075 } YiChan_Point[3424072488][16] = {x=2565 ,y=4815 ,z=1552 } YiChan_Point[3424072488][17] = {x=2695 ,y=5904 ,z=1915 } YiChan_Point[3424072488][18] = {x=2468 ,y=4236 ,z=1855 } YiChan_Point[3424072488][19] = {x=2566 ,y=5816 ,z=1943 } YiChan_Point[3424072488][20] = {x=2432 ,y=4291 ,z=1887 } YiChan_Point[3424072488][21] = {x=2656 ,y=3967 ,z=2680 } YiChan_Point[3424072488][22] = {x=1938 ,y=3500 ,z=2568 } YiChan_Point[3424072488][23] = {x=1457 ,y=7354 ,z=2254 } YiChan_Point[3424072488][24] = {x=1793 ,y=3939 ,z=2306 } YiChan_Point[3424072488][25] = {x=1703 ,y=4747 ,z=2168 } YiChan_Point[3424072488][26] = {x=1585 ,y=7689 ,z=1750 } YiChan_Point[3424072488][27] = {x=1266 ,y=7932 ,z=2114 } YiChan_Point[3424072488][28] = {x=1052 ,y=7152 ,z=1025 } YiChan_Point[3424072488][29] = {x=1538 ,y=3100 ,z=454 } YiChan_Point[3424072488][30] = {x=1749 ,y=3077 ,z=775 } YiChan_Point[3424072488][31] = {x=1714 ,y=5800 ,z=1085 } YiChan_Point[3424072488][32] = {x=1709 ,y=4270 ,z=1486 } YiChan_Point[3424072488][33] = {x=1841 ,y=3225 ,z=1287 } YiChan_Point[3424072488][34] = {x=1967 ,y=5760 ,z=1181 } YiChan_Point[3424072488][35] = {x=2175 ,y=5857 ,z=1105 } YiChan_Point[3424072488][36] = {x=2125 ,y=3278 ,z=966 } YiChan_Point[3424072488][37] = {x=2161 ,y=7200 ,z=693 } YiChan_Point[3424072488][38] = {x=1612 ,y=6503 ,z=718 } YiChan_Point[3424072488][39] = {x=1427 ,y=3106 ,z=595 } YiChan_Point[3424072488][40] = {x=1274 ,y=3211 ,z=369 } YiChan_Point[3424072488][41] = {x=1200 ,y=7829 ,z=2080 } YiChan_Point[3424072488][42] = {x=837 ,y=6036 ,z=2075 } YiChan_Point[3424072488][43] = {x=1375 ,y=5865 ,z=1303 } YiChan_Point[3424072488][44] = {x=1332 ,y=6362 ,z=1529 } YiChan_Point[3424072488][45] = {x=823 ,y=5907 ,z=2177 } YiChan_Point[3424072488][46] = {x=1839 ,y=3514 ,z=2360 } YiChan_Point[3424072488][47] = {x=2040 ,y=6000 ,z=1774 } YiChan_Point[3424072488][48] = {x=2047 ,y=6000 ,z=1846 } YiChan_Point[3424072488][49] = {x=2406 ,y=4061 ,z=2497 } YiChan_Point[3424072488][50] = {x=2355 ,y=4702 ,z=1285 } YiChan_Point[3424072232] = {} -- Карта s07 - Нань Чжоу YiChan_Point[3424072232][1] = {x=2228 ,y=3457 ,z=1273 } YiChan_Point[3424072232][2] = {x=2329 ,y=3430 ,z=1383 } YiChan_Point[3424072232][3] = {x=2384 ,y=3616 ,z=1519 } YiChan_Point[3424072232][4] = {x=2325 ,y=4369 ,z=1744 } YiChan_Point[3424072232][5] = {x=2275 ,y=4746 ,z=1864 } YiChan_Point[3424072232][6] = {x=2205 ,y=4167 ,z=1839 } YiChan_Point[3424072232][7] = {x=2352 ,y=4384 ,z=1878 } YiChan_Point[3424072232][8] = {x=2059 ,y=5632 ,z=2298 } YiChan_Point[3424072232][9] = {x=1911 ,y=5796 ,z=2116 } YiChan_Point[3424072232][10] = {x=1883 ,y=6400 ,z=2214 } YiChan_Point[3424072232][11] = {x=2596 ,y=2973 ,z=2439 } YiChan_Point[3424072232][12] = {x=2565 ,y=2911 ,z=2432 } YiChan_Point[3424072232][13] = {x=2587 ,y=2884 ,z=2382 } YiChan_Point[3424072232][14] = {x=1623 ,y=4959 ,z=2665 } YiChan_Point[3424072232][15] = {x=2246 ,y=10085 ,z=2607 } YiChan_Point[3424072232][16] = {x=2246 ,y=10085 ,z=2607 } YiChan_Point[3424072232][17] = {x=2031 ,y=8913 ,z=2659 } YiChan_Point[3424072232][18] = {x=2038 ,y=8942 ,z=2540 } YiChan_Point[3424072232][19] = {x=1774 ,y=5722 ,z=2643 } YiChan_Point[3424072232][20] = {x=1604 ,y=4653 ,z=2420 } YiChan_Point[3424072232][21] = {x=1559 ,y=4519 ,z=2327 } YiChan_Point[3424072232][22] = {x=1403 ,y=5760 ,z=2303 } YiChan_Point[3424072232][23] = {x=1538 ,y=4400 ,z=2434 } YiChan_Point[3424072232][24] = {x=1590 ,y=4409 ,z=2267 } YiChan_Point[3424072232][25] = {x=1648 ,y=5771 ,z=2040 } YiChan_Point[3424072232][26] = {x=1519 ,y=5997 ,z=2022 } YiChan_Point[3424072232][27] = {x=1249 ,y=11695 ,z=2009 } YiChan_Point[3424072232][28] = {x=1093 ,y=11755 ,z=2097 } YiChan_Point[3424072232][29] = {x=826 ,y=12285 ,z=1993 } YiChan_Point[3424072232][30] = {x=799 ,y=14388 ,z=1593 } YiChan_Point[3424072232][31] = {x=712 ,y=14595 ,z=1546 } YiChan_Point[3424072232][32] = {x=788 ,y=14604 ,z=1460 } YiChan_Point[3424072232][33] = {x=701 ,y=13164 ,z=1417 } YiChan_Point[3424072232][34] = {x=601 ,y=14756 ,z=1365 } YiChan_Point[3424072232][35] = {x=754 ,y=14600 ,z=1326 } YiChan_Point[3424072232][36] = {x=2330 ,y=4262 ,z=1788 } YiChan_Point[3424072232][37] = {x=2310 ,y=7176 ,z=865 } YiChan_Point[3424072232][38] = {x=2297 ,y=7320 ,z=778 } YiChan_Point[3424072232][39] = {x=2183 ,y=7201 ,z=825 } YiChan_Point[3424072232][40] = {x=1934 ,y=4190 ,z=796 } YiChan_Point[3424072232][41] = {x=1886 ,y=3894 ,z=848 } YiChan_Point[3424072232][42] = {x=2011 ,y=3441 ,z=1057 } YiChan_Point[3424072232][43] = {x=1822 ,y=3465 ,z=950 } YiChan_Point[3424072232][44] = {x=1795 ,y=3456 ,z=860 } YiChan_Point[3424072232][45] = {x=1298 ,y=2879 ,z=618 } YiChan_Point[3424072232][46] = {x=1131 ,y=2872 ,z=625 } YiChan_Point[3424072232][47] = {x=1128 ,y=2809 ,z=470 } YiChan_Point[3424072232][48] = {x=1284 ,y=2838 ,z=438 } YiChan_Point[3424072232][49] = {x=1391 ,y=2986 ,z=663 } YiChan_Point[3424072232][50] = {x=1468 ,y=3680 ,z=980 } YiChan_Point[3424075048] = {} -- Карта s08 - Дун Чжоу YiChan_Point[3424075048][1] = {x=1621, y=9752, z=1746} YiChan_Point[3424075048][2] = {x=1365, y=10435, z=1815} YiChan_Point[3424075048][3] = {x=1341, y=10706, z=1915} YiChan_Point[3424075048][4] = {x=1251, y=10708, z=2002} YiChan_Point[3424075048][5] = {x=1138, y=9998, z=2088} YiChan_Point[3424075048][6] = {x=1020, y=9994, z=2212} YiChan_Point[3424075048][7] = {x=830, y=9812, z=2239} YiChan_Point[3424075048][8] = {x=873, y=9978, z=2103} YiChan_Point[3424075048][9] = {x=877, y=10000, z=1940} YiChan_Point[3424075048][10] = {x=727, y=10000, z=1879} YiChan_Point[3424075048][11] = {x=577, y=10289, z=1674} YiChan_Point[3424075048][12] = {x=528, y=8485, z=1509} YiChan_Point[3424075048][13] = {x=619, y=7754, z=1387} YiChan_Point[3424075048][14] = {x=611, y=7953, z=1253} YiChan_Point[3424075048][15] = {x=560, y=8969, z=1191} YiChan_Point[3424075048][16] = {x=561, y=10907, z=1093} YiChan_Point[3424075048][17] = {x=756, y=11608, z=953} YiChan_Point[3424075048][18] = {x=1150, y=10844, z=1495} YiChan_Point[3424075048][19] = {x=1391, y=11705, z=1182} YiChan_Point[3424075048][20] = {x=1631, y=10806, z=1008} YiChan_Point[3424075048][21] = {x=1884, y=7919, z=963} YiChan_Point[3424075048][22] = {x=2129, y=7350, z=925} YiChan_Point[3424075048][23] = {x=2288, y=7461, z=769} YiChan_Point[3424075048][24] = {x=2413, y=8932, z=599} YiChan_Point[3424075048][25] = {x=2583, y=9466, z=574} YiChan_Point[3424075048][26] = {x=2768, y=9288, z=360} YiChan_Point[3424075048][27] = {x=2555, y=9934, z=680} YiChan_Point[3424075048][28] = {x=2502, y=10487, z=1073} YiChan_Point[3424075048][29] = {x=2464, y=11826, z=1352} YiChan_Point[3424075048][30] = {x=2534, y=13090, z=1586} YiChan_Point[3424075048][31] = {x=2734, y=14335, z=1651} YiChan_Point[3424075048][32] = {x=2830, y=16674, z=1553} YiChan_Point[3424075048][33] = {x=2759, y=16792, z=1536} YiChan_Point[3424075048][34] = {x=2798, y=12871, z=1959} YiChan_Point[3424075048][35] = {x=2701, y=9968, z=2175} YiChan_Point[3424075048][36] = {x=2678, y=10171, z=2360} YiChan_Point[3424075048][37] = {x=2683, y=11624, z=2682} YiChan_Point[3424075048][38] = {x=2551, y=13386, z=2835} YiChan_Point[3424075048][39] = {x=2307, y=13080, z=2697} YiChan_Point[3424075048][40] = {x=2029, y=10969, z=2547} YiChan_Point[3424075048][41] = {x=1853, y=10510, z=2237} YiChan_Point[3424075048][42] = {x=1562, y=10988, z=2154} YiChan_Point[3424075048][43] = {x=1388, y=10539, z=2027} YiChan_Point[3424075048][44] = {x=1187, y=10005, z=2058} YiChan_Point[3424075048][45] = {x=1030, y=10025, z=2206} YiChan_Point[3424075048][46] = {x=804, y=10058, z=2291} YiChan_Point[3424075048][47] = {x=739, y=10642, z=2471} YiChan_Point[3424075048][48] = {x=821, y=9813, z=2253} YiChan_Point[3424075048][49] = {x=201, y=11372, z=1521} YiChan_Point[3424075048][50] = {x=349, y=11651, z=1758} YiChan_Point[3424074792] = {} -- Карта s09 - Сумеречная империя YiChan_Point[3424074792][1] = {x=300,y=6333,z=1225} YiChan_Point[3424074792][2] = {x=625,y=5873,z=1360} YiChan_Point[3424074792][3] = {x=590,y=5946,z=1450} YiChan_Point[3424074792][4] = {x=190,y=6707,z=1670} YiChan_Point[3424074792][5] = {x=650,y=7137,z=1750} YiChan_Point[3424074792][6] = {x=760,y=7042,z=1480} YiChan_Point[3424074792][7] = {x=925,y=9694,z=1745} YiChan_Point[3424074792][8] = {x=1050,y=6230,z=1280} YiChan_Point[3424074792][9] = {x=1250,y=6189,z=1400} YiChan_Point[3424074792][10] = {x=1600,y=7421,z=1600} YiChan_Point[3424074792][11] = {x=1650,y=8799,z=1750} YiChan_Point[3424074792][12] = {x=1740,y=7391,z=1395} YiChan_Point[3424074792][13] = {x=1850,y=7722,z=1150} YiChan_Point[3424074792][14] = {x=1300,y=6196,z=1100} YiChan_Point[3424074792][15] = {x=1400,y=6010,z=800} YiChan_Point[3424074792][16] = {x=1788,y=7743,z=982} YiChan_Point[3424074792][17] = {x=1690,y=8637,z=560} YiChan_Point[3424074792][18] = {x=1250,y=6548,z=730} YiChan_Point[3424074792][19] = {x=1400,y=7377,z=410} YiChan_Point[3424074792][20] = {x=1095,y=7053,z=450} YiChan_Point[3440849960] = {} -- Карта s11 - Аришат YiChan_Point[3440849960][1] = {x=620,y=3429,z=680} YiChan_Point[3440849960][2] = {x=980,y=3520,z=370} YiChan_Point[3440849960][3] = {x=400,y=3598,z=950} YiChan_Point[3440849960][4] = {x=850,y=2149,z=650} YiChan_Point[3440849960][5] = {x=1400,y=2447,z=530} YiChan_Point[3440849960][6] = {x=1200,y=2827,z=900} YiChan_Point[3440849960][7] = {x=1450,y=4145,z=1150} YiChan_Point[3440849960][8] = {x=780,y=2089,z=1125} YiChan_Point[3440849960][9] = {x=535,y=2647,z=1235} YiChan_Point[3440849960][10] = {x=1680,y=4175,z=1370} YiChan_Point[3440849960][11] = {x=1600,y=4178,z=1700} YiChan_Point[3440849960][12] = {x=1350,y=4104,z=1450} YiChan_Point[3440849960][13] = {x=1100,y=4136,z=1700} YiChan_Point[3440849960][14] = {x=750,y=2905,z=1380} YiChan_Point[3440849960][15] = {x=400,y=2942,z=1700} ------------------------------Функции управления активностью----------------------------- -- Функция запуска активности Yaojing Yichan function YiChan_OnStart(actID) -- Инициализация глобальных переменных YiChan_TimerMin = 0 -- Сброс счетчика минут Open_Time = 0 -- Сброс времени начала OpenTimes = 0 -- Сброс счетчика проведенных активностей -- Расчет прошедшего времени с момента старта сервера local curmin = tonumber(os.date("%M")) local curhour = tonumber(os.date("%H")) YiChan_TimerMin = YiChan_TimerMin + (curhour-18)*60 + curmin -- Отправка системного сообщения о начале активности local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 102, 100171) -- "Активность добычи ресурсов началась! Соберите все ресурсы, которые сможете!" msg.DispatchBroadcast(MsgID, -1, -1, -1) end -- Регистрация обработчика начала активности aux.RegisterActEvent(33, 2, "YiChan_OnStart") -- Функция обработки минутного таймера активности -- Запускается каждый час начиная с 18:01 function YiChan_OnTimerMin(actID) -- Увеличение счетчика минут YiChan_TimerMin = YiChan_TimerMin + 1 ---------------------Создание существ----------------------------- -- Внутренняя функция создания существ в случайных точках -- Использует разные алгоритмы спавна для баланса и предотвращает спавн в одинаковых местах local function Yichan_CreatCreature(Time) -- Создание копий массивов координат для каждой карты local beizhou = {} -- Карта s05 - Бейджоу local xizhou = {} -- Карта s06 - Си Чжоу local nanzhou = {} -- Карта s07 - Нань Чжоу local dongzhou = {} -- Карта s08 - Дун Чжоу local sumerech = {} -- Карта s09 - Сумеречная империя local arishat = {} -- Карта s11 - Аришат -- Копирование координат для основных карт (по 50 точек каждая) for i = 1, 50 do beizhou[i] = {x=YiChan_Point[3424071720][i].x,y=YiChan_Point[3424071720][i].y,z=YiChan_Point[3424071720][i].z} xizhou[i] = {x=YiChan_Point[3424072488][i].x,y=YiChan_Point[3424072488][i].y,z=YiChan_Point[3424072488][i].z} nanzhou[i] = {x=YiChan_Point[3424072232][i].x,y=YiChan_Point[3424072232][i].y,z=YiChan_Point[3424072232][i].z} dongzhou[i] = {x=YiChan_Point[3424075048][i].x,y=YiChan_Point[3424075048][i].y,z=YiChan_Point[3424075048][i].z} end -- Копирование координат для Сумеречной империи (20 точек) for i = 1, 20 do sumerech[i] = {x=YiChan_Point[3424074792][i].x,y=YiChan_Point[3424074792][i].y,z=YiChan_Point[3424074792][i].z} end -- Копирование координат для Аришат (15 точек) for i = 1, 15 do arishat[i] = {x=YiChan_Point[3440849960][i].x,y=YiChan_Point[3440849960][i].y,z=YiChan_Point[3440849960][i].z} end -- Спавн существ через 5 минут после начала активности if Time - Open_Time == 5 then -- Отправка системного сообщения local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 102, 100174) -- "Через 5 минут начнется спавн ресурсов! Соберите все ресурсы, которые сможете!" msg.DispatchBroadcast(MsgID, -1, -1, -1) -- Спавн существ на карте Бейджоу (s05) for i = 1,30 do if i <= 6 then -- Первые 6 существ спавнятся в фиксированных точках map.MapCreateCreature(3424071720, -1, 5513004, beizhou[1].x, beizhou[1].y, beizhou[1].z) table.remove(beizhou,1) -- Удаление использованной точки else -- Остальные существа спавнятся в случайных точках local k = math.random(51-i) map.MapCreateCreature(3424071720, -1,5513004 , beizhou[k].x, beizhou[k].y, beizhou[k].z) table.remove(beizhou,k) end end for i = 1,20 do if i <= 6 then map.MapCreateCreature(3424072488, -1, 5513013, xizhou[1].x, xizhou[1].y, xizhou[1].z) table.remove(xizhou,1) else local k = math.random(51-i) map.MapCreateCreature(3424072488, -1, 5513013, xizhou[k].x, xizhou[k].y, xizhou[k].z) table.remove(xizhou,k) end end for i = 1,10 do local k = math.random(51-i) map.MapCreateCreature(3424072232, -1,5513014 , nanzhou[k].x, nanzhou[k].y, nanzhou[k].z) table.remove(nanzhou,k) end for i = 1,10 do local k = math.random(51-i) map.MapCreateCreature(3424075048, -1, 5513020, dongzhou[k].x, dongzhou[k].y, dongzhou[k].z) table.remove(dongzhou,k) end for i = 1,12 do local k = math.random(21-i) map.MapCreateCreature(3424074792, -1, 5513021, sumerech[k].x, sumerech[k].y, sumerech[k].z) table.remove(sumerech,k) end for i = 1,12 do local k = math.random(16-i) map.MapCreateCreature(3440849960, -1, 5513022, arishat[k].x, arishat[k].y, arishat[k].z) table.remove(arishat,k) end elseif (Time - Open_Time) % 5 == 0 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 102, 100174) --��5���Ӻ��ڱ��ޡ����ޡ����޽������������Ų����䣡�� msg.DispatchBroadcast(MsgID, -1, -1, -1) for i = 1,8 do local k = math.random(51-i) map.MapCreateCreature(3424071720, -1,5513004 , beizhou[k].x, beizhou[k].y, beizhou[k].z) table.remove(beizhou,k) end for i = 1,5 do local k = math.random(51-i) map.MapCreateCreature(3424072488, -1, 5513013, xizhou[k].x, xizhou[k].y, xizhou[k].z) table.remove(xizhou,k) end for i = 1,2 do local k = math.random(51-i) map.MapCreateCreature(3424072232, -1, 5513014, nanzhou[k].x, nanzhou[k].y, nanzhou[k].z) table.remove(nanzhou,k) end for i = 1,2 do local k = math.random(51-i) map.MapCreateCreature(3424075048, -1, 5513020, dongzhou[k].x, dongzhou[k].y, dongzhou[k].z) table.remove(dongzhou,k) end for i = 1,2 do local k = math.random(21-i) map.MapCreateCreature(3424074792, -1, 5513021, sumerech[k].x, sumerech[k].y, sumerech[k].z) table.remove(sumerech,k) end for i = 1,1 do local k = math.random(16-i) map.MapCreateCreature(3440849960, -1, 5513022, arishat[k].x, arishat[k].y, arishat[k].z) table.remove(arishat,k) end end end --------------------------�ӻ�������ж�--------------------- if YiChan_TimerMin % 30 == 1 then if Open_Time == 0 then if YiChan_TimerMin >= 31 then if math.random(100) <= 30 then Open_Time = YiChan_TimerMin --��¼�ӻ��ʼʱ�� OpenTimes = OpenTimes + 1 --��¼�ӻ�Ѿ���ʼ�Ĵ��� --Yichan_CreatCreature(YiChan_TimerMin) --ˢ���䣬���þֲ����� end else if math.random(100) <= 15 then--xiugaiguo Open_Time = YiChan_TimerMin --��¼�ӻ��ʼʱ�� OpenTimes = OpenTimes + 1 --��¼�ӻ�Ѿ���ʼ�Ĵ��� --Yichan_CreatCreature(YiChan_TimerMin) end end else if YiChan_TimerMin - Open_Time == 60 then if math.random(100) <= 15 then Open_Time = YiChan_TimerMin --��¼�ӻ��ʼʱ�� OpenTimes = OpenTimes + 1 --��¼�ӻ�Ѿ���ʼ�Ĵ��� --Yichan_CreatCreature(YiChan_TimerMin) end elseif YiChan_TimerMin - Open_Time >= 90 then if math.random(100) <= 30 then Open_Time = YiChan_TimerMin --��¼�ӻ��ʼʱ�� OpenTimes = OpenTimes + 1 --��¼�ӻ�Ѿ���ʼ�Ĵ��� --Yichan_CreatCreature(YiChan_TimerMin) end end end if YiChan_TimerMin == 241 and OpenTimes < 2 and Open_Time ~= YiChan_TimerMin then Open_Time = YiChan_TimerMin --��¼�ӻ��ʼʱ�� OpenTimes = OpenTimes + 1 --��¼�ӻ�Ѿ���ʼ�Ĵ��� --Yichan_CreatCreature(YiChan_TimerMin) elseif YiChan_TimerMin == 301 and OpenTimes < 3 and Open_Time ~= YiChan_TimerMin then Open_Time = YiChan_TimerMin --��¼�ӻ��ʼʱ�� OpenTimes = OpenTimes + 1 --��¼�ӻ�Ѿ���ʼ�Ĵ��� --Yichan_CreatCreature(YiChan_TimerMin) end end if YiChan_TimerMin - Open_Time < 30 then Yichan_CreatCreature(YiChan_TimerMin) end end aux.RegisterActEvent(33, 4, "YiChan_OnTimerMin") --�˴���Ҫ��һ���ID --����� function YiChan_OnEnd(actID) local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 102,100173 ) --�������� msg.DispatchBroadcast(MsgID, -1, -1, -1) end aux.RegisterActEvent(33, 3, "YiChan_OnEnd") --�˴���Ҫ��һ���ID function YiChan_OnCheck(MapID, InstanceID, TargetID, TargetTypeID, RoleID) -- Добавление основных предметов role.AddRoleItem(MapID, InstanceID, RoleID, 4400104, 1, -1, 8, 420) role.AddRoleItem(MapID, InstanceID, RoleID, 4400105, 1, -1, 8, 420) role.AddRoleItem(MapID, InstanceID, RoleID, 4400106, 1, -1, 8, 420) role.AddRoleItem(MapID, InstanceID, RoleID, 4800287, 1, -1, 8, 420) role.AddRoleItem(MapID, InstanceID, RoleID, 4080080, math.random(1,3), -1, 8, 420) -- Красный паук Лили role.AddRoleItem(MapID, InstanceID, RoleID, 4080081, math.random(1,3), -1, 8, 420) -- Камень пояса ветров role.AddRoleItem(MapID, InstanceID, RoleID, 4080082, math.random(1,3), -1, 8, 420) -- Вода забвения role.AddRoleItem(MapID, InstanceID, RoleID, 4080083, math.random(1,3), -1, 8, 420) -- Призрачное перо role.AddRoleItem(MapID, InstanceID, RoleID, 4080084, math.random(1,3), -1, 8, 420) -- Фолиант оков -- Проверка квеста и добавление предмета квеста local a = role.GetRoleItemNum(RoleID, 6600885) if role.IsRoleHaveQuest(MapID, InstanceID, RoleID, 30012) and a == 0 then role.QuestAddRoleItem(MapID, InstanceID, RoleID, 30012, 6600885, 1, -1, 420) -- ���ݧ� ���� �ܧӧ֧��� end -- Распределение предметов команде local TeamID = role.IsRoleHaveTeam(MapID, InstanceID, RoleID) if TeamID and TeamID ~= 4294967295 then -- Игрок в команде - раздать предметы всем участникам команды на той же карте local Role = {} Role[1], Role[2], Role[3], Role[4], Role[5], Role[6] = role.GetRoleTeamMemID(TeamID) for i = 1, 6 do if Role[i] and Role[i] ~= 4294967295 then local Target_MapID, Target_InstanceID = role.GetRoleMapID(Role[i]) if MapID == Target_MapID and role.GetBagFreeSize(Role[i]) > 0 then role.AddRoleItem(MapID, InstanceID, Role[i], 4400201, 1, -1, 8, 420) end end end else -- Игрок не в команде - выдать предмет только ему if role.GetBagFreeSize(RoleID) > 0 then role.AddRoleItem(MapID, InstanceID, RoleID, 4400201, 1, -1, 8, 420) end end end aux.RegisterCreatureEvent(5513004, 4, "YiChan_OnCheck") aux.RegisterCreatureEvent(5513013, 4, "YiChan_OnCheck") aux.RegisterCreatureEvent(5513014, 4, "YiChan_OnCheck") aux.RegisterCreatureEvent(5513020, 4, "YiChan_OnCheck") aux.RegisterCreatureEvent(5513021, 4, "YiChan_OnCheck") aux.RegisterCreatureEvent(5513022, 4, "YiChan_OnCheck") function Hrom_OnCheck(MapID, InstanceID, TargetID, TargetTypeID, RoleID) role.AddRoleItem(MapID, InstanceID, RoleID, 6600781, 1, -1, 8, 420) end aux.RegisterCreatureEvent(9010421, 4, "Hrom_OnCheck") function S9000401_CanUsed(MapID, InstanceID, SkillID, RoleID, TargetID, TargetTypeID) local rolelevel = role.GetRoleLevel(MapID, InstanceID, RoleID) local bRet, bIgnore = 0, false if MapID == 3440849960 then if rolelevel < 30 or rolelevel > 121 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 206303) -- 40�����ϲ��ܽ��� msg.DispatchRoleMsgEvent(RoleID, MsgID) bRet = 999 end elseif MapID == 3424074792 then if rolelevel < 30 or rolelevel > 121 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 206303) -- 40�����ϲ��ܽ��� msg.DispatchRoleMsgEvent(RoleID, MsgID) bRet = 999 end elseif MapID == 3424075048 then if rolelevel < 30 or rolelevel > 121 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 206303) -- 40�����ϲ��ܽ��� msg.DispatchRoleMsgEvent(RoleID, MsgID) bRet = 999 end elseif MapID == 3424072232 then if rolelevel < 30 or rolelevel > 121 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 206303) -- 40�����ϲ��ܽ��� msg.DispatchRoleMsgEvent(RoleID, MsgID) bRet = 999 end elseif MapID == 3424072488 then if rolelevel < 30 or rolelevel > 121 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 206303) -- 40�����ϲ��ܽ��� msg.DispatchRoleMsgEvent(RoleID, MsgID) bRet = 999 end elseif MapID == 3424071720 then if rolelevel < 30 or rolelevel > 121 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 206303) -- 40�����ϲ��ܽ��� msg.DispatchRoleMsgEvent(RoleID, MsgID) bRet = 999 end end return bRet, bIgnore end aux.RegisterSkillEvent(9000401, 0, "S9000401_CanUsed") -- Телепортационный NPC для перемещения игроков function x5513001_OnTalk(MapID, InstanceID, TargetID, TargetTypeID, RoleID, TalkIndex) -- Начальный диалог с NPC if TalkIndex == -1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604000) -- "Вы хотите воспользоваться телепортом?" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC (для телепортационных NPC обычно не требуется) msg.AddMsgEvent(MsgID, 21, 4) -- Опция 4 - подтверждение телепортации msg.AddMsgEvent(MsgID, 1, 100001) -- "Да" msg.AddMsgEvent(MsgID, 21, 5) -- Опция 5 - отказ от телепортации msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) -- Телепортация игрока при выборе опции 4 elseif TalkIndex == 4 then role.RoleGotoNewMap(MapID, InstanceID, RoleID, 619034298, 118, 40, 189) end end -- Регистрация обработчика диалога для телепортационного NPC aux.RegisterCreatureEvent(5513001, 7, "x5513001_OnTalk") -- NPC для призыва различных существ function x5513002_OnTalk(MapID, InstanceID, TargetID, TargetTypeID, RoleID, TalkIndex) -- Начальный диалог с NPC if TalkIndex == -1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604004) -- "Выберите существо для призыва" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 6) -- Опция 6 - Снежная женщина msg.AddMsgEvent(MsgID, 1, 604003) -- "Снежная женщина" msg.AddMsgEvent(MsgID, 21, 9) -- Опция 9 - Темный договор msg.AddMsgEvent(MsgID, 1, 604005) -- "Темный договор" msg.AddMsgEvent(MsgID, 21, 10) -- Опция 10 - Полуночная буря msg.AddMsgEvent(MsgID, 1, 604007) -- "Полуночная буря" msg.AddMsgEvent(MsgID, 21, 11) -- Опция 11 - Вечерний закат msg.AddMsgEvent(MsgID, 1, 604009) -- "Вечерний закат" msg.AddMsgEvent(MsgID, 21, 12) -- Опция 12 - Ледяной дракон msg.AddMsgEvent(MsgID, 1, 604011) -- "Ледяной дракон" msg.AddMsgEvent(MsgID, 21, 13) -- Опция 13 - Огненный дракон msg.AddMsgEvent(MsgID, 1, 604013) -- "Огненный дракон" msg.AddMsgEvent(MsgID, 21, 14) -- Опция 14 - Морская дева msg.AddMsgEvent(MsgID, 1, 604015) -- "Морская дева" msg.AddMsgEvent(MsgID, 21, 15) -- Опция 15 - Драконица msg.AddMsgEvent(MsgID, 1, 604017) -- "Драконица" msg.AddMsgEvent(MsgID, 21, 5) -- Опция 5 - Отмена msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) elseif TalkIndex == 6 then -- Снежная женщина local num = role.GetRoleItemNum(RoleID, 4400202) if num >= 20 then -- У игрока достаточно ресурсов для призыва local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604001) -- "У вас достаточно ресурсов для призыва существа" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 101) -- Кнопка подтверждения msg.AddMsgEvent(MsgID, 1, 100001) -- "Подтвердить" msg.AddMsgEvent(MsgID, 21, 102) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) else -- У игрока недостаточно ресурсов local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604002) -- "У вас недостаточно ресурсов для призыва" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 103) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) end elseif TalkIndex == 101 then -- Подтверждение призыва Снежной женщины local num = role.GetRoleItemNum(RoleID, 4400202) if num >= 20 then role.RemoveFromRole(MapID, InstanceID, RoleID, 4400202, 20, 420) map.MapCreateCreature(619034298, InstanceID, 1092001, 104, 1994, 141) -- NPC остается для повторных призывов end elseif TalkIndex == 9 then -- Темный договор local num = role.GetRoleItemNum(RoleID, 4400203) if num >= 20 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604006) -- "У вас достаточно ресурсов для призыва существа" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 111) -- Кнопка подтверждения msg.AddMsgEvent(MsgID, 1, 100001) -- "Подтвердить" msg.AddMsgEvent(MsgID, 21, 112) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604002) -- "У вас недостаточно ресурсов для призыва" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 113) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) end elseif TalkIndex == 111 then -- Подтверждение призыва Темного договора local num = role.GetRoleItemNum(RoleID, 4400203) if num >= 20 then role.RemoveFromRole(MapID, InstanceID, RoleID, 4400203, 20, 420) map.MapCreateCreature(619034298, InstanceID, 1092006, 104, 1994, 141) -- NPC остается для повторных призывов end elseif TalkIndex == 10 then -- Полуночная буря local num = role.GetRoleItemNum(RoleID, 4400204) if num >= 30 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604008) -- "У вас достаточно ресурсов для призыва существа" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 121) -- Кнопка подтверждения msg.AddMsgEvent(MsgID, 1, 100001) -- "Подтвердить" msg.AddMsgEvent(MsgID, 21, 122) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604002) -- "У вас недостаточно ресурсов для призыва" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 123) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) end elseif TalkIndex == 121 then -- Подтверждение призыва Полуночной бури local num = role.GetRoleItemNum(RoleID, 4400204) if num >= 30 then role.RemoveFromRole(MapID, InstanceID, RoleID, 4400204, 30, 420) map.MapCreateCreature(619034298, InstanceID, 1092002, 104, 1994, 141) -- NPC остается для повторных призывов end elseif TalkIndex == 11 then -- Вечерний закат local num = role.GetRoleItemNum(RoleID, 4400205) if num >= 30 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604010) -- "У вас достаточно ресурсов для призыва существа" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 131) -- Кнопка подтверждения msg.AddMsgEvent(MsgID, 1, 100001) -- "Подтвердить" msg.AddMsgEvent(MsgID, 21, 132) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604002) -- "У вас недостаточно ресурсов для призыва" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 133) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) end elseif TalkIndex == 131 then -- Подтверждение призыва Вечернего заката local num = role.GetRoleItemNum(RoleID, 4400205) if num >= 30 then role.RemoveFromRole(MapID, InstanceID, RoleID, 4400205, 30, 420) map.MapCreateCreature(619034298, InstanceID, 1092007, 104, 1994, 141) -- NPC остается для повторных призывов end elseif TalkIndex == 12 then -- Ледяной дракон local num = role.GetRoleItemNum(RoleID, 4400206) if num >= 40 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604012) -- "У вас достаточно ресурсов для призыва существа" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 141) -- Кнопка подтверждения msg.AddMsgEvent(MsgID, 1, 100001) -- "Подтвердить" msg.AddMsgEvent(MsgID, 21, 142) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604002) -- "У вас недостаточно ресурсов для призыва" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 143) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) end elseif TalkIndex == 141 then -- Подтверждение призыва Ледяного дракона local num = role.GetRoleItemNum(RoleID, 4400206) if num >= 40 then role.RemoveFromRole(MapID, InstanceID, RoleID, 4400206, 40, 420) map.MapCreateCreature(619034298, InstanceID, 1092003, 104, 1994, 141) -- NPC остается для повторных призывов end elseif TalkIndex == 13 then -- Огненный дракон local num = role.GetRoleItemNum(RoleID, 4400207) if num >= 40 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604014) -- "У вас достаточно ресурсов для призыва существа" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 151) -- Кнопка подтверждения msg.AddMsgEvent(MsgID, 1, 100001) -- "Подтвердить" msg.AddMsgEvent(MsgID, 21, 152) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604002) -- "У вас недостаточно ресурсов для призыва" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 153) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) end elseif TalkIndex == 151 then -- Подтверждение призыва Огненного дракона local num = role.GetRoleItemNum(RoleID, 4400207) if num >= 40 then role.RemoveFromRole(MapID, InstanceID, RoleID, 4400207, 40, 420) map.MapCreateCreature(619034298, InstanceID, 1092008, 104, 1994, 141) -- NPC остается для повторных призывов end elseif TalkIndex == 14 then -- Морская дева local num = role.GetRoleItemNum(RoleID, 4400208) if num >= 50 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604016) -- "У вас достаточно ресурсов для призыва существа" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 161) -- Кнопка подтверждения msg.AddMsgEvent(MsgID, 1, 100001) -- "Подтвердить" msg.AddMsgEvent(MsgID, 21, 162) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604002) -- "У вас недостаточно ресурсов для призыва" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 163) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) end elseif TalkIndex == 161 then -- Подтверждение призыва Морской девы local num = role.GetRoleItemNum(RoleID, 4400208) if num >= 50 then role.RemoveFromRole(MapID, InstanceID, RoleID, 4400208, 50, 420) map.MapCreateCreature(619034298, InstanceID, 1092004, 104, 1994, 141) -- NPC остается для повторных призывов end elseif TalkIndex == 15 then -- Драконица local num = role.GetRoleItemNum(RoleID, 4400209) if num >= 50 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604018) -- "У вас достаточно ресурсов для призыва существа" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 171) -- Кнопка подтверждения msg.AddMsgEvent(MsgID, 1, 100001) -- "Подтвердить" msg.AddMsgEvent(MsgID, 21, 172) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604002) -- "У вас недостаточно ресурсов для призыва" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 173) -- Кнопка отмены msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) end elseif TalkIndex == 171 then -- Подтверждение призыва Драконицы local num = role.GetRoleItemNum(RoleID, 4400209) if num >= 50 then role.RemoveFromRole(MapID, InstanceID, RoleID, 4400209, 50, 420) map.MapCreateCreature(619034298, InstanceID, 1092009, 104, 1994, 141) -- NPC остается для повторных призывов end end end -- Регистрация обработчика диалога для NPC призыва существ aux.RegisterCreatureEvent(5513002, 7, "x5513002_OnTalk") -- Информационный NPC о системе function x5513003_OnTalk(MapID, InstanceID, TargetID, TargetTypeID, RoleID, TalkIndex) -- Начальный диалог с информационным NPC if TalkIndex == -1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604019) -- "Вы хотите узнать о системе призыва существ?" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 1001) -- Опция 1001 msg.AddMsgEvent(MsgID, 1, 604020) -- "О системе призыва" msg.AddMsgEvent(MsgID, 21, 1002) -- Опция 1002 msg.AddMsgEvent(MsgID, 1, 604021) -- "О ресурсах для призыва" msg.AddMsgEvent(MsgID, 21, 1003) -- Опция 1003 msg.AddMsgEvent(MsgID, 1, 604022) -- "Где найти ресурсы" msg.AddMsgEvent(MsgID, 21, 1004) -- Опция 1004 msg.AddMsgEvent(MsgID, 1, 604023) -- "Список доступных существ" msg.AddMsgEvent(MsgID, 21, 5) -- Опция 5 - Отмена msg.AddMsgEvent(MsgID, 1, 100002) -- "Отмена" msg.DispatchRoleMsgEvent(RoleID, MsgID) elseif TalkIndex == 1001 then -- Информация о системе призыва local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604024) -- "Система призыва позволяет вызывать различных существ" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 5) -- Кнопка "OK" msg.AddMsgEvent(MsgID, 1, 100002) -- "OK" msg.DispatchRoleMsgEvent(RoleID, MsgID) elseif TalkIndex == 1002 then -- Информация о ресурсах local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604025) -- "Ресурсы можно получить из убитых существ" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 5) -- Кнопка "OK" msg.AddMsgEvent(MsgID, 1, 100002) -- "OK" msg.DispatchRoleMsgEvent(RoleID, MsgID) elseif TalkIndex == 1003 then -- Где найти ресурсы local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604026) -- "Ресурсы можно найти в различных локациях мира" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 5) -- Кнопка "OK" msg.AddMsgEvent(MsgID, 1, 100002) -- "OK" msg.DispatchRoleMsgEvent(RoleID, MsgID) elseif TalkIndex == 1004 then -- Список доступных существ local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 604027) -- "Доступны: Снежная женщина, Темный договор, и другие" msg.AddMsgEvent(MsgID, 24, TargetID) -- ID NPC msg.AddMsgEvent(MsgID, 21, 5) -- Кнопка "OK" msg.AddMsgEvent(MsgID, 1, 100002) -- "OK" msg.DispatchRoleMsgEvent(RoleID, MsgID) end end -- Регистрация обработчика диалога для информационного NPC aux.RegisterCreatureEvent(5513003, 7, "x5513003_OnTalk")