Ir para conteúdo

Featured Replies

Postado

tentei deixar esse script para poder refinar so itens de defesa como armor,boots,helmet,shield... mais ainda ta refinando itens de ataque como sword,axe,club etc. queria tb deixar para poder refinar no maximo até +10 OBG!!!!

local vocations = {1, 2, 4, 5, 6, 7, 8} -- Vocações que podem refinar itens

local ids_bloqueados = {2160, 5706, 2463} -- Itens que não podem ser refinados

local controle = {
    {level = 0, money = 1, chance = 100}, -- Level do item, quantidade de Iron Ore necessaria, chance de sucesso
    {level = 1, money = 100, chance = 100},
}

function getItemLevel(uid)
    if uid > 0 then
        return getItemAttribute(uid, "lvl") or 0
    end
    return false
end

function doItemAddLevel(uid, count)
    if uid > 0 and tonumber(count) > 0 then
        return doItemSetAttribute(uid, "lvl", getItemLevel(uid) + count)
    end
    return false
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if not isInArray(vocations, getPlayerVocation(cid)) then
        return doPlayerSendCancel(cid, "Sua vocacao nao pode refinar.")
    elseif isInArray(ids_bloqueados, itemEx.uid) then
        return doPlayerSendCancel(cid, "Este item nao pode ser refinado.")
    end 
    
    if getItemInfo(itemEx.itemid).defense > 0 or getItemInfo(itemEx.itemid).armor > 0 then
        for _, upgrade in pairs(controle) do
            local def = getItemAttribute(itemEx.uid, "defense") or getItemInfo(itemEx.itemid).defense
            local arm = getItemAttribute(itemEx.uid, "armor") or getItemInfo(itemEx.itemid).armor
            local chance = math.random(1, 100)
            if getItemLevel(itemEx.uid) == upgrade.level then
               if doPlayerRemoveItem(cid, 2160, upgrade.money) then
                   doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_CRAPS)
                  if chance <= upgrade.chance then
                      if getItemLevel(itemEx.uid) == 0 then
                          doItemSetAttribute(itemEx.uid, "description", "Esse item foi refinado por" ..getCreatureName(cid))
                      end
                      doItemAddLevel(itemEx.uid, 1)
                      doItemSetAttribute(itemEx.uid, "name", getItemNameById(itemEx.itemid).. " + " ..getItemLevel(itemEx.uid))
                      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce refinou com sucesso! Agora seu "..getItemNameById(itemEx.itemid).." eh level " ..getItemLevel(itemEx.uid))
                          if getItemInfo(itemEx.itemid).armor > 0 then
                          doItemSetAttribute(itemEx.uid, "armor", arm + 1)
                          return true
                      elseif getItemInfo(itemEx.itemid).defense > 0 and getItemInfo(itemEx.itemid).attack <= 0 then
                          doItemSetAttribute(itemEx.uid, "defense", def + 1)
                          return true
                      end
                  else
                      doTransformItem(itemEx.uid, 2256)
                      doItemSetAttribute(itemEx.uid, 'name', "metal trash")
                      doItemSetAttribute(itemEx.uid, 'armor', 0)
                      doItemSetAttribute(itemEx.uid, 'defense', 0)
                      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce falhou.")
                      return true
                  end
              else
                  doPlayerSendCancel(cid, "Voce nao tem dinheiro o suficiente. Voce precisa de "..upgrade.money.." crystal coins.")
              end
          end
      end
  else
      doPlayerSendCancel(cid, "Esse item nao pode ser refinado.")
  end
  return true
end 

I like

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo