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 function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local vocations = {
[5] = 9,
[6] = 10,
[7] = 11,
[8] = 12,
}
local player = Player(cid)
if msgcontains(msg, "asender") then
npcHandler:say("Estas listo para asender a chaotic por 2 crystal coins? ", cid)
npcHandler.topic[cid] = 1
elseif msgcontains(msg, "si") and npcHandler.topic[cid] == 1 then
local vocation = player:getVocation()
local vocID = vocation:getId()
local PromotionPrice = 20000
if vocations[vocID] then
if player:removeMoney(PromotionPrice) then
player:setVocation(Vocation(vocations[vocID]))
selfSay('¡Aquí tiene!.', cid)
else
selfSay('Lo siento, Tu no tienes dinero.', cid)
end
else
selfSay('Lo siento, Tu aun no eres digno de asender.', cid)
end
elseif(msgcontains(msg, 'no') and isInArray({1}) == TRUE) then
selfSay('Ok entonces.', cid)
end
return true
end
keywordHandler:addKeyword({'prom'}, StdModule.say, {npcHandler = npcHandler, text = 'di {asender} para ser asendido'})
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME| di {prom} para ser asendido")
npcHandler:setMessage(MESSAGE_FAREWELL, "Por favor no dudes en volver. |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Por favor no dudes en volver. |PLAYERNAME|.")
npcHandler:addModule(FocusModule:new())