Ir para conteúdo

Pergunta

Boa Noite Galerinha do XTibia, alguem poderia estar me ajudando com um sistema de upgrade ?
Como funciona esse sistema?
o player usa um item selecionado em uma arma e o ataque dela almenta, como exemplo
sword (Atk:14, Def:12 +1) -
sword +1 (Atk:15, Def:13 +1)

 

cada upgrade a arma almenta

que vai do +1 ou +10, cada upgrade almenta +1 de atk da arma, sendo isso em wands, rods, crossbows, bows, axes, swords e clubs.

alguem poderia me ajudar ?

 

TFS 0.4

Link para o comentário
https://xtibia.com/forum/topic/234425-sistema-upgrade/
Compartilhar em outros sites

13 respostass a esta questão

Posts Recomendados

  • 0


--- Xtibia

--- Xtibia.

 

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, quantOre = 1, chance = 100}, -- Level do item, quantidade de Iron Ore necessaria, chance de sucesso

{level = 1, quantOre = 2, chance = 90},

{level = 2, quantOre = 3, chance = 80},

{level = 3, quantOre = 4, chance = 70},

{level = 4, quantOre = 5, chance = 60},

{level = 5, quantOre = 6, chance = 50},

{level = 6, quantOre = 7, chance = 40},

{level = 7, quantOre = 8, chance = 30},

{level = 8, quantOre = 9, chance = 20},

{level = 9, quantOre = 10, chance = 10}

}

 

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) 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).attack > 0 or getItemInfo(itemEx.itemid).defense > 0 or getItemInfo(itemEx.itemid).armor > 0 then

for _, upgrade in pairs(controle) do

local atk = getItemAttribute(itemEx.uid, "attack") or getItemInfo(itemEx.itemid).attack

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, 5880, upgrade.quantOre) 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).attack > 0 then

doItemSetAttribute(itemEx.uid, "attack", atk + 1)

return true

elseif 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

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce falhou.")

if getItemLevel(itemEx.uid) > 0 then

doItemAddLevel(itemEx.uid, -1)

doItemSetAttribute(itemEx.uid, "name", getItemNameById(itemEx.itemid).. " + " ..getItemLevel(itemEx.uid))

if getItemInfo(itemEx.itemid).attack > 0 then

doItemSetAttribute(itemEx.uid, "attack", atk - 1)

return true

elseif 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

end

return true

end

else

doPlayerSendCancel(cid, "Voce nao tem iron ores o suficiente. Voce precisa de "..upgrade.quantOre.." iron ores.")

end

end

end

else

doPlayerSendCancel(cid, "Esse item nao pode ser refinado.")

end

return true

end

Link para o comentário
https://xtibia.com/forum/topic/234425-sistema-upgrade/#findComment-1654314
Compartilhar em outros sites

  • 0

Somente equipamentos e armas podem ser refinados.



crie Killua Upgrading System.lua em data/actions/scripts e coloque:



--- Xtibia
--- Xtibia.

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, quantOre = 1, chance = 100}, -- Level do item, quantidade de Iron Ore necessaria, chance de sucesso
{level = 1, quantOre = 2, chance = 90},
{level = 2, quantOre = 3, chance = 80},
{level = 3, quantOre = 4, chance = 70},
{level = 4, quantOre = 5, chance = 60},
{level = 5, quantOre = 6, chance = 50},
{level = 6, quantOre = 7, chance = 40},
{level = 7, quantOre = 8, chance = 30},
{level = 8, quantOre = 9, chance = 20},
{level = 9, quantOre = 10, chance = 10}
}

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).attack > 0 or getItemInfo(itemEx.itemid).defense > 0 or getItemInfo(itemEx.itemid).armor > 0 then
for _, upgrade in pairs(controle) do
local atk = getItemAttribute(itemEx.uid, "attack") or getItemInfo(itemEx.itemid).attack
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, 5880, upgrade.quantOre) 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).attack > 0 then
doItemSetAttribute(itemEx.uid, "attack", atk + 1)
return true
elseif 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, 'attack', 0)
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 iron ores o suficiente. Voce precisa de "..upgrade.quantOre.." iron ores.")
end
end
end
else
doPlayerSendCancel(cid, "Esse item nao pode ser refinado.")
end
return true
end

Em data/actions/actions.xml coloque essa TAG:



<action itemid="2422" event="script" value="Killua Upgradin System.lua"/>

Para configurar, leia meus comentários dentro do código.


Link para o comentário
https://xtibia.com/forum/topic/234425-sistema-upgrade/#findComment-1654011
Compartilhar em outros sites

  • 0
  Em 03/06/2015 em 01:37, MartzGlobal disse:

 

Somente equipamentos e armas podem ser refinados.

crie Killua Upgrading System.lua em data/actions/scripts e coloque:

--- Xtibia
--- Xtibia.

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, quantOre = 1, chance = 100}, -- Level do item, quantidade de Iron Ore necessaria, chance de sucesso
    {level = 1, quantOre = 2, chance = 90},
    {level = 2, quantOre = 3, chance = 80},
    {level = 3, quantOre = 4, chance = 70},
    {level = 4, quantOre = 5, chance = 60},
    {level = 5, quantOre = 6, chance = 50},
    {level = 6, quantOre = 7, chance = 40},
    {level = 7, quantOre = 8, chance = 30},
    {level = 8, quantOre = 9, chance = 20},
    {level = 9, quantOre = 10, chance = 10}
}

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).attack > 0 or getItemInfo(itemEx.itemid).defense > 0 or getItemInfo(itemEx.itemid).armor > 0 then
        for _, upgrade in pairs(controle) do
            local atk = getItemAttribute(itemEx.uid, "attack") or getItemInfo(itemEx.itemid).attack
            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, 5880, upgrade.quantOre) 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).attack > 0 then
                          doItemSetAttribute(itemEx.uid, "attack", atk + 1)
                          return true
                      elseif 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, 'attack', 0)
                      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 iron ores o suficiente. Voce precisa de "..upgrade.quantOre.." iron ores.")
              end
          end
      end
  else
      doPlayerSendCancel(cid, "Esse item nao pode ser refinado.")
  end
  return true
end   

Em data/actions/actions.xml coloque essa TAG:

<action itemid="2422" event="script" value="Killua Upgradin System.lua"/>

Para configurar, leia meus comentários dentro do código.

 

O Script funcionou direitinho, más ele não funciona em WANDS e RODS, poderia ajudar ? e tipo de vez quebrar o item não poderia ser feito para voltar ? está +3 voltar +2 ?

Editado por Leonardo Macedo
Link para o comentário
https://xtibia.com/forum/topic/234425-sistema-upgrade/#findComment-1654026
Compartilhar em outros sites

  • 0
  Em 03/06/2015 em 02:36, Leonardo Macedo disse:

O Script funcionou direitinho, más ele não funciona em WANDS e RODS, poderia ajudar ? e tipo de vez quebrar o item não poderia ser feito para voltar ? está +3 voltar +2 ?

Olha da para fazer essa parte de voltar sim, porém wands e rods não utilizam atributos para atacar, por isso que esse sistema não funciona nestes items.

Para voltar ao invés de quebrar, tente assim:

 

  Mostrar conteúdo oculto

 

Link para o comentário
https://xtibia.com/forum/topic/234425-sistema-upgrade/#findComment-1654090
Compartilhar em outros sites

  • 0
  Em 03/06/2015 em 13:45, Bruno Minervino disse:

Olha da para fazer essa parte de voltar sim, porém wands e rods não utilizam atributos para atacar, por isso que esse sistema não funciona nestes items.

Para voltar ao invés de quebrar, tente assim:

 

  Mostrar conteúdo oculto

 

 

Quando ele falha, não volta do +6 para o +5 continua sendo +6

Link para o comentário
https://xtibia.com/forum/topic/234425-sistema-upgrade/#findComment-1654240
Compartilhar em outros sites

  • 0

ae amigo tenta esse script .... ele só não funciona em wands mais ele regride o nivel de upgrade do iten também pode falhar .... caso você não quiser que seja falhado e volte para o nivel 1 de upgrade apenas tire a função

 

 

  Mostrar conteúdo oculto

 

 

[1] = {100, false, false},

 

caso quiser que ele não "quebre" no caso volte todos os upgrades feitos apenas deixe o segundo em false caso queira que ele regrida todos os upgrades feitos deixe o segundo em true

 

o primeiro false não lembro oque é .... mais o script funciona 100% faz tempo que não mexo nele por isso não lembro muito bem essas paradas do true e false ... Pedido para algum scripter poder explicar melhor sobre isso grato desde já

Editado por Brunds
Link para o comentário
https://xtibia.com/forum/topic/234425-sistema-upgrade/#findComment-1654245
Compartilhar em outros sites

  • 0
  Em 04/06/2015 em 00:35, Brunds disse:

ae amigo tenta esse script .... ele só não funciona em wands mais ele regride o nivel de upgrade do iten também pode falhar .... caso você não quiser que seja falhado e volte para o nivel 1 de upgrade apenas tire a função

 

 

  Mostrar conteúdo oculto

 

 

[1] = {100, false, false},

 

caso quiser que ele não "quebre" no caso volte todos os upgrades feitos apenas deixe o segundo em false caso queira que ele regrida todos os upgrades feitos deixe o segundo em true

 

o primeiro false não lembro oque é .... mais o script funciona 100% faz tempo que não mexo nele por isso não lembro muito bem essas paradas do true e false ... Pedido para algum scripter poder explicar melhor sobre isso grato desde já

 

Acabei de dar uma olhada nesse script kkk, bom eu não curti muito, o script passado a cima eu achei melhor, mais valeu ae !

Link para o comentário
https://xtibia.com/forum/topic/234425-sistema-upgrade/#findComment-1654252
Compartilhar em outros sites

  • 0
  Em 04/06/2015 em 15:44, zipter98 disse:
--- Xtibia
--- Xtibia.

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, quantOre = 1, chance = 100}, -- Level do item, quantidade de Iron Ore necessaria, chance de sucesso
    {level = 1, quantOre = 2, chance = 90},
    {level = 2, quantOre = 3, chance = 80},
    {level = 3, quantOre = 4, chance = 70},
    {level = 4, quantOre = 5, chance = 60},
    {level = 5, quantOre = 6, chance = 50},
    {level = 6, quantOre = 7, chance = 40},
    {level = 7, quantOre = 8, chance = 30},
    {level = 8, quantOre = 9, chance = 20},
    {level = 9, quantOre = 10, chance = 10}
}

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) 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).attack > 0 or getItemInfo(itemEx.itemid).defense > 0 or getItemInfo(itemEx.itemid).armor > 0 then
        for _, upgrade in pairs(controle) do
            local atk = getItemAttribute(itemEx.uid, "attack") or getItemInfo(itemEx.itemid).attack
            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, 5880, upgrade.quantOre) 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).attack > 0 then
                          doItemSetAttribute(itemEx.uid, "attack", atk + 1)
                          return true
                      elseif 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
                      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce falhou.")
                      if getItemLevel(itemEx.uid) > 0 then
                          doItemAddLevel(itemEx.uid, -1)
                          doItemSetAttribute(itemEx.uid, "name", getItemNameById(itemEx.itemid).. " + " ..getItemLevel(itemEx.uid))
                          if getItemInfo(itemEx.itemid).attack > 0 then
                              doItemSetAttribute(itemEx.uid, "attack", atk - 1)
                              return true
                          elseif 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
                      end
					  return true
                  end
              else
                  doPlayerSendCancel(cid, "Voce nao tem iron ores o suficiente. Voce precisa de "..upgrade.quantOre.." iron ores.")
              end
          end
      end
  else
      doPlayerSendCancel(cid, "Esse item nao pode ser refinado.")
  end
  return true
end  

Funcionou mano! obrigado!

Link para o comentário
https://xtibia.com/forum/topic/234425-sistema-upgrade/#findComment-1654359
Compartilhar em outros sites

  • 0
  Em 04/06/2015 em 15:44, zipter98 disse:

 

--- Xtibia--- Xtibia.local vocations = {1, 2, 4, 5, 6, 7, 8} -- Vocações que podem refinar itenslocal ids_bloqueados = {2160, 5706, 2463} -- Itens que não podem ser refinadoslocal controle = {    {level = 0, quantOre = 1, chance = 100}, -- Level do item, quantidade de Iron Ore necessaria, chance de sucesso    {level = 1, quantOre = 2, chance = 90},    {level = 2, quantOre = 3, chance = 80},    {level = 3, quantOre = 4, chance = 70},    {level = 4, quantOre = 5, chance = 60},    {level = 5, quantOre = 6, chance = 50},    {level = 6, quantOre = 7, chance = 40},    {level = 7, quantOre = 8, chance = 30},    {level = 8, quantOre = 9, chance = 20},    {level = 9, quantOre = 10, chance = 10}}function getItemLevel(uid)    if uid > 0 then        return getItemAttribute(uid, "lvl") or 0    end    return falseendfunction doItemAddLevel(uid, count)    if uid > 0 and tonumber(count) then        return doItemSetAttribute(uid, "lvl", getItemLevel(uid) + count)    end    return falseendfunction 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).attack > 0 or getItemInfo(itemEx.itemid).defense > 0 or getItemInfo(itemEx.itemid).armor > 0 then        for _, upgrade in pairs(controle) do            local atk = getItemAttribute(itemEx.uid, "attack") or getItemInfo(itemEx.itemid).attack            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, 5880, upgrade.quantOre) 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).attack > 0 then                          doItemSetAttribute(itemEx.uid, "attack", atk + 1)                          return true                      elseif 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                      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce falhou.")                      if getItemLevel(itemEx.uid) > 0 then                          doItemAddLevel(itemEx.uid, -1)                          doItemSetAttribute(itemEx.uid, "name", getItemNameById(itemEx.itemid).. " + " ..getItemLevel(itemEx.uid))                          if getItemInfo(itemEx.itemid).attack > 0 then                              doItemSetAttribute(itemEx.uid, "attack", atk - 1)                              return true                          elseif 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                      end					  return true                  end              else                  doPlayerSendCancel(cid, "Voce nao tem iron ores o suficiente. Voce precisa de "..upgrade.quantOre.." iron ores.")              end          end      end  else      doPlayerSendCancel(cid, "Esse item nao pode ser refinado.")  end  return trueend

alguém poderia deixa que todas vocation pode usa e no lugar de coloca os id bloqueado coloca os item que pode ser refinados

Editado por Xtudomuito
Link para o comentário
https://xtibia.com/forum/topic/234425-sistema-upgrade/#findComment-1654398
Compartilhar em outros sites

×
×
  • Criar Novo...