local rewards = {
SORCERER = {
[10] = {items = {
[1] = {itemid = 1111, count = 1},
[2] = {itemid = 1111, count = 1}
}, storage = 40000},
[20] = {items = {
[1] = {itemid = 1111, count = 1},
[2] = {itemid = 1111, count = 1}
}, storage = 40001},
}
DRUID = {
[10] = {items = {
[1] = {itemid = 1111, count = 1},
[2] = {itemid = 1111, count = 1}
}, storage = 40002},
[20] = {items = {
[1] = {itemid = 1111, count = 1},
[2] = {itemid = 1111, count = 1}
}, storage = 40003},
}
PALADIN = {
[10] = {items = {
[1] = {itemid = 1111, count = 1},
[2] = {itemid = 1111, count = 1}
}, storage = 40004},
[20] = {items = {
[1] = {itemid = 1111, count = 1},
[2] = {itemid = 1111, count = 1}
}, storage = 40005},
}
KNIGHT = {
[10] = {items = {
[1] = {itemid = 1111, count = 1},
[2] = {itemid = 1111, count = 1}
}, storage = 40006},
[20] = {items = {
[1] = {itemid = 1111, count = 1},
[2] = {itemid = 1111, count = 1}
}, storage = 40007},
}
}
local sorc = {1, 5, 9}
local druid = {2, 6, 10}
local paladin = {3, 7, 11}
local knight = {4, 8, 12}
local magicEffect_reward = 14
function onAdvance(player, skill, oldlevel, newlevel)
if skill ~= SKILL__LEVEL then
return true
end
if isInArray(sorc, player:getVocation():getId()) then
VOC = rewards.SORC
elseif isInArray(sorc, player:getVocation():getId()) then
VOC = rewards.DRUID
elseif isInArray(sorc, player:getVocation():getId()) then
VOC = rewards.PALADIN
elseif isInArray(sorc, player:getVocation():getId()) then
VOC = rewards.KNIGHT
end
if not VOC then return true end
REWARD = VOC[newlevel]
if not REWARD then return true end
if player:getStorageValue(REWARD.storage) == nil then
for i = 1, #REWARD.items do
player:addItem(REWARD.items[i].itemid, rewards.items[i].count)
end
player:setStorageValue(REWARD.items[i].storage, 1)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations, you have reached level "..player:getLevel().." and received your rewards.")
player:getPosition():sendMagicEffect(magicEffect_reward)
end
return true
end