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
function onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) end
function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) end
local node1 = keywordHandler:addKeyword({'wisdom'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want me to grant you Wisdom of Solitude blessing for 25000 gold?'})
node1:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 1, premium = true, baseCost = 25000, levelCost = 0, startLevel = 1, endLevel = 0})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Okay.'})
local node2 = keywordHandler:addKeyword({'spark'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want me to grant you Spark of The Phoenix blessing for 25000 gold?'})
node2:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 2, premium = true, baseCost = 25000, levelCost = 0, startLevel = 1, endLevel = 0})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Okay.'})
local node3 = keywordHandler:addKeyword({'fire'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want me to grant you double sun power of our local Fire of Two Suns blessing for 25000 gold?'})
node3:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 3, premium = true, baseCost = 25000, levelCost = 0, startLevel = 1, endLevel = 0})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Okay.'})
local node4 = keywordHandler:addKeyword({'spiritual'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to grant you ancient Spiritual Shielding blessing for 25000 gold?'})
node4:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 4, premium = true, baseCost = 25000, levelCost = 0, startLevel = 1, endLevel = 0})
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Okay.'})
local node5 = keywordHandler:addKeyword({'embrace'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to receive Embrace of Tibia blessing for 25000 gold?'})
node5:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 5, premium = true, baseCost = 25000, levelCost = 0, startLevel = 1, endLevel = 0})
node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Okay.'})
local node6 = keywordHandler:addKeyword({'twist'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Special one... Twist of Fate, it can reduce loss from unfair fights. Do you wish to receive it for 25000 gold?'})
node6:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 0, premium = true, baseCost = 25000, levelCost = 0, startLevel = 1, endLevel = 0})
node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Okay.'})
local node7 = keywordHandler:addKeyword({'all'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to receive all blessings for 150000 gold?'})
node7:addChildKeyword({'yes'}, StdModule.allbless, {npcHandler = npcHandler, number = 1, premium = true, baseCost = 150000, levelCost = 200, startLevel = 1, endLevel = 0})
node7:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Okay.'})
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'map') or msgcontains(msg, 'mark')) then
local marks = {
{mark = 5, pos = {x = 256, y = 256, z = 7}, desc = "Enigma City Temple"},
{mark = 10, pos = {x = 287, y = 254, z = 7}, desc = "Depot with bank"},
{mark = 13, pos = {x = 303, y = 247, z = 7}, desc = "Food store"},
{mark = 8, pos = {x = 278, y = 236, z = 7}, desc = "Smithery"},
{mark = 8, pos = {x = 271, y = 226, z = 7}, desc = "Distance weapons shop"},
{mark = 13, pos = {x = 268, y = 241, z = 7}, desc = "Jewellery, magic shop and music instruments shop"},
{mark = 13, pos = {x = 303, y = 247, z = 7}, desc = "Food store and magic shop"},
{mark = 7, pos = {x = 252, y = 242, z = 7}, desc = "Tools and furniture"},
{mark = 13, pos = {x = 258, y = 237, z = 7}, desc = "Creature products and fashion"},
{mark = 9, pos = {x = 234, y = 215, z = 7}, desc = "Boat"},
}
local f_addMark = doPlayerAddMapMark
if(not f_addMark) then f_addMark = doAddMapMark end
for _, m in pairs(marks) do
f_addMark(cid, m.pos, m.mark, m.desc ~= nil and m.desc or "")
end
selfSay('Here you are.', cid)
end
if msgcontains(msg, "heal") then
if getCreatureCondition(cid, CONDITION_FIRE) == TRUE then
npcHandler:say("You are burning. I will use water on you.", cid)
doRemoveCondition(cid, CONDITION_FIRE)
doSendMagicEffect(getCreaturePosition(cid), 14)
elseif getCreatureCondition(cid, CONDITION_POISON) == TRUE then
npcHandler:say("You are poisoned. I will cure you.", cid)
doRemoveCondition(cid, CONDITION_POISON)
doSendMagicEffect(getCreaturePosition(cid), 13)
elseif getCreatureCondition(cid, CONDITION_ENERGY) == TRUE then
npcHandler:say("You are electrificed. I will help you.", cid)
doRemoveCondition(cid, CONDITION_ENERGY)
doSendMagicEffect(getCreaturePosition(cid), 12)
elseif getCreatureCondition(cid, CONDITION_PARALYZE) == TRUE then
npcHandler:say("You are paralyzed. I will cure you.", cid)
doRemoveCondition(cid, CONDITION_PARALYZE)
doSendMagicEffect(getCreaturePosition(cid), 14)
elseif getCreatureCondition(cid, CONDITION_DROWN) == TRUE then
npcHandler:say("You are drowing. I will help you.", cid)
doRemoveCondition(cid, CONDITION_DROWN)
doSendMagicEffect(getCreaturePosition(cid), 12)
elseif getCreatureCondition(cid, CONDITION_FREEZING) == TRUE then
npcHandler:say("You are cold! I will burn you.", cid)
doRemoveCondition(cid, CONDITION_FREEZING)
doSendMagicEffect(getCreaturePosition(cid), 15)
elseif getCreatureCondition(cid, CONDITION_DAZZLED) == TRUE then
npcHandler:say("You are dazzled! Do not mess with holy creatures anymore!", cid)
doRemoveCondition(cid, CONDITION_DAZZLED)
doSendMagicEffect(getCreaturePosition(cid), 47)
elseif getCreatureCondition(cid, CONDITION_CURSED) == TRUE then
npcHandler:say("You are cursed! I will remove it.", cid)
doRemoveCondition(cid, CONDITION_CURSED)
doSendMagicEffect(getCreaturePosition(cid), 47)
elseif getCreatureHealth(cid) < 65 then
npcHandler:say("You are looking really bad. Let me heal your wounds.", cid)
doCreatureAddHealth(cid, 65 - getCreatureHealth(cid))
doSendMagicEffect(getCreaturePosition(cid), 12)
elseif getCreatureHealth(cid) < 2000 then
npcHandler:say("I did my best to fix your wounds.", cid)
doCreatureAddHealth(cid, 2000 - getCreatureHealth(cid))
doSendMagicEffect(getCreaturePosition(cid), 12)
else
npcHandler:say("You aren't looking really bad, " .. getCreatureName(cid) .. ". I only help in cases of real emergencies. Raise your health simply by eating {food}.", cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())