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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local player = Player(cid)
if(msgcontains(msg, "vengoth")) then
npcHandler:say("So you are saying you're looking for someone to take you to Vengoth?", cid)
npcHandler.topic[cid] = 1
end
if msgcontains(msg, "blood crystal") then
npcHandler:say("What the heck, stop bothering me with your questions.", cid)
npcHandler.topic[cid] = 0
elseif (msgcontains(msg, "yes")) then
if npcHandler.topic[cid] == 1 and player:getStorageValue(Storage.BloodBrothersQuest.Mission04) >= 1 then
npcHandler:say("I could do that, it's not far from here. I don't run a charity organisation, though. Tell you what. Give me 100 gold pieces, and me and my boat are yours for the trip. Okay?", cid)
npcHandler.topic[cid] = 2
elseif npcHandler.topic[cid] == 2 and player:getMoney() >= 100 then
player:removeMoney(100)
npcHandler:say("Okay. Enjoy.", cid)
doTeleportThing(cid, {x = 32858, y = 31549, z = 7})
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
npcHandler.topic[cid] = 0
elseif npcHandler.topic[cid] == 2 and player:getMoney() < 100 then
npcHandler:say("You don't have enough money.", cid)
npcHandler.topic[cid] = 0
elseif npcHandler.topic[cid] == 1 and player:getStorageValue(Storage.BloodBrothersQuest.Mission04) < 1 then
npcHandler:say("Sorry, but you are not allowed to go there.", cid)
npcHandler.topic[cid] = 0
end
end
return true
end
npcHandler:setMessage(MESSAGE_FAREWELL, "Bye!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Fine then.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())