local MACHINE_SELECT = { [01] = {NAME = "Machine #01", LEVEL = 040, COIN_TYPE = 01, COIN_PRICE = 10, GOLD_PRICE = 010000, RARE = {00, 01}, DESC = "Chance de vim raridade: COMUM a MELHORADO."}; [02] = {NAME = "Machine #02", LEVEL = 085, COIN_TYPE = 01, COIN_PRICE = 20, GOLD_PRICE = 040000, RARE = {00, 02}, DESC = "Chance de vim raridade: COMUM a RARO."}; [03] = {NAME = "Machine #03", LEVEL = 130, COIN_TYPE = 01, COIN_PRICE = 30, GOLD_PRICE = 070000, RARE = {01, 02}, DESC = "Chance de vim raridade: MELHORADO a RARO."}; [04] = {NAME = "Machine #04", LEVEL = 180, COIN_TYPE = 02, COIN_PRICE = 20, GOLD_PRICE = 100000, RARE = {00, 03}, DESC = "Chance de vim raridade: COMUM a ÉPICO."}; [05] = {NAME = "Machine #05", LEVEL = 225, COIN_TYPE = 02, COIN_PRICE = 30, GOLD_PRICE = 155000, RARE = {01, 03}, DESC = "Chance de vim raridade: MELHORADO a ÉPICO."}; [06] = {NAME = "Machine #06", LEVEL = 285, COIN_TYPE = 03, COIN_PRICE = 25, GOLD_PRICE = 200000, RARE = {01, 04}, DESC = "Chance de vim raridade: MELHORADO a LENDÁRIO."}; [07] = {NAME = "Machine #07", LEVEL = 320, COIN_TYPE = 03, COIN_PRICE = 35, GOLD_PRICE = 250000, RARE = {02, 04}, DESC = "Chance de vim raridade: RARO a LENDÁRIO."}; } local TASK_POINTS_NAME = { [01] = "Branco"; [02] = "Amarelo"; [03] = "Azul"; } local AMULET_ID = { [01] = {1001, 1002, 1008, 1016, 1005}, [02] = {1001, 1002, 1008, 1016, 1005, 1017, 1018, 1007}, [03] = {1001, 1002, 1008, 1016, 1005, 1017, 1018, 1007, 1019, 1020, 1021}, [04] = {1001, 1002, 1008, 1016, 1005, 1017, 1018, 1007, 1019, 1020, 1021, 1000, 1003, 1004, 1009}, [05] = {1001, 1002, 1008, 1016, 1005, 1017, 1018, 1007, 1019, 1020, 1021, 1000, 1003, 1004, 1009, 1006, 1014, 1015}, [06] = {1001, 1002, 1008, 1016, 1005, 1017, 1018, 1007, 1019, 1020, 1021, 1000, 1003, 1004, 1009, 1006, 1014, 1015, 1010, 1011, 1012, 1013}, [07] = {1001, 1002, 1008, 1016, 1005, 1017, 1018, 1007, 1019, 1020, 1021, 1000, 1003, 1004, 1009, 1006, 1014, 1015, 1010, 1011, 1012, 1013}, } function onSay(player, words, param) local split = param:splitTrimmed(" ") local INDEX = tonumber(split[01]) local PlayerCoins = 0 local PlayerGold = PlayerGoldCoins(player, 00) local NeedCoins = MACHINE_SELECT[INDEX].COIN_PRICE local GoldCoins = MACHINE_SELECT[INDEX].GOLD_PRICE local CoinsType = 0 if player:getLevel() < MACHINE_SELECT[INDEX].LEVEL then player:popupFYI("Você não tem nível suficiente.") return false end if MACHINE_SELECT[INDEX].COIN_TYPE == 01 then PlayerCoins = player:getStorageValue(_SYSTEM.TASK[00].TASK_COIN_1) CoinsType = 01 elseif MACHINE_SELECT[INDEX].COIN_TYPE == 02 then PlayerCoins = player:getStorageValue(_SYSTEM.TASK[00].TASK_COIN_2) CoinsType = 02 elseif MACHINE_SELECT[INDEX].COIN_TYPE == 03 then PlayerCoins = player:getStorageValue(_SYSTEM.TASK[00].TASK_COIN_3) CoinsType = 03 end if _DEBUG_MODE then print("[TALK - MACHINE AMULET] " ..player:getName().. " - Usando Machine Amulet (" ..split[01].. ")") end if _CHEATS.MACHINE_SORT_FREE == false then if PlayerGold >= GoldCoins then if PlayerCoins >= NeedCoins then local iid = AMULET_ID[INDEX][math.random(01, #AMULET_ID[INDEX])] local slo = 01 local rar = math.random(MACHINE_SELECT[INDEX].RARE[01], MACHINE_SELECT[INDEX].RARE[02]) local sta = 00 local qnt = 01 local ext = 00 if doBackpack(player, 00, slo, ext, 01) then if doBackpack(player, 01, slo, ext, 0, iid, rar, sta) then if CoinsType == 01 then player:setStorageValue(_SYSTEM.TASK[00].TASK_COIN_1, (player:getStorageValue(_SYSTEM.TASK[00].TASK_COIN_1) - NeedCoins)) elseif CoinsType == 02 then player:setStorageValue(_SYSTEM.TASK[00].TASK_COIN_2, (player:getStorageValue(_SYSTEM.TASK[00].TASK_COIN_2) - NeedCoins)) elseif CoinsType == 03 then player:setStorageValue(_SYSTEM.TASK[00].TASK_COIN_3, (player:getStorageValue(_SYSTEM.TASK[00].TASK_COIN_3) - NeedCoins)) end PlayerGoldCoins(player, 01, GoldCoins) --player:setStorageValue(_SYSTEM.GOLD_COIN, (PlayerGold - GoldCoins)) player:popupFYI("Você recebeu o item\n[ ".._RARIDADES[rar].Name.. " " .._ITEMS[iid].NAME.. " ].") player:getPosition():sendMagicEffect(14) if player:getStorageValue(_QUESTLOG[95].UID_01) == 02 then player:setStorageValue(_QUESTLOG[95].UID_01, 100) player:setStorageValue(_QUESTLOG[96].UID_01, 01) player:setStorageValue(_QUESTLOG[97].UID_01, 01) player:addExperience(15000, true, true) player:getPosition():sendMagicEffect(14) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") end end else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sua Backpack esta cheia.") player:getPosition():sendMagicEffect(03) return false end -- DESAFIO if player:getStorageValue(_DESAFIOS[00].DESAFIO_ID) > 00 then if INDEX == 01 then onPlayerDesafios(player, 58, 01) elseif INDEX == 02 then onPlayerDesafios(player, 59, 01) elseif INDEX == 03 then onPlayerDesafios(player, 60, 01) elseif INDEX == 04 then onPlayerDesafios(player, 61, 01) elseif INDEX == 05 then onPlayerDesafios(player, 62, 01) elseif INDEX == 06 then onPlayerDesafios(player, 63, 01) elseif INDEX == 07 then onPlayerDesafios(player, 64, 01) end end else player:popupFYI("Você não tem Task Points "..TASK_POINTS_NAME[MACHINE_SELECT[INDEX].COIN_TYPE].." suficiente.") end else player:popupFYI("Você não tem dinheiro suficiente.") end else local iid = math.random(1000, 1017) local slo = 01 local rar = math.random(MACHINE_SELECT[INDEX].RARE[01], MACHINE_SELECT[INDEX].RARE[02]) local sta = 00 local qnt = 01 local ext = 00 if doBackpack(player, 00, slo, ext, 01) then if doBackpack(player, 01, slo, ext, 0, iid, rar, sta) then PlayerTokenCoins(player, CoinsType, NeedCoins, 01) PlayerGoldCoins(player, 01, GoldCoins) --player:setStorageValue(_SYSTEM.GOLD_COIN, (PlayerGold - GoldCoins)) player:popupFYI("Você recebeu o item\n[ ".._RARIDADES[rar].Name.. " " .._ITEMS[iid].NAME.. " ].") player:getPosition():sendMagicEffect(14) if player:getStorageValue(_QUESTLOG[95].UID_01) == 02 then player:setStorageValue(_QUESTLOG[95].UID_01, 100) player:setStorageValue(_QUESTLOG[96].UID_01, 01) player:setStorageValue(_QUESTLOG[97].UID_01, 01) player:addExperience(35000, true, true) player:getPosition():sendMagicEffect(14) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") end end else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sua Backpack esta cheia.") player:getPosition():sendMagicEffect(03) return false end end doBackpack(player, 11) return false end