Advertisement
NewWars

Untitled

Apr 1st, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. function bonusItem(bonusTable, vnum)
  2.             --Sem Bonus?
  3.             if table.getn(bonusTable) < 1 then
  4.                 return
  5.             end
  6.            
  7.             --Dar e selecionar item
  8.             pc.give_item2_select(vnum)
  9.            
  10.             --item é equipamento? se não, remover.
  11.             if not (item.get_type() == ITEM_WEAPON or item.get_type() == ITEM_ARMOR or item.get_sub_type() == ARMOR_EAR) then
  12.                 item.remove()
  13.                 return
  14.             end
  15.            
  16.             --Cada bonus na tabela, adicionar no item
  17.             for i = 0, table.getn(bonusTable) do
  18.                 item.set_value(i, bonusTable[i][1], bonusTable[i][2])
  19.             end
  20.            
  21.             --Tudo ok, item dado com os bonus desejados ;)
  22.         end
  23.        
  24.         function bonus_insert(bonusTable, idx, id, qnt)
  25.             --Criar valor de bonus com ID e Quantidade de bonus
  26.             local bonus = { id, qnt }
  27.            
  28.             --Inserir valor de bonus na table de bonus
  29.             table.insert(bonusTable, idx, bonus)
  30.         end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement