local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
local expgive = 'Here you go.'
local nomoney = 'You dont have enough money!'
local cost = 10000
local exp = 1000000
npcHandler:setMessage(MESSAGE_GREET, "Greetings, |PLAYERNAME|.")
function expBuy(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if doPlayerRemoveMoney(cid, cost) then
npcHandler:say(expgive)
doPlayerAddExp(cid, exp)
end
else
npcHandler:say(nomoney)
end
end
keywordHandler:addKeyword({'exp'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Do you want to buy |exp| experience for the total cost of |cost| gold pieces?"})
local node1 = keywordHandler:addKeyword({'experience'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy |exp| experience for the total cost of |cost| gold pieces?'})
node1:addChildKeyword({'yes'}, expBuy, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok then.', reset = true})
npcHandler:addModule(FocusModule:new())