function getStats(lvl, stat, voc)
local cfg, value = {
k = {4,8},
d = {2,6},
s = {1,5},
p = {3,7}
}
if stat == 'health' then
if isInArray(cfg.p, voc) then
value = lvl * 10 + 105
elseif isInArray(cfg.d, voc) or isInArray(cfg.s, voc) then
value = lvl * 5 + 145
elseif isInArray(cfg.k, voc) then
value = lvl * 15 + 65
end
elseif stat == 'mana' then
if isInArray(cfg.p, voc) then
value = lvl * 15 - 85
elseif isInArray(cfg.d, voc) or isInArray(cfg.s, voc) then
value = lvl * 30 - 205
elseif isInArray(cfg.k, voc) then
value = lvl * 5 - 5
end
elseif stat == 'cap' then
if isInArray(cfg.p, voc) then
value = lvl * 20 + 310
elseif isInArray(cfg.d, voc) or isInArray(cfg.s, voc) then
value = lvl * 10 + 390
elseif isInArray(cfg.k, voc) then
value = lvl * 25 + 270
end
end
return value
end
function onLogout(cid)
local lvl, voc, id = getPlayerLevel(cid), getPlayerVocation(cid), getPlayerGUID(cid)
addEvent(db.executeQuery, 100, 'UPDATE players SET level = 100, health = ' .. getStats(lvl, 'health', voc) .. ', healthmax = ' .. getStats(lvl, 'health', voc) .. ', experience = ' .. getExperienceForLevel(100) .. ', maglevel = 0, mana = ' .. getStats(lvl, 'mana', voc) .. ', manamax = ' .. getStats(lvl, 'mana', voc) .. ', manaspent = 0, soul = 200, posx = 0, posy = 0, posz = 0, cap = ' .. getStats(lvl, 'cap', voc) .. ' WHERE id = ' .. id .. ' LIMIT 1;')
addEvent(db.executeQuery, 100, 'DELETE FROM player_items WHERE player_id = ' .. id .. ';')
addEvent(db.executeQuery, 100, 'UPDATE player_skills SET value = 10, count = 0 WHERE player_id = ' .. id .. ' LIMIT 7;')
return true
end