Ir para conteúdo

[OTG][NPC][Storages][Dawnport] Liberando os acessos das Quests e Missões pelo NPC Captain Dreadnought

Featured Replies

Postado

 otgskull.gif

otgking0.png

 

Open Source MMORPG emulador de Tibia escrito em C++.

Servidor Oficial do Tibiaking!

 

 

 

 

 

Spoiler

 

 

 

separador.png

 

[OTG][NPC][Storages][Dawnport] Liberando os acessos das Quests e Missões pelo NPC Captain Dreadnought

Tutorial explicado de como liberar os acessos, missões e quests para todos os jogadores!

 

separador.png

NPC Captain Dreadnought

Abra o script do npc captain_dreadnought.lua localizado na pasta data/npc/scripts/ e substitua todo o código pelo código abaixo:

 

Spoiler


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

local voices = {
	{text = "No smuggling aboard this ship! Only 20 pieces of any creature product allowed!"},
	{text = "No fear! The Sea Cat will ship you safely to the mainland!"},
	{text = "All aboard! Prepare to sail!"},
	{text = "Come hell or high water, we'll reach any port I sail you to!"},
	{text = "This island is too small. I need sea water around me."}
}

npcHandler:addModule(VoiceModule:new(voices))

--From topic of the citys name to topic of the "yes" msg
local topicTable = {
	[3] = 13,
	[4] = 14,
	[5] = 15,
	[6] = 16,
	[7] = 17,
	[8] = 18,
	[9] = 19,
	[10] = 20,
	[11] = 21,
	[12] = 22,
	[13] = 23
}

--From topic of final msg "yes" to select town
local townTable = {
	[13] = TOWNS_LIST.AB_DENDRIEL,
	[14] = TOWNS_LIST.ANKRAHMUN,
	[15] = TOWNS_LIST.CARLIN,
	[16] = TOWNS_LIST.DARASHIA,
	[17] = TOWNS_LIST.EDRON,
	[18] = TOWNS_LIST.KAZORDOON,
	[19] = TOWNS_LIST.LIBERTY_BAY,
	[20] = TOWNS_LIST.PORT_HOPE,
	[21] = TOWNS_LIST.SVARGROND,
	[22] = TOWNS_LIST.THAIS,
	[23] = TOWNS_LIST.VENORE
}

local function greetCallback(cid)
	local player = Player(cid)
	npcHandler:setMessage(
		MESSAGE_GREET,
		"Well, well, a new " ..
			player:getVocation():getName():lower() .. "! \z
		Want me to bring you somewhere nice? Just say {yes}."
	)
	return true
end

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

	local player = Player(cid)
	if msgcontains(msg, "yes") and npcHandler.topic[cid] == 0 then
		npcHandler:say("Good. Got all you want to take to the mainland, {yes}? Gear, limbs, loot?", cid)
		npcHandler.topic[cid] = 1
	elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 1 then
		npcHandler:say(
			"Well, I can tell you stuff about {Ab'Dendriel}, {Ankrahmun}, {Carlin}, \z
			{Darashia}, {Edron}, {Kazordoon}, {Liberty Bay}, {Port Hope}, {Svargrond}, {Thais}, {Venore} or {Yalahar}.",
			cid
		)
		npcHandler.topic[cid] = 2
	elseif msgcontains(msg, "ab'dendriel") and npcHandler.topic[cid] == 2 then
		npcHandler:say(
			{
				"Main city of the elves - lots of trees, bug milk and stuff that easily burns ...",
				"... Sorry, just thinking aloud. Ahem. Very cosy and safe I guess if you're fond of nature. \z
					I can {sail} there if you like."
			},
			cid,
			false,
			true,
			10
		)
		npcHandler.topic[cid] = 3
	elseif msgcontains(msg, "ankrahmun") and npcHandler.topic[cid] == 2 then
		if player:isPremium() then
			npcHandler:say(
				"Only for premium travelers! Desert pyramid city close to the ocean, \z
		some underground tombs where I heard it's not bad hunting. I can {sail} there if you like.",
				cid
			)
			npcHandler.topic[cid] = 4
		else
			npcHandler:say("You are not a premium account..", cid)
			npcHandler.topic[cid] = 0
		end
	elseif msgcontains(msg, "carlin") and npcHandler.topic[cid] == 2 then
		npcHandler:say(
			"A city ruled by forthright independent women. Very clean and safe, \z
			but also very strict on the booze, alas. But if that's what you like... I can {sail} there if you like.",
			cid
		)
		npcHandler.topic[cid] = 5
	elseif msgcontains(msg, "darashia") and npcHandler.topic[cid] == 2 then
		if player:isPremium() then
			npcHandler:say(
				"Only for premium travelers! One of the two desert cities. \z
			Built around a lovely oasis. Lions, dragons... decent location for a newcomer. I can {sail} there if you like.",
				cid
			)
			npcHandler.topic[cid] = 6
		else
			npcHandler:say("You are not a premium account..", cid)
			npcHandler.topic[cid] = 0
		end
	elseif msgcontains(msg, "edron") and npcHandler.topic[cid] == 2 then
		if player:isPremium() then
			npcHandler:say(
				"Only for premium travelers! Quiet little castle city on an island in the north-eastern \z
			part of Tibia. Trolls, goblins, rotworms... good place for starters, too. I can {sail} there if you like.",
				cid
			)
			npcHandler.topic[cid] = 7
		else
			npcHandler:say("You are not a premium account..", cid)
			npcHandler.topic[cid] = 0
		end
	elseif msgcontains(msg, "kazordoon") and npcHandler.topic[cid] == 2 then
		npcHandler:say("The underground dwarven city. Doesn't have a real harbour, so I can't bring you there, sorry.", cid)
		npcHandler.topic[cid] = 8
	elseif msgcontains(msg, "liberty bay") and npcHandler.topic[cid] == 2 then
		if player:isPremium() then
			npcHandler:say(
				"Only for premium travelers! Liberty Bay is on an island group in the South Seas. \z
			Ah, home sweet home. Err. I mean, it's pirates galore. Good deal of tortoises, too. \z
			Just be careful, then it's a good hunting location. I can {sail} there if you like.",
				cid
			)
			npcHandler.topic[cid] = 9
		else
			npcHandler:say("You are not a premium account..", cid)
			npcHandler.topic[cid] = 0
		end
	elseif msgcontains(msg, "port hope") and npcHandler.topic[cid] == 2 then
		if player:isPremium() then
			npcHandler:say(
				{
					"Only for premium travelers! Port Hope is an outpost right in the middle of the jungle. ...",
					"Apes, bananas, hydras, tarantulas... Who'd want to go there? \z
				Except for crazy adventurers like these guys here on the island, obviously. Still, I can {sail} there if you like."
				},
				cid,
				false,
				true,
				10
			)
			npcHandler.topic[cid] = 10
		else
			npcHandler:say("You are not a premium account..", cid)
			npcHandler.topic[cid] = 0
		end
	elseif msgcontains(msg, "svargrond") and npcHandler.topic[cid] == 2 then
		if player:isPremium() then
			npcHandler:say(
				"Negative, can't bring you there. \z
			You gotta pass some sort of Barbarian test before they let you live there. \z
			Still, you should go there sometime, I heard it's quite interesting.",
				cid
			)
			npcHandler.topic[cid] = 11
		else
			npcHandler:say("You are not a premium account..", cid)
			npcHandler.topic[cid] = 0
		end
	elseif msgcontains(msg, "thais") and npcHandler.topic[cid] == 2 then
		npcHandler:say(
			"Old-school city. Actually the oldest main city in Tibia. \z
			Be careful on those streets, there are bandits everywhere. But I can {sail} there if you like.",
			cid
		)
		npcHandler.topic[cid] = 12
	elseif msgcontains(msg, "venore") and npcHandler.topic[cid] == 2 then
		npcHandler:say(
			"Hohoh, one of the richest cities, filled with merchants and LOOT! Err. \z
			I mean, it is HIGHLY recommendable for unexperienced and first-time adventurers. \z
			Don't know why they built it over a stinking swamp though. I can {sail} there if you like.",
			cid
		)
		npcHandler.topic[cid] = 13
	elseif msgcontains(msg, "sail") then
		for index, value in pairs(topicTable) do
			if npcHandler.topic[cid] == index then
				npcHandler:say("So, you've decided on your new home city?", cid)
				npcHandler.topic[cid] = value
			end
		end
	elseif msgcontains(msg, "yes") then
		for index, value in pairs(townTable) do
			local townId = Town(value)
			if npcHandler.topic[cid] == index then
				player:setTown(townId)
				player:teleportTo(townId:getTemplePosition())
				player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
				player:setStorageValue(Storage.Dawnport.Mainland, 1)
				
				-- The Mermaid Marina
                player:setStorageValue(Storage.FriendsandTraders.DefaultStart, 1)
                player:setStorageValue(Storage.FriendsandTraders.TheMermaidMarina, 2)

                -- Forgotten Knowledge
                player:setStorageValue(Storage.ForgottenKnowledge.Tomes, 1)
                player:setStorageValue(Storage.ForgottenKnowledge.LastLoreKilled, 1)
                player:setStorageValue(Storage.ForgottenKnowledge.TimeGuardianKilled, 1)
                player:setStorageValue(Storage.ForgottenKnowledge.HorrorKilled, 1)
                player:setStorageValue(Storage.ForgottenKnowledge.DragonkingKilled, 1)
                player:setStorageValue(Storage.ForgottenKnowledge.ThornKnightKilled, 1)
                player:setStorageValue(Storage.ForgottenKnowledge.LloydKilled, 1)
                player:setStorageValue(Storage.ForgottenKnowledge.LadyTenebrisKilled, 1)
                player:setStorageValue(Storage.ForgottenKnowledge.AccessMachine, 1)

                -- The Explorer Society Quest
                player:setStorageValue(Storage.ExplorerSociety.QuestLine, 61)
                player:setStorageValue(Storage.ExplorerSociety.JoiningtheExplorers, 4)
                player:setStorageValue(Storage.ExplorerSociety.TheIceDelivery, 7)
                player:setStorageValue(Storage.ExplorerSociety.TheButterflyHunt, 16)
                player:setStorageValue(Storage.ExplorerSociety.ThePlantCollection, 26)
                player:setStorageValue(Storage.ExplorerSociety.TheLizardUrn, 29)
                player:setStorageValue(Storage.ExplorerSociety.TheBonelordSecret, 32)
                player:setStorageValue(Storage.ExplorerSociety.TheOrcPowder, 35)
                player:setStorageValue(Storage.ExplorerSociety.TheElvenPoetry, 38)
                player:setStorageValue(Storage.ExplorerSociety.TheMemoryStone, 41)
                player:setStorageValue(Storage.ExplorerSociety.TheRuneWritings, 44)
                player:setStorageValue(Storage.ExplorerSociety.TheEctoplasm, 47)
                player:setStorageValue(Storage.ExplorerSociety.TheSpectralDress, 50)
                player:setStorageValue(Storage.ExplorerSociety.TheSpectralStone, 55)
                player:setStorageValue(Storage.ExplorerSociety.TheAstralPortals, 56)
                player:setStorageValue(Storage.ExplorerSociety.TheIslandofDragons, 59)
                player:setStorageValue(Storage.ExplorerSociety.TheIceMusic, 62)
                player:setStorageValue(Storage.ExplorerSociety.CalassaQuest, 3)

                -- In Service Of Yalahar
                player:setStorageValue(Storage.InServiceofYalahar.Questline, 48)
                player:setStorageValue(Storage.InServiceofYalahar.Mission01, 6)
                player:setStorageValue(Storage.InServiceofYalahar.Mission02, 8)
                player:setStorageValue(Storage.InServiceofYalahar.Mission03, 6)
                player:setStorageValue(Storage.InServiceofYalahar.Mission04, 6)
                player:setStorageValue(Storage.InServiceofYalahar.Mission05, 8)
                player:setStorageValue(Storage.InServiceofYalahar.Mission06, 5)
                player:setStorageValue(Storage.InServiceofYalahar.Mission07, 5)
                player:setStorageValue(Storage.InServiceofYalahar.Mission08, 4)
                player:setStorageValue(Storage.TheWayToYalahar.QuestLine, 30)

                -- Searoutes Around Yalahar
                player:setStorageValue(Storage.SearoutesAroundYalahar.TownsCounter, 8)
                player:setStorageValue(Storage.SearoutesAroundYalahar.AbDendriel, 1)
                player:setStorageValue(Storage.SearoutesAroundYalahar.Darashia, 1)
                player:setStorageValue(Storage.SearoutesAroundYalahar.Venore, 1)
                player:setStorageValue(Storage.SearoutesAroundYalahar.Ankrahmun, 1)
                player:setStorageValue(Storage.SearoutesAroundYalahar.PortHope, 1)
                player:setStorageValue(Storage.SearoutesAroundYalahar.Thais, 1)
                player:setStorageValue(Storage.SearoutesAroundYalahar.LibertyBay, 1)
                player:setStorageValue(Storage.SearoutesAroundYalahar.Carlin, 1)

                -- Children Of The Revolution
                player:setStorageValue(Storage.ChildrenoftheRevolution.Questline, 18)
                player:setStorageValue(Storage.ChildrenoftheRevolution.Mission00, 2)
                player:setStorageValue(Storage.ChildrenoftheRevolution.Mission01, 3)
                player:setStorageValue(Storage.ChildrenoftheRevolution.Mission02, 5)
                player:setStorageValue(Storage.ChildrenoftheRevolution.Mission04, 3)
                player:setStorageValue(Storage.ChildrenoftheRevolution.Mission05, 6)

                -- The Travelling Trader
                player:setStorageValue(Storage.TravellingTrader.Mission01, 2)
                player:setStorageValue(Storage.TravellingTrader.Mission02, 5)
                player:setStorageValue(Storage.TravellingTrader.Mission03, 3)
                player:setStorageValue(Storage.TravellingTrader.Mission04, 3)
                player:setStorageValue(Storage.TravellingTrader.Mission05, 3)
                player:setStorageValue(Storage.TravellingTrader.Mission06, 2)
                player:setStorageValue(Storage.TravellingTrader.Mission07, 1)
                player:setStorageValue(Storage.TravellingTrader.packageDoor, 1)

                -- The Inquisition
                player:setStorageValue(Storage.TheInquisition.Questline, 14)
                player:setStorageValue(Storage.TheInquisition.Mission01, 7)
                player:setStorageValue(Storage.TheInquisition.Mission02, 3)
                player:setStorageValue(Storage.TheInquisition.Mission03, 6)
                player:setStorageValue(Storage.TheInquisition.Mission04, 3)
                player:setStorageValue(Storage.PitsOfInferno.ThronePumin, 1)

                -- The New Frontier
                player:setStorageValue(Storage.TheNewFrontier.Questline, 24)
                player:setStorageValue(Storage.TheNewFrontier.Mission01, 3)
                player:setStorageValue(Storage.TheNewFrontier.Mission02, 6)
                player:setStorageValue(Storage.TheNewFrontier.Mission03, 3)
                player:setStorageValue(Storage.TheNewFrontier.Mission04, 2)
                player:setStorageValue(Storage.TheNewFrontier.Mission05, 7)
                player:setStorageValue(Storage.TheNewFrontier.Mission06, 3)
                player:setStorageValue(Storage.TheNewFrontier.Mission07, 3)
                player:setStorageValue(Storage.TheNewFrontier.Mission08, 2)
                player:setStorageValue(Storage.TheNewFrontier.TomeofKnowledge, 12)

                -- Barbarian Test
                player:setStorageValue(Storage.BarbarianTest.Questline, 8)
                player:setStorageValue(Storage.BarbarianTest.Mission01, 3)
                player:setStorageValue(Storage.BarbarianTest.Mission02, 3)
                player:setStorageValue(Storage.BarbarianTest.Mission03, 3)

                -- Wrath Of The Emperor
                player:setStorageValue(Storage.WrathoftheEmperor.Questline, 24)
                player:setStorageValue(Storage.WrathoftheEmperor.Mission01, 3)
                player:setStorageValue(Storage.WrathoftheEmperor.Mission02, 3)
                player:setStorageValue(Storage.WrathoftheEmperor.Mission03, 3)
                player:setStorageValue(Storage.WrathoftheEmperor.Mission04, 3)
                player:setStorageValue(Storage.WrathoftheEmperor.Mission05, 3)
                player:setStorageValue(Storage.WrathoftheEmperor.Mission06, 4)
                player:setStorageValue(Storage.WrathoftheEmperor.Mission07, 6)

                -- Djinn War Factions
                player:setStorageValue(Storage.DjinnWar.EfreetFaction.Start, 1)
                player:setStorageValue(Storage.DjinnWar.EfreetFaction.Mission01, 3)
                player:setStorageValue(Storage.DjinnWar.EfreetFaction.Mission02, 3)
                player:setStorageValue(Storage.DjinnWar.EfreetFaction.Mission03, 3)
                player:setStorageValue(Storage.DjinnWar.MaridFaction.Start, 1)
                player:setStorageValue(Storage.DjinnWar.MaridFaction.Mission01, 2)
                player:setStorageValue(Storage.DjinnWar.MaridFaction.Mission02, 2)
                player:setStorageValue(Storage.DjinnWar.MaridFaction.Mission03, 3)
                player:setStorageValue(Storage.DjinnWar.MaridFaction.RataMari, 2)

                -- Big Foot Burden
                player:setStorageValue(Storage.BigfootBurden.QuestLine, 30)
                player:setStorageValue(Storage.BigfootBurden.Rank, 30)
                player:setStorageValue(Storage.BigfootBurden.Warzone1Access, 2)
                player:setStorageValue(Storage.BigfootBurden.Warzone2Access, 2)
                player:setStorageValue(Storage.BigfootBurden.Warzone3Access, 2)
                player:setStorageValue(Storage.BigfootBurden.WarzoneStatus, 1)

                -- The Shattered Isles
                player:setStorageValue(Storage.TheShatteredIsles.DefaultStart, 1)
                player:setStorageValue(Storage.TheShatteredIsles.ADjinnInLove, 5)
                player:setStorageValue(Storage.TheShatteredIsles.APoemForTheMermaid, 3)
                player:setStorageValue(Storage.TheShatteredIsles.AccessToGoroma, 1)
                player:setStorageValue(Storage.TheShatteredIsles.AccessToLagunaIsland, 1)
                player:setStorageValue(Storage.TheShatteredIsles.AccessToMeriana, 1)
                player:setStorageValue(Storage.TheShatteredIsles.TheCounterspell, 4)
                player:setStorageValue(Storage.TheShatteredIsles.TheErrand, 2)
                player:setStorageValue(Storage.TheShatteredIsles.TheGovernorDaughter, 3)

                -- Cults of Tibia
                player:setStorageValue(Storage.CultsOfTibia.Questline, 1)
                player:setStorageValue(Storage.CultsOfTibia.Minotaurs.Mission, 1)
                player:setStorageValue(Storage.CultsOfTibia.MotA.Mission, 1)
                player:setStorageValue(Storage.CultsOfTibia.Barkless.Mission, 1)
                player:setStorageValue(Storage.CultsOfTibia.Misguided.Mission, 1)
                player:setStorageValue(Storage.CultsOfTibia.Orcs.Mission, 1)
                player:setStorageValue(Storage.CultsOfTibia.Life.Mission, 1)
                player:setStorageValue(Storage.CultsOfTibia.Humans.Mission, 1)

                -- The First Dragon
                player:setStorageValue(Storage.TheFirstDragon.tamorilTasks, 1)
                player:setStorageValue(Storage.TheFirstDragon.tamorilTasksPower, 0)
                player:setStorageValue(Storage.TheFirstDragon.tamorilTasksKnowledge, 0)
                player:setStorageValue(Storage.TheFirstDragon.tamorilTasksLife, 0)
                player:setStorageValue(Storage.TheFirstDragon.tamorilTasksTreasure, 0)
                player:setStorageValue(Storage.TheFirstDragon.tamorilTasksTreasure, 0)

                -- Achievements
                player:addAchievement("Just in Time")
                player:addAchievement("Recognised Trader")
                player:addAchievement("Bearhugger")
                player:addAchievement("Honorary Barbarian")
                player:addAchievement("Ghostwhisperer")
                player:addAchievement("Efreet Ally")
                player:addAchievement("Marid Ally")
                player:addAchievement("Explorer")
                player:addAchievement("Sea Scout")
				
				npcHandler:say(
					"Cast off! Don't forget to talk to the guide at the port for directions to nearest bars... \z
					err, shops and bank and such!",
					cid
				)
				npcHandler.topic[cid] = 0
			end
		end
	else
		npcHandler:say(
			"Kid, listen. Answering with a clear {yes} will get you much further in World. \z
			Most people are not as sharp-eared as I am. Got that?",
			cid
		)
		npcHandler.topic[cid] = 0
	end
	return true
end

npcHandler:setMessage(
	MESSAGE_FAREWELL,
	"You sure you want to spend time on this piece of rock? \z
I can show you the world! Huh."
)

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)

npcHandler:addModule(FocusModule:new())

 

 

separador.png

CRÉDITOS:

@EddyHavoc

@Marco Oliveira

Editado por EddyHavoc (veja o histórico de edições)

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo