local NINHO_DIFICULTY = { [01] = {"FACIL", 2000, 500}; [02] = {"MEDIO", 10000, 3000}; [03] = {"DIFICIL", 35000, 15000}; [04] = {"IMPOSSIVEL", 55000, 25000}; } local TREE_CLICK = { [01] = 10150; [02] = 10151; [03] = 10152; [04] = 10153; [05] = 10153; } function onUse(player, item, fromPosition, target, toPosition, isHotkey) local checkArea = 0 local from = {x=4043, y=934, z=08} local to = {x=4067, y=955, z=08} for A = from.x, to.x do for B = from.y, to.y do for C = from.z, to.z do local tile = Tile(A, B, C) local creature = tile:getTopCreature() if creature and creature:isMonster() then checkArea = 1 break end end end end if checkArea == 00 then local TAG = _SYSTEM.GLOBAL_INDEX[02] local CHECK_STEP = player:getStorageValue(TAG) local HARD = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][01] if CHECK_STEP < 1 then CHECK_STEP = 01 end if _DEBUG_MODE then print("[ACTION - CURSED TREE] " ..player:getName().. " - Clicando na Árvore (" ..CHECK_STEP.. ")") end if item.uid == TREE_CLICK[CHECK_STEP] then if CHECK_STEP == 05 then local EXPERIENCE = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][02] player:teleportTo({x=3685, y=1033, z=7}) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) player:setStorageValue(TAG, nil) player:addExperience(EXPERIENCE, true, true) if HARD == "FACIL" then local RANDOM_ITEM = math.random(00, 10) if RANDOM_ITEM < 08 then local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03] PlayerGoldCoins(player, 02, GoldQnt) else local Atributos = { 11001, 11006, 11007, 11008, 11015, 11020, 11004, 11005, 11011, 11014, 11032, 11040 } local itemid = Atributos[math.random(01, #Atributos)] local rare = _ITEMS[itemid].RARE local star = 00 local slot = 03 local uni = false if doBackpack(player, 00, slot, 00, 01) then if doBackpack(player, 01, slot, 00, 0, itemid, rare, star, 01, uni) then player:getPosition():sendMagicEffect(14) end else local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03] PlayerGoldCoins(player, 02, GoldQnt) player:getPosition():sendMagicEffect(03) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sua Backpack está cheia.") end end elseif HARD == "MEDIO" then local RANDOM_ITEM = math.random(00, 10) if RANDOM_ITEM < 06 then local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03] PlayerGoldCoins(player, 02, GoldQnt) else local Atributos = { 11001, 11006, 11007, 11008, 11015, 11020, 11004, 11005, 11011, 11014, 11032, 11040, 11003, 11010, 11012, 11016, 11026 } local itemid = Atributos[math.random(01, #Atributos)] local rare = _ITEMS[itemid].RARE local star = 00 local slot = 03 local uni = false if doBackpack(player, 00, slot, 00, 01) then if doBackpack(player, 01, slot, 00, 0, itemid, rare, star, 01, uni) then player:getPosition():sendMagicEffect(14) end else local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03] PlayerGoldCoins(player, 02, GoldQnt) player:getPosition():sendMagicEffect(03) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sua Backpack está cheia.") end end elseif HARD == "DIFICIL" then local RANDOM_ITEM = math.random(00, 10) if RANDOM_ITEM < 03 then local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03] PlayerGoldCoins(player, 02, GoldQnt) elseif RANDOM_ITEM > 02 and RANDOM_ITEM < 08 then local Atributos = { 11001, 11006, 11007, 11008, 11015, 11020, 11004, 11005, 11011, 11014, 11032, 11040, 11003, 11010, 11012, 11016, 11026, 11002, 11013, 11017, 11018, 11019, 11021, 11022, 11023, 11024 } local itemid = Atributos[math.random(01, #Atributos)] local rare = _ITEMS[itemid].RARE local star = 00 local slot = 03 local uni = false if doBackpack(player, 00, slot, 00, 01) then if doBackpack(player, 01, slot, 00, 0, itemid, rare, star, 01, uni) then player:getPosition():sendMagicEffect(14) end else local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03] PlayerGoldCoins(player, 02, GoldQnt) player:getPosition():sendMagicEffect(03) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sua Backpack está cheia.") end else local itemid = math.random(7000, 7014) local rare = math.random(00, 01) local star = 0 local slot = 07 local uni = false if doBackpack(player, 00, slot, 00, 01) then if doBackpack(player, 01, slot, 00, 0, itemid, rare, star, 01, uni) then player:getPosition():sendMagicEffect(14) end else local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03] PlayerGoldCoins(player, 02, GoldQnt) player:getPosition():sendMagicEffect(03) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sua Backpack está cheia.") end end else local RANDOM_ITEM = math.random(00, 10) if RANDOM_ITEM < 02 then local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03] PlayerGoldCoins(player, 02, GoldQnt) elseif RANDOM_ITEM > 01 and RANDOM_ITEM < 06 then local Atributos = { 11001, 11006, 11007, 11008, 11015, 11020, 11004, 11005, 11011, 11014, 11032, 11040, 11003, 11010, 11012, 11016, 11026, 11002, 11013, 11017, 11018, 11019, 11021, 11022, 11023, 11024 } local itemid = Atributos[math.random(01, #Atributos)] local rare = _ITEMS[itemid].RARE local star = 00 local slot = 03 if doBackpack(player, 00, slot, 00, 01) then if doBackpack(player, 01, slot, 00, 0, itemid, rare, star) then player:getPosition():sendMagicEffect(14) end else local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03] PlayerGoldCoins(player, 02, GoldQnt) player:getPosition():sendMagicEffect(03) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sua Backpack está cheia.") end else local itemid = math.random(7000, 7014) local rare = math.random(00, 02) local star = 0 local slot = 07 if doBackpack(player, 00, slot, 00, 01) then if doBackpack(player, 01, slot, 00, 0, itemid, rare, star) then player:getPosition():sendMagicEffect(14) end else local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03] PlayerGoldCoins(player, 02, GoldQnt) player:getPosition():sendMagicEffect(03) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sua Backpack está cheia.") end end end -- DESAFIO if player:getStorageValue(_DESAFIOS[00].DESAFIO_ID) > 00 then if HARD == "FACIL" then onPlayerDesafios(player, 54, 01) elseif HARD == "MEDIO" then onPlayerDesafios(player, 55, 01) elseif HARD == "DIFICIL" then onPlayerDesafios(player, 56, 01) elseif HARD == "IMPOSSIVEL" then onPlayerDesafios(player, 57, 01) end end player:setStorageValue(_SYSTEM.CURSED_TREE, nil) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Você finalizou a Arvore Amaldiçoada na dificuldade (" ..HARD.. ")\n[ EXP " ..EXPERIENCE.. " ]") if player:getStorageValue(_QUESTLOG[31].UID_01) == 02 then addEvent(function() player:setStorageValue(_QUESTLOG[31].UID_01, 03) player:getPosition():sendMagicEffect(14) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") doBackpack(player, 12) end, 3000) end if HARD == "MEDIO" then if player:getStorageValue(_QUESTLOG[153].UID_01) == 01 then addEvent(function() player:setStorageValue(_QUESTLOG[153].UID_01, 100) player:setStorageValue(_QUESTLOG[154].UID_01, 01) player:addExperience(40000, true, true) player:getPosition():sendMagicEffect(14) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") doBackpack(player, 12) end, 3000) end end if HARD == "DIFICIL" then if player:getStorageValue(_QUESTLOG[154].UID_01) == 01 then addEvent(function() player:setStorageValue(_QUESTLOG[154].UID_01, 100) player:setStorageValue(_QUESTLOG[155].UID_01, 01) player:addExperience(60000, true, true) player:getPosition():sendMagicEffect(14) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") doBackpack(player, 12) end, 3000) end end if HARD == "IMPOSSIVEL" then if player:getStorageValue(_QUESTLOG[155].UID_01) == 01 then addEvent(function() player:setStorageValue(_QUESTLOG[155].UID_01, 100) player:addExperience(80000, true, true) player:getPosition():sendMagicEffect(14) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") doBackpack(player, 12) end, 3000) end end else player:setStorageValue(TAG, (CHECK_STEP + 1)) player:getPosition():sendMagicEffect(13) Game.createMonster(_GLOBAL_RANDOM.NINHOS[HARD][math.random(01, #_GLOBAL_RANDOM.NINHOS[HARD])].NAME, {x=4048, y=945, z=08}, false, true) Game.createMonster(_GLOBAL_RANDOM.NINHOS[HARD][math.random(01, #_GLOBAL_RANDOM.NINHOS[HARD])].NAME, {x=4050, y=948, z=08}, false, true) Game.createMonster(_GLOBAL_RANDOM.NINHOS[HARD][math.random(01, #_GLOBAL_RANDOM.NINHOS[HARD])].NAME, {x=4053, y=942, z=08}, false, true) Game.createMonster(_GLOBAL_RANDOM.NINHOS[HARD][math.random(01, #_GLOBAL_RANDOM.NINHOS[HARD])].NAME, {x=4055, y=950, z=08}, false, true) Game.createMonster(_GLOBAL_RANDOM.NINHOS[HARD][math.random(01, #_GLOBAL_RANDOM.NINHOS[HARD])].NAME, {x=4059, y=948, z=08}, false, true) Game.createMonster(_GLOBAL_RANDOM.NINHOS[HARD][math.random(01, #_GLOBAL_RANDOM.NINHOS[HARD])].NAME, {x=4059, y=944, z=08}, false, true) end else player:getPosition():sendMagicEffect(03) end else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Limpe a área primeiro.") player:getPosition():sendMagicEffect(03) end return true end