Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
Untitled diff
Created
7 years ago
Diff never expires
Clear
Export
Share
Explain
55 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
164 lines
Copy
34 additions
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
160 lines
Copy
Copy
Copied
Copy
Copied
--- Perfect refine system by Mock the bear (MTB).
--- Email: mock_otnet@hotmail.com
-- &a = weapon attack
-- &a = weapon attack
-- &d = weapon defense
-- &d = weapon defense
-- &s = shield defense
-- &s = shield defense
-- &p = armor defense
-- &p = armor defense
-- # = nivel do item
-- # = nivel do item
-- @ = max level
-- @ = max level
local gain = {
local gain = {
Copy
Copied
Copy
Copied
gainArmor='&p+(
1
)',loseArmor='&p-(
1
)',
gainArmor='&p+(
2
)',loseArmor='&p-(
3
)',
gainShield='&s+
#
',loseShield='&s-(
#+1
)',
gainShield='&s+
(2)
',loseShield='&s-(
3
)',
gainAttack='&a+(
1*(#)
)',loseAttack='&a-(
1*(#+1)
)',
gainAttack='&a+(
2
)',loseAttack='&a-(
3
)',
gainDefense='&d+(
1*(#)
)',loseDefense='&d-(
1*(#+1)
)',
gainDefense='&d+(
2
)',loseDefense='&d-(
3
)',
chance='(
1
00/math.sqrt((((@/
4
)+(#*2))/@)*#
))',
chance='(
2
00/math.sqrt((((@/
2
)+(#*2))/@)*#
*2
))',
maxlvl =
11
,
maxlvl =
10
,
blocked_ids = {}
blocked_ids = {}
}
}
local it = {
local it = {
--[itemid] = [percent]
--[itemid] = [percent]
Copy
Copied
Copy
Copied
[
5881] = 10, -- 0% additional
[
8300
] = 0, -- 0% additional
[5879
] = 0, -- 0% additional
[5882] = 100, -- 50%
}
}
if not setItemName then
if not setItemName then
function setItemName(uid,name)
function setItemName(uid,name)
return doItemSetAttribute(uid,'name',name)
return doItemSetAttribute(uid,'name',name)
end
end
function setItemArmor(uid,name)
function setItemArmor(uid,name)
return doItemSetAttribute(uid,'armor',name)
return doItemSetAttribute(uid,'armor',name)
end
end
function setItemDefense(uid,name)
function setItemDefense(uid,name)
return doItemSetAttribute(uid,'defense',name)
return doItemSetAttribute(uid,'defense',name)
end
end
function setItemAttack(uid,name)
function setItemAttack(uid,name)
return doItemSetAttribute(uid,'attack',name)
return doItemSetAttribute(uid,'attack',name)
end
end
function getItemAttack(uid)
function getItemAttack(uid)
return getItemAttribute(uid,'attack')
return getItemAttribute(uid,'attack')
end
end
function getItemDefense(uid)
function getItemDefense(uid)
return getItemAttribute(uid,'defense')
return getItemAttribute(uid,'defense')
end
end
function getItemArmor(uid)
function getItemArmor(uid)
if type(uid) == 'number' then
if type(uid) == 'number' then
return getItemAttribute(uid,'armor')
return getItemAttribute(uid,'armor')
else
else
return getItemInfo(uid.itemid).armor
return getItemInfo(uid.itemid).armor
end
end
end
end
end
end
Copy
Copied
Copy
Copied
local function isArmor(uid)
local function isArmor(uid)
-- Function by Mock the bear.
if (getItemInfo(uid.itemid).armor ~= 0) and (getItemWeaponType(uid.uid) == 0) then
if (getItemInfo(uid.itemid).armor ~= 0) and (getItemWeaponType(uid.uid) == 0) then
return true
return true
end
end
return false
return false
end
end
Copy
Copied
Copy
Copied
local function isWeapon(uid)
-- Function by Mock the bear.
local function isWeapon(uid)
uid = uid or 0
uid = uid or 0
local f = getItemWeaponType(uid)
local f = getItemWeaponType(uid)
Copy
Copied
Copy
Copied
if f ==
0 or f ==
1 or f == 2 or f == 3 then
if f ==
1 or f == 2 or f == 3 then
return true
return true
end
end
return false
return false
end
end
Copy
Copied
Copy
Copied
local function isShield(uid)
-- Function by Mock the bear.
local function isShield(uid)
uid = uid or 0
uid = uid or 0
Copy
Copied
Copy
Copied
if getItemWeaponType(uid) ==
4
then
if getItemWeaponType(uid) ==
5
then
return true
return true
end
end
return false
return false
end
end
Copy
Copied
Copy
Copied
local function isBow(uid)
-- Function by Mock the bear.
local function isBow(uid)
uid = uid or 0
uid = uid or 0
Copy
Copied
Copy
Copied
if getItemWeaponType(uid) ==
5
then
if getItemWeaponType(uid) ==
4
then
return true
return true
end
end
return false
return false
end
end
Copy
Copied
Copy
Copied
local function getWeaponLevel(uid)
-- Function by Mock the bear.
local function getWeaponLevel(uid)
uid = uid or 0
uid = uid or 0
local name = getItemName(uid.uid) or getItemInfo(uid.itemid).name or ''
local name = getItemName(uid.uid) or getItemInfo(uid.itemid).name or ''
local lvl = string.match(name,'%s%+(%d+)%s*')
local lvl = string.match(name,'%s%+(%d+)%s*')
return tonumber(lvl) or 0
return tonumber(lvl) or 0
end
end
Copy
Copied
Copy
Copied
local function doTransform(s,i)
-- Function by Mock the bear.
local function doTransform(s,i)
local c = string.gsub(s,'@',gain.maxlvl)
local c = string.gsub(s,'@',gain.maxlvl)
local c = string.gsub(c,'&a',(getItemAttack(i.uid) ~= 0 and getItemAttack(i.uid) or getItemInfo(i.itemid).attack))
local c = string.gsub(c,'&a',(getItemAttack(i.uid) ~= 0 and getItemAttack(i.uid) or getItemInfo(i.itemid).attack))
local c = string.gsub(c,'&d',(getItemDefense(i.uid) ~= 0 and getItemDefense(i.uid) or getItemInfo(i.itemid).defense))
local c = string.gsub(c,'&d',(getItemDefense(i.uid) ~= 0 and getItemDefense(i.uid) or getItemInfo(i.itemid).defense))
local c = string.gsub(c,'&s',(getItemDefense(i.uid) ~= 0 and getItemDefense(i.uid) or getItemInfo(i.itemid).defense))
local c = string.gsub(c,'&s',(getItemDefense(i.uid) ~= 0 and getItemDefense(i.uid) or getItemInfo(i.itemid).defense))
local c = string.gsub(c,'&p',(getItemArmor(i.uid) ~= 0 and getItemArmor(i.uid) or getItemInfo(i.itemid).armor))
local c = string.gsub(c,'&p',(getItemArmor(i.uid) ~= 0 and getItemArmor(i.uid) or getItemInfo(i.itemid).armor))
local c = string.gsub(c,'#',getWeaponLevel(i))
local c = string.gsub(c,'#',getWeaponLevel(i))
Copy
Copied
Copy
Copied
local q =
assert(loadstring('return '..c))
local q =
assert(loadstring('return '..c))
return math.floor(assert(q()))
return math.floor(assert(q()))
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.uid == 0 or item.itemid == 0 then return false end
if item.uid == 0 or item.itemid == 0 then return false end
toPosition.stackpos = 255
toPosition.stackpos = 255
if isInArray(gain.blocked_ids, itemEx.itemid)
if isInArray(gain.blocked_ids, itemEx.itemid)
or (not getItemWeaponType(itemEx.uid) or getItemWeaponType(itemEx.uid) > 5)
or (not getItemWeaponType(itemEx.uid) or getItemWeaponType(itemEx.uid) > 5)
or (getItemWeaponType(itemEx.uid) == 0 and not isArmor(itemEx))
or (getItemWeaponType(itemEx.uid) == 0 and not isArmor(itemEx))
or itemEx.itemid == 0 or itemEx.type > 1 or isItemStackable(itemEx.uid) then
or itemEx.itemid == 0 or itemEx.type > 1 or isItemStackable(itemEx.uid) then
Copy
Copied
Copy
Copied
doPlayerSend
TextMessage
(cid,
24,
"You cant refine this item.")
doPlayerSend
Cancel
(cid,
"You cant refine this item.")
return
TRUE
return
true
end
end
Copy
Copied
Copy
Copied
if isCreature(itemEx.uid) ==
TRUE
then
if isCreature(itemEx.uid) ==
true
then
return
FALSE
return
false
end
end
local level = getWeaponLevel(itemEx)
local level = getWeaponLevel(itemEx)
local chance = doTransform(gain.chance,itemEx)
local chance = doTransform(gain.chance,itemEx)
if level == gain.maxlvl then
if level == gain.maxlvl then
Copy
Copied
Copy
Copied
doSendMagicEffect(toPosition,
2
)
doSendMagicEffect(toPosition,
11
)
return doPlayerSend
TextMessage
(cid,
24,
"Your item is on max level, you can't upgrade it.")
return doPlayerSend
Cancel
(cid,
"Your item is on max level, you can't upgrade it.")
end
end
Copy
Copied
Copy
Copied
doPlayerSend
TextMessage
(cid,
24,
"Trying refine with "..(chance+it[item.itemid] > 100 and 100 or chance+it[item.itemid]).."% of sucess!")
doPlayerSend
Cancel
(cid,
"Trying refine with "..(chance+it[item.itemid] > 100 and 100 or chance+it[item.itemid]).."% of sucess!")
if chance+it[item.itemid] >= math.random(0,100) then
if chance+it[item.itemid] >= math.random(0,100) then
local nm = getItemName(itemEx.uid)
local nm = getItemName(itemEx.uid)
Copy
Copied
Copy
Copied
local slot = nm:match('(%[.+%])') or '' ---If you server use slot system dont change it
^^
local slot = nm:match('(%[.+%])') or '' ---If you server use slot system dont change it
slot = slot~='' and ' '..slot or slot
slot = slot~='' and ' '..slot or slot
setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level+1)..slot)
setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level+1)..slot)
Copy
Copied
Copy
Copied
addEvent(
doSendAnimatedText(getCreaturePosition(cid),
"Great!", 32)
)
doSendAnimatedText(getCreaturePosition(cid),
'UPGRADE!!', 144, cid
)
doSendMagicEffect(toPosition,
12
)
doSendMagicEffect(toPosition,
30)
doRemoveItem(item.uid, 1
)
if isArmor(itemEx) then
if isArmor(itemEx) then
local get = doTransform(gain.gainArmor,itemEx)
local get = doTransform(gain.gainArmor,itemEx)
setItemArmor(itemEx.uid,get)
setItemArmor(itemEx.uid,get)
elseif isBow(itemEx.uid) then
elseif isBow(itemEx.uid) then
setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
elseif isWeapon(itemEx.uid) then
elseif isWeapon(itemEx.uid) then
setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
setItemDefense(itemEx.uid, doTransform(gain.gainDefense,itemEx))
setItemDefense(itemEx.uid, doTransform(gain.gainDefense,itemEx))
elseif isShield(itemEx.uid) then
elseif isShield(itemEx.uid) then
setItemDefense(itemEx.uid, doTransform(gain.gainShield,itemEx))
setItemDefense(itemEx.uid, doTransform(gain.gainShield,itemEx))
end
end
else
else
if level == 0 then
if level == 0 then
Copy
Copied
Copy
Copied
addEvent(doPlayerSend
TextMessage
,500,cid,
24,
"No effect.")
addEvent(doPlayerSend
Cancel
,500,cid,
"No effect.")
doSendMagicEffect(toPosition,
2
)
doSendMagicEffect(toPosition,
11
)
elseif level > 0 then
elseif level > 0 then
local nm = getItemName(itemEx.uid)
local nm = getItemName(itemEx.uid)
Copy
Copied
Copy
Copied
local slot = nm:match('(%[.+%])') or '' ---If you server use slot system dont change it
^^
local slot = nm:match('(%[.+%])') or '' ---If you server use slot system dont change it
slot = slot~='' and ' '..slot or slot
slot = slot~='' and ' '..slot or slot
if level == 1 then
if level == 1 then
setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..slot)
setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..slot)
Copy
Copied
Copy
Copied
addEvent(
doSendAnimatedText(getCreaturePosition(
cid
)
, "
Fail!", 85)
)
addEvent(
doPlayerSendCancel,500,
cid
, "
Your item back to normal."
)
else
else
Copy
Copied
Copy
Copied
setItemName(itemEx.uid, getItemNameById(itemEx.itemid).
.slot)
setItemName(itemEx.uid, getItemNameById(itemEx.itemid).
.' +'..(level-3).
.slot)
addEvent(doSendAnimatedText(getCreaturePosition(cid), "Fail!", 65))
end
end
if isArmor(itemEx) then
if isArmor(itemEx) then
Copy
Copied
Copy
Copied
setItemArmor(itemEx.uid,doTransform(gain.loseArmor
,itemEx))
setItemArmor(itemEx.uid,doTransform(gain.loseArmor
,itemEx))
elseif isWeapon(itemEx.uid) then
elseif isWeapon(itemEx.uid) then
setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
setItemDefense(itemEx.uid, doTransform(gain.loseDefense,itemEx))
setItemDefense(itemEx.uid, doTransform(gain.loseDefense,itemEx))
elseif isBow(itemEx.uid) then
elseif isBow(itemEx.uid) then
setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
elseif isShield(itemEx.uid) then
elseif isShield(itemEx.uid) then
setItemDefense(itemEx.uid, doTransform(gain.loseShield,itemEx))
setItemDefense(itemEx.uid, doTransform(gain.loseShield,itemEx))
end
end
end
end
Copy
Copied
Copy
Copied
doSendMagicEffect(toPosition,
9
)
doSendAnimatedText(getCreaturePosition(cid), 'Failed', 144, cid)
doSendMagicEffect(toPosition,
11)
doRemoveItem(item.uid, 1
)
end
end
Copy
Copied
Copy
Copied
doRemoveItem(item.uid,1)
return true
return true
end
end
Saved diffs
Original text
Open file
--- Perfect refine system by Mock the bear (MTB). --- Email: mock_otnet@hotmail.com -- &a = weapon attack -- &d = weapon defense -- &s = shield defense -- &p = armor defense -- # = nivel do item -- @ = max level local gain = { gainArmor='&p+(1)',loseArmor='&p-(1)', gainShield='&s+#',loseShield='&s-(#+1)', gainAttack='&a+(1*(#))',loseAttack='&a-(1*(#+1))', gainDefense='&d+(1*(#))',loseDefense='&d-(1*(#+1))', chance='(100/math.sqrt((((@/4)+(#*2))/@)*#))', maxlvl = 11, blocked_ids = {} } local it = { --[itemid] = [percent] [5881] = 10, -- 0% additional [5879] = 0, -- 0% additional [5882] = 100, -- 50% } if not setItemName then function setItemName(uid,name) return doItemSetAttribute(uid,'name',name) end function setItemArmor(uid,name) return doItemSetAttribute(uid,'armor',name) end function setItemDefense(uid,name) return doItemSetAttribute(uid,'defense',name) end function setItemAttack(uid,name) return doItemSetAttribute(uid,'attack',name) end function getItemAttack(uid) return getItemAttribute(uid,'attack') end function getItemDefense(uid) return getItemAttribute(uid,'defense') end function getItemArmor(uid) if type(uid) == 'number' then return getItemAttribute(uid,'armor') else return getItemInfo(uid.itemid).armor end end end local function isArmor(uid) -- Function by Mock the bear. if (getItemInfo(uid.itemid).armor ~= 0) and (getItemWeaponType(uid.uid) == 0) then return true end return false end local function isWeapon(uid) -- Function by Mock the bear. uid = uid or 0 local f = getItemWeaponType(uid) if f == 0 or f == 1 or f == 2 or f == 3 then return true end return false end local function isShield(uid) -- Function by Mock the bear. uid = uid or 0 if getItemWeaponType(uid) == 4 then return true end return false end local function isBow(uid) -- Function by Mock the bear. uid = uid or 0 if getItemWeaponType(uid) == 5 then return true end return false end local function getWeaponLevel(uid) -- Function by Mock the bear. uid = uid or 0 local name = getItemName(uid.uid) or getItemInfo(uid.itemid).name or '' local lvl = string.match(name,'%s%+(%d+)%s*') return tonumber(lvl) or 0 end local function doTransform(s,i) -- Function by Mock the bear. local c = string.gsub(s,'@',gain.maxlvl) local c = string.gsub(c,'&a',(getItemAttack(i.uid) ~= 0 and getItemAttack(i.uid) or getItemInfo(i.itemid).attack)) local c = string.gsub(c,'&d',(getItemDefense(i.uid) ~= 0 and getItemDefense(i.uid) or getItemInfo(i.itemid).defense)) local c = string.gsub(c,'&s',(getItemDefense(i.uid) ~= 0 and getItemDefense(i.uid) or getItemInfo(i.itemid).defense)) local c = string.gsub(c,'&p',(getItemArmor(i.uid) ~= 0 and getItemArmor(i.uid) or getItemInfo(i.itemid).armor)) local c = string.gsub(c,'#',getWeaponLevel(i)) local q = assert(loadstring('return '..c)) return math.floor(assert(q())) end function onUse(cid, item, fromPosition, itemEx, toPosition) if item.uid == 0 or item.itemid == 0 then return false end toPosition.stackpos = 255 if isInArray(gain.blocked_ids, itemEx.itemid) or (not getItemWeaponType(itemEx.uid) or getItemWeaponType(itemEx.uid) > 5) or (getItemWeaponType(itemEx.uid) == 0 and not isArmor(itemEx)) or itemEx.itemid == 0 or itemEx.type > 1 or isItemStackable(itemEx.uid) then doPlayerSendTextMessage(cid, 24,"You cant refine this item.") return TRUE end if isCreature(itemEx.uid) == TRUE then return FALSE end local level = getWeaponLevel(itemEx) local chance = doTransform(gain.chance,itemEx) if level == gain.maxlvl then doSendMagicEffect(toPosition, 2) return doPlayerSendTextMessage(cid, 24,"Your item is on max level, you can't upgrade it.") end doPlayerSendTextMessage(cid, 24,"Trying refine with "..(chance+it[item.itemid] > 100 and 100 or chance+it[item.itemid]).."% of sucess!") if chance+it[item.itemid] >= math.random(0,100) then local nm = getItemName(itemEx.uid) local slot = nm:match('(%[.+%])') or '' ---If you server use slot system dont change it ^^ slot = slot~='' and ' '..slot or slot setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level+1)..slot) addEvent(doSendAnimatedText(getCreaturePosition(cid), "Great!", 32)) doSendMagicEffect(toPosition, 12) if isArmor(itemEx) then local get = doTransform(gain.gainArmor,itemEx) setItemArmor(itemEx.uid,get) elseif isBow(itemEx.uid) then setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx)) elseif isWeapon(itemEx.uid) then setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx)) setItemDefense(itemEx.uid, doTransform(gain.gainDefense,itemEx)) elseif isShield(itemEx.uid) then setItemDefense(itemEx.uid, doTransform(gain.gainShield,itemEx)) end else if level == 0 then addEvent(doPlayerSendTextMessage,500,cid, 24,"No effect.") doSendMagicEffect(toPosition, 2) elseif level > 0 then local nm = getItemName(itemEx.uid) local slot = nm:match('(%[.+%])') or '' ---If you server use slot system dont change it ^^ slot = slot~='' and ' '..slot or slot if level == 1 then setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..slot) addEvent(doSendAnimatedText(getCreaturePosition(cid), "Fail!", 85)) else setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..slot) addEvent(doSendAnimatedText(getCreaturePosition(cid), "Fail!", 65)) end if isArmor(itemEx) then setItemArmor(itemEx.uid,doTransform(gain.loseArmor ,itemEx)) elseif isWeapon(itemEx.uid) then setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx)) setItemDefense(itemEx.uid, doTransform(gain.loseDefense,itemEx)) elseif isBow(itemEx.uid) then setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx)) elseif isShield(itemEx.uid) then setItemDefense(itemEx.uid, doTransform(gain.loseShield,itemEx)) end end doSendMagicEffect(toPosition, 9) end doRemoveItem(item.uid,1) return true end
Changed text
Open file
-- &a = weapon attack -- &d = weapon defense -- &s = shield defense -- &p = armor defense -- # = nivel do item -- @ = max level local gain = { gainArmor='&p+(2)',loseArmor='&p-(3)', gainShield='&s+(2)',loseShield='&s-(3)', gainAttack='&a+(2)',loseAttack='&a-(3)', gainDefense='&d+(2)',loseDefense='&d-(3)', chance='(200/math.sqrt((((@/2)+(#*2))/@)*#*2))', maxlvl = 10, blocked_ids = {} } local it = { --[itemid] = [percent] [8300] = 0, -- 0% additional } if not setItemName then function setItemName(uid,name) return doItemSetAttribute(uid,'name',name) end function setItemArmor(uid,name) return doItemSetAttribute(uid,'armor',name) end function setItemDefense(uid,name) return doItemSetAttribute(uid,'defense',name) end function setItemAttack(uid,name) return doItemSetAttribute(uid,'attack',name) end function getItemAttack(uid) return getItemAttribute(uid,'attack') end function getItemDefense(uid) return getItemAttribute(uid,'defense') end function getItemArmor(uid) if type(uid) == 'number' then return getItemAttribute(uid,'armor') else return getItemInfo(uid.itemid).armor end end end local function isArmor(uid) if (getItemInfo(uid.itemid).armor ~= 0) and (getItemWeaponType(uid.uid) == 0) then return true end return false end local function isWeapon(uid) uid = uid or 0 local f = getItemWeaponType(uid) if f == 1 or f == 2 or f == 3 then return true end return false end local function isShield(uid) uid = uid or 0 if getItemWeaponType(uid) == 5 then return true end return false end local function isBow(uid) uid = uid or 0 if getItemWeaponType(uid) == 4 then return true end return false end local function getWeaponLevel(uid) uid = uid or 0 local name = getItemName(uid.uid) or getItemInfo(uid.itemid).name or '' local lvl = string.match(name,'%s%+(%d+)%s*') return tonumber(lvl) or 0 end local function doTransform(s,i) local c = string.gsub(s,'@',gain.maxlvl) local c = string.gsub(c,'&a',(getItemAttack(i.uid) ~= 0 and getItemAttack(i.uid) or getItemInfo(i.itemid).attack)) local c = string.gsub(c,'&d',(getItemDefense(i.uid) ~= 0 and getItemDefense(i.uid) or getItemInfo(i.itemid).defense)) local c = string.gsub(c,'&s',(getItemDefense(i.uid) ~= 0 and getItemDefense(i.uid) or getItemInfo(i.itemid).defense)) local c = string.gsub(c,'&p',(getItemArmor(i.uid) ~= 0 and getItemArmor(i.uid) or getItemInfo(i.itemid).armor)) local c = string.gsub(c,'#',getWeaponLevel(i)) local q = assert(loadstring('return '..c)) return math.floor(assert(q())) end function onUse(cid, item, fromPosition, itemEx, toPosition) if item.uid == 0 or item.itemid == 0 then return false end toPosition.stackpos = 255 if isInArray(gain.blocked_ids, itemEx.itemid) or (not getItemWeaponType(itemEx.uid) or getItemWeaponType(itemEx.uid) > 5) or (getItemWeaponType(itemEx.uid) == 0 and not isArmor(itemEx)) or itemEx.itemid == 0 or itemEx.type > 1 or isItemStackable(itemEx.uid) then doPlayerSendCancel(cid, "You cant refine this item.") return true end if isCreature(itemEx.uid) == true then return false end local level = getWeaponLevel(itemEx) local chance = doTransform(gain.chance,itemEx) if level == gain.maxlvl then doSendMagicEffect(toPosition, 11) return doPlayerSendCancel(cid, "Your item is on max level, you can't upgrade it.") end doPlayerSendCancel(cid, "Trying refine with "..(chance+it[item.itemid] > 100 and 100 or chance+it[item.itemid]).."% of sucess!") if chance+it[item.itemid] >= math.random(0,100) then local nm = getItemName(itemEx.uid) local slot = nm:match('(%[.+%])') or '' ---If you server use slot system dont change it slot = slot~='' and ' '..slot or slot setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level+1)..slot) doSendAnimatedText(getCreaturePosition(cid), 'UPGRADE!!', 144, cid) doSendMagicEffect(toPosition, 30) doRemoveItem(item.uid, 1) if isArmor(itemEx) then local get = doTransform(gain.gainArmor,itemEx) setItemArmor(itemEx.uid,get) elseif isBow(itemEx.uid) then setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx)) elseif isWeapon(itemEx.uid) then setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx)) setItemDefense(itemEx.uid, doTransform(gain.gainDefense,itemEx)) elseif isShield(itemEx.uid) then setItemDefense(itemEx.uid, doTransform(gain.gainShield,itemEx)) end else if level == 0 then addEvent(doPlayerSendCancel,500,cid, "No effect.") doSendMagicEffect(toPosition, 11) elseif level > 0 then local nm = getItemName(itemEx.uid) local slot = nm:match('(%[.+%])') or '' ---If you server use slot system dont change it slot = slot~='' and ' '..slot or slot if level == 1 then setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..slot) addEvent(doPlayerSendCancel,500,cid, "Your item back to normal.") else setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level-3)..slot) end if isArmor(itemEx) then setItemArmor(itemEx.uid,doTransform(gain.loseArmor ,itemEx)) elseif isWeapon(itemEx.uid) then setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx)) setItemDefense(itemEx.uid, doTransform(gain.loseDefense,itemEx)) elseif isBow(itemEx.uid) then setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx)) elseif isShield(itemEx.uid) then setItemDefense(itemEx.uid, doTransform(gain.loseShield,itemEx)) end end doSendAnimatedText(getCreaturePosition(cid), 'Failed', 144, cid) doSendMagicEffect(toPosition, 11) doRemoveItem(item.uid, 1) end return true end
Find difference