local ITEM_ID_VOCS = 6527
local vocationTransformations = {
[1] = 5, --Master Sorcerer
[2] = 6,--Elder Druid
[3] = 7, --Royal Paladin
[4] = 8, --Elite Knight
}
local VocsAction = Action()
function VocsAction.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local currentVocation = player:getVocation():getId()
local newVocation = vocationTransformations[currentVocation]
if newVocation then
player:setVocation(Vocation(newVocation))
local id = player:getId()
local name = player:getName()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You've been promoted! Congratulations!")
player:getPosition():sendMagicEffect(10)
item:remove(1)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Sorry, you don't have a vocation transformation defined for your current type.")
end
end
VocsAction:id(ITEM_ID_VOCS)
VocsAction:register()