-- Upgrade system by Gelio local znika = "tak" -- Czy item ma znikać po upgrade (item upgradujący) local ileProcent = 10 -- O ile procent powiększa atrybuty czegoś. Jak wyjdzie liczba rzeczywista to podnosi o tyle, żeby była liczba całkowita. local maksProcent = 0 -- Ile maksymalnie procent może być upgradowane. 0 - nieskończoność function onUse(cid, item, frompos, item2, topos) if(item2.uid ~= 0) then local arm = getItemArmor(item2.uid) local def = getItemDefense(item2.uid) local atk = getItemAttack(item2.uid) local descr = "" local action = item2.actionid-100 if(action < 0) then action = 0 end if(maksProcent > 0 and action >= maksProcent) then doPlayerSendCancel(cid,"You can't upgrade it anymore.") return TRUE end if(arm ~= 0 or def ~= 0 or atk ~= 0) then descr = "Values: " if(arm ~= 0) then descr = descr .."armor increased by ".. ileProcent+action .. " percents " local ilePowieksza = math.ceil(arm * (ileProcent/100)) setItemArmor(item2.uid, arm+ilePowieksza) doSetItemActionId(item2.uid,100+action+ileProcent) end if(def ~= 0) then descr = descr .."defense increased by ".. ileProcent+action .." percents " local ilePowieksza = math.ceil(def * (ileProcent/100)) setItemDefense(item2.uid, def+ilePowieksza) doSetItemActionId(item2.uid,100+action+ileProcent) end if(atk ~= 0) then descr = descr .."attack increased by ".. ileProcent+action .." percents " local ilePowieksza = math.ceil(atk * (ileProcent/100)) setItemAttack(item2.uid, atk+ilePowieksza) doSetItemActionId(item2.uid,100+action+ileProcent) end doSetItemSpecialDescription(item2.uid,descr) doSendMagicEffect(topos,CONST_ME_MAGIC_GREEN) if(znika == "tak") then if(item.type > 1) then doChangeTypeItem(item.uid, item.type-1) else doRemoveItem(item.uid,1) end end else doPlayerSendCancel(cid,"You can't upgrade this.") end return TRUE end return FALSE end
<action itemid="2270" script="upgrade system.lua" />
|