function onUse(cid, item, frompos, item2, topos)
local gems = {2146, 2147, 2149, 2150}
local egems = {7759, 7760, 7761, 7762}
local altars = {{7508, 7509, 7510, 7511}, {7504, 7505, 7506, 7507}, {7516, 7517, 7518, 7519}, {7512, 7513, 7514, 7515}}
local weapons = {2383, 7384, 7389, 7406, 7402, 2429, 2430, 2435, 7380, 2454, 2423, 2445, 7415, 7392, 2391, 2544, 8905, 2342}
local eweapons = {{7763, 7744, 7854, 7869}, {7765, 7746, 7856, 7871}, {7770, 7751, 7861, 7876}, {7766, 7747, 7857, 7872}, {7767, 7748, 7858, 7873}, {7768, 7749, 7859, 7874}, {7769, 7750, 7860, 7875}, {7770, 7751, 7861, 7876}, {7771, 7752, 7862, 7877}, {7772, 7753, 7863, 7878}, {7773, 7754, 7864, 7879}, {7774, 7755, 7865, 7880}, {7775, 7756, 7866, 7881}, {7776, 7757, 7867, 7882}, {7777, 7758, 7868, 7883}, {7839, 7840, 7838, 7850}, {8907, 8906, 8909, 8908}, {2343, 2343, 2343, 2343}}
local type = item.type
if type == 0 then
type = 1
end
local mana = 300 * type
local soul = 2 * type
if isInArray(gems, item.itemid)== TRUE then
for aa=1, #gems do
if item.itemid == gems[aa] then
a=aa
end
end
if isInArray(altars[a], item2.itemid)== TRUE then
if getPlayerMana(cid) >= mana and getPlayerSoul(cid) >= soul then
doTransformItem(item.uid,egems[a])
doPlayerAddMana(cid,-mana)
doPlayerAddSoul(cid,-soul)
doSendMagicEffect(frompos,39)
else
doPlayerSendCancel(cid,"You dont have mana or soul points.")
end
else
return 2
end
elseif isInArray(egems, item.itemid)== TRUE then
for bb=1, #egems do
if item.itemid == egems[bb] then
b=bb
end
end
if isInArray(weapons, item2.itemid)== TRUE then
for cc=1, #weapons do
if item2.itemid == weapons[cc] then
c=cc
end
end
doTransformItem(item2.uid,eweapons[c][b],1000)
doSendMagicEffect(frompos,39)
doRemoveItem(item.uid,1)
else
doPlayerSendCancel(cid,"You can't enchanted this.")
end
else
return 0
end
return 1
end
<!-- Weapons enchanting (Gems) -->
<action itemid="2146" script="other/enchant.lua" />
<action itemid="2147" script="other/enchant.lua" />
<action itemid="2150" script="other/enchant.lua" />
<action itemid="2149" script="other/enchant.lua" />
<action itemid="7759" script="other/enchant.lua" />
<action itemid="7760" script="other/enchant.lua" />
<action itemid="7761" script="other/enchant.lua" />
<action itemid="7762" script="other/enchant.lua" />
<item id="7744" article="a" name="spike sword">
<attribute key="weight" value="5000"/>
<attribute key="defense" value="21"/>
<attribute key="attack" value="24"/>
<attribute key="weaponType" value="sword"/>
<attribute key="extradef" value="2"/>
<attribute key="elementFire" value="4"/>
<attribute key="charges" value="1000"/>
<attribute key="decayTo" value="2383"/>
<attribute key="showcharges" value="1"/>
</item>
<item id="7745" article="a" name="relic sword">
<attribute key="weight" value="4800"/>
<attribute key="defense" value="24"/>
<attribute key="attack" value="42"/>
<attribute key="weaponType" value="sword"/>
<attribute key="extradef" value="1"/>
<attribute key="elementFire" value="8"/>
<attribute key="charges" value="1000"/>
<attribute key="decayTo" value="7383"/>
<attribute key="showcharges" value="1"/>
</item>
<item id="7746" article="a" name="mystic blade">
<attribute key="weight" value="3500"/>
<attribute key="defense" value="25"/>
<attribute key="attack" value="44"/>
<attribute key="weaponType" value="sword"/>
<attribute key="extradef" value="2"/>
<attribute key="elementFire" value="8"/>
<attribute key="charges" value="1000"/>
<attribute key="decayTo" value="7384"/>
<attribute key="showcharges" value="1"/>
</item>
<item id="7747" article="a" name="blacksteel sword">
<attribute key="weight" value="5900"/>
<attribute key="defense" value="22"/>
<attribute key="attack" value="42"/>
<attribute key="weaponType" value="sword"/>
<attribute key="slotType" value="two-handed"/>
<attribute key="elementFire" value="7"/>
<attribute key="charges" value="1000"/>
<attribute key="decayTo" value="7406"/>
<attribute key="showcharges" value="1"/>
</item>
<item id="7748" article="a" name="dragon slayer">
<attribute key="weight" value="8200"/>
<attribute key="defense" value="28"/>
<attribute key="attack" value="44"/>
<attribute key="weaponType" value="sword"/>
<attribute key="slotType" value="two-handed"/>
<attribute key="elementFire" value="9"/>
<attribute key="charges" value="1000"/>
<attribute key="decayTo" value="7402"/>
<attribute key="showcharges" value="1"/>
</item>
<item id="7754" article="a" name="clerical mace">
<attribute key="weight" value="5800"/>
<attribute key="defense" value="15"/>
<attribute key="attack" value="28"/>
<attribute key="weaponType" value="club"/>
<attribute key="elementFire" value="5"/>
<attribute key="charges" value="1000"/>
<attribute key="decayTo" value="2423"/>
<attribute key="showcharges" value="1"/>
</item>
<item id="7755" article="a" name="crystal mace">
<attribute key="weight" value="8000"/>
<attribute key="defense" value="16"/>
<attribute key="attack" value="38"/>
<attribute key="weaponType" value="club"/>
<attribute key="elementFire" value="7"/>
<attribute key="charges" value="1000"/>
<attribute key="decayTo" value="2445"/>
<attribute key="showcharges" value="1"/>
</item>
<item id="7756" article="a" name="cranial basher">
<attribute key="weight" value="7800"/>
<attribute key="defense" value="20"/>
<attribute key="attack" value="44"/>
<attribute key="weaponType" value="club"/>
<attribute key="extradef" value="-2"/>
<attribute key="elementFire" value="8"/>
<attribute key="charges" value="1000"/>
<attribute key="decayTo" value="7415"/>
<attribute key="showcharges" value="1"/>
</item>
<item id="7757" article="an" name="orcish maul">
<attribute key="weight" value="5400"/>
<attribute key="defense" value="18"/>
<attribute key="attack" value="42"/>
<attribute key="weaponType" value="club"/>
<attribute key="slotType" value="two-handed"/>
<attribute key="elementFire" value="6"/>
<attribute key="charges" value="1000"/>
<attribute key="decayTo" value="7392"/>
<attribute key="showcharges" value="1"/>
</item>
<item id="7758" article="a" name="war hammer">
<attribute key="weight" value="8500"/>
<attribute key="defense" value="10"/>
<attribute key="attack" value="45"/>
<attribute key="weaponType" value="club"/>
<attribute key="slotType" value="two-handed"/>
<attribute key="elementFire" value="9"/>
<attribute key="charges" value="1000"/>
<attribute key="decayTo" value="2391"/>
<attribute key="showcharges" value="1"/>
</item>
<item id="7749" article="a" name="barbarian axe">
<attribute key="weight" value="5100"/>
<attribute key="defense" value="18"/>
<attribute key="attack" value="28"/>
<attribute key="weaponType" value="axe"/>
<attribute key="extradef" value="1"/>
<attribute key="elementFire" value="5"/>
<attribute key="charges" value="1000"/>
<attribute key="decayTo" value="2429"/>
<attribute key="showcharges" value="1"/>
</item>
<item id="7750" article="a" name="knight axe">
<attribute key="weight" value="5900"/>
<attribute key="defense" value="21"/>
<attribute key="attack" value="33"/>
<attribute key="weaponType" value="axe"/>
<attribute key="extradef" value="1"/>
<attribute key="elementFire" value="7"/>
<attribute key="charges" value="1000"/>
<attribute key="decayTo" value="2430"/>
<attribute key="showcharges" value="1"/>
</item>
<item id="7751" article="a" name="heroic axe">
<attribute key="weight" value="6100"/>
<attribute key="defense" value="24"/>
<attribute key="attack" value="44"/>
<attribute key="weaponType" value="axe"/>
<attribute key="extradef" value="1"/>
<attribute key="elementFire" value="9"/>
<attribute key="charges" value="1000"/>
<attribute key="decayTo" value="7389"/>
<attribute key="showcharges" value="1"/>
</item>
<item id="7752" article="a" name="headchopper">
<attribute key="weight" value="4500"/>
<attribute key="defense" value="20"/>
<attribute key="attack" value="42"/>
<attribute key="slotType" value="two-handed"/>
<attribute key="weaponType" value="axe"/>
<attribute key="elementFire" value="7"/>
<attribute key="charges" value="1000"/>
<attribute key="decayTo" value="7380"/>
<attribute key="showcharges" value="1"/>
</item>
<item id="7753" article="a" name="war axe">
<attribute key="weight" value="6150"/>
<attribute key="defense" value="10"/>
<attribute key="attack" value="48"/>
<attribute key="weaponType" value="axe"/>
<attribute key="slotType" value="two-handed"/>
<attribute key="elementFire" value="10"/>
<attribute key="charges" value="1000"/>
<attribute key="decayTo" value="2454"/>
<attribute key="showcharges" value="1"/>
</item>