Special Gem Combiner
A lot of friends were asking me to release what I had in my server, which is a normal gem combiner like any other server "but" it takes only level 1. Few servers used to let players keep level 2+ gems in bank before combining. With this Special Gem Combiner, it will only take level 1 and combine it with ease.
First, add this to any of your NPCscript (Add rest of gems by yourself)
function FastCombinerNpc()
Talk(1,'Hello! I am the Fast Gem Combiner. How can I help you?')
Text(1,'Level 4 Gem Combining!', JumpPage, 2)
Talk(2,'Special Gem Combiner: Here is list of Level 4 Gems!' )
Text(2,'Refining Gem',FastCombiner,885,4) -- Gem item id, level to combine
Text(2,'Gem of Rage',FastCombiner,863,4) -- Gem item id, level to combine
Text(2,'Eye of Black Dragon',FastCombiner,864,4) -- Gem item id, level to combine
end
Second, add this in your NPCsdk.lua (between lines: 2300~2500?)
elseif item.func == FastCombiner then
return FastCombiner(character,item.p1,item.p2)
Finally, add this in your functions.lua
function FastCombiner(cha,itemid,lvl)
local CombineLvl = {}
CombineLvl[4] = {pieces=8,fee=100000}
CombineLvl[5] = {pieces=16,fee=500000}
CombineLvl[6] = {pieces=32,fee=1000000}
--! Check if Bag is locked
if(KitbagLock(cha, 0) ~= LUA_TRUE)then
HelpInfo(cha,0,'Your bag is locked!')
return
end
--! Check has money required for gem level
local m = HasMoney(cha,CombineLvl[lvl].fee)
if(m == 0)then
HelpInfo(cha,0,'You must have '..CombineLvl[lvl].fee..'G to combine!')
return
end
--! Scan whole inventory and store gem slots location
local bag,gemSlot,gemLv,array = GetKbCap(cha),0,0,{}
for i = 0,bag-1 do
gemSlot = GetChaItem(cha,2,i)
if(GetItemID(gemSlot) == itemid)then
gemLv = GetItemAttr(gemSlot,ITEMATTR_VAL_BaoshiLV)
if(gemLv == 1)then
table.insert(array,i)
end
end
end
--! Check if player has correct number of gems (Lv1)
if(table.getn(array) < CombineLvl[lvl].pieces)then
HelpInfo(cha,0,'You must have x'..CombineLvl[lvl].pieces..' of Lv1 '..GetItemName(itemid)..' to combine!')
return
end
--! Remove gems
local rem = 0
for k,j in pairs(array) do
if(rem < CombineLvl[lvl].pieces)then
RemoveChaItem(cha,0,1,2,j,2,1)
rem = rem + 1
else
break
end
end
--! Give a message, take the money & the gem combined
BickerNotice(cha,GetItemName(itemid)..' was successfully combined to level '..lvl..'!')
TakeMoney(cha,0,CombineLvl[lvl].fee)
GiveItem(cha,0,itemid,1,100+lvl)
end