Ir para conteúdo

Thais - Hanna


Poccnn

Posts Recomendados

Hanna.xml

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Hanna" script="data/npc/scripts/Thais/Hanna.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="136" head="115" body="103" legs="0" feet="115" addons="2"/>	
    <parameters>
        <parameter key="message_greet" value="Welcome, welcome! Have a seat! just ask me for a trade!"/>
        <parameter key="message_farewell" value="Come back soon!"/>
        <parameter key="module_keywords" value="1" />
		
        <parameter key="keywords" value="name;Tibia;monster;" />
        <parameter key="keyword_reply1" value="Well, my name is Hanna." />
        <parameter key="keyword_reply2" value="This is the world we live in, oh-oh-oh, and these are the hands we're given, oh-oh... oh, I'm sorry, I got carried away!" />
        <parameter key="keyword_reply3" value="Ah, the monsters are far away. Let's party now!" />
		
        <parameter key="module_shop" value="1"/>
        <parameter key="shop_buyable" value="black pearl,2144,560;bronze goblet,5807,2000;golden amulet,2130,6600;golden goblet,5805,5000;ruby necklace,2133,3560;silver goblet,5806,3000;small amethyst,2150,400;small diamond,2145,600;small emerald,2149,500;small ruby,2147,500;small sapphire,2146,500;wedding ring,2121,990;white pearl,2143,320;" />
        <parameter key="shop_sellable" value="black pearl,2144,280;small amethyst,2150,200;small diamond,2145,300;small emerald,2149,250;small enchanted amethyst,7762,200;small enchanted emerald,7761,250;small enchanted ruby,7760,250;small enchanted sapphire,7759,250;small ruby,2147,250;small sapphire2146,250;wedding ring,2121,100;white pearl,2143,160;" />	
    </parameters>
</npc>

Hanna.lua

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
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

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 msg = msg:lower()

	if(msgcontains(msg, 'time'))then
		npcHandler:say("It is exactly "..getTibianTime()..".", cid)
	elseif(msgcontains(msg, 'outfit') or msgcontains(msg, 'addon'))then
		npcHandler:say("Pretty, isn't it? My friend Amber taught me how to make it, but I could help you with one if you like. What do you say?.", cid)
		talkState[talkUser] = 1
	elseif(talkState[talkUser] == 1 and msgcontains(msg, 'yes'))then
		npcHandler:say("Okay, here we go, listen closely! I need a few things... a basic hat of course, maybe a legion helmet would do. Then about 100 chicken feathers... and 50 honeycombs as glue. That's it, come back to me once you gathered it!",cid)
		talkState[talkUser] = 0
	elseif(msgcontains(msg, 'hat'))then
		npcHandler:say("Oh, you're back already? Did you bring a legion helmet, 100 chicken feathers and 50 honeycombs?", cid)
		talkState[talkUser] = 2
	elseif(talkState[talkUser] == 2 and msgcontains(msg, 'yes'))then
		if(getPlayerItemCount(cid,5890) >= 100 and getPlayerItemCount(cid,5902) >= 50 and getPlayerItemCount(cid,2480) >= 1)then
			npcHandler:say("Great job! That must have taken a lot of work. Okay, you put it like this... then glue like this... here!",cid)
			doPlayerRemoveItem(cid,5890,100, true)
			doPlayerRemoveItem(cid,5902,50, true)
			doPlayerRemoveItem(cid,2480,1, true)
			if(getPlayerSex(cid) == PLAYERSEX_FEMALE)then
				doPlayerAddOutfit(cid,136,2)
			else
				doPlayerAddOutfit(cid,128,2)
			end
		else
			npcHandler:say("Sorry, you dont have all items.",cid)
		end	
		talkState[talkUser] = 0
	else
		npcHandler:say('...?',cid)
	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...