function donation_next_settle() -- notice('this is a donation settle stuff') end function trigger_auto_time() if math.floor(gv("x") / 16128)~=1 and math.floor(gv("y") / 16128)~=6 then if math.floor(gv("x") / 16128)==13 and math.floor(gv("y") / 16128)==11 then warp( 219760, 192733 ) --add_state(6008,1,3000) elseif math.floor(gv("x") / 16128)==1 and math.floor(gv("y") / 16128)==6 then warp(20302, 108675) else warp( 186987, 160009 ) end end notice('auto time thing'..gv('name')..' - some stuff') --add_state(6008,1,2000) --warp( 186987 , 160009 ) set_flag("gsat",gametime()) set_flag("gsas",0) --set_flag("gsai",math.random(12,15)) end function sPVP_CHECK(idx,name) end function on_logout(name) -- notice('player '..name..'has logged out ') end function on_autotime(first,second) local sum = first + second set_flag("gsas",sum) local arrColor = {"22DC4F","E6EC2A","2AECCC","3818B9","F840ED","F84088","EC6A6A"} local num1 --, num2, num3 num1 = math.random(1,#arrColor) --num2 = math.random(1,#arrColor) --num3 = math.random(1,#arrColor) --local text = "<#"..arrColor[num1].."> "..tostring(first).." + <#"..arrColor[num2].."> "..tostring(second).." <#"..arrColor[num3].."> = ?" local text = "<#"..arrColor[num1].."> "..tostring(first).." + "..tostring(second).." = ?" private_notice( text, "@CHAT_TYPE:22" ) end function on_check_overpk(name) local xID = math.floor(gv("x",name) / 16128) local yID = math.floor(gv("y",name) / 16128) if (xID >= 5 and xID <= 6 and yID>=0 and yID<=8) or (xID==13 and yID==11) or (xID==12 and yID==11) then return true else return false end end function on_punish_overpk(name) --warp( 186987, 160009, name ) private_notice( "لا يحق لك قتل لاعب جديد خلال تدربه
you shall not kill newbie players", "@CHAT_TYPE:22", name ) end function get_owned_dungeon_state(dungeon_id) local state_id = 0 local arrState = { 19604, 19608, 19605, 19607, 19606, 19609, 19610, 19611, 19601, 19602, 19603, 19604 } local arrDungeon = { 130000,130600,130300,130500,130400,130700,130800,130900,121000,122000,123000,120700 } for i = 1, #arrDungeon do if arrDungeon[i] == dungeon_id then state_id = arrState[i] break end end return state_id end function get_deathmatch_rewardid(rank) local rank_rewards ={ 491032, 491033, 491034, 491035, 491036 } if rank <= 0 or rank > #rank_rewards then return 0 end return get_item_name_id(rank_rewards[rank]); end function on_kill_dmm(arg,monster_type) --[[ enum _DEATHMATCH_VALUE { SCORE = 1, KILL = 2, DEAD = 3, RANK = 4, IDX = 5, MAX }; ]] add_deathmatch_point(1,monster_type) end function on_deathmatch_reward(name,rank,score) if rank <= 0 then return end local exFlag if rank == 1 then exFlag = tonumber(get_flag("kill")) or 0 set_flag("kill",exFlag+1) else exFlag = tonumber(get_flag("dead")) or 0 set_flag("dead",exFlag+1) end local rank_rewards ={ 491032, 491033, 491034, 491035, 491036 } local basic_rewards= { {491025,1,10}, {491026,11,20}, {491027,21,30}--, {491028,31,40}, {491029,41,50} --update: decreasing rewards to top30 only } local score_rewards={ 491030, 491031 } if rank <= #rank_rewards then insert_item(rank_rewards[rank],1) private_notice( sconv("@90611026", "#@reward@#", "@"..tostring(get_item_name_id(rank_rewards[rank])) )) end if rank <= basic_rewards[#basic_rewards][3] then for i = 1, #basic_rewards do if rank >= basic_rewards[i][2] and rank <= basic_rewards[i][3] then insert_item(basic_rewards[i][1],1) private_notice( sconv("@90611025", "#@reward@#", "@"..tostring(get_item_name_id(basic_rewards[i][1])), "#@grade@#", tostring(rank) )) break end end end if score >= 100 then insert_item(score_rewards[1],1) elseif score >= 10 then insert_item(score_rewards[2],1) end end function on_use_deathmatch_reward(rank_reward,special_reward,score_reward) if rank_reward>=1 and rank_reward<=5 then local my_cnt = 100-(rank_reward-1)*20 insert_item(1100119,my_cnt) message(sconv("@254","#@item_num@#",tostring(my_cnt),"#@item_name@#","@"..tostring(get_item_name_id(1100119)))) local my_id = 705050+math.random(0,14) insert_item(my_id,1) message(sconv("@254","#@item_num@#",tostring(1),"#@item_name@#","@"..tostring(get_item_name_id(my_id)))) end if special_reward>=1 and special_reward<=2 then if math.random(1,20)>=20 then local my_id = 705126+math.random(0,6) insert_item(my_id,1) message(sconv("@254","#@item_num@#",tostring(1),"#@item_name@#","@"..tostring(get_item_name_id(my_id)))) notice("حصل اللاعب "..tostring(gv("name")).." على حجر إستقلاب المعايرة من مبارزات الهلاك","@CHAT_TYPE:22") end end if special_reward>= 1 and special_reward <= 2 then local handle_1 = get_item_handle(800000055) if find_item(800000055)>0 and handle_1>0 and math.random(1,10)>=5 then change_item_code( handle_1, 800000056 ) notice("مبارك للاعب "..tostring(gv("name")).." ! لقد تطورت الروح البيضاء لديه إلى II","@CHAT_TYPE:22") end end if special_reward<=2 and math.random(1,10)>=9 then local handle_1 = get_item_handle(800000056) if find_item(800000056)>0 and handle_1>0 then change_item_code( handle_1, 800000057 ) notice("مبارك للاعب "..tostring(gv("name")).." ! لقد تطورت الروح البيضاء لديه إلى III","@CHAT_TYPE:22") end end if score_reward>0 then local nPotionId = {610167,610169,610171,610173} local nRand = math.random(1,#nPotionId) insert_item(nPotionId[nRand],2) message(sconv("@254","#@item_num@#",tostring(2),"#@item_name@#","@"..tostring(get_item_name_id(nPotionId[nRand])))) end end ---------------------------------- function NPC_pierrot_Rondo_contact() dlg_title("@"..get_npc_type().."|@"..get_npc_name() ) dlg_text("@90611152") dlg_menu("@90010002", "") dlg_show() end function NPC_Quest_Katan_priest_contact() dlg_title("@"..get_npc_type().."|@"..get_npc_name() ) dlg_text("@90611236") dlg_menu("@90010002", "") dlg_show() end function NPC_Quest_Horizen_monk_contact() dlg_title("@"..get_npc_type().."|@"..get_npc_name() ) dlg_text("@90611236") dlg_menu("@90010002", "") dlg_show() end function NPC_Quest_RuinCity_monk_contact() dlg_title("@"..get_npc_type().."|@"..get_npc_name() ) dlg_text("@90611236") dlg_menu("@90010002", "") dlg_show() end function pw_merchant_exchange(handle,new,old) if get_local_info() == 8192 then return end dlg_title("@"..get_npc_type().."|@"..get_npc_name() ) if handle == 0 then dlg_text("@90610684") for i=0,14 do dlg_menu("@"..get_item_name_id(705050+i),"pw_merchant_exchange(1,"..(705050+i)..",0)") end elseif handle == 1 then dlg_text(sconv("@90610685","#@item@#","@"..get_item_name_id(new))) local it for i=0,14 do it=705050+i if find_item(it)>0 then dlg_menu(sconv("@90610687","#@number@#",find_item(it),"#@item@#","@"..get_item_name_id(it)),"pw_merchant_exchange(2,"..new..","..it..")") end end elseif handle == 2 then local nCount = find_item(old) if delete_item(get_item_handle(old),nCount) == 1 then insert_item(new,nCount) end pw_merchant_exchange(0,0,0) end dlg_menu( "@90605284", "parallelworld_merchant_etc()" ) dlg_show() end ------------------------------------ function Creature_Enchanter_IncSlot(idx,hHandle) dlg_title("@"..get_npc_type().."|@"..get_npc_name()) if idx >= 5 then local need_id=710015 if idx==6 then need_id = 710016 end if delete_item( get_item_handle( need_id ), 1 ) ~= 1 then return end local bSuc = math.random(1,100) >= 100 or idx == 6 if bSuc and get_creature_value( hHandle, "summon_state" ) == 0 then dlg_text("@90010274") message("@90010274") set_creature_value( hHandle, "sp", get_creature_value( hHandle, "sp" )+1 ) else dlg_text("@90010277") message("@90010277") end elseif idx >= 3 and idx <=4 then dlg_text( "@90010268" ) local need_id=710015 if idx==4 then need_id = 710016 end if find_item(need_id)>=1 and get_creature_value( hHandle, "sp" )<7 then dlg_menu( "@90010195", 'Creature_Enchanter_IncSlot('..(idx+2)..','..hHandle..')' ) end else dlg_text( "@90010265" ) local handle for i = 0, 5 do handle = get_creature_handle( i ) if handle ~= 0 and handle ~= nil and get_creature_value( handle, "summon_state" ) == 0 and get_item_enhance(get_parent_card(handle))>=5 then dlg_menu( sconv("<#ebe6ad>|@90010279", "#@name@#", get_creature_value( handle, "name" ), "#@lv@#",tostring(get_creature_value( handle, "level" )), "#@unit@#", tostring(get_creature_value( handle, "sp" ))), 'Creature_Enchanter_IncSlot('..(idx+2)..','..handle..')' ) end end end dlg_menu( "@2341", "NPC_Creature_Enchanter_Deva_contact()" ) --dlg_menu( "@2341", "Creature_Enchanter_IncSlot(1)" ) --dlg_menu( "<#ebe6ad>|@90010280", "Creature_Enchanter_IncSlot(1)" ) --MohcenMaher dlg_show() end ---------------------------------------------- function on_use_steel(idx) local need_id,result_id local need_cnt=10 if idx == 1 then need_id=1100103 result_id=1100117 elseif idx == 2 then need_id=1100117 result_id=1100119 elseif idx == 3 then need_id=1100118 result_id=1100119 need_cnt=100 end local create_count = math.floor( find_item( need_id ) / need_cnt ) if delete_item( get_item_handle( need_id ), create_count * need_cnt ) == 1 then insert_item( result_id, create_count ) end end function tp_add() sv("tp",gv("tp")+1) cprint( "@90604780" ) end function NPC_SkyFortress_Summon(idx,is_init) if is_init =="" or is_init==nil then is_init=false end if is_init then NPC_SkyFortress() dgv("skyfort_mbh") dgv("skyfort_bh") dgv("skyfort_tick") end if idx == 99 and get_quest_progress(6012)==1 then set_quest_status(6012,1,get_quest_status(6012,1)+1) end if idx == 1 then --killing mini-boss dgv("skyfort_mbh") dgv("skyfort_tick") elseif idx == 2 then --killing boss dgv("skyfort_bh") add_field_prop( 10602, 0, 24201, 104814, 0, 0 ) elseif idx == 3 then --call mini-boss, when initted, when get_minute() == 1 local pMob = {{24208, 107273,22300423},{24184, 102273,22300423},{26633, 104824,22300424},{21759, 104832,22300424}} local i = math.random(1,#pMob) sgv("skyfort_mbh", add_monster(pMob[i][3],pMob[i][1],pMob[i][2],0) ) elseif idx == 4 then --call boss, when mini-boss called (after 1 miniute) if GAGV("skyfort_mbh") == 0 then if GAGV("skyfort_tick") == 2 and GAGV("skyfort_bh") == 0 then sgv("skyfort_bh", add_monster(22300425,24184,104824,0) ) sgv("skyfort_tick",GAGV("skyfort_tick")+1) else sgv("skyfort_tick",GAGV("skyfort_tick")+1) end end end end function NPC_SkyFortress_Warp() local lastMin = GAGV("skyfort_lastmin") local lastPos = GAGV("skyfort_lastpos") local SKY_FORTRESS_POS = {{20388, 100958},{20302, 108675},{28208, 108738},{27972, 101036}} sv("hx",gv("x")) sv("hy",gv("y")) if lastMin == get_minute() then warp(SKY_FORTRESS_POS[lastPos+1][1],SKY_FORTRESS_POS[lastPos+1][2]) else sgv("skyfort_lastmin",get_minute()) if lastPos==3 then sgv("skyfort_lastpos",0) else sgv("skyfort_lastpos",lastPos+1) end lastPos = GAGV("skyfort_lastpos") warp(SKY_FORTRESS_POS[lastPos+1][1],SKY_FORTRESS_POS[lastPos+1][2]) end --set_pk_mode(1) end function NPC_Scout_Adeliana_contact() dlg_title("@"..get_npc_type().."|@"..get_npc_name() ) dlg_text("@90611511") dlg_menu("@90010002", "") dlg_show() end function NPC_fortune_teller_contact() dlg_title("@"..get_npc_type().."|@"..get_npc_name() ) dlg_text("@90108102") --if get_quest_progress(4074)==255 then dlg_menu("@90611498", "NPC_SkyFortress_Warp()") end if gv("level")>=190 then dlg_menu("@90611498", "NPC_SkyFortress_Warp()") end --MohcenMaher, 9.7; 9.8 new change dlg_menu("@90010002", "") dlg_show() end function NPC_fris_contact() dlg_title("@"..get_npc_type().."|@"..get_npc_name() ) dlg_text("@90108102") --[[if get_quest_progress(4074)==255 then dlg_menu("@90611498", "NPC_SkyFortress_Warp()") else]] if get_quest_progress(4074)==1 then set_quest_status(4074,1,1) end if gv("level")>=190 then dlg_menu("@90611498", "NPC_SkyFortress_Warp()") end --MohcenMaher, 9.7; 9.8 new change dlg_menu("@90010002", "") dlg_show() end function NPC_derrick_contact() dlg_title("@"..get_npc_type().."|@"..get_npc_name() ) dlg_text("@90108102") --[[if get_quest_progress(4074)==255 then dlg_menu("@90611498", "NPC_SkyFortress_Warp()") else]] if get_quest_progress(4074)==1 then set_quest_status(4074,1,1) end if gv("level")>=190 then dlg_menu("@90611498", "NPC_SkyFortress_Warp()") end --MohcenMaher, 9.7; 9.8 new change dlg_menu("@90010002", "") dlg_show() end function NPC_evangile_contact() dlg_title("@"..get_npc_type().."|@"..get_npc_name() ) dlg_text("@90108102") --[[if get_quest_progress(4074)==255 then dlg_menu("@90611498", "NPC_SkyFortress_Warp()") else]] if get_quest_progress(4074)==1 then set_quest_status(4074,1,1) end if gv("level")>=190 then dlg_menu("@90611498", "NPC_SkyFortress_Warp()") end --MohcenMaher, 9.7; 9.8 new change dlg_menu("@90010002", "") dlg_show() end function nomal_charge_Buff_operation3(step) local chaos = gv("chaos") if step>=1 and chaos>=(step*20000) then add_state( 1599, math.min(step,10), 60*60*100 ) av("chaos",-(step*20000)) update_gold_chaos() elseif step == 0 then dlg_title( "@90702501" ) dlg_text( "@90611530" ) if chaos>=20000 then local buffLv = math.floor(chaos/20000) for i=1,math.min(10,buffLv) do dlg_menu( "@90611531|"..i, "nomal_charge_Buff_operation3("..i..")" ) end end dlg_menu( "@90010003", "NPC_Secroute_mage_contact1()" ) dlg_menu( "@90010002", " " ) dlg_show() end end function NPC_SkyFortress() local pMob = { {20522, 108399 ,22300413}, {20869, 108431 ,22300413}, {20404, 108289 ,22300413}, {20719, 108226 ,22300413}, {20577, 107998 ,22300413}, {21034, 108281 ,22300413}, {21231, 107636 ,22300413}, {21570, 107328 ,22300413}, {20743, 108147 ,22300413}, {21184, 108124 ,22300413}, {20814, 107864 ,22300413}, {20380, 108321 ,22300413}, {22042, 106816, 22300417}, {22341, 106832, 22300417}, {22050, 106549, 22300417}, {22239, 106407, 22300417}, {22467, 106273, 22300417}, {22696, 106391, 22300417}, {22759, 106635, 22300417}, {22483, 106801, 22300417}, {22168, 105872, 22300417}, {23247, 106848, 22300417}, {21924, 105423, 22300422}, {22074, 105344, 22300422}, {22365, 104926, 22300422}, {22334, 104698, 22300422}, {22082, 104336, 22300422}, {21877, 104257, 22300422}, {21837, 105068, 22300422}, {22011, 104824, 22300422}, {21585, 104674, 22300422}, {21349, 104383, 22300422}, {21160, 104871, 22300422}, {21270, 105178, 22300422}, {22137, 103911, 22300420}, {22294, 103485, 22300420}, {22184, 103257, 22300420}, {22578, 103312, 22300420}, {22743, 103147, 22300420}, {22790, 103005, 22300420}, {22877, 102863, 22300420}, {22593, 102840, 22300420}, {22334, 102824, 22300420}, {22129, 102840, 22300420}, {23278, 102761, 22300420}, {21790, 102430, 22300416}, {21570, 102162, 22300416}, {21003, 101714, 22300416}, {20853, 101556, 22300416}, {20711, 101784, 22300416}, {20672, 101336, 22300416}, {20719, 101028, 22300416}, {20491, 101422, 22300416}, {20420, 101650, 22300416}, {20672, 101871, 22300416}, {21097, 101336, 22300416}, {20955, 101564, 22300416}, {23594, 102532, 22300421}, {23688, 102651, 22300421}, {24098, 102910, 22300421}, {24286, 102910, 22300421}, {24720, 102627, 22300421}, {24790, 102493, 22300421}, {23964, 102375, 22300421}, {24342, 102501, 22300421}, {24412, 102170, 22300421}, {24783, 102123, 22300421}, {24412, 101769, 22300421}, {23751, 101863, 22300421}, {25484, 102887, 22300419}, {25736, 102824, 22300419}, {25531, 103060, 22300419}, {25901, 103052, 22300419}, {26114, 102910, 22300419}, {25759, 103470, 22300419}, {26082, 103462, 22300419}, {26240, 103202, 22300419}, {25932, 102981, 22300419}, {26271, 102690, 22300419}, {26531, 102446, 22300415}, {26846, 102178, 22300415}, {27405, 101454, 22300415}, {27626, 101013, 22300415}, {28004, 101367, 22300415}, {27578, 101398, 22300415}, {27279, 101241, 22300415}, {27696, 101674, 22300415}, {27547, 101934, 22300415}, {27216, 101769, 22300415}, {27224, 101485, 22300415}, {27310, 101462, 22300415}, {26366, 104304, 22300422}, {26507, 104273, 22300422}, {26074, 104738, 22300422}, {26074, 104926, 22300422}, {26326, 105368, 22300422}, {26484, 105407, 22300422}, {26744, 104564, 22300422}, {26358, 104824, 22300422}, {26688, 105076, 22300422}, {26940, 105368, 22300422}, {27263, 104903, 22300422}, {27058, 104399, 22300422}, {26027, 106163, 22300418}, {25814, 106297, 22300418}, {26114, 106438, 22300418}, {25791, 106533, 22300418}, {25578, 106438, 22300418}, {25546, 106675, 22300418}, {25783, 106824, 22300418}, {26098, 106895, 22300418}, {26145, 106706, 22300418}, {26287, 106998, 22300418}, {25972, 106588, 22300418}, {25862, 106628, 22300418}, {24720, 106974, 22300421}, {24759, 107092, 22300421}, {24279, 106683, 22300421}, {24098, 106683, 22300421}, {23688, 106942, 22300421}, {23625, 107084, 22300421}, {23609, 107446, 22300421}, {23877, 107801, 22300421}, {24491, 107809, 22300421}, {24412, 107132, 22300421}, {24350, 107565, 22300421}, {23908, 107289, 22300421}, {26523, 107250, 22300414}, {26870, 107572, 22300414}, {27184, 107856, 22300414}, {27539, 107817, 22300414}, {27082, 108116, 22300414}, {27870, 108210, 22300414}, {27366, 108549, 22300414}, {27783, 108423, 22300414}, {27523, 108179, 22300414}, {27893, 108202, 22300414}, {27374, 108006, 22300414}, {27248, 108273, 22300414} } for i=1,#pMob do respawn_rare_mob( 10600, --[[1*60*100]]30*100, pMob[i][1], pMob[i][2], pMob[i][3], 4, 0 ) --no wandering, 4 per square, 10m revival interval --2m interval end local MOBA_JUNGLE = { {29000207,11316, 125212}, {29000208,12261, 124071}, {29000209,11844, 124000}, {29000210,10789, 124850}, {29000211,12450, 124803}, {29000212,11096, 124456}, {29000213,11734, 125291}, {29000214,12474, 124559}, {29000215,11686, 124260}, {29000216,11860, 125031}, {29000217,12710, 124102}, {29000218,11513, 125150}, {29000219,10883, 125165}, } for j=1,#MOBA_JUNGLE do respawn_rare_mob( 700, 10*60*100, MOBA_JUNGLE[j][2], MOBA_JUNGLE[j][3], MOBA_JUNGLE[j][1], 1, 0 ) --no wandering, 1 per square, 10m revival interval end local pNpc = { {20412, 108541}, {20467, 101076}, {27830, 101107}, {28098, 108628} } for i=1,#pNpc do add_npc_to_world( pNpc[i][1], pNpc[i][2], 0, 15133) end -------------9.8------------- local pPos = { {139167, 142679}, {139017, 142671}, {138876, 142671} } for i = 0,2 do add_field_prop( 2320+i, 0, pPos[i+1][1], pPos[i+1][2], 0, 3 ) --layer 0, height 3 end -------------DAYON------------- add_field_prop( 400112, 0, 152744, 77537, 0, 0, 0, 0, 0, 2, 2, 2 ) --add_npc_to_world( 153028, 76954, 0, 40004) --add_npc_to_world( 152466, 76950, 0, 40005) end function quest_start_4073() --quest_skyfortress_bones() local pos = { {100461, 69985}, {100572, 69426}, {100264, 69820}, {101524, 69804}, {101477, 69426}, {102036, 69347}, {102131, 70095}, {102430, 70749}, {102454, 69119}, {102477, 68828} --[[ {101950, 69780}, {101926, 70560}, {101934, 71143}, {101769, 68702}, {101462, 69402}, ]] } for i = 1, #pos do add_field_prop( 30224, 0, pos[i][1]+math.random(0,10), pos[i][2]+math.random(0,10), 0) end end function quest_prop_Vulcanus_30179() enter_vulcanus() end function DailyBeast_Call(step) local wday = tonumber(get_os_date("%w")) local idx = -1 if wday == 1 or wday == 4 then idx = 0 elseif wday == 2 or wday == 5 then idx = 1 elseif wday == 3 or wday == 6 then idx = 2 end if idx < 0 then return end if step == 0 then notice("@"..tostring(90611452+idx)) return end local pos = { {116251, 141199}, {155610, 79404}, {114424, 56243} } add_npc(pos[idx+1][1], pos[idx+1][2], 22300408+idx, 1, (45*6000), 0) notice("@"..tostring(90611455+idx)) notice("@"..tostring(90611458+idx)) end function DailyBeast_Kill(mid,top_damager) local stringCode = 90611461 + (mid-22300408) notice(sconv("@"..tostring(stringCode),"#@winner@#",tostring(top_damager))) notice("@"..tostring(90611464+mid-22300408)) end function salon_dlg() end ---------------------------------------------- TH_MAX_MINUTE = 30 function NPC_Quest_maze_Templar_contact() dlg_title("@"..get_npc_type().."|@"..get_npc_name() ) dlg_text("@90611511") dlg_menu("@90010002", "") dlg_show() end function TH_maze(step,layer) --1 init 2 join 3 leave if step == 1 then set_instance_dungeon_flag( 90100, layer, 'room', 0 ) set_instance_dungeon_flag( 90100, layer, 'time', get_os_time() ) local pGate = { --{74788, 14733, 2301}, {74812, 13750, 2300}, {76072, 13766, 2300}, {77332, 13750, 2300}, {78608, 13750, 2300}, {74805, 12734, 2300}, {76072, 12726, 2300}, {77348, 12734, 2300}, {78585, 12742, 2300}, {74812, 11734, 2300}, {76072, 11734, 2300}, {77325, 11718, 2300}, {78577, 11734, 2300}, {74797, 10718, 2300}, {76057, 10726, 2300}, {77317, 10718, 2300}, {78577, 10726, 2300}, {75884, 13742, 2301}, {77144, 13750, 2301}, {78404, 13742, 2301}, {79664, 13734, 2301}, {75884, 12734, 2301}, {77136, 12734, 2301}, {78404, 12742, 2301}, {79664, 12734, 2301}, {75876, 11726, 2301}, {77144, 11726, 2301}, {78404, 11726, 2301}, {79664, 11726, 2301}, {75884, 10702, 2301}, {77136, 10718, 2301}, {78404, 10718, 2301}, {79671, 10710, 2301} } for i = 1, #pGate do add_field_prop( pGate[i][3], 0, pGate[i][1], pGate[i][2], layer, 41 ) --last par is for height if pGate[i][3] == 2301 then add_field_prop( 2302, 0, pGate[i][1]-22, pGate[i][2]+32, layer, 41, 0, 0, 0, 0.3, 0.3, 0.3 ) add_field_prop( 2303, 0, pGate[i][1]+16, pGate[i][2]+32, layer, 41, 0, 0, 0, 0.3, 0.3, 0.3 ) add_field_prop( 2304, 0, pGate[i][1]+16, pGate[i][2]-32, layer, 41, 0, 0, 0, 0.3, 0.3, 0.3 ) add_field_prop( 2305, 0, pGate[i][1]-22, pGate[i][2]-32, layer, 41, 0, 0, 0, 0.3, 0.3, 0.3 ) end end end --warp_to_instance_dungeon(90100) end function TH_clear(group,layer,x,y) if group >= 90121 then local number = tonumber(get_instance_dungeon_flag( 90100, layer, 'number' )) or 0 local code = math.random(1,5) set_instance_dungeon_flag(90100, layer, 'number', number+code) add_field_prop( 2311+code-1, 0, x, y, layer, -140 ) --last par is for height local remaining_time = math.max(0,(tonumber(get_instance_dungeon_flag( 90100, layer, 'time' )) + TH_MAX_MINUTE*60) - get_os_time()) local minute = math.floor(remaining_time/60) local second = remaining_time - minute*60 do_each_player_in_instance_dungeon( 90100, layer, 'private_notice(sconv("@9922","#@num@#",tostring('..code..'),"#@time@#","'..minute..':'..second..'"),"@CHAT_TYPE:22")' ) end if group == 90136 and get_alive_instance_respawn_group_monster_count( 90100, layer, 90136 ) == 0 then add_field_prop( 2317, 0, 74946, 9694, layer, 25 ) add_field_prop( 2316, 0, 74773, 9694, layer, 0 ) end end function TH_Portal() local x = gv("x") local y = gv("y") if math.floor(x/16128) ~= 4 or math.floor(y/16128) ~= 0 then return end local layer = gv("layer") --local room = tonumber(get_instance_dungeon_flag( 90100, layer, 'room')) or 0 local room = TH_get_room(x,y) local pRoom = { {74812, 13750}, {76072, 13766}, {77332, 13750}, {78608, 13750}, {74805, 12734}, {76072, 12726}, {77348, 12734}, {78585, 12742}, {74812, 11734}, {76072, 11734}, {77325, 11718}, {78577, 11734}, {74797, 10718}, {76057, 10726}, {77317, 10718}, {78577, 10726} } if room == 0 then common_warp_gate(pRoom[room+1][1], pRoom[room+1][2]) elseif room == 16 then if get_alive_instance_respawn_group_monster_count( 90100, layer, 90120+room ) == 0 then common_warp_gate(74883, 9702) else do_each_player_in_instance_dungeon( 90100, layer, 'private_notice("@9921","@CHAT_TYPE:22")' ) end elseif room >= 1 and room < #pRoom then local count = get_alive_instance_respawn_group_monster_count( 90100, layer, 90120+room ) local skip = tonumber(get_instance_dungeon_flag( 90100, layer, 'skip_'..room )) or 1 if count == 0 then common_warp_gate(pRoom[math.min(16,room+skip)][1], pRoom[math.min(16,room+skip)][2]) local current = tonumber(get_instance_dungeon_flag( 90100, layer, 'room')) or 1 if room+skip > current then set_instance_dungeon_flag( 90100, layer, 'number', 0 ) set_instance_dungeon_flag( 90100, layer, 'room', math.min(16,room+skip) ) end else do_each_player_in_instance_dungeon( 90100, layer, 'private_notice("@9921","@CHAT_TYPE:22")' ) end end end function TH_get_room(x,y) local room = 0 if x >= 74718 and y<=14196 and x<=75936 and y>=13230 then room=1 elseif x >= 75978 and y<=14196 and x<=77196 and y>=13230 then room=2 elseif x >= 77238 and y<=14196 and x<=78456 and y>=13230 then room=3 elseif x >= 78498 and y<=14196 and x<=79884 and y>=13230 then room=4 elseif x >= 74718 and y<=13188 and x<=75936 and y>=12222 then room=5 elseif x >= 75978 and y<=13188 and x<=77196 and y>=12222 then room=6 elseif x >= 77238 and y<=13188 and x<=78456 and y>=12264 then room=7 elseif x >= 78498 and y<=13188 and x<=79716 and y>=12222 then room=8 elseif x >= 74718 and y<=12180 and x<=75936 and y>=11214 then room=9 elseif x >= 75978 and y<=12180 and x<=77196 and y>=11214 then room=10 elseif x >= 77238 and y<=12180 and x<=78456 and y>=11214 then room=11 elseif x >= 78498 and y<=12180 and x<=79716 and y>=11214 then room=12 elseif x >= 74718 and y<=11172 and x<=75936 and y>=10206 then room=13 elseif x >= 75978 and y<=11172 and x<=77196 and y>=10206 then room=14 elseif x >= 77238 and y<=11172 and x<=78456 and y>=10206 then room=15 elseif x >= 78498 and y<=11172 and x<=79716 and y>=10206 then room=16 end return room end function is_prime(n) for i = 2, n^(1/2) do if (n % i) == 0 then return false end end return true end function TH_Slate(key) local layer = gv("layer") local room = TH_get_room(gv("x"),gv("y")) local count = tonumber(get_alive_instance_respawn_group_monster_count( 90100, layer, 90120+room )) or -1 local number = tonumber(get_instance_dungeon_flag( 90100, layer, 'number' )) or 0 if count ~= 0 or number == 0 then private_notice("@9921","@CHAT_TYPE:22") add_field_prop( 2302+key-1, 0, gv("x"), gv("y"), layer, 41, 0, 0, 0, 0.3, 0.3, 0.3 ) --last par is for height return end local skip = tonumber(get_instance_dungeon_flag( 90100, layer, 'skip_'..room )) or 1 --if skip>=4 then return end if skip>=3 then return end local correct = false if key == 1 and number%2==0 then correct = true elseif key == 2 and (number==4 or number==9 or number==16 or number==25) then correct = true elseif key == 3 and is_prime(number) then correct = true end if correct then set_instance_dungeon_flag( 90100, layer, 'skip_'..room, skip+1 ) do_each_player_in_instance_dungeon( 90100, layer, 'private_notice("@'..tostring(170002302+key-1)..'|: T","@CHAT_TYPE:22")' ) else do_each_player_in_instance_dungeon( 90100, layer, 'private_notice("@'..tostring(170002302+key-1)..'|: F","@CHAT_TYPE:22")' ) end end function TH_Core(code) if math.floor(gv("x")/16128) ~= 4 or math.floor(gv("y")/16128) ~= 0 then return end local layer = gv("layer") local remaining_time = math.max(0,(tonumber(get_instance_dungeon_flag( 90100, layer, 'time' )) + TH_MAX_MINUTE*60) - get_os_time()) local minute = math.floor(remaining_time/60) local second = remaining_time - minute*60 do_each_player_in_instance_dungeon( 90100, layer, 'private_notice(sconv("@9922","#@num@#",tostring('..code..'),"#@time@#","'..minute..':'..second..'"),"@CHAT_TYPE:22")' ) end function TH_Reward(idx) --TODO set_quest_status(6013,1,get_quest_status(6013,1)+1) local rate = math.random(1,10) if rate >= 9 then do_each_player_in_instance_dungeon( 90100, gv("layer"), 'insert_item(803006,4)' ) do_each_player_in_instance_dungeon( 90100, gv("layer"), 'private_notice(sconv("@254","#@item_num@#",tostring(4),"#@item_name@#","@10803006"),"@CHAT_TYPE:22")' ) elseif rate>=5 then do_each_player_in_instance_dungeon( 90100, gv("layer"), 'insert_item(2020003,math.random(3,3))' ) do_each_player_in_instance_dungeon( 90100, gv("layer"), 'private_notice(sconv("@254","#@item_num@#",tostring(3),"#@item_name@#","@12020003"),"@CHAT_TYPE:22")' ) else do_each_player_in_instance_dungeon( 90100, gv("layer"), 'insert_item(2020000,7)' ) do_each_player_in_instance_dungeon( 90100, gv("layer"), 'private_notice(sconv("@254","#@item_num@#",tostring(7),"#@item_name@#","@12020000"),"@CHAT_TYPE:22")' ) end end function test_p(id,h) -- 74750, 14734 add_field_prop( id, 0, gv("x"), gv("y"), gv("layer"), h ) end function quest_maze(id,state) --state: 1/start; 3/end; --[[local pPos = { {139167, 142679}, {139017, 142671}, {138876, 142671} } local idx = id-4122 if state == 1 then add_field_prop( 2320+idx, 0, pPos[idx+1][1], pPos[idx+1][2], gv("layer"), 3 ) end]] end function maze_enterance(id) local status = get_quest_progress(id) if status == 1 then set_quest_status(id,1,1) end local can_enter = get_quest_progress(4124) if id == 4124 and (can_enter == 255 or can_enter == 1 or can_enter == 2) then sv("hx",gv("x")) sv("hy",gv("y")) warp_to_instance_dungeon(90100) end end --//test_p(2301) --//add_field_prop( 2316, 0, gv("x"), gv("y"), gv("layer"), 10 ) ----------------------------------------------------- function GF_CHECK(tick) end --run warp(75462,13950, 3) function ResponMonsterByID(id) add_npc(24184,104824,id, 1) end