Ir para conteúdo

Featured Replies

Postado
  • Este é um post popular.

Loot Channel para TFS 1.X

 

Liberando mais alguns conteúdos para vocês. Dessa vez o loot channel para tfs 1.x.

 

Crie um arquivo chamado loot.lua na pasta chatchannels/scripts contendo isso

local STORAGEVALUE_LOOT = 8914
function onSpeak(player, type, message)
	return false
end

function onJoin(player)
	player:setStorageValue(STORAGEVALUE_LOOT, 1)
	return true
end

function onLeave(player)
	player:setStorageValue(STORAGEVALUE_LOOT, 0)
	return true
end

 

Agora em chatchannels.xml adicione a tag

<channel id="11" name="Loot" script="loot.lua" />

 

Em events/scripts, abra o arquivo monster.lua e você provavelmente irá encontra-lo assim

function Monster:onDropLoot(corpse)
	if configManager.getNumber(configKeys.RATE_LOOT) == 0 then
		return
	end

	local player = Player(corpse:getCorpseOwner())
	local mType = self:getType()
	if not player or player:getStamina() > 840 then
		local monsterLoot = mType:getLoot()
		for i = 1, #monsterLoot do
			local item = corpse:createLootItem(monsterLoot[i])
			if not item then
				print('[Warning] DropLoot:', 'Could not add loot item to corpse.')
			end
		end

		if player then
			local text = ("Loot of %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription())
			local party = player:getParty()
			if party then
				party:broadcastPartyLoot(text)
			else
				player:sendTextMessage(MESSAGE_INFO_DESCR, text)
			end
		end
	else
		local text = ("Loot of %s: nothing (due to low stamina)"):format(mType:getNameDescription())
		local party = player:getParty()
		if party then
			party:broadcastPartyLoot(text)
		else
			player:sendTextMessage(MESSAGE_INFO_DESCR, text)
		end
	end
end

Altere para esse

local STORAGEVALUE_LOOT = 8914
function Monster:onDropLoot(corpse)

	if configManager.getNumber(configKeys.RATE_LOOT) == 0 then
		return
	end

	local player = Player(corpse:getCorpseOwner())
	local mType = self:getType()
	if not player or player:getStamina() > 840 then
		local monsterLoot = mType:getLoot()

		for i = 1, #monsterLoot do
			local item = corpse:createLootItem(monsterLoot[i])
			if not item then
				print('[Warning] DropLoot:', 'Could not add loot item to corpse.')
			end
		end

		if player then
			local text = ("Loot de %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription())
			local party = player:getParty()
			if party then
				party:broadcastPartyLoot(text)
			else
				if player:getStorageValue(STORAGEVALUE_LOOT) == 1 then
					sendChannelMessage(11, TALKTYPE_CHANNEL_O, text)
				else
					player:sendTextMessage(MESSAGE_INFO_DESCR, text)
				end
			end
		end
	else
		local text = ("Loot de %s: nada (devivo a baixa stamina)"):format(mType:getNameDescription())
		local party = player:getParty()
		if party then
			party:broadcastPartyLoot(text)
		else
			if player:getStorageValue(STORAGEVALUE_LOOT) == 1 then
				sendChannelMessage(11, TALKTYPE_CHANNEL_O, text)
			else
				player:sendTextMessage(MESSAGE_INFO_DESCR, text)
			end
		end
	end
end

 

Pronto, adicionado o Loot Channel!

 

Créditos: 100% meu :)

  • 4 months later...
Postado
Em 03/11/2020 em 18:43, Breno Alves disse:

Loot Channel para TFS 1.X

 

Liberando mais alguns conteúdos para vocês. Dessa vez o loot channel para tfs 1.x.

 

Crie um arquivo chamado loot.lua na pasta chatchannels/scripts contendo isso



local STORAGEVALUE_LOOT = 8914
function onSpeak(player, type, message)
	return false
end

function onJoin(player)
	player:setStorageValue(STORAGEVALUE_LOOT, 1)
	return true
end

function onLeave(player)
	player:setStorageValue(STORAGEVALUE_LOOT, 0)
	return true
end

 

Agora em chatchannels.xml adicione a tag



<channel id="11" name="Loot" script="loot.lua" />

 

Em events/scripts, abra o arquivo monster.lua e você provavelmente irá encontra-lo assim



function Monster:onDropLoot(corpse)
	if configManager.getNumber(configKeys.RATE_LOOT) == 0 then
		return
	end

	local player = Player(corpse:getCorpseOwner())
	local mType = self:getType()
	if not player or player:getStamina() > 840 then
		local monsterLoot = mType:getLoot()
		for i = 1, #monsterLoot do
			local item = corpse:createLootItem(monsterLoot[i])
			if not item then
				print('[Warning] DropLoot:', 'Could not add loot item to corpse.')
			end
		end

		if player then
			local text = ("Loot of %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription())
			local party = player:getParty()
			if party then
				party:broadcastPartyLoot(text)
			else
				player:sendTextMessage(MESSAGE_INFO_DESCR, text)
			end
		end
	else
		local text = ("Loot of %s: nothing (due to low stamina)"):format(mType:getNameDescription())
		local party = player:getParty()
		if party then
			party:broadcastPartyLoot(text)
		else
			player:sendTextMessage(MESSAGE_INFO_DESCR, text)
		end
	end
end

Altere para esse



local STORAGEVALUE_LOOT = 8914
function Monster:onDropLoot(corpse)

	if configManager.getNumber(configKeys.RATE_LOOT) == 0 then
		return
	end

	local player = Player(corpse:getCorpseOwner())
	local mType = self:getType()
	if not player or player:getStamina() > 840 then
		local monsterLoot = mType:getLoot()

		for i = 1, #monsterLoot do
			local item = corpse:createLootItem(monsterLoot[i])
			if not item then
				print('[Warning] DropLoot:', 'Could not add loot item to corpse.')
			end
		end

		if player then
			local text = ("Loot de %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription())
			local party = player:getParty()
			if party then
				party:broadcastPartyLoot(text)
			else
				if player:getStorageValue(STORAGEVALUE_LOOT) == 1 then
					sendChannelMessage(11, TALKTYPE_CHANNEL_O, text)
				else
					player:sendTextMessage(MESSAGE_INFO_DESCR, text)
				end
			end
		end
	else
		local text = ("Loot de %s: nada (devivo a baixa stamina)"):format(mType:getNameDescription())
		local party = player:getParty()
		if party then
			party:broadcastPartyLoot(text)
		else
			if player:getStorageValue(STORAGEVALUE_LOOT) == 1 then
				sendChannelMessage(11, TALKTYPE_CHANNEL_O, text)
			else
				player:sendTextMessage(MESSAGE_INFO_DESCR, text)
			end
		end
	end
end

 

Pronto, adicionado o Loot Channel!

 

Créditos: 100% meu :)

 

Parabéns pelo conteudo, se funcionar certinho vou postar aqui a versão pra funcionar perfeitamente com Reward Boss para versões 12+

 

Testei o sistema mas ficou 1 chat Loot para todos jogadores kkkkkk,

acredito que só vai funcionar no server save corretamente por causa da storage correto?? mesmo dando reload nao resolveu.

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

Postado
  • Autor
10 horas atrás, Johncore disse:

 

Parabéns pelo conteudo, se funcionar certinho vou postar aqui a versão pra funcionar perfeitamente com Reward Boss para versões 12+

 

Testei o sistema mas ficou 1 chat Loot para todos jogadores kkkkkk,

acredito que só vai funcionar no server save corretamente por causa da storage correto?? mesmo dando reload nao resolveu.

Não entendi... poderia explicar melhor?

Postado
14 horas atrás, Breno Alves disse:

Não entendi... poderia explicar melhor?

 

Instalei o seu sistema, porém o Chat Loot de vez de abrir um individual por jogador,

ficou todo mundo logando no chat Loot e aparece o Loot de todos jogadores.

 

 

img1.png

o loot de geral no mesmo chat kkkk

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

  • 9 months later...

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

Quem Está Navegando 0

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

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo