Ir para conteúdo

Fibula - Dermot


Poccnn

Posts Recomendados

Dermot.xml

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Dermot" script="data/npc/scripts/Fibula/Dermot.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="57" body="68" legs="38" feet="114" addons="0"/>
    <parameters>
        <parameter key="message_greet" value="Hello, traveller |PLAYERNAME|. How can I help you?"/>
        <parameter key="message_farewell" value="See you again."/>
		<parameter key="message_needmoremoney" value="You need more money."/>
		<parameter key="message_sendtrade" value="...."/>
		<parameter key="message_onbuy" value="thank you."/>
		<parameter key="message_decline" value="No problem..."/>
		<parameter key="message_walkaway" value="Yeah, get lost." />
		<parameter key="message_onsendtrade" value="Yeah, buy something." />
		
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="job;magistrate;name;time;fibula;dungeon;monsters;" />
        <parameter key="keyword_reply1" value="I am the magistrate of this isle." />
        <parameter key="keyword_reply2" value="Thats me." />
        <parameter key="keyword_reply3" value="I am Dermot, the magistrate of this isle." />
        <parameter key="keyword_reply4" value="Time is not important on Fibula." />
        <parameter key="keyword_reply5" value="You are at Fibula. This isle is not very dangerous. Just the wolves bother outside the village." />
        <parameter key="keyword_reply6" value="Oh, my god. In the dungeon of Fibula are a lot of monsters. That's why we have sealed it with a solid door." />
        <parameter key="keyword_reply7" value="Oh, my god. In the dungeon of Fibula are a lot of monsters. That's why we have sealed it with a solid door." />
        <parameter key="keyword_reply8" value="" />		
    </parameters>
</npc>

Dermot.lua

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 talkState,talkUser = {}, 0

function creatureSayCallback(cid, type, msg)
if not(npcHandler:isFocused(cid)) then return false end
local msg = string.lower(msg)
talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

	if(msgcontains(msg, 'door') or msgcontains(msg, 'key'))then
		npcHandler:say("Do you want to buy the dungeon key for 2000 gold?", cid)
		talkState[talkUser] = 1
	elseif(talkState[talkUser] == 1)then
		if(msgcontains(msg, 'yes'))then
			if(getPlayerMoney(cid) >= 2000)then
			local key = doCreateItemEx(2087)
				doItemSetAttribute(key, "aid", 3940)
				doPlayerAddItemEx(cid, key)
				doPlayerRemoveMoney(cid, 2000)	
				npcHandler:say("Now you own the hot key.",cid)
			else
				npcHandler:say("Hmm, I need 2000 gold piece.",cid)
			end
		else
			npcHandler:say("Hmm, maybe next time.",cid)
		end	
		talkState[talkUser] = 0
	else
		npcHandler:say('...?',cid)
		talkState[talkUser] = 0
	end
	return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...