Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
2.3 kB
2
Indexable
Never
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
	
 
	if(msgcontains(msg, "u can understand me?") and getPlayerStorageValue(cid, 203) < 1) then
		npcHandler:say("But of course knucklehead, who do you think you're talking to?.", cid)
		npcHandler.topic[cid] = 1
	elseif(msgcontains(msg, "need help")) then
		if(npcHandler.topic[cid] == 1) then
			npcHandler:say("and what fault do I have?, not my problem...", cid)
			npcHandler.topic[cid] = 2
		end
	elseif(msgcontains(msg, "maybe it's urgent")) then
		if(npcHandler.topic[cid] == 2) then
			npcHandler:say("....Damn, tell me quickly what you want, I don't have all day ", cid)
			npcHandler.topic[cid] = 3
		end
	elseif(msgcontains(msg, "I don't understand an orc")) then
		if(npcHandler.topic[cid] == 3) then				
			npcHandler:say({
				"Your empty brain does not understand the orc language, and do you want me to help you with that?. ...",
				"okay, i've been working on a spell that gives a person the ability to understand different types of languages, i don't know if it's luck or 'fate' that this happened but, I will try this new spell on you, you will be a good guinea pig. ...",
				"Kzaaam... Well, run to try it before I regret it, I hope that in some future you tell me how it went for you. Go save the world...SAVIOR."
			}, cid)
			npcHandler.topic[cid] = 0
			if(getPlayerStorageValue(cid, 205) < 1) then
				setPlayerStorageValue(cid, 205, 1)
				Player(cid):setStorageValue(12111, Player(cid):getStorageValue(12111) + 1) -- The Inquisition Questlog- "Mission 1: Interrogation"
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
			end
		end
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())