Ir para conteúdo
  • Cadastre-se

Posts Recomendados

.Qual servidor ou website você utiliza como base? 

 

Qual o motivo deste tópico? 

Eu tenho um npc cassino, e queria saber se tem como colocar pra ele atender o player pelo default, e nao pelo npc chat, só pra dar uma emoção.. plateia e tal

 

Você tem o código disponível? Se tiver publique-o aqui: 

local config = {
	bet = {
		min = 10,
		win = 160, -- 160% high/low
		winNum = 500, -- 300% numbers
	},
	playerPosition = Position(5021, 5017, 7), -- player must stay on this position to talk with npc
	dicerCounter = Position(5022, 5018, 7), -- counter position
}

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()
	local tile = Tile(config.playerPosition)
	if tile then
		local player = tile:getTopCreature()
		if not player then
			npcHandler.focuses = {}
			npcHandler:updateFocus()
		end
	end
end

local function getCoinValue(id)
	if id == 2160 then
		return 10000
	elseif id == 2152 then
		return 100
	elseif id == 2148 then
		return 1
	end
	return 0
end

local function getBetValue()
	local value = 0
	local tile = Tile(config.dicerCounter)
	if tile then
		local items = tile:getItems()
		if not items or #items == 0 then
			return 0
		end

		local tempMoney = {}
		for _, item in pairs(items) do
			if table.contains({2160, 2152, 2148}, item:getId()) then
				value = value + getCoinValue(item:getId()) * item:getCount()
				tempMoney[#tempMoney + 1] = item
			end
		end

		if value >= config.bet.min then -- valid bet
			for _, item in pairs(tempMoney) do
				item:remove()
			end
			return value
		end
	end
	return nil
end

local function createMoney(money)
	local table = {}
	local currentMoney = money
	local crystals = math.floor(currentMoney / 10000)
	currentMoney = currentMoney - crystals * 10000
	while crystals > 0 do
		local count = math.min(100, crystals)
		table[#table + 1] = {2160, count}
		crystals = crystals - count
	end

	local platinums = math.floor(currentMoney / 100)
	if platinums ~= 0 then
		table[#table + 1] = {2152, platinums}
		currentMoney = currentMoney - platinums * 100
	end

	if currentMoney ~= 0 then
		table[#table + 1] = {2148, currentMoney}
	end
	return table
end

local function greetCallback(cid)
	local player = Player(cid)
	if player:getPosition() ~= config.playerPosition then
		npcHandler:say("If you want to play with me please come near me.", cid)
		return false
	end
	return true
end

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

	local player = Player(cid)
	if player:getPosition() ~= config.playerPosition then
		npcHandler:unGreet(cid)
		return false
	end

	local thisNpc = Npc(getNpcCid())
	if table.contains({"low", "high", "h", "l", "1", "2", "3", "4", "5", "6"}, msg) then
		local bet = getBetValue()
		if not bet then
			npcHandler:say("Your bet is lower than the min {".. config.bet.min .."} bet.", cid)
			npcHandler.topic[cid] = 0
			return true
		end

		local number = math.random(1, 6)
		thisNpc:say(thisNpc:getName() .. " rolled a ".. number .. ".", TALKTYPE_MONSTER_SAY)
		thisNpc:getPosition():sendMagicEffect(CONST_ME_CRAPS)
		if table.contains({"low", "l"}, msg) then
			if table.contains({1, 2, 3}, number) then
				local wonMoney = bet * (config.bet.win / 100)
				npcHandler:say("Congratulations, you won! Here's your (".. wonMoney ..") gold coins.", cid)
				config.dicerCounter:sendMagicEffect(math.random(29, 31))
				for _, coin in pairs(createMoney(wonMoney)) do
					Game.createItem(coin[1], coin[2], config.dicerCounter)
				end
			else
				npcHandler:say("No luck this time, you lost.", cid)
			end
		elseif table.contains({"high", "h"}, msg) then
			if table.contains({4, 5, 6}, number) then
				local wonMoney = bet * (config.bet.win / 100)
				npcHandler:say("Congratulations, you won! Here's your (".. wonMoney ..") gold coins.", cid)
				config.dicerCounter:sendMagicEffect(math.random(29, 31))
				for _, coin in pairs(createMoney(wonMoney)) do
					Game.createItem(coin[1], coin[2], config.dicerCounter)
				end
			else
				npcHandler:say("No luck this time, you lost.", cid)
			end
		elseif table.contains({"1", "2", "3", "4", "5", "6"}, msg) then
			if number == tonumber(msg) then
				local wonMoney = bet * (config.bet.winNum / 100)
				npcHandler:say("Congratulations, you won! Here's your (".. wonMoney ..") gold coins.", cid)
				config.dicerCounter:sendMagicEffect(math.random(29, 31))
				for _, coin in pairs(createMoney(wonMoney)) do
					Game.createItem(coin[1], coin[2], config.dicerCounter)
				end
			else
				npcHandler:say("No luck this time, you lost.", cid)
			end
		end
	end
	return true
end

npcHandler:setMessage(MESSAGE_GREET, "Welcome to my cassino! I'm offering {high/low} and {numbers}, to start just put your {money} on {counter} and say {number} or {high/low}.")
npcHandler:setMessage(MESSAGE_FAREWELL, 'Good bye.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Good bye.')

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

npcHandler:addModule(FocusModule:new())
 

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

 

MEUS POSTS:

 

SE AJUDEI, DÁ O REP+, ESQUECE NÃO, VLW BB <3

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.

  • Conteúdo Similar

    • Por braianlomas
      Como faço para corrigir esse problema para meu cliente, eu uso o tfs 0.3.6  
      Quero resolver esse problema que tenho no meu cliente, como e onde posso resolver?  
      Eu uso o tfs 0.3.6, não tenho as fontes do cliente, se você puder me dar eu vou amá-las para sempre  
       

       
    • Por A.Mokk
      Ola pessoal, estou tentando compilar o TFS 1.5 Downgrade para 8.60 atraves do MSVC 2022, ao tentar compilar da o seguinte erro:
       
       
      Fiz o download do MSVC, GitDash, TFS-SDK-3.2, e de varios boosts que tentei, ao fazer o seguinte procedimento no GitDash:
       
      Ao chegar em ./bootstrap-vcpkg.bat o GitDash nao consegue realizar o procedimento corretamente, alguem poderia me ajudar ?

      Tentei de diversas formas mas o mesmo erro sempre persiste, atualmente meu servidor utiliza TFS 0.4, consigo compilar sem nenhum problema no MSVC 2010, porem, as limitações do TFS 0.4 estão me fazendo precisar atualizar, se alguem souber como corrigir esses erros eu agradeço !

      Tutoriais utilizados :
      Compiling on Windows (vcpkg) · otland/forgottenserver Wiki · GitHub
      Compiling on Windows · otland/forgottenserver Wiki · GitHub
      Compilando TFS 1.3 com vídeo-aula - Tutoriais Infraestrutura & Proteção - Tibia King - Tudo sobre Tibia, OTServ e Bots!
      Compilar TFS 1.3 Vcpkg - Tutoriais Infraestrutura & Proteção - Tibia King - Tudo sobre Tibia, OTServ e Bots!
       
      O que acontece no Powershell:
       
    • Por thunmin
      .Qual servidor ou website você utiliza como base? 
      Canary 2.3.6
      Qual o motivo deste tópico? 
      Queria fazer com que os players não pudessem mexer no aleta sio, pois, agora os mesmos estão conseguindo mexer nos itens
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
      Você tem o código disponível? Se tiver publique-o aqui: 
         
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 
       
    • Por thunmin
      .Qual servidor ou website você utiliza como base? 
      canary para o cliente 13.16
      Qual o motivo deste tópico? 
      Não consigo encontrar onde ajusta
      to com o problema no 13.16  o exausted, por exemplo os kinas era pra combar exori, erori gran e exori min, porém não ta indo ta dando exausted o char ta soltando magia ou runa e não consegue usar as potions
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
      Você tem o código disponível? Se tiver publique-o aqui: 
         
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 
       
    • Por Andersontatuador
      Olá galera da TK, me chamo Anderson estou procurando alguém profissional em otservs e site.
      Já tenho um servidor o site e o cliente preciso só de uma pessoal competente, que esteja empenhado a trabalhar,
      não quero nada de graça, pois nessa onda fui mais roubado do quer eu pagar um profissional.
      caso alguém se interesse entrar em contato comigo através do whatsapp
      82 9 9304-9462
       
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
      Você tem o código disponível? Se tiver publique-o aqui: 
         
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 
       
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo