Ir para conteúdo
  • Cadastre-se

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


Posts Recomendados

 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)
Link para o post
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por Imperius
      O propósito é criar uma nova função em creaturescripts que será acionada toda vez que um novo report (CTRL + R) for aberto.
       
      Eu implementei para enviar uma notificação no grupo do Telegram, contendo os dados do report.
       
      Isso garantirá que os GMs tenham acesso aos reports dos jogadores mesmo quando não estiverem logados, e também evitará que algum report seja perdido caso o jogador saia do servidor.
      A parte do Telegram é apenas um exemplo. Você pode ajustar o script para executar outras ações desejadas.
       
      creatureevent.cpp:
      Dentro deste arquivo, localize a função:
       
      uint32_t CreatureEvent::executeChannelLeave(Player* player, uint16_t channelId, UsersMap usersMap)  
      abaixo dela, adicione:
       
      uint32_t CreatureEvent::executeOpenRuleViolation(Player* player, std::string message) { if (!m_interface->reserveEnv()) { std::clog << "[Error - CreatureEvent::executeOpenRuleViolation] Call stack overflow." << std::endl; return 0; } ScriptEnviroment* env = m_interface->getEnv(); env->setScriptId(m_scriptId, m_interface); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); lua_pushstring(L, message.c_str()); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; }  
      Após, procure por:
       
      std::string CreatureEvent::getScriptEventName() const  
      abaixo de:
       
      case CREATURE_EVENT_CHANNEL_LEAVE: return "onLeaveChannel";  
      adicione:
       
      case CREATURE_EVENT_OPEN_RULE_VIOLATION: return "onOpenRuleViolation";  
      Agora, procure por:
       
      std::string CreatureEvent::getScriptEventParams() const  
      abaixo de:
       
      case CREATURE_EVENT_CHANNEL_LEAVE: return "cid, channel, users";  
      adicione:
       
      case CREATURE_EVENT_OPEN_RULE_VIOLATION: return "cid, message";  
      Procure por:
       
      bool CreatureEvent::configureEvent(xmlNodePtr p)  
      abaixo de:
       
      else if(tmpStr == "leavechannel") m_type = CREATURE_EVENT_CHANNEL_LEAVE;  
      adicione:
       
      else if(tmpStr == "openruleviolation") m_type = CREATURE_EVENT_OPEN_RULE_VIOLATION;  
       
      creatureevent.h:
      Dentro deste arquivo, localize:
       
      enum CreatureEventType_t  
      adicione "CREATURE_EVENT_OPEN_RULE_VIOLATION" como o último item de enum CreatureEventType_t
       
      Exemplo:
       
      enum CreatureEventType_t { // ... CREATURE_EVENT_OPEN_RULE_VIOLATION };  
      Agora, procure por:
       
      uint32_t executeChannelLeave(Player* player, uint16_t channelId, UsersMap usersMap);  
      abaixo dela, adicione:
       
      uint32_t executeOpenRuleViolation(Player* player, std::string message);  
      game.cpp:
      Dentro deste arquivo, localize:
       
      bool Game::playerReportRuleViolation(Player* player, const std::string& text)  
      e substitua por:
       
      bool Game::playerReportRuleViolation(Player* player, const std::string& text) { //Do not allow reports on multiclones worlds since reports are name-based if(g_config.getNumber(ConfigManager::ALLOW_CLONES)) { player->sendTextMessage(MSG_INFO_DESCR, "Rule violation reports are disabled."); return false; } cancelRuleViolation(player); boost::shared_ptr<RuleViolation> rvr(new RuleViolation(player, text, time(NULL))); ruleViolations[player->getID()] = rvr; ChatChannel* channel = g_chat.getChannelById(CHANNEL_RVR); if(!channel) return false; for(UsersMap::const_iterator it = channel->getUsers().begin(); it != channel->getUsers().end(); ++it) it->second->sendToChannel(player, SPEAK_RVR_CHANNEL, text, CHANNEL_RVR, rvr->time); CreatureEventList joinEvents = player->getCreatureEvents(CREATURE_EVENT_OPEN_RULE_VIOLATION); for(CreatureEventList::iterator it = joinEvents.begin(); it != joinEvents.end(); ++it) (*it)->executeOpenRuleViolation(player, text); return true; }  
      Agora é só compilar a source.
       
      depois em "data > creaturescripts > creaturescripts.xml", adicione:
       
      <event type="login" name="loginNotifyRuleViolation" script="notifyRuleViolation.lua"/> <event type="openruleviolation" name="openNotifyRuleViolation" script="notifyRuleViolation.lua"/>  
      em "data > creaturescripts > scripts", crie um arquivo notifyRuleViolation.lua e adicione:
       
      function onOpenRuleViolation(cid, message) local config = { token = "", -- Token do seu BOT no Telegram chatId = "" -- ID do chat do Telegram que será enviado a notificação. } local message = "Player: "..getCreatureName(cid).."\n\nReport:\n"..message.."" message = string.gsub(message, "\n", "%%0A") local url = "https://api.telegram.org/bot"..config.token.."/sendMessage" local data = "chat_id="..config.chatId.."&text="..message.."" local curl = io.popen('curl -d "'..data..'" "'..url..'"'):read("*a") return true end function onLogin(cid) registerCreatureEvent(cid, "openNotifyRuleViolation") return true end  
       
      Demonstração:
      1. Jogador abre um novo report (CTRL + R)

      2. notifyRuleViolation.lua, definido em creaturescripts.xml, é acionado para enviar uma notificação ao grupo do Telegram.
       

       
    • Por Johncore
      Otg Server é um projeto fork do The Forgotten Server 1.3, feito por brasileiros que visam sempre por estabilidade, um código mais clean, temos no projeto várias Datapacks como
      Global 11.0, Global 8.6, Global 8.0, RadBR 11.0, Evolutions 11.0, Yurots Classic 11.0, nossa base também é excelente para rodar projetos que são mapa Baiak ou ATS Custom pelo baixissimo uso de cpu e fix do Decay de itens.

      Todos são bem vindos para colaborar com o projeto... que não visa nenhum lucro financeiro, queremos apenas colaborar com a comunidade OTSERV,
      temos ouvido de muitas pessoas que procuram uma base estável, limpa, esse é o nosso objetivo nesse projeto.
       
      Estamos a procura de programadores/dev/webmaster que queiram ajudar / que tenham tempo e serão recompensados por isso.
       
      Nossa Datapack principal Global 11.00 contem as seguintes features:
      CAST SYSTEM ✅
      AUTOLOOT ✅
      WINTER UPDATE 2023 ✅
      SUMMER UPDATE 2023 ✅
      ADDONS 13.22 UPDATE ✅
      MONTARIAS 13.22 UPDATE ✅
      ITEMS 13.22 UPDATE ✅
      DAILY REWARD ✅
      IMBUEMENTS ✅
      PREY ✅
      EXERCISE WEAPONS ✅
      HIRELINGS NPCS ✅
      ANTI ROLLBACK ✅
       
       
      Github Global 11x:  💾
      https://github.com/otg-br/global-11x
      Clients e outras ferramentas:  💾
      https://github.com/otg-br/tools
      Github Otg Gesior:  💾
      https://github.com/otg-br/gesior
      Github Otg Otclientv8:  💾
      https://github.com/otg-br/otclientv8
      Wiki Otg:  💾
      https://github.com/otg-br/global-11x/wiki
       
       
      Creditos:
      TFS Team Erick Nunes Gui Bruxo Worthdavi LuSKT Leo Pereira Luan Luciano Cjaker Comedinhas Nekiro OTG Colaborators
    • Por Glacial
      Boa tarde galera, tudo bem?
       
      Meu nome é Gustavo/Glacial, gostaria de compartilhar com a comunidade meu projeto solo no RME 3.5 /Client 10.98 do Tibia.
      Glacial City, com houses, hunts, lojas, quests, bosses e depot.

      Os teleportes já estão redirecionados, falta apenas itens nos baús das quests.
       
      Espero que curtam e podem baixar pra colocar no ot de vocês!
       
      Atualização versão 2.0:
      - Houses na cidade
      - Hive Lair (Lady Bug)
      - Silencer & Frazzle/Guzzlemaw Hunt
      - Drakens + Demons Hunt (área maior)
       
      Links MediaFire e VirusTotal:
      Download Mapas: https://www.mediafire.com/folder/hz0q694t9nk86/Mapas_Glacial
      versão 1.0 Virus Total: https://www.virustotal.com/gui/file/b4e94903752e24aba63b291f9929f15f6bd7f4feb44d5a1f42ec3d755ee7977e?nocache=1
      versão 2.0 Virus Total: https://www.virustotal.com/gui/file/d88ae087e966bed6e2f2348f31246c1858831c1fb13d4e8613ba98f6ede37503?nocache=1
       
      Segue fotos em anexo.
       

       

       

       
       
       

       

       

    • Por ambrozii0
      Gostaria de fazer um pedido de um NPC de Task progressiva,

      Ele iniciaria dando missões para level 8 para caçar Troll, Rotworm e Ghoul.
       
      No level 30 liberaria: Cyclops, Dragon e Wyrm... e assim em diante se puder deixar comentado eu faço as criaturas na sequencia dos leveis seguintes.
       
      O jogador pode fazer as tasks dos leveis anteriores mesmo que já tenha ultrapassado o level do próximo nível de task.
       
      E o jogador ao terminar a missão poderia escolher a recompensa em gold ou experiência. As tasks podem se repetir sem problema, mas apenas pode pegar uma de cada vez.
       
      Ao finalizar todas as tasks o jogador ganha uma montaria.
       
      Minha versão de cliente é 12.91
      Versão da Canary 2.6.1
      Não sei qual o TFS do meu servidor.
    • Por Garou
      QUIZ







      Fala, grande reino! Tudo beleza?

      Eu estava aqui a deriva, sem nada para fazer, quando um colega me chamou no msn e pediu para eu revisar um código que ele havia feito para um NPC. A função era bem simples, o tal NPC iria fazer perguntas ao jogador que devia responder-las corretamente, caso errasse, duas criaturas configuráveis iriam aparecer.

      Quando eu dei uma olhada no código, tomei um grande susto, era algo caótico, tudo embaralhado. Se você quer dar uma olhada, tenha certeza de ter um coração forte.



      --[[ NPC de Perguntas e Respostas Criado por Bruno Lopes / Lpz &#169; 2011 TibiaKing ]]-- local focuses = {} local talk_start = 0 local topic = {} local var = 0 local quiz = { [1] = {"What is the ring of mana?", "energy ring"}, [2] = {"Who sells addons?", "raphael"} } local monster = {"Orc", 2} local prize = { question = 100, all = 10000 } function onCreatureSay(cid, type, msg) local msg = msg:lower() or "" if getNpcDistanceTo(cid) > 3 then return false end if doMessageCheck(msg, {"hi", "hello"}) and not(isFocused(cid, focuses)) then selfSay("Hello, ".. getCreatureName(cid) ..". Can you answer my questions? heh...", cid) addFocus(cid, focuses) selfFocus(cid) topic[cid] = 100 talk_start = os.clock() elseif doMessageCheck(msg, {"hi", "hello"}) and #focuses ~= 0 then selfSay("Sorry, ".. getCreatureName(cid) ..". I am talking with another person, wait!", cid) end if doMessageCheck(msg, {"bye", "farewell", "goodbye"}) and isFocused(cid, focuses) then selfSay("Bye-bye, hehe!", cid) removeFocus(cid, focuses) end if topic[cid] == 100 then if doMessageCheck(msg, "yes") then selfSay("To start my challenge, just say {ready}. I will ask you some questions.", cid) topic[cid] = 1 elseif doMessageCheck(msg, "no") then selfSay("Huh? Why are you here then?", cid) removeFocus(cid, focuses) topic[cid] = 0 end elseif topic[cid] == 1 then if var == 0 then if doMessageCheck(msg, "ready") then var = 1 selfSay(quiz[var][1], cid) end elseif var >= 1 then if var <= #quiz then if doMessageCheck(msg, quiz[var][2]) then selfSay("CORRECT!", cid) doPlayerAddMoney(cid, prize.question) var = var+1 if var > #quiz then selfSay("CONGRATULATIONS! YOU HAVE FINISHED ALL QUESTIONS!", cid) doPlayerAddMoney(cid, prize.all) else selfSay(quiz[var][1], cid) end else selfSay("YOU HAVE WRONG MY QUESTION! GUARDS, COME HERE!", cid) var = 0 topic[cid] = 0 removeFocus(cid, focuses) for i = 1, monster[2] do doCreateMonster(monster[1], getNpcPos()) end end end end end return true end function onThink() for _, cid in ipairs(focuses) do if isPlayer(cid) and isFocused(cid, focuses) then if os.clock() > (talk_start + 180) then talk_start = 0 selfSay("Hmph!") closeShopWindow(cid) removeFocus(cid, focuses) elseif getNpcDistanceTo(cid) > 3 then talk_start = 0 selfSay("How Rude!") closeShopWindow(cid) removeFocus(cid, focuses) end end end lookAtFocus(focuses) end Bom, eu fiz o arquivo .lua que você iria associar a algum npc de seu servidor, deixo o arquivo .xml por sua conta. Como é um NPC que faz perguntas, você pode configurar o seu NPC do jeito que você quiser, com as perguntas que você quiser. Veja abaixo como proceder: local quiz = { [1] = {"What is the ring of mana?", "energy ring"}, [2] = {"Who sells addons?", "raphael"} } Para adicionar novas perguntas, basta você colocar uma vírgula na última linha e criar uma nova linha conforme o modelo: local quiz = { [1] = {"What is the ring of mana?", "energy ring"}, [2] = {"Who sells addons?", "raphael"}, [3] = {"PERGUNTA", "RESPOSTA"}, [4] = {"PERGUNTA", "RESPOSTA"} } Há também algumas outras configurações básicas para você fazer, as criaturas que irão aparecer caso o jogador erre a pergunta e a quantidade. Também você pode configurar a quantidade de dinheiro que o jogador ganha quando acerta uma pergunta e a quantidade de dinheiro do prêmio final. local monster = {"Orc", 2} local prize = { question = 100, all = 10000 } OBSERVAÇÕES Para evitar quaisquer erros no script, substitua o conteúdo de npc.lua em data/npc/lib por este que estou passando abaixo:



      É isso aê, galerinha do tibiaKing!

      Até o próximo tópico.
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo