PoccnnEnquanto houver armas no mundo, haverá guerra!PHerói
info
Grupo: Herói
Registrado: 07/03/16
Posts: 1.4k
Reputação: +385
Gênero: Masculino
31 de agosto de 2020 às 10:11
Hanna.xml
<?xml version="1.0" encoding="UTF-8"?><npcname="Hanna"script="data/npc/scripts/Thais/Hanna.lua"walkinterval="2000"floorchange="0"><healthnow="100"max="100"/><looktype="136"head="115"body="103"legs="0"feet="115"addons="2"/><parameters><parameterkey="message_greet"value="Welcome, welcome! Have a seat! just ask me for a trade!"/><parameterkey="message_farewell"value="Come back soon!"/><parameterkey="module_keywords"value="1"/><parameterkey="keywords"value="name;Tibia;monster;"/><parameterkey="keyword_reply1"value="Well, my name is Hanna."/><parameterkey="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!"/><parameterkey="keyword_reply3"value="Ah, the monsters are far away. Let's party now!"/><parameterkey="module_shop"value="1"/><parameterkey="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;"/><parameterkey="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)endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid)endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg)endfunction onThink() npcHandler:onThink()endlocal shopModule = ShopModule:new()
npcHandler:addModule(shopModule)function creatureSayCallback(cid, type, msg)if(not npcHandler:isFocused(cid))thenreturnfalseendlocal talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and0or 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]=1elseif(talkState[talkUser]==1and 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]=0elseif(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]=2elseif(talkState[talkUser]==2and msgcontains(msg,'yes'))thenif(getPlayerItemCount(cid,5890)>=100and getPlayerItemCount(cid,5902)>=50and 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)endelse
npcHandler:say("Sorry, you dont have all items.",cid)end
talkState[talkUser]=0else
npcHandler:say('...?',cid)endreturntrueend
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
info
Grupo: Herói
Registrado: 07/03/16
Posts: 1.4k
Reputação: +385
Gênero: Masculino
Hanna.xml
Hanna.lua