Ir para conteúdo

Thais - Lubo


Poccnn

Posts Recomendados

Lubo.xml

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Lubo" script="data/npc/scripts/Thais/Lubo.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="128" head="57" body="122" legs="126" feet="94" addons="3"/>
	<parameters>   
		<parameter key="module_shop" value="1"/>
        <parameter key="shop_buyable" value="basket,1989,6;bottle,4839,3;bucket,2005,4,0;candelabrum,2041,8;closed trap,2578,280;crowbar,2416,260;cup,2013,3,0;fishing rod,2580,150;machete,2420,35;pick,2553,50;present,1990,10;backpack,1988,25;rope,2120,50;scyhe,2550,50;shovel,2554,50;torch,2050,2;worm,3976,1;" />
        <parameter key="shop_sellable" value="crowbar,2416,75;closed trap,2578,50;fishing rod,2580,40;machete,2420,6;pick,2553,15;rope,2120,15;scythe,2550,10;shovel,2554,8;wooden hammer,2556,15;" />
		
        <parameter key="message_greet" value="Welcome to my adventurer shop, |PLAYERNAME|! What do you need?"/>
        <parameter key="message_farewell" value="Come back soon!"/>
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="job;equipment;maps;magic;name;weapon;mountain;magician;crunor;flower guys;accident;stable;buy;sell;wares;dog;inn;pet;finger;cottage;" />
        <parameter key="keyword_reply1" value="I am selling equipment for adventurers. Do you need anything?" />
        <parameter key="keyword_reply2" value="I sell torches, fishing rods, ropes, water hoses, backpacks, apples, and maps." />
        <parameter key="keyword_reply3" value="Oh! I'm sorry, I sold the last one just five minutes ago." />
        <parameter key="keyword_reply4" value="There's a lot of magic flowing in the mountain to the north." />
        <parameter key="keyword_reply5" value="I am Lubo, the owner of this shop." />
        <parameter key="keyword_reply6" value="If you want to buy weapons, you'll have to go to a town or city." />
        <parameter key="keyword_reply7" value="It is said that once there lived a great magician on the top of this mountain." />
        <parameter key="keyword_reply8" value="I don't remember his name, but it's said that his banner was the black eye." />		
        <parameter key="keyword_reply9" value="Ah yes, I remember my grandfather talking about that name. This house used to be an inn a long time ago. My family bought it from some of these flower guys." />		
        <parameter key="keyword_reply10" value="Oh, I mean druids of course. They sold the cottage to my family after some of them died in an accident or something like that." />		
        <parameter key="keyword_reply11" value="As far as I can remember the story, a pet escaped its stable behind the inn. It got somehow involved with powerful magic at a ritual and was transformed in some way." />		
        <parameter key="keyword_reply12" value="My grandpa told me, in the old days there were some behind this cottage. Nothing big though, just small ones, for chicken or rabbits." />		
        <parameter key="keyword_reply13" value="I sell torches, fishing rods, worms, ropes, water hoses, backpacks, apples, and maps." />
        <parameter key="keyword_reply14" value="I sell torches, fishing rods, worms, ropes, water hoses, backpacks, apples, and maps." />		
        <parameter key="keyword_reply15" value="I sell torches, fishing rods, worms, ropes, water hoses, backpacks, apples, and maps." />		
        <parameter key="keyword_reply17" value="This is Ruffy my dog, please don't do him any harm." />		
        <parameter key="keyword_reply18" value="Frodo runs a nice inn in the near town Thais." />		
        <parameter key="keyword_reply19" value="There are some strange stories about a magicians pet names. Ask Hoggle about it." />		
		<parameter key="keyword_reply20" value="Oh, you sure mean this old story about the mage Dago, who lost two fingers when he conjured a dragon." />	
		<parameter key="keyword_reply21" value="Ah yes, I remember my grandfather talking about that name. This house used to be an inn a long time ago. My family bought it from some of these flower guys." />	
    </parameters>
</npc>

Lubo.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 function say(npc,text, cid)
	doCreatureSay(npc,text,TALKTYPE_PRIVATE_NP,cid)
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 msg = string.lower(msg)

	if(msgcontains(msg, 'time'))then
		npcHandler:say("It is exactly "..getTibianTime()..".", cid)
	elseif(msgcontains(msg, 'outfit') or msgcontains(msg, 'addon'))then
		npcHandler:say("Sorry, the backpack I wear is not for sale. It's handmade from rare {minotaur leather}.", cid)
		talkState[talkUser] = 1
	elseif(talkState[talkUser] == 1 and msgcontains(msg, 'minotaur leather'))then
		npcHandler:say("Well, if you really like this backpack, I could make one for you, but minotaur leather is hard to come by these days. Are you willing to put some work into this?",cid)
		talkState[talkUser] = 11
	elseif(talkState[talkUser] == 11 and msgcontains(msg, 'yes'))then
		npcHandler:say("Alright then, if you bring me 100 pieces of fine minotaur leather I will see what I can do for you. You probably have to kill really many minotaurs though... so good luck!",cid)
		talkState[talkUser] = 0
	elseif(msgcontains(msg, 'backpack'))then
		npcHandler:say("Ah, right, almost forgot about the backpack! Have you brought me 100 pieces of minotaur leather as requested?", cid)
		talkState[talkUser] = 2
	elseif(talkState[talkUser] == 2 and msgcontains(msg, 'yes'))then
		if(getPlayerItemCount(cid,5878) >= 100)then
			npcHandler:say("Great! Alright, I need a while to finish this backpack for you. Please, wait a minute...",cid)
			addEvent(say,6000,getNpcCid(),"... a little more... I'm almost finishing...",cid)
			addEvent(say,20000,getNpcCid(),"... Your backpack is finished. Here you go, I hope you like it.",cid)
			doPlayerRemoveItem(cid,5878,100, true)
			if(getPlayerSex(cid) == PLAYERSEX_FEMALE)then
				doPlayerAddOutfit(cid,136,1)
			else
				doPlayerAddOutfit(cid,128,1)
			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())

 

Editado por Poccnn
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...