Ir para conteúdo
  • Cadastre-se

(Resolvido)[PEDIDO] Promote para players free account!


Ir para solução Resolvido por Caronte,

Posts Recomendados

Olá galerinha do TK!

 

Estou com um probleminha...

 

Tenho um servidor e uso tsf 1.0 nele, como não tenho nenhum sistema VIP eu gostaria de usar a própria premium para isso porém não consegui que a Queen Eloise e o King Tibianus dessem promote para players free account, alguém pode me ajudar?

 

Agradeço a ajuda desde já! :D

Meu servidor -> http://atena-global.com/

 

Visite o servidor e ajude-nos a crescer! Atena Global, um novo conceito de Tibia, o verdadeiro RPG você encontra aqui!

Link para o post
Compartilhar em outros sites

Olá galerinha do TK!

 

Estou com um probleminha...

 

Tenho um servidor e uso tsf 1.0 nele, como não tenho nenhum sistema VIP eu gostaria de usar a própria premium para isso porém não consegui que a Queen Eloise e o King Tibianus dessem promote para players free account, alguém pode me ajudar?

 

Agradeço a ajuda desde já! :D

 

Posta os XML/LUA deles...

Se quiser sua dúvida tirada, mande PM com os links, e não com a dúvida (outros podem ter a mesma dúvida, e o fórum serve para ser usado).

 

Tópicos:


 

yNlhRVC.png

 

55px-Judo_yellow_belt.svg.png

Link para o post
Compartilhar em outros sites

Posta os XML/LUA deles...

 

Queen Eloise XML

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Queen Eloise" script="Queen Eloise.lua" walkinterval="2000" speechbubble="1" floorchange="0">
<health now="100" max="100"/>
<look type="331" head="96" body="94" legs="79" feet="115" addons="0"/>
<parameters>
       <parameter key="message_greet" value="I greet thee, my loyal subject."/>
        <parameter key="message_farewell" value="Farewell, |PLAYERNAME|"/>
		<parameter key="message_walkaway" value="Farewell, |PLAYERNAME|" />
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="job;king;" />
        <parameter key="keyword_reply1" value="I am Queen Eloise. It is my duty to reign over this marvellous city and the lands of the north." />
		 <parameter key="keyword_reply2" value="I am the Queen, the only rightful ruler on the continent!" />
    </parameters>
</npc>

Queen Eloise 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

keywordHandler:addKeyword({'subject'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am {Queen} Eloise. It is my duty to reign over this marvellous {city} and the {lands} of the north."})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am {Queen} Eloise. It is my duty to reign over this marvellous {city} and the {lands} of the north."})
keywordHandler:addKeyword({'justice'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We women try to bring justice and wisdom to all, even to males."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am Queen Eloise. For you it's 'My Queen' or 'Your Majesty', of course."})
keywordHandler:addKeyword({'news'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't care about gossip like a simpleminded male would do."})
keywordHandler:addKeyword({'tibia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Soon the whole land will be ruled by women at last!"})
keywordHandler:addKeyword({'land'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Soon the whole land will be ruled by {women} at last!"})
keywordHandler:addKeyword({'how are you'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Thank you, I'm fine."})
keywordHandler:addKeyword({'castle'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It's my humble domain."})
keywordHandler:addKeyword({'sell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Sell? Your question shows that you are a typical member of your gender!"})
keywordHandler:addKeyword({'god'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We honor the gods of good in our fair city, especially Crunor, of course."})
keywordHandler:addKeyword({'citizen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "All citizens of Carlin are my subjects. I see them more as my childs, though, epecially the male population."})
keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "This beast scared my cat away on my last diplomatic mission in this filthy town."})
keywordHandler:addKeyword({'ferumbras'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is the scourge of the whole continent!"})
keywordHandler:addKeyword({'treasure'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The royal treasure is hidden beyond the grasps of any thieves by magical means."})
keywordHandler:addKeyword({'monster'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Go and hunt them! For queen and country!"})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Visit the church or the townguards for help."})
keywordHandler:addKeyword({'quest'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I will call for heroes as soon as the need arises again."})
keywordHandler:addKeyword({'mission'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I will call for heroes as soon as the need arises again."})
keywordHandler:addKeyword({'gold'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our city is rich and prospering."})
keywordHandler:addKeyword({'money'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our city is rich and prospering."})
keywordHandler:addKeyword({'tax'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our city is rich and prospering."})
keywordHandler:addKeyword({'sewer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't want to talk about 'sewers'."})
keywordHandler:addKeyword({'dungeon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Dungeons are places where males crawl around and look for trouble."})
keywordHandler:addKeyword({'equipment'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Feel free to visit our town's magnificent shops."})
keywordHandler:addKeyword({'food'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Feel free to visit our town's magnificent shops."})
keywordHandler:addKeyword({'time'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Don't worry about time in the presence of your Queen."})
keywordHandler:addKeyword({'hero'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We need the assistance of heroes now and then. Even males prove useful now and then."})
keywordHandler:addKeyword({'adventure'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We need the assistance of heroes now and then. Even males prove useful now and then."})
keywordHandler:addKeyword({'collector'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The taxes in Carlin are not high, more a symbol than a sacrifice."})
keywordHandler:addKeyword({'queen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am the Queen, the only rightful ruler on the continent!"})
keywordHandler:addKeyword({'army'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask one of the soldiers about that."})
keywordHandler:addKeyword({'enemy'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our enemies are numerous. We have to fight vile monsters and have to watch this silly king in the south carefully."})
keywordHandler:addKeyword({'enemies'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our enemies are numerous. We have to fight vile monsters and have to watch this silly king in the south carefully."})
keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They dare to reject my reign over them!"})
keywordHandler:addKeyword({'south'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They dare to reject my reign over them!"})
keywordHandler:addKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Isn't our city marvellous? Have you noticed the lovely gardens on the roofs?"})
keywordHandler:addKeyword({'city'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Isn't our city marvellous? Have you noticed the lovely gardens on the roofs?"})
keywordHandler:addKeyword({'shop'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My subjects maintain many fine shops. Go and have a look at their wares."})
keywordHandler:addKeyword({'merchant'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask around about them."})
keywordHandler:addKeyword({'craftsmen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask around about them."})
keywordHandler:addKeyword({'guild'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The four major guilds are the Knights, the Paladins, the Druids, and the Sorcerers."})
keywordHandler:addKeyword({'minotaur'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They havn't troubled our city lately. I guess, they fear the wrath of our druids."})
keywordHandler:addKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The paladins are great hunters."})
keywordHandler:addKeyword({'legola'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The paladins are great hunters."})
keywordHandler:addKeyword({'elane'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It's a shame that the High Paladin does not reside in Carlin."})
keywordHandler:addKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The knights of Carlin are the bravest."})
keywordHandler:addKeyword({'trisha'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The knights of Carlin are the bravest."})
keywordHandler:addKeyword({'sorc'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The sorcerers have a small isle for their guild. So if they blow something up it does not burn the whole city to ruins."})
keywordHandler:addKeyword({'lea'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The sorcerers have a small isle for their guild. So if they blow something up it does not burn the whole city to ruins."})
keywordHandler:addKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The druids of Carlin are our protectors and advisors. Their powers provide us with wealth and food."})
keywordHandler:addKeyword({'padreia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The druids of Carlin are our protectors and advisors. Their powers provide us with wealth and food."})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Carlin is a center of the forces of good, of course."})
keywordHandler:addKeyword({'evil'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The forces of evil have a firm grip on this puny city to the south."})
keywordHandler:addKeyword({'order'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The order, Crunor gives the world, is essential for survival."})
keywordHandler:addKeyword({'chaos'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Chaos is common in the southern regions, where they allow a man to reign over a realm."})
keywordHandler:addKeyword({'excalibug'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "A mans tale ... that means 'nonsense', of course."})
keywordHandler:addKeyword({'reward'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "If you want a reward, go and bring me something this silly King Tibianus wants dearly!"})
keywordHandler:addKeyword({'tbi'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "A dusgusting organisation, which could be only created by men."})
keywordHandler:addKeyword({'eremo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It is said that he lives on a small island near Edron. Maybe the people there know more about him."})

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	if msgcontains(msg, "promote") or msgcontains(msg, "promotion") then
		npcHandler:say("Do you want to be promoted in your vocation for 20000 gold?", cid)
		npcHandler.topic[cid] = 1
	elseif npcHandler.topic[cid] == 1 then
		if msgcontains(msg, "yes") then
			local player = Player(cid)
			if player:getStorageValue(Storage.Promotion) == 1 then
				npcHandler:say('You are already promoted.', cid)
			elseif player:getLevel() < 20 then
				npcHandler:say('You need to be at least level 20 in order to be promoted.', cid)
			elseif player:getMoney() < 20000 then
				npcHandler:say('You do not have enough money.', cid)
			elseif player:isPremium() then
				npcHandler:say("Congratulations! You are now promoted.", cid)
				local promotion = player:getVocation():getPromotion()
				player:setVocation(Vocation(promotion and promotion:getId() or 0))
				player:removeMoney(20000)
			else
				npcHandler:say("You need a premium account in order to promote.", cid)
			end
		else
			npcHandler:say('Ok, whatever.', cid)
		end
		npcHandler.topic[cid] = 0
		return true
	end

	if msgcontains(msg, "uniforms") then
		local player = Player(cid)
		if player:getStorageValue(Storage.postman.Mission06) == 5 then
			npcHandler:say("I remember about those uniforms, they had a camouflage inlay so they could be worn the inside out too. I will send some color samples via mail to Mr. Postner. ", cid)
			player:setStorageValue(Storage.postman.Mission06, 6)
		else
			npcHandler:say('The uniforms of our guards and soldiers are of unparraleled quality of course.', cid)
		end
	end
	return true
end

npcHandler:setMessage(MESSAGE_GREET, "I greet thee, my loyal {subject}.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Farewell, |PLAYERNAME|!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

local focusModule = FocusModule:new()
focusModule:addGreetMessage('hail queen')
focusModule:addGreetMessage('salutations queen')
npcHandler:addModule(focusModule)

King Tibianus XML

<?xml version="1.0" encoding="UTF-8"?>
<npc name="King Tibianus" script="King Tibianus.lua" walkinterval="2000" speechbubble="1">
<health now="100" max="100"/>
<look type="332"/>
</npc>

King Tibianus 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

keywordHandler:addKeyword({'eremo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It is said that he lives on a small island near Edron. Maybe the people there know more about him."})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am your sovereign, King Tibianus III, and it's my duty to uphold {justice} and provide guidance for my subjects."})
keywordHandler:addKeyword({'justice'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I try my best to be just and fair to our citizens. The army and the {TBI} are a great help in fulfilling this duty."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Preposterous! You must know the name of your own King!"})
keywordHandler:addKeyword({'news'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The latest news is usually brought to our magnificent town by brave adventurers. They recount tales of their journeys at Frodo's tavern."})
keywordHandler:addKeyword({'how are you'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Thank you, I'm fine."})
keywordHandler:addKeyword({'castle'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Rain Castle is my home."})
keywordHandler:addKeyword({'sell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Sell? Sell what? My kingdom isn't for sale!"})
keywordHandler:addKeyword({'god'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Honour the Gods and above all pay your {taxes}."})
keywordHandler:addKeyword({'zathroth'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Please ask a priest about the gods."})
keywordHandler:addKeyword({'citizen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The citizens of Tibia are my subjects. Ask the old monk Quentin if you want to learn more about them."})
keywordHandler:addKeyword({'sam'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is a skilled blacksmith and a loyal subject."})
keywordHandler:addKeyword({'frodo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is the owner of Frodo's Hut and a faithful tax-payer."})
keywordHandler:addKeyword({'gorn'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He was once one of Tibia's greatest fighters. Now he sells equipment."})
keywordHandler:addKeyword({'benjamin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He was once my greatest general. Now he is very old and senile so we assigned him to work for the Royal Tibia Mail."})
keywordHandler:addKeyword({'noodles'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The royal poodle Noodles is my greatest {treasure}!"})
keywordHandler:addKeyword({'ferumbras'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is a follower of the evil God Zathroth and responsible for many attacks on us. Kill him on sight!"})
keywordHandler:addKeyword({'bozo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is my royal jester and cheers me up now and then."})
keywordHandler:addKeyword({'treasure'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The royal poodle Noodles is my greatest treasure!"})
keywordHandler:addKeyword({'monster'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Go and hunt them! For king and country!"})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Visit Quentin the monk for help."})
keywordHandler:addKeyword({'sewer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "What a disgusting topic!"})
keywordHandler:addKeyword({'dungeon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Dungeons are no places for kings."})
keywordHandler:addKeyword({'equipment'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Feel free to buy it in our town's fine shops."})
keywordHandler:addKeyword({'food'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask the royal cook for some food."})
keywordHandler:addKeyword({'tax collector'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "That tax collector is the bane of my life. He is so lazy. I bet you haven't payed any taxes at all."})
keywordHandler:addKeyword({'king'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am the king, so watch what you say!"})
keywordHandler:addKeyword({'army'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask the soldiers about that."})
keywordHandler:addKeyword({'shop'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Visit the shops of our merchants and craftsmen."})
keywordHandler:addKeyword({'guild'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The four major guilds are the knights, the paladins, the druids, and the sorcerers."})
keywordHandler:addKeyword({'minotaur'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Vile monsters, but I must admit they are strong and sometimes even cunning ... in their own bestial way."})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The forces of good are hard pressed in these dark times."})
keywordHandler:addKeyword({'evil'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We need all strength we can muster to smite evil!"})
keywordHandler:addKeyword({'order'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We need order to survive!"})
keywordHandler:addKeyword({'chaos'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Chaos arises from selfishness."})
keywordHandler:addKeyword({'excalibug'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It's the sword of the Kings. If you return this weapon to me I will {reward} you beyond your wildest dreams."})
keywordHandler:addKeyword({'reward'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Well, if you want a reward, go on a quest to bring me Excalibug!"})
keywordHandler:addKeyword({'chester'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "A very competent person. A little nervous but very competent."})
keywordHandler:addKeyword({'tbi'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "This organisation is an essential tool for holding our enemies in check. Its headquarter is located in the bastion in the northwall."})

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	local player = Player(cid)
	if isInArray({"tibia", "land"}, msg) then
		npcHandler:say("Soon the whole land will be ruled by me once again!", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"harkath", "bloodblade", "general"}, msg) then
		npcHandler:say("Harkath Bloodblade is the general of our glorious {army}.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"quest", "mission"}, msg) then
		npcHandler:say("I will call for heroes as soon as the need arises again and then reward them appropriately.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"gold", "money", "tax", "collector"}, msg) then
		npcHandler:say("To pay your taxes, visit the royal tax collector.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"time", "hero", "adventurer"}, msg) then
		npcHandler:say("It's a time for heroes!", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"enemy", "enemies"}, msg) then
		npcHandler:say("Our enemies are numerous. The evil minotaurs, Ferumbras, and the renegade city of Carlin to the north are just some of them.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"city", "north", "carlin"}, msg) then
		npcHandler:say("They dare to reject my reign over the whole continent!", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"thais", "city"}, msg) then
		npcHandler:say("Our beloved city has some fine shops, guildhouses and a modern sewerage system.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"merchant", "craftsmen"}, msg) then
		npcHandler:say("Ask around about them.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"paladin", "elane"}, msg) then
		npcHandler:say("The paladins are great protectors for Thais.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"knight", "gregor"}, msg) then
		npcHandler:say("The brave knights are necessary for human survival in Thais.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"sorcerer", "muriel"}, msg) then
		npcHandler:say("The magic of the sorcerers is a powerful tool to smite our enemies.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"druid", "marvik"}, msg) then
		npcHandler:say("We need the druidic healing powers to fight evil.", cid)
		npcHandler.topic[cid] = 0
	elseif msgcontains(msg, "promote") or msgcontains(msg, "promotion") then
		npcHandler:say("Do you want to be promoted in your vocation for 20000 gold?", cid)
		npcHandler.topic[cid] = 1
	elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 1 then
		if player:getStorageValue(Storage.Promotion) == 1 then
			npcHandler:say('You are already promoted.', cid)
		elseif player:getLevel() < 20 then
			npcHandler:say('You need to be at least level 20 in order to be promoted.', cid)
		elseif player:getMoney() < 20000 then
			npcHandler:say('You do not have enough money.', cid)
		elseif player:isPremium() then
			npcHandler:say("Congratulations! You are now promoted.", cid)
			local promotion = player:getVocation():getPromotion()
			player:setVocation(Vocation(promotion and promotion:getId() or 0))
			player:removeMoney(20000)
		else
			npcHandler:say("You need a premium account in order to promote.", cid)
		end
		npcHandler.topic[cid] = 0
	elseif npcHandler.topic[cid] == 1 then
		npcHandler:say("Ok, whatever.", cid)
		npcHandler.topic[cid] = 0
	end

	--The New Frontier
	if msgcontains(msg, "farmine") then
		if player:getStorageValue(Storage.TheNewFrontier.Questline) == 15 then
			npcHandler:say("Ah, I vaguely remember that our little allies were eager to build some base. So speak up, what do you want?", cid)
			npcHandler.topic[cid] = 2
		end
	elseif msgcontains(msg, "flatter") then
		if npcHandler.topic[cid] == 2 then
			if player:getStorageValue(Storage.TheNewFrontier.BribeKing) ~= 1 then
				npcHandler:say("Indeed, indeed. Without the help of Thais, our allies stand no chance! Well, I'll send some money to support their cause.", cid)
				player:setStorageValue(Storage.TheNewFrontier.BribeKing, 1)
				player:setStorageValue(Storage.TheNewFrontier.Mission05, player:getStorageValue(Storage.TheNewFrontier.Mission05) + 1) --Questlog, The New Frontier Quest "Mission 05: Getting Things Busy"
			end
		end
	end
	return true
end

npcHandler:setMessage(MESSAGE_GREET, "I greet thee, my loyal subject |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye, |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "How rude!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

local focusModule = FocusModule:new()
focusModule:addGreetMessage('hail king')
focusModule:addGreetMessage('salutations king')
npcHandler:addModule(focusModule)

Meu servidor -> http://atena-global.com/

 

Visite o servidor e ajude-nos a crescer! Atena Global, um novo conceito de Tibia, o verdadeiro RPG você encontra aqui!

Link para o post
Compartilhar em outros sites
  • Solução

Eloise.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

keywordHandler:addKeyword({'subject'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am {Queen} Eloise. It is my duty to reign over this marvellous {city} and the {lands} of the north."})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am {Queen} Eloise. It is my duty to reign over this marvellous {city} and the {lands} of the north."})
keywordHandler:addKeyword({'justice'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We women try to bring justice and wisdom to all, even to males."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am Queen Eloise. For you it's 'My Queen' or 'Your Majesty', of course."})
keywordHandler:addKeyword({'news'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't care about gossip like a simpleminded male would do."})
keywordHandler:addKeyword({'tibia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Soon the whole land will be ruled by women at last!"})
keywordHandler:addKeyword({'land'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Soon the whole land will be ruled by {women} at last!"})
keywordHandler:addKeyword({'how are you'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Thank you, I'm fine."})
keywordHandler:addKeyword({'castle'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It's my humble domain."})
keywordHandler:addKeyword({'sell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Sell? Your question shows that you are a typical member of your gender!"})
keywordHandler:addKeyword({'god'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We honor the gods of good in our fair city, especially Crunor, of course."})
keywordHandler:addKeyword({'citizen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "All citizens of Carlin are my subjects. I see them more as my childs, though, epecially the male population."})
keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "This beast scared my cat away on my last diplomatic mission in this filthy town."})
keywordHandler:addKeyword({'ferumbras'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is the scourge of the whole continent!"})
keywordHandler:addKeyword({'treasure'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The royal treasure is hidden beyond the grasps of any thieves by magical means."})
keywordHandler:addKeyword({'monster'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Go and hunt them! For queen and country!"})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Visit the church or the townguards for help."})
keywordHandler:addKeyword({'quest'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I will call for heroes as soon as the need arises again."})
keywordHandler:addKeyword({'mission'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I will call for heroes as soon as the need arises again."})
keywordHandler:addKeyword({'gold'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our city is rich and prospering."})
keywordHandler:addKeyword({'money'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our city is rich and prospering."})
keywordHandler:addKeyword({'tax'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our city is rich and prospering."})
keywordHandler:addKeyword({'sewer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't want to talk about 'sewers'."})
keywordHandler:addKeyword({'dungeon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Dungeons are places where males crawl around and look for trouble."})
keywordHandler:addKeyword({'equipment'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Feel free to visit our town's magnificent shops."})
keywordHandler:addKeyword({'food'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Feel free to visit our town's magnificent shops."})
keywordHandler:addKeyword({'time'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Don't worry about time in the presence of your Queen."})
keywordHandler:addKeyword({'hero'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We need the assistance of heroes now and then. Even males prove useful now and then."})
keywordHandler:addKeyword({'adventure'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We need the assistance of heroes now and then. Even males prove useful now and then."})
keywordHandler:addKeyword({'collector'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The taxes in Carlin are not high, more a symbol than a sacrifice."})
keywordHandler:addKeyword({'queen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am the Queen, the only rightful ruler on the continent!"})
keywordHandler:addKeyword({'army'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask one of the soldiers about that."})
keywordHandler:addKeyword({'enemy'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our enemies are numerous. We have to fight vile monsters and have to watch this silly king in the south carefully."})
keywordHandler:addKeyword({'enemies'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our enemies are numerous. We have to fight vile monsters and have to watch this silly king in the south carefully."})
keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They dare to reject my reign over them!"})
keywordHandler:addKeyword({'south'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They dare to reject my reign over them!"})
keywordHandler:addKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Isn't our city marvellous? Have you noticed the lovely gardens on the roofs?"})
keywordHandler:addKeyword({'city'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Isn't our city marvellous? Have you noticed the lovely gardens on the roofs?"})
keywordHandler:addKeyword({'shop'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My subjects maintain many fine shops. Go and have a look at their wares."})
keywordHandler:addKeyword({'merchant'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask around about them."})
keywordHandler:addKeyword({'craftsmen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask around about them."})
keywordHandler:addKeyword({'guild'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The four major guilds are the Knights, the Paladins, the Druids, and the Sorcerers."})
keywordHandler:addKeyword({'minotaur'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They havn't troubled our city lately. I guess, they fear the wrath of our druids."})
keywordHandler:addKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The paladins are great hunters."})
keywordHandler:addKeyword({'legola'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The paladins are great hunters."})
keywordHandler:addKeyword({'elane'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It's a shame that the High Paladin does not reside in Carlin."})
keywordHandler:addKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The knights of Carlin are the bravest."})
keywordHandler:addKeyword({'trisha'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The knights of Carlin are the bravest."})
keywordHandler:addKeyword({'sorc'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The sorcerers have a small isle for their guild. So if they blow something up it does not burn the whole city to ruins."})
keywordHandler:addKeyword({'lea'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The sorcerers have a small isle for their guild. So if they blow something up it does not burn the whole city to ruins."})
keywordHandler:addKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The druids of Carlin are our protectors and advisors. Their powers provide us with wealth and food."})
keywordHandler:addKeyword({'padreia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The druids of Carlin are our protectors and advisors. Their powers provide us with wealth and food."})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Carlin is a center of the forces of good, of course."})
keywordHandler:addKeyword({'evil'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The forces of evil have a firm grip on this puny city to the south."})
keywordHandler:addKeyword({'order'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The order, Crunor gives the world, is essential for survival."})
keywordHandler:addKeyword({'chaos'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Chaos is common in the southern regions, where they allow a man to reign over a realm."})
keywordHandler:addKeyword({'excalibug'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "A mans tale ... that means 'nonsense', of course."})
keywordHandler:addKeyword({'reward'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "If you want a reward, go and bring me something this silly King Tibianus wants dearly!"})
keywordHandler:addKeyword({'tbi'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "A dusgusting organisation, which could be only created by men."})
keywordHandler:addKeyword({'eremo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It is said that he lives on a small island near Edron. Maybe the people there know more about him."})

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	if msgcontains(msg, "promote") or msgcontains(msg, "promotion") then
		npcHandler:say("Do you want to be promoted in your vocation for 20000 gold?", cid)
		npcHandler.topic[cid] = 1
	elseif npcHandler.topic[cid] == 1 then
		if msgcontains(msg, "yes") then
			local player = Player(cid)
			if player:getStorageValue(Storage.Promotion) == 1 then
				npcHandler:say('You are already promoted.', cid)
			elseif player:getLevel() < 20 then
				npcHandler:say('You need to be at least level 20 in order to be promoted.', cid)
			elseif player:getMoney() < 20000 then
				npcHandler:say('You do not have enough money.', cid)
			else
				npcHandler:say("Congratulations! You are now promoted.", cid)
				local promotion = player:getVocation():getPromotion()
				player:setVocation(Vocation(promotion and promotion:getId() or 0))
				player:removeMoney(20000)
			end
		else
			npcHandler:say('Ok, whatever.', cid)
		end
		npcHandler.topic[cid] = 0
		return true
	end

	if msgcontains(msg, "uniforms") then
		local player = Player(cid)
		if player:getStorageValue(Storage.postman.Mission06) == 5 then
			npcHandler:say("I remember about those uniforms, they had a camouflage inlay so they could be worn the inside out too. I will send some color samples via mail to Mr. Postner. ", cid)
			player:setStorageValue(Storage.postman.Mission06, 6)
		else
			npcHandler:say('The uniforms of our guards and soldiers are of unparraleled quality of course.', cid)
		end
	end
	return true
end

npcHandler:setMessage(MESSAGE_GREET, "I greet thee, my loyal {subject}.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Farewell, |PLAYERNAME|!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

local focusModule = FocusModule:new()
focusModule:addGreetMessage('hail queen')
focusModule:addGreetMessage('salutations queen')
npcHandler:addModule(focusModule)

 

King Tibianus.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

keywordHandler:addKeyword({'eremo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It is said that he lives on a small island near Edron. Maybe the people there know more about him."})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am your sovereign, King Tibianus III, and it's my duty to uphold {justice} and provide guidance for my subjects."})
keywordHandler:addKeyword({'justice'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I try my best to be just and fair to our citizens. The army and the {TBI} are a great help in fulfilling this duty."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Preposterous! You must know the name of your own King!"})
keywordHandler:addKeyword({'news'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The latest news is usually brought to our magnificent town by brave adventurers. They recount tales of their journeys at Frodo's tavern."})
keywordHandler:addKeyword({'how are you'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Thank you, I'm fine."})
keywordHandler:addKeyword({'castle'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Rain Castle is my home."})
keywordHandler:addKeyword({'sell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Sell? Sell what? My kingdom isn't for sale!"})
keywordHandler:addKeyword({'god'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Honour the Gods and above all pay your {taxes}."})
keywordHandler:addKeyword({'zathroth'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Please ask a priest about the gods."})
keywordHandler:addKeyword({'citizen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The citizens of Tibia are my subjects. Ask the old monk Quentin if you want to learn more about them."})
keywordHandler:addKeyword({'sam'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is a skilled blacksmith and a loyal subject."})
keywordHandler:addKeyword({'frodo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is the owner of Frodo's Hut and a faithful tax-payer."})
keywordHandler:addKeyword({'gorn'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He was once one of Tibia's greatest fighters. Now he sells equipment."})
keywordHandler:addKeyword({'benjamin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He was once my greatest general. Now he is very old and senile so we assigned him to work for the Royal Tibia Mail."})
keywordHandler:addKeyword({'noodles'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The royal poodle Noodles is my greatest {treasure}!"})
keywordHandler:addKeyword({'ferumbras'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is a follower of the evil God Zathroth and responsible for many attacks on us. Kill him on sight!"})
keywordHandler:addKeyword({'bozo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is my royal jester and cheers me up now and then."})
keywordHandler:addKeyword({'treasure'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The royal poodle Noodles is my greatest treasure!"})
keywordHandler:addKeyword({'monster'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Go and hunt them! For king and country!"})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Visit Quentin the monk for help."})
keywordHandler:addKeyword({'sewer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "What a disgusting topic!"})
keywordHandler:addKeyword({'dungeon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Dungeons are no places for kings."})
keywordHandler:addKeyword({'equipment'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Feel free to buy it in our town's fine shops."})
keywordHandler:addKeyword({'food'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask the royal cook for some food."})
keywordHandler:addKeyword({'tax collector'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "That tax collector is the bane of my life. He is so lazy. I bet you haven't payed any taxes at all."})
keywordHandler:addKeyword({'king'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am the king, so watch what you say!"})
keywordHandler:addKeyword({'army'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask the soldiers about that."})
keywordHandler:addKeyword({'shop'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Visit the shops of our merchants and craftsmen."})
keywordHandler:addKeyword({'guild'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The four major guilds are the knights, the paladins, the druids, and the sorcerers."})
keywordHandler:addKeyword({'minotaur'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Vile monsters, but I must admit they are strong and sometimes even cunning ... in their own bestial way."})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The forces of good are hard pressed in these dark times."})
keywordHandler:addKeyword({'evil'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We need all strength we can muster to smite evil!"})
keywordHandler:addKeyword({'order'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We need order to survive!"})
keywordHandler:addKeyword({'chaos'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Chaos arises from selfishness."})
keywordHandler:addKeyword({'excalibug'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It's the sword of the Kings. If you return this weapon to me I will {reward} you beyond your wildest dreams."})
keywordHandler:addKeyword({'reward'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Well, if you want a reward, go on a quest to bring me Excalibug!"})
keywordHandler:addKeyword({'chester'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "A very competent person. A little nervous but very competent."})
keywordHandler:addKeyword({'tbi'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "This organisation is an essential tool for holding our enemies in check. Its headquarter is located in the bastion in the northwall."})

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	local player = Player(cid)
	if isInArray({"tibia", "land"}, msg) then
		npcHandler:say("Soon the whole land will be ruled by me once again!", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"harkath", "bloodblade", "general"}, msg) then
		npcHandler:say("Harkath Bloodblade is the general of our glorious {army}.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"quest", "mission"}, msg) then
		npcHandler:say("I will call for heroes as soon as the need arises again and then reward them appropriately.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"gold", "money", "tax", "collector"}, msg) then
		npcHandler:say("To pay your taxes, visit the royal tax collector.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"time", "hero", "adventurer"}, msg) then
		npcHandler:say("It's a time for heroes!", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"enemy", "enemies"}, msg) then
		npcHandler:say("Our enemies are numerous. The evil minotaurs, Ferumbras, and the renegade city of Carlin to the north are just some of them.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"city", "north", "carlin"}, msg) then
		npcHandler:say("They dare to reject my reign over the whole continent!", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"thais", "city"}, msg) then
		npcHandler:say("Our beloved city has some fine shops, guildhouses and a modern sewerage system.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"merchant", "craftsmen"}, msg) then
		npcHandler:say("Ask around about them.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"paladin", "elane"}, msg) then
		npcHandler:say("The paladins are great protectors for Thais.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"knight", "gregor"}, msg) then
		npcHandler:say("The brave knights are necessary for human survival in Thais.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"sorcerer", "muriel"}, msg) then
		npcHandler:say("The magic of the sorcerers is a powerful tool to smite our enemies.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"druid", "marvik"}, msg) then
		npcHandler:say("We need the druidic healing powers to fight evil.", cid)
		npcHandler.topic[cid] = 0
	elseif msgcontains(msg, "promote") or msgcontains(msg, "promotion") then
		npcHandler:say("Do you want to be promoted in your vocation for 20000 gold?", cid)
		npcHandler.topic[cid] = 1
	elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 1 then
		if player:getStorageValue(Storage.Promotion) == 1 then
			npcHandler:say('You are already promoted.', cid)
		elseif player:getLevel() < 20 then
			npcHandler:say('You need to be at least level 20 in order to be promoted.', cid)
		elseif player:getMoney() < 20000 then
			npcHandler:say('You do not have enough money.', cid)
		else
			npcHandler:say("Congratulations! You are now promoted.", cid)
			local promotion = player:getVocation():getPromotion()
			player:setVocation(Vocation(promotion and promotion:getId() or 0))
			player:removeMoney(20000)
	
		end
		npcHandler.topic[cid] = 0
	elseif npcHandler.topic[cid] == 1 then
		npcHandler:say("Ok, whatever.", cid)
		npcHandler.topic[cid] = 0
	end

	--The New Frontier
	if msgcontains(msg, "farmine") then
		if player:getStorageValue(Storage.TheNewFrontier.Questline) == 15 then
			npcHandler:say("Ah, I vaguely remember that our little allies were eager to build some base. So speak up, what do you want?", cid)
			npcHandler.topic[cid] = 2
		end
	elseif msgcontains(msg, "flatter") then
		if npcHandler.topic[cid] == 2 then
			if player:getStorageValue(Storage.TheNewFrontier.BribeKing) ~= 1 then
				npcHandler:say("Indeed, indeed. Without the help of Thais, our allies stand no chance! Well, I'll send some money to support their cause.", cid)
				player:setStorageValue(Storage.TheNewFrontier.BribeKing, 1)
				player:setStorageValue(Storage.TheNewFrontier.Mission05, player:getStorageValue(Storage.TheNewFrontier.Mission05) + 1) --Questlog, The New Frontier Quest "Mission 05: Getting Things Busy"
			end
		end
	end
	return true
end

npcHandler:setMessage(MESSAGE_GREET, "I greet thee, my loyal subject |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye, |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "How rude!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

local focusModule = FocusModule:new()
focusModule:addGreetMessage('hail king')
focusModule:addGreetMessage('salutations king')
npcHandler:addModule(focusModule)

Se quiser sua dúvida tirada, mande PM com os links, e não com a dúvida (outros podem ter a mesma dúvida, e o fórum serve para ser usado).

 

Tópicos:


 

yNlhRVC.png

 

55px-Judo_yellow_belt.svg.png

Link para o post
Compartilhar em outros sites

Eloise.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

keywordHandler:addKeyword({'subject'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am {Queen} Eloise. It is my duty to reign over this marvellous {city} and the {lands} of the north."})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am {Queen} Eloise. It is my duty to reign over this marvellous {city} and the {lands} of the north."})
keywordHandler:addKeyword({'justice'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We women try to bring justice and wisdom to all, even to males."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am Queen Eloise. For you it's 'My Queen' or 'Your Majesty', of course."})
keywordHandler:addKeyword({'news'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't care about gossip like a simpleminded male would do."})
keywordHandler:addKeyword({'tibia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Soon the whole land will be ruled by women at last!"})
keywordHandler:addKeyword({'land'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Soon the whole land will be ruled by {women} at last!"})
keywordHandler:addKeyword({'how are you'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Thank you, I'm fine."})
keywordHandler:addKeyword({'castle'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It's my humble domain."})
keywordHandler:addKeyword({'sell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Sell? Your question shows that you are a typical member of your gender!"})
keywordHandler:addKeyword({'god'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We honor the gods of good in our fair city, especially Crunor, of course."})
keywordHandler:addKeyword({'citizen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "All citizens of Carlin are my subjects. I see them more as my childs, though, epecially the male population."})
keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "This beast scared my cat away on my last diplomatic mission in this filthy town."})
keywordHandler:addKeyword({'ferumbras'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is the scourge of the whole continent!"})
keywordHandler:addKeyword({'treasure'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The royal treasure is hidden beyond the grasps of any thieves by magical means."})
keywordHandler:addKeyword({'monster'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Go and hunt them! For queen and country!"})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Visit the church or the townguards for help."})
keywordHandler:addKeyword({'quest'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I will call for heroes as soon as the need arises again."})
keywordHandler:addKeyword({'mission'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I will call for heroes as soon as the need arises again."})
keywordHandler:addKeyword({'gold'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our city is rich and prospering."})
keywordHandler:addKeyword({'money'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our city is rich and prospering."})
keywordHandler:addKeyword({'tax'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our city is rich and prospering."})
keywordHandler:addKeyword({'sewer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't want to talk about 'sewers'."})
keywordHandler:addKeyword({'dungeon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Dungeons are places where males crawl around and look for trouble."})
keywordHandler:addKeyword({'equipment'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Feel free to visit our town's magnificent shops."})
keywordHandler:addKeyword({'food'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Feel free to visit our town's magnificent shops."})
keywordHandler:addKeyword({'time'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Don't worry about time in the presence of your Queen."})
keywordHandler:addKeyword({'hero'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We need the assistance of heroes now and then. Even males prove useful now and then."})
keywordHandler:addKeyword({'adventure'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We need the assistance of heroes now and then. Even males prove useful now and then."})
keywordHandler:addKeyword({'collector'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The taxes in Carlin are not high, more a symbol than a sacrifice."})
keywordHandler:addKeyword({'queen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am the Queen, the only rightful ruler on the continent!"})
keywordHandler:addKeyword({'army'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask one of the soldiers about that."})
keywordHandler:addKeyword({'enemy'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our enemies are numerous. We have to fight vile monsters and have to watch this silly king in the south carefully."})
keywordHandler:addKeyword({'enemies'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our enemies are numerous. We have to fight vile monsters and have to watch this silly king in the south carefully."})
keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They dare to reject my reign over them!"})
keywordHandler:addKeyword({'south'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They dare to reject my reign over them!"})
keywordHandler:addKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Isn't our city marvellous? Have you noticed the lovely gardens on the roofs?"})
keywordHandler:addKeyword({'city'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Isn't our city marvellous? Have you noticed the lovely gardens on the roofs?"})
keywordHandler:addKeyword({'shop'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My subjects maintain many fine shops. Go and have a look at their wares."})
keywordHandler:addKeyword({'merchant'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask around about them."})
keywordHandler:addKeyword({'craftsmen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask around about them."})
keywordHandler:addKeyword({'guild'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The four major guilds are the Knights, the Paladins, the Druids, and the Sorcerers."})
keywordHandler:addKeyword({'minotaur'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They havn't troubled our city lately. I guess, they fear the wrath of our druids."})
keywordHandler:addKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The paladins are great hunters."})
keywordHandler:addKeyword({'legola'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The paladins are great hunters."})
keywordHandler:addKeyword({'elane'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It's a shame that the High Paladin does not reside in Carlin."})
keywordHandler:addKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The knights of Carlin are the bravest."})
keywordHandler:addKeyword({'trisha'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The knights of Carlin are the bravest."})
keywordHandler:addKeyword({'sorc'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The sorcerers have a small isle for their guild. So if they blow something up it does not burn the whole city to ruins."})
keywordHandler:addKeyword({'lea'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The sorcerers have a small isle for their guild. So if they blow something up it does not burn the whole city to ruins."})
keywordHandler:addKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The druids of Carlin are our protectors and advisors. Their powers provide us with wealth and food."})
keywordHandler:addKeyword({'padreia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The druids of Carlin are our protectors and advisors. Their powers provide us with wealth and food."})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Carlin is a center of the forces of good, of course."})
keywordHandler:addKeyword({'evil'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The forces of evil have a firm grip on this puny city to the south."})
keywordHandler:addKeyword({'order'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The order, Crunor gives the world, is essential for survival."})
keywordHandler:addKeyword({'chaos'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Chaos is common in the southern regions, where they allow a man to reign over a realm."})
keywordHandler:addKeyword({'excalibug'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "A mans tale ... that means 'nonsense', of course."})
keywordHandler:addKeyword({'reward'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "If you want a reward, go and bring me something this silly King Tibianus wants dearly!"})
keywordHandler:addKeyword({'tbi'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "A dusgusting organisation, which could be only created by men."})
keywordHandler:addKeyword({'eremo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It is said that he lives on a small island near Edron. Maybe the people there know more about him."})

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	if msgcontains(msg, "promote") or msgcontains(msg, "promotion") then
		npcHandler:say("Do you want to be promoted in your vocation for 20000 gold?", cid)
		npcHandler.topic[cid] = 1
	elseif npcHandler.topic[cid] == 1 then
		if msgcontains(msg, "yes") then
			local player = Player(cid)
			if player:getStorageValue(Storage.Promotion) == 1 then
				npcHandler:say('You are already promoted.', cid)
			elseif player:getLevel() < 20 then
				npcHandler:say('You need to be at least level 20 in order to be promoted.', cid)
			elseif player:getMoney() < 20000 then
				npcHandler:say('You do not have enough money.', cid)
			else
				npcHandler:say("Congratulations! You are now promoted.", cid)
				local promotion = player:getVocation():getPromotion()
				player:setVocation(Vocation(promotion and promotion:getId() or 0))
				player:removeMoney(20000)
			end
		else
			npcHandler:say('Ok, whatever.', cid)
		end
		npcHandler.topic[cid] = 0
		return true
	end

	if msgcontains(msg, "uniforms") then
		local player = Player(cid)
		if player:getStorageValue(Storage.postman.Mission06) == 5 then
			npcHandler:say("I remember about those uniforms, they had a camouflage inlay so they could be worn the inside out too. I will send some color samples via mail to Mr. Postner. ", cid)
			player:setStorageValue(Storage.postman.Mission06, 6)
		else
			npcHandler:say('The uniforms of our guards and soldiers are of unparraleled quality of course.', cid)
		end
	end
	return true
end

npcHandler:setMessage(MESSAGE_GREET, "I greet thee, my loyal {subject}.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Farewell, |PLAYERNAME|!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

local focusModule = FocusModule:new()
focusModule:addGreetMessage('hail queen')
focusModule:addGreetMessage('salutations queen')
npcHandler:addModule(focusModule)

 

King Tibianus.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

keywordHandler:addKeyword({'eremo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It is said that he lives on a small island near Edron. Maybe the people there know more about him."})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am your sovereign, King Tibianus III, and it's my duty to uphold {justice} and provide guidance for my subjects."})
keywordHandler:addKeyword({'justice'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I try my best to be just and fair to our citizens. The army and the {TBI} are a great help in fulfilling this duty."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Preposterous! You must know the name of your own King!"})
keywordHandler:addKeyword({'news'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The latest news is usually brought to our magnificent town by brave adventurers. They recount tales of their journeys at Frodo's tavern."})
keywordHandler:addKeyword({'how are you'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Thank you, I'm fine."})
keywordHandler:addKeyword({'castle'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Rain Castle is my home."})
keywordHandler:addKeyword({'sell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Sell? Sell what? My kingdom isn't for sale!"})
keywordHandler:addKeyword({'god'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Honour the Gods and above all pay your {taxes}."})
keywordHandler:addKeyword({'zathroth'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Please ask a priest about the gods."})
keywordHandler:addKeyword({'citizen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The citizens of Tibia are my subjects. Ask the old monk Quentin if you want to learn more about them."})
keywordHandler:addKeyword({'sam'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is a skilled blacksmith and a loyal subject."})
keywordHandler:addKeyword({'frodo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is the owner of Frodo's Hut and a faithful tax-payer."})
keywordHandler:addKeyword({'gorn'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He was once one of Tibia's greatest fighters. Now he sells equipment."})
keywordHandler:addKeyword({'benjamin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He was once my greatest general. Now he is very old and senile so we assigned him to work for the Royal Tibia Mail."})
keywordHandler:addKeyword({'noodles'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The royal poodle Noodles is my greatest {treasure}!"})
keywordHandler:addKeyword({'ferumbras'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is a follower of the evil God Zathroth and responsible for many attacks on us. Kill him on sight!"})
keywordHandler:addKeyword({'bozo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is my royal jester and cheers me up now and then."})
keywordHandler:addKeyword({'treasure'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The royal poodle Noodles is my greatest treasure!"})
keywordHandler:addKeyword({'monster'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Go and hunt them! For king and country!"})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Visit Quentin the monk for help."})
keywordHandler:addKeyword({'sewer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "What a disgusting topic!"})
keywordHandler:addKeyword({'dungeon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Dungeons are no places for kings."})
keywordHandler:addKeyword({'equipment'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Feel free to buy it in our town's fine shops."})
keywordHandler:addKeyword({'food'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask the royal cook for some food."})
keywordHandler:addKeyword({'tax collector'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "That tax collector is the bane of my life. He is so lazy. I bet you haven't payed any taxes at all."})
keywordHandler:addKeyword({'king'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am the king, so watch what you say!"})
keywordHandler:addKeyword({'army'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask the soldiers about that."})
keywordHandler:addKeyword({'shop'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Visit the shops of our merchants and craftsmen."})
keywordHandler:addKeyword({'guild'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The four major guilds are the knights, the paladins, the druids, and the sorcerers."})
keywordHandler:addKeyword({'minotaur'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Vile monsters, but I must admit they are strong and sometimes even cunning ... in their own bestial way."})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The forces of good are hard pressed in these dark times."})
keywordHandler:addKeyword({'evil'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We need all strength we can muster to smite evil!"})
keywordHandler:addKeyword({'order'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We need order to survive!"})
keywordHandler:addKeyword({'chaos'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Chaos arises from selfishness."})
keywordHandler:addKeyword({'excalibug'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It's the sword of the Kings. If you return this weapon to me I will {reward} you beyond your wildest dreams."})
keywordHandler:addKeyword({'reward'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Well, if you want a reward, go on a quest to bring me Excalibug!"})
keywordHandler:addKeyword({'chester'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "A very competent person. A little nervous but very competent."})
keywordHandler:addKeyword({'tbi'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "This organisation is an essential tool for holding our enemies in check. Its headquarter is located in the bastion in the northwall."})

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	local player = Player(cid)
	if isInArray({"tibia", "land"}, msg) then
		npcHandler:say("Soon the whole land will be ruled by me once again!", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"harkath", "bloodblade", "general"}, msg) then
		npcHandler:say("Harkath Bloodblade is the general of our glorious {army}.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"quest", "mission"}, msg) then
		npcHandler:say("I will call for heroes as soon as the need arises again and then reward them appropriately.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"gold", "money", "tax", "collector"}, msg) then
		npcHandler:say("To pay your taxes, visit the royal tax collector.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"time", "hero", "adventurer"}, msg) then
		npcHandler:say("It's a time for heroes!", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"enemy", "enemies"}, msg) then
		npcHandler:say("Our enemies are numerous. The evil minotaurs, Ferumbras, and the renegade city of Carlin to the north are just some of them.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"city", "north", "carlin"}, msg) then
		npcHandler:say("They dare to reject my reign over the whole continent!", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"thais", "city"}, msg) then
		npcHandler:say("Our beloved city has some fine shops, guildhouses and a modern sewerage system.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"merchant", "craftsmen"}, msg) then
		npcHandler:say("Ask around about them.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"paladin", "elane"}, msg) then
		npcHandler:say("The paladins are great protectors for Thais.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"knight", "gregor"}, msg) then
		npcHandler:say("The brave knights are necessary for human survival in Thais.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"sorcerer", "muriel"}, msg) then
		npcHandler:say("The magic of the sorcerers is a powerful tool to smite our enemies.", cid)
		npcHandler.topic[cid] = 0
	elseif isInArray({"druid", "marvik"}, msg) then
		npcHandler:say("We need the druidic healing powers to fight evil.", cid)
		npcHandler.topic[cid] = 0
	elseif msgcontains(msg, "promote") or msgcontains(msg, "promotion") then
		npcHandler:say("Do you want to be promoted in your vocation for 20000 gold?", cid)
		npcHandler.topic[cid] = 1
	elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 1 then
		if player:getStorageValue(Storage.Promotion) == 1 then
			npcHandler:say('You are already promoted.', cid)
		elseif player:getLevel() < 20 then
			npcHandler:say('You need to be at least level 20 in order to be promoted.', cid)
		elseif player:getMoney() < 20000 then
			npcHandler:say('You do not have enough money.', cid)
		else
			npcHandler:say("Congratulations! You are now promoted.", cid)
			local promotion = player:getVocation():getPromotion()
			player:setVocation(Vocation(promotion and promotion:getId() or 0))
			player:removeMoney(20000)
	
		end
		npcHandler.topic[cid] = 0
	elseif npcHandler.topic[cid] == 1 then
		npcHandler:say("Ok, whatever.", cid)
		npcHandler.topic[cid] = 0
	end

	--The New Frontier
	if msgcontains(msg, "farmine") then
		if player:getStorageValue(Storage.TheNewFrontier.Questline) == 15 then
			npcHandler:say("Ah, I vaguely remember that our little allies were eager to build some base. So speak up, what do you want?", cid)
			npcHandler.topic[cid] = 2
		end
	elseif msgcontains(msg, "flatter") then
		if npcHandler.topic[cid] == 2 then
			if player:getStorageValue(Storage.TheNewFrontier.BribeKing) ~= 1 then
				npcHandler:say("Indeed, indeed. Without the help of Thais, our allies stand no chance! Well, I'll send some money to support their cause.", cid)
				player:setStorageValue(Storage.TheNewFrontier.BribeKing, 1)
				player:setStorageValue(Storage.TheNewFrontier.Mission05, player:getStorageValue(Storage.TheNewFrontier.Mission05) + 1) --Questlog, The New Frontier Quest "Mission 05: Getting Things Busy"
			end
		end
	end
	return true
end

npcHandler:setMessage(MESSAGE_GREET, "I greet thee, my loyal subject |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye, |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "How rude!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

local focusModule = FocusModule:new()
focusModule:addGreetMessage('hail king')
focusModule:addGreetMessage('salutations king')
npcHandler:addModule(focusModule)

 

Muito obrigado, funcionou certinho!

Meu servidor -> http://atena-global.com/

 

Visite o servidor e ajude-nos a crescer! Atena Global, um novo conceito de Tibia, o verdadeiro RPG você encontra aqui!

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo