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 greet(cid) talkState[cid] = 0 return true end
function getNpcName() return getCreatureName(getNpcId()) 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
if msgcontains(msg, "job") then
selfSay("My job is to show the world how fashionable they can be!", cid)
talkState[talkUser] = 0
elseif msgcontains(msg, "name") then
selfSay("My name is " .. getNpcName() .. ".", cid)
talkState[talkUser] = 0
-- Addon already given
elseif msgcontains(msg, "addon") and (getPlayerStorageValue(cid, 45001) == 2) then
selfSay("You have already received the citizen outfit addons.", cid)
talkState[talkUser] = 0
-- Addon not given yet
elseif msgcontains(msg, "addon") then
selfSay("Would you like to get all citizen outfit addons?", cid)
talkState[talkUser] = 1
elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 and (getPlayerStorageValue(cid, 45001) == 1) then
selfSay("Wonderful! Here you are! {Addon Obtained!}", cid)
doPlayerAddOutfit(cid, 136, 3) -- female
doPlayerAddOutfit(cid, 128, 3) -- male
setPlayerStorageValue(cid, 45001, 2)
talkState[talkUser] = 0
elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 and (getPlayerStorageValue(cid, 45001) < 1) then
selfSay("Sorry. I only give out addons to those that are {worthy}.", cid)
talkState[talkUser] = 0
elseif msgcontains(msg, "worthy") then
selfSay("You must do {this random quest} to become worthy of this fine hat and backpack.", cid)
talkState[talkUser] = 0
elseif msgcontains(msg, "give") then
selfSay("I have given you +1 to your storage.", cid)
setPlayerStorageValue(cid, 45001, 1)
talkState[talkUser] = 0
elseif msgcontains(msg, "take") then
selfSay("I have reset your storage.", cid)
setPlayerStorageValue(cid, 45001, 0)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greet)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())