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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
---
--Buy Items
---
shopModule:addBuyableItem({'Elven amulet'}, 2198, 500, 1, 'Elven amulet')
---
--Sell Items
---
shopModule:addSellableItem({'Elven amulet'}, 2198, 100, 'Elven amulet')
npcHandler:addModule(FocusModule:new())
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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
---
--Buy Items
---
shopModule:addBuyableItem({'Elven amulet'}, 2198, 500, 1, 'Elven amulet')
---
--Sell Items
---
shopModule:addSellableItem({'Elven amulet'}, 2198, 100, 'Elven amulet')
npcHandler:addModule(FocusModule:new())
-- Npc A
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 storage = 9105
if(msgcontains(msg, 'mount')) then
if(getPlayerStorageValue(cid, storage) == -1) then
selfSay('Go visit npc B.', cid)
setPlayerStorageValue(cid, storage, 1)
elseif(getPlayerStorageValue(cid, storage) == 1) then
selfSay('Already visited npc B? Haven\'t heard anything from him yet, please go visit him.', cid)
elseif(getPlayerStorageValue(cid, storage) > 1) then
selfSay('Npc B told me you were helping him, that is great.', cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())