local t = {
[29001] = {{"Ultimate Arcane Beam"},{1, 5}},
[29002] = {{"Divine Bless"},{2, 6}},
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local v = t[item.actionid]
if v then
if player:hasLearnedSpell(v[1]) then
return player:sendCancelMessage("You already know this spell!"), toPosition:sendMagicEffect(CONST_ME_PURPLEENERGY), false
end
if isInArray(v[2], player:getVocation()) then
return player:sendCancelMessage("Vocation Not found!"), toPosition:sendMagicEffect(CONST_ME_PURPLEENERGY), false
end
player:learnSpell(v[1])
toPosition:sendMagicEffect(CONST_ME_PURPLEENERGY)
player:say("You learned the spell " .. v[1] ..".", TALKTYPE_MONSTER_SAY)
end
return true
end