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 09:44
Lily.xml
<?xml version="1.0" encoding="UTF-8"?><npcname="Lily"script="data/npc/scripts/Rookgaard/Lily.lua"walkinterval="2000"floorchange="0"><healthnow="100"max="100"/><looktype="138"head="78"body="119"legs="105"feet="115"addons="0"/><parameters><parameterkey="message_greet"value="Welcome |PLAYERNAME|! You look a little stressed today. If you like to view my offers of potions, just ask me for a trade. In case you're looking for the marketplace and dungeons, just follow the path to the east!/><parameterkey="message_farewell"value="Take care, |PLAYERNAME|."/><parameterkey="module_keywords"value="1"/><parameterkey="keywords"value="monsters;job;name;Lily;mainland;druid;tibia;Hyacinth;Crunor;"/><parameterkey="keyword_reply1"value="Sadly, our little village of Rookgaard is invaded by monsters. From the dungeons they creep to the surface and attack the city. We always need adventurers helping us to fight them."/><parameterkey="keyword_reply2"value="I'm a druid, bound to the spirit of nature. My potions will help you if you feel bad. I also buy blueberries and cookies. Just ask me for a trade."/><parameterkey="keyword_reply3"value="My name is Lily, like the flower. It also stands for purity, just like my potions are!"/><parameterkey="keyword_reply4"value="Yes?"/><parameterkey="keyword_reply5"value="The main continent is huge! The gods of Tibia created everything from great seas, deep jungles and large deserts."/><parameterkey="keyword_reply6"value="Being a druid is a wonderful profession. You control the forces of nature and can heal others."/><parameterkey="keyword_reply7"value="Tibia is our beautiful world, created by the gods. Being a druid, I'm a worshipper of Crunor."/><parameterkey="keyword_reply8"value="Hyacinth also sells small health potions. He lives outside the village, in a hidden place."/><parameterkey="keyword_reply9"value="Crunor is the great lord of trees and the creator of all plants. Despite what some people believe, he didn't create the monsters, though."/><parameterkey="module_shop"value="1"/><parameterkey="shop_buyable"value="antidote potion,8474,50;small health potion,8704,20;"/><parameterkey="shop_sellable"value="cookie,2687,1;empty potion flask,7636,5;vial,2006,5;"/></parameters></npc>
Lily.lua
local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)local talkState ={}local tipo,count,item,price,more
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 tibiaTime(min, sec)
suffix =''
varh =(min*60+sec)/150
tibH = math.floor(varh)
tibM = math.floor(60*(varh-tibH))if tonumber(tibH)>11then
tibH = tonumber(tibH)-12
suffix =' pm'else
suffix =' am'endif tibH ==0then
tibH =12endif(tibH <10)then
tibH ='0'..tibH
endif(tibM <10)then
tibM ='0'..tibM
endreturn(tibH..':'..tibM..suffix)endfunction creatureSayCallback(cid, type, msg)
tipo,count,item = msg:trade()if(not npcHandler:isFocused(cid))thenreturnfalseendlocal talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and0or cid
if msgcontains(msg,'time')then
npcHandler:say("It is about "..tibiaTime(os.date('%M'), os.date('%S'))..". But does it really matter? Don't rush yourself and enjoy all these little moments.", cid)elseif msgcontains(msg,'blueberry')then
npcHandler:say("how many blueberry do you have?", cid)
talkState[talkUser]=1elseif(talkState[talkUser]==1)thenif(count >=5)then
npcHandler:say('I pay '..math.proxInteger(count/5)..' gps on '..count..' blueberry. accepted?', cid)
talkState[talkUser]=2elseif(count >100)then
npcHandler:say('Tell me counter equal or less than 100.', cid)else
npcHandler:say('I pay 1 gp for every 5 blueberry.', cid)endelseif(talkState[talkUser]==2)thenif msgcontains(msg,'yes')thenif(doPlayerRemoveItem(cid,2677,count)==true)then
npcHandler:say('thank you very much!',cid)
doPlayerAddMoney(cid,math.proxInteger(count/5))else
npcHandler:say('Hummm...',cid)endelse
npcHandler:say('Sorry for my bad offer.',cid)end
talkState[talkUser]=0elseifnot(foodSayString(msg))then
npcHandler:say('sorry but I do not know what they wanted.', 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
Lily.xml
Lily.lua
Editado Agosto 31 por Poccnn