local config = {
storage = 77777,
value = 1,
money = 5000
}
function magicl(cid, message, keywords, parameters, node)
local guid = getPlayerGUID(cid)
if not npcHandler:isFocused(cid) then
return false
end
if isDruid(cid) or isSorcerer(cid) then
if getPlayerMoney(cid) >= config.money then
doPlayerRemoveMoney(cid, config.money)
local conditionMagic = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(conditionMagic, CONDITION_PARAM_BUFF, TRUE)
setConditionParam(conditionMagic, CONDITION_PARAM_TICKS, skillsseconds * 1000)
setConditionParam(conditionMagic, CONDITION_PARAM_STAT_MAGICLEVEL, skillsupgrade['ml'])
doAddCondition(cid, conditionMagic)
selfSay('Your magic level has increased for ' .. skillsseconds .. '!', cid)
setPlayerStorageValue(cid, config.storage, config.value)
addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
else
selfSay('You don\'t have such money.', cid)
end
else
selfSay('You must be a druid or sorcerer', cid)
end
end