local cfg = {
minLevel = 1
}
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local lvl = getPlayerLevel(cid)
local voc = getPlayerVocation(cid)
if msgcontains(msg, "vocation") then
if lvl >= cfg.minLevel then
if voc ~= 0 then
local rand = math.random(1,4)
selfSay("Here you are.", cid)
doPlayerSetVocation(cid, rand)
doPlayerSendOutfitWindow(cid)
doPlayerSetStorageValue(cid, (63835 + rand), true)
doPlayerSetMaxCapacity(cid, (lvl*(getVocationInfo(rand).capacity)+400))
setCreatureMaxHealth(cid, (lvl*(getVocationInfo(rand).healthGain)+150))
setCreatureMaxMana(cid, (lvl*(getVocationInfo(rand).manaGain)))
else
selfSay("Sorry, I cannot help you.", cid)
end
else
selfSay("Your level is too low!", cid)
end
else
selfSay("Ask me for {vocation}.", cid)
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())