Postado Julho 1, 2017 8 anos Fala galera, estou com esse script de um Sistema de Refinamento que está funcionando perfeitamente para TFS 1.x, porem gostaria de adicionar algumas coisas e espero contar com a ajuda de vocês. Citar local vocations = {1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12} -- Vocações que podem refinar itens local ids_bloqueados = {2160, 5706, 2463} -- Itens que não podem ser refinados local controle = { {level = 0, quantOre = 1, chance = 100}, -- Level do item, quantidade de Iron Ore necessaria, chance de sucesso {level = 1, quantOre = 1, chance = 90}, {level = 2, quantOre = 1, chance = 80}, {level = 3, quantOre = 1, chance = 70}, {level = 4, quantOre = 1, chance = 60}, {level = 5, quantOre = 1, chance = 50}, {level = 6, quantOre = 1, chance = 40}, {level = 7, quantOre = 1, chance = 30}, {level = 8, quantOre = 1, chance = 20}, {level = 9, quantOre = 1, chance = 10} } function Item.getLevel(self) if self.uid > 0 then if self:getAttribute("aid") < 1 then return 0 else return (tonumber(self:getAttribute("aid"))-100) or 0 end end return false end function Item.addLevel(self, count) if self.uid > 0 and tonumber(count) > 0 then return self:setAttribute("aid", (self:getLevel() + count)+100) end return false end function getItemDescriptionsById(id) local it = ItemType(id) return {attack = it.getAttack(), defense = it.getDefense(), armor = it.getArmor()} end function onUse(cid, item, fromPosition, itemEx, toPosition) local player = Player(cid) if not isInArray(vocations, player:getVocation():getId()) then return player:sendCancelMessage("Sua vocacao nao pode refinar.") elseif isInArray(ids_bloqueados, itemEx.uid) then return player:sendCancelMessage("Este item nao pode ser refinado.") end local atk = ItemType(itemEx.itemid):getAttack() or nil local def = ItemType(itemEx.itemid):getDefense() or nil local arm = ItemType(itemEx.itemid):getArmor() or nil if atk > 0 or def > 0 or arm > 0 then for _, upgrade in pairs(controle) do local chance = math.random(1, 100) local item = Item(itemEx.uid) if item:getLevel() == upgrade.level then if player:removeItem(26408, upgrade.quantOre) then item:getPosition():sendMagicEffect(CONST_ME_CRAPS) if chance <= upgrade.chance then if item:getLevel() == 0 then item:setAttribute("description", "Esse item foi refinado por " ..player:getName()) end item:addLevel(1) item:setAttribute("name", ItemType(itemEx.itemid):getName().. " + " ..item:getLevel()) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Voce refinou com sucesso! Agora seu "..ItemType(itemEx.itemid):getName().." eh level " ..item:getLevel()) if atk > 0 then item:setAttribute("attack", atk+(3*item:getLevel())) return true elseif arm > 0 then item:setAttribute("armor", arm+(3*item:getLevel())) return true elseif def > 0 and atk <= 0 then item:setAttribute("defense", def+(3*item:getLevel())) return true end end else player:sendCancelMessage("Voce nao tem iron ores o suficiente. Voce precisa de "..upgrade.quantOre.." iron ores.") end end end else player:sendCancelMessage("Esse item nao pode ser refinado.") end return true end 1. A linha item:setAttribute("attack", atk+(3*item:getLevel())) adiciona uma quantidade FIXA de Ataque a arma, gostaria que o sistema adicionasse ataque em PORCENTAGEM. 2. Quando o jogador refinar um item a partir do +7, que isso fosse anunciado no chat global. 3. Gostaria que em caso de falha o player recebesse uma mensagem dizendo que o refinamento falhou, atualmente nenhuma mensagem é enviada. Espero que possam ajudar, de qualquer forma quem procurava por um Sistema de Refinamento funcional no 1.x+ aí está. Grato desde já, Abraços! Editado Julho 1, 2017 8 anos por Brahh (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.