local M = 0 local S = 0 function onUse(player, item, fromPosition, target, toPosition, isHotkey) local id = { [1] = { 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026 }, [2] = { 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 }, [3] = { 10500, 10501, 10502, 10503, 10504, 10505, 10506, 10507, 10508, 10509, 10510, 10511, 10512, 10513, 10514, 10515, 10516, 10517, 10518, 10519, 10520, 10521, 10522, 10523, 10524, 10525, 10526 }, --[[[3] = { 11001, 11002, 11003, 11004, 11005, 11006, 11007, 11008, 11009, 11010, 11011, 11012, 11013, 11014, 11015, 11016, 11017, 11018, 11019, 11020, 11021, 11022, 11023, 11024, 11025, 11026, 11027 },]] [4] = { 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049 }, [5] = { 5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019, 5020, 5021, 5022, 5023, 5024, 5025, 5026, 5027, 5028, 5029, 5030, 5031, 5032, 5033, 5034, 5035, 5036, 5037, 5038, 5039, 5040, 5041, 5042, 5043, 5044, 5045, 5046, 5047, 5048 }, [6] = { 6000, 6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008, 6009, 6010, 6011, 6012, 6013, 6014, 6015, 6016, 6017, 6018, 6019, 6020, 6021, 6022, 6023 }, [7] = { 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010 }, [8] = { 8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019, 8020, 8021, 8022, 8023, 8024 }, [9] = { 9000, 9001, 9002, 9003, 9004, 9005, 9006, 9007, 9008, 9009, 9010, 9011, 9012, 9013, 9014, 9015, 9016, 9017, 9018, 9019, 9020 }, } local type = 0 local slot = math.random(1, 1) local itemid = 1002 --id[slot][math.random(01, #id[slot])] local rare = 02 --math.random(00, 04) local star = 01 --math.random(00, 02) local qnt = 01 --math.random(01, 05) local ext = 0 if type == 0 then if _ITEMS[itemid] then if doBackpack(player, 00, slot, ext, 01) then if slot == 3 then doBackpack(player, 03, slot, ext, 01, itemid) -- Procurar if doBackpack(player, 01, slot, ext, 0, itemid, rare, star, qnt) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce recebeu o item [ " .._ITEMS[itemid].NAME.. ", x" ..qnt.." ].") player:getPosition():sendMagicEffect(14) end else if doBackpack(player, 01, slot, ext, 0, itemid, rare, star) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce recebeu o item [ " .._ITEMS[itemid].NAME.. " ].") player:getPosition():sendMagicEffect(14) end end else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Sua Backpack esta cheia.") player:getPosition():sendMagicEffect(03) end else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Tente novamente.") player:getPosition():sendMagicEffect(03) end elseif type == 1 then local sumid = math.random(1000, 1156) local star = _SUMMON[sumid].STAR if doSummon(player, 02, star, sumid) == 0 then doSummon(player, 00, star) doSummon(player, 01, star, sumid) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce recebeu o summon \n[ " .._SUMMON[sumid].NAME.. " ]\nEstrelas [ " ..star.. " ].") player:getPosition():sendMagicEffect(14) doSummon(player, 00, 00) else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Você já possui o summon [ " .._SUMMON[sumid].NAME.. " ].\nTente novamente") player:getPosition():sendMagicEffect(03) end elseif type == 2 then M = 00 S = 15 local party = player:getParty() if not party then player:sendCancelMessage("@DGTime 01") else local members = party:getMembers() members[#members + 1] = party:getLeader() for _, member in ipairs(members) do member:sendCancelMessage("@DGTime 01") end end addEvent(onCountTimer, 1000, player.uid) else player:sendCancelMessage("@TaskMSG") end end function onCountTimer(cid) local player = Player(cid) if player then if M == 0 and S == 0 then local party = player:getParty() if not party then player:sendCancelMessage("@DGTime 00") else local members = party:getMembers() members[#members + 1] = party:getLeader() for _, member in ipairs(members) do member:sendCancelMessage("@DGTime 00") end end else local M1 = 0 local S1 = 0 local M2 = 0 local S2 = 0 if M > 0 and S > 0 then S = S - 1 elseif M > 0 and S == 0 then S = 59 M = M - 1 elseif M == 0 and S > 0 then S = S - 1 end if string.len(M) == 2 then M1 = string.sub(M, 1, 1) M2 = string.sub(M, 2, 2) else M1 = 0 M2 = string.sub(M, 1, 1) end if string.len(S) == 2 then S1 = string.sub(S, 1, 1) S2 = string.sub(S, 2, 2) else S1 = 0 S2 = string.sub(S, 1, 1) end local party = player:getParty() if not party then player:sendCancelMessage("@CountTempo " ..M1.. " " ..M2.." " ..S1.. " " ..S2) else local members = party:getMembers() members[#members + 1] = party:getLeader() for _, member in ipairs(members) do member:sendCancelMessage("@CountTempo " ..M1.. " " ..M2.." " ..S1.. " " ..S2) end end addEvent(onCountTimer, 1000, player.uid) end end end