[8.42+]npc Bank Para Ot Sql

tibiaa4e
em NPCs, monsters e raids
  • 1
  • 2

tibiaa4e

Ex amante de Tibia
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 18/12/05Posts: 912Gênero: MasculinoChar no Tibia: Kohzete

Funciona em 8.31 até 8.42 sem exceção. De preferencia use The Forgotten Server

 

Fiz esse npc pq n vi nenhuma que funcionasse com o novo Jiddo System

 

AGORA COM SISTEMA DE CHANGE GOLD.

 

Só funciona em tfs 0.3.0 alpha 4 +, pois os outros não possuem algumas funções

 

 

Ele faz deposit,withdraw e transfer sem bugs nenhum.

 

Para pega-lo crie em npcs

 

bank.xml

<?xml version="1.0" encoding="UTF-8"?>
<npc name="BankMan" script="data/npc/scripts/bank.lua" walkinterval="25" floorchange="0" access="5" >
<health now="150" max="150"/>
<look type="132" head="115" body="0" legs="114" feet="0" addons="3" corpse="2212"/>

<parameters>
	<parameter key="message_greet" value="Welcome |PLAYERNAME|! Here, you can {deposit}, {withdraw} or {transfer} your money from your bank account. I can change your coins too."/>
	<parameter key="message_alreadyfocused" value="You are drunked ? I talk with you."/>
	<parameter key="message_farewell" value="Goodbye. I wanna see your money... oh you again."/>
</parameters>
</npc>

 

 

Em npcs/scripts

 

bank.lua

-- npc maded by ta4e for tibia 8.31 to 8.42--
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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

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

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

--------------------MESSAGES------------------------------------------------------------------------------
if msgcontains(msg, 'deposit') then
	selfSay('Please tell me how much gold it is you would like to deposit.', cid)
	talkState[talkUser] = 1

elseif msgcontains(msg, 'withdraw') then
	selfSay('Please tell me how much gold you would like to withdraw.', cid)
	talkState[talkUser] = 3

elseif msgcontains(msg, 'transfer') then
	selfSay('Please tell me the amount of gold coins you would like to transfer.', cid)
	talkState[talkUser] = 5

elseif msgcontains(msg, 'change gold') then
	selfSay('How many platinum coins do you want to get?', cid)
	talkState[talkUser] = 8

elseif msgcontains(msg, 'change platinum') then
	selfSay('Do you want to change your platinum coins to gold or crystal?', cid)
	talkState[talkUser] = 10

elseif msgcontains(msg, 'change crystal') then
	selfSay('How many crystal coins do you want to change to platinum?', cid)
	talkState[talkUser] = 15

elseif msgcontains(msg, 'balance') then
	n = getPlayerBalance(cid)
	selfSay('Your balance are '..n..' golds.', cid)
	talkState[talkUser] = 0


----------------------DEPOSIT-------------------------------------------------------
elseif talkState[talkUser] == 1 then
	if msgcontains(msg, 'all') then
		n = getPlayerMoney(cid)
		selfSay('Do you want deposit '..n..' golds ?', cid)
		talkState[talkUser] = 2			
	else
		n = getNumber(msg)
		selfSay('Do you want deposit '..n..' golds ?', cid)
		talkState[talkUser] = 2
	end

elseif talkState[talkUser] == 2 then
	if msgcontains(msg, 'yes') then
		if getPlayerMoney(cid) >= n then
			doPlayerDepositMoney(cid,n)			
			selfSay('Sucessfull. Now your balance account is ' ..getPlayerBalance(cid)..' golds.', cid)
			talkState[talkUser] = 0
		else
			selfSay('You don\'t have money.', cid)
		end
	else
			selfSay('Ok then', cid)
	end

----------------------WITHDRAW-------------------------------------------------------------------------------------

elseif talkState[talkUser] == 3 then
	if msgcontains(msg, 'all') then
		n = getPlayerBalance(cid)
		selfSay('Do you want withdraw '..n..' golds ?', cid)
		talkState[talkUser] = 4			
	else
		n = getNumber(msg)
		selfSay('Do you want withdraw '..n..' golds ?', cid)
		talkState[talkUser] = 4
	end

elseif talkState[talkUser] == 4 then
	if msgcontains(msg, 'yes') then
		if getPlayerBalance(cid) >= n then
			doPlayerWithdrawMoney(cid, n)		
			selfSay('Here you are, '..n..' gold. Now your balance account is ' ..getPlayerBalance(cid)..' golds.', cid)
			talkState[talkUser] = 0
		else
			selfSay('There is not enough gold on your account', cid)
		end
	else
			selfSay('Ok then', cid)
	end

----------------------TRANSFER----------------------------------------------------------------------------------------		

elseif talkState[talkUser] == 5 then
	if msgcontains(msg, 'all') then
		n = getPlayerBalance(cid)
		selfSay('Who would you like transfer '..n..' gold to?', cid)
		talkState[talkUser] = 6			
	else
		n = getNumber(msg)
		selfSay('Who would you like transfer '..n..' gold to?', cid)
		talkState[talkUser] = 6
	end

elseif talkState[talkUser] == 6 then
	p = msg
	selfSay('So you would like to transfer '..n..' gold to '..p..'?', cid)
	talkState[talkUser] = 7

elseif talkState[talkUser] == 7 then
	if msgcontains(msg, 'yes') then
		if getPlayerBalance(cid) >= n then
			if doPlayerTransferMoneyTo(cid, p, n) == TRUE then
				selfSay('You have transferred '..n..' gold to '..p..' and your account balance is '..getPlayerBalance(cid)..' golds.', cid)
				talkState[talkUser] = 0
			else
			selfSay('This player does not exist. Please tell me a valid name!', cid)
			talkState[talkUser] = 0
			end
		else
			selfSay('There is not enough gold on your account', cid)
			talkState[talkUser] = 0
		end
	else
		selfSay('Ok then', cid)
		talkState[talkUser] = 0
	end

----------------------CHANGE GOLD---------------------------------------------------------------------------------
elseif talkState[talkUser] == 8 then
	n = getNumber(msg)
	b = n * 100
	selfSay('So I should change '..b..' of your gold coins to '..n..' platinum coins for you?', cid)
	talkState[talkUser] = 9

elseif talkState[talkUser] == 9 then
	if msgcontains(msg, 'yes') then
		if doPlayerRemoveItem(cid, 2148, b) == TRUE then
			doPlayerAddItem(cid, 2152, n)
			talkState[talkUser] = 0
		else
			selfSay('You don\'t have money.', cid)
			talkState[talkUser] = 0
		end
	else
		selfSay('Ok. We cancel.', cid)
		talkState[talkUser] = 0
	end

---------------------CHANGE PLATINUM-------------------------------------------------------------------------
	elseif talkState[talkUser] == 10 then
		if msgcontains(msg, 'gold') then
			selfSay('How many platinum coins do you want to change to gold?', cid)
			talkState[talkUser] = 11
		elseif msgcontains(msg, 'crystal') then
			selfSay('How many crystal coins do you want to get?', cid)
			talkState[talkUser] = 13				
		end


	elseif talkState[talkUser] == 11 then
		n = getNumber(msg)
		b = n * 100
		selfSay('So I should change '..n..' of your platinum coins to '..b..' gold coins for you?', cid)
		talkState[talkUser] = 12

elseif talkState[talkUser] == 12 then
	if msgcontains(msg, 'yes') then
		if doPlayerRemoveItem(cid, 2152, n) == TRUE then
			doPlayerAddItem(cid, 2148, b)
			talkState[talkUser] = 0
		else
			selfSay('You don\'t have money.', cid)
			talkState[talkUser] = 0
		end
	else
		selfSay('Ok. We cancel.', cid)
		talkState[talkUser] = 0
	end

elseif talkState[talkUser] == 13 then
	n = getNumber(msg)
	b = n * 100
	selfSay('So I should change '..b..' of your platinum coins to '..n..' crystal coins for you?', cid)
	talkState[talkUser] = 14

elseif talkState[talkUser] == 14 then
	if msgcontains(msg, 'yes') then
		if doPlayerRemoveItem(cid, 2152, b) == TRUE then
			doPlayerAddItem(cid, 2160, n)
			talkState[talkUser] = 0
		else
			selfSay('You don\'t have money.', cid)
			talkState[talkUser] = 0
		end
	else
		selfSay('Ok. We cancel.', cid)
		talkState[talkUser] = 0
	end

---------------------CHANGE CRYSTAL-------------------------------------------------------------------------------		
	elseif talkState[talkUser] == 15 then
	n = getNumber(msg)
	b = n * 100
	selfSay('So I should change '..n..' of your crystal coins to '..b..' platinum coins for you?', cid)
	talkState[talkUser] = 16

elseif talkState[talkUser] == 16 then
	if msgcontains(msg, 'yes') then
		if doPlayerRemoveItem(cid, 2160, n) == TRUE then
			doPlayerAddItem(cid, 2152, b)
			talkState[talkUser] = 0
		else
			selfSay('You don\'t have money.', cid)
			talkState[talkUser] = 0
		end
	else
		selfSay('Ok. We cancel.', cid)
		talkState[talkUser] = 0
	end


end


end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())



-- function maded by Gesior--
function getNumber(txt) --return number if its number and is > 0, else return 0
x = string.gsub(txt,"%a","")
x = tonumber(x)
if x ~= nill and x > 0 then
return x
else
return 0
end
end

 

Foi feito por mim e se quiser postar em outro forum coloque os creditos

Aposentado de OTserver e Tibia

Meus melhores tutoriais
Enciclopédia Pasta Data
Tutorial de quest

BillyBola

Ex-Imprensa XTibia
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 08/06/08Posts: 676Char no Tibia: Kimera De Pegasus

Po velho sempre com grandes trabalhos Oo.

 

Parabéns.

Andre26

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 05/10/08Posts: 12

Putz cara, estava procurando um npc banker pra tfs 8.31+. Tomare que esse npc funcione xD

Irei testar depois edito aqui.

 

Edit

Vlww funfo certinho! obrigado mesmo!!!!!

~~A vida é como uma onda do mar~~

MarcolinoGOD

Byte que eu gosto! (TI na veia)
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 19/06/07Posts: 267Gênero: MasculinoChar no Tibia: Rambocop Infernus

Como sempre... Muito bom, testei aqui e deu tudo certo! Obrigado por compartilhar!

 

Ps: Perdeu o sono? euahuh

--

noobinhu

Ex Administrador
avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 01/03/06Posts: 1022Gênero: Masculino

Uhm, depois eu faço um com o novo sistema de NPC do Jiddo e posto também.

 

Esse usa o selfSay né, antigo sistema.

alissonlinneker

ñ frite bacon sem kmiza xP
avatar
Barão
Barão

INFOS

Grupo: BarãoRegistrado: 15/12/07Posts: 239

Vixi...c num sabe o quanto tava procurando essse script..

eu tinha feito o meu propio aqui, via SQL..

ele salvava tudo via SQL...so q n ia fik bom pq ia ter processo d mais pro sql..

 

mais esse aqui vai ser melhor..

vo botar aqui..

vlw mesmo ae



Devo esquecer aqueles que me impuseram obstáculos infundados e agradecer àqueles que me impulsionaram adiante. É hora, mais do que nunca, de valorizar as amizades e os conhecimentos adquiridos aqui. Agradeço a todos que me apoiaram. Vlw xTibia!
Amais!
[Retired]



~~>Meus Trabalhos:

---Sistema De Domínio De Castelos. (Action)
---Sistema De Mineraçao (Action)
---Scroll Que Da X Exp Quando é Usada (Action)
---Portas Não Abrem? Venha Aqui Ver Como Arruma! (Action)
---Crie Suas Quest´s De Uma Maneira Rapida E Facil. (Action)
---The Demon OaK Quest (Action)

---Addon Por Item, Com Todos Os Outfits. (Npc)

---Aprenda a colocar suas quests no Quest Log (Tutorial+scripts _ data/xml/quests.xml)
---Conhecendo Melhor A Pasta Globalevents (Tutorial+scripts)
---Gerencie O Seu Mysql Como Se Fosse Sqlite (Tutorial)
---Multi World Sistem - Como Funciona. (Tutorial)

---Projeto de tradução do TFS 8.31 SQL - Inglês para o Portugês (Server 8.31)

---2 Templantes para Web Site de OT (Websites de OTserv)
---Atualização de sites do Gesior para sistema de mult-world (Websites de OTserv)

---Thyrania editado (Map)
---Yalahar Global Completo (Map)

---Pic Editor para Tibia 8.2+ (Programa)
---Ztracker - Clone mapas 8.4 (Programa)



tibiaa4e

Ex amante de Tibia
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 18/12/05Posts: 912Gênero: MasculinoChar no Tibia: Kohzete

@noobinhu

 

Ah eu uso so algumas coisas do jiddo system

 

Eu ainda sou adepto do self-say pq eu entendo melhor...

 

EU nunca usei msg de sistema (ja usei do zorzin,do jiddo e um outro da qual n me lembro)

 

@alisson

 

Eu tbm procurei demais, ai como não achei fiz um

 

@albert

 

to sem net em casa, ai to aqui na casa do meu amigo e aproveitei

Aposentado de OTserver e Tibia

Meus melhores tutoriais
Enciclopédia Pasta Data
Tutorial de quest

gorno

God Gorno
avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 21/12/07Posts: 121Char no Tibia: Jhonye Runner

@tibiaa4e

 

No TFS 0.2 para 8.4 não funcionou (claro, você disse que é para 0.3), mas você tem algum jeito de fazê-lo funcionar no 0.2?

 

Atenciosamente,

Gorno.

Att,

Gorno.

 

 

e7bd2e64bd.gif

 

- Você é meu fã? Então use minha Fã Bar!

6eb71bf385.png

Otaviobls

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 15/12/08Posts: 39Char no Tibia: Tlying

AEEAHUEIAHEAIUEHAUEA a maioria vem com bug

esse vem?

tibiaa4e

Ex amante de Tibia
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 18/12/05Posts: 912Gênero: MasculinoChar no Tibia: Kohzete

@gorno

 

Não pois n tem as funções bases

 

Não sei tem aqui + tem um npc do gesior q acho q funciona nele

 

Eu recomendo pega o 0.3.0 que não tem bugs...

Aposentado de OTserver e Tibia

Meus melhores tutoriais
Enciclopédia Pasta Data
Tutorial de quest

6662597

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 11/01/09Posts: 117Char no Tibia: GOD Tower

BOUUA

 

Òtimo KRA NOTA 10

CLIKA AKI E UPA MEU DRAGAO PLZ C KISER TER O SEU E AKI TBM!!!


VC E MEU FAN??? TE AJUDEI???







EU SOU:
[x]1post
[x]5 posts SERVO
[x]10 posts CAMPONÊS
[x]25 posts CAÇADOR
[x]50 posts CAVALEIRO
[x]100 posts BARONETE
[ ]200 posts BARÃO <-----------< MINHA META!!! XEGO LAH!
[ ]300 posts VISCONDE
[ ]400 posts DUQUE
[ ]600 posts ARQUEDUQUE
[ ]800 posts ARISTOCRATA
[ ]1000 posts REGENTE
[ ]1400 posts SÁBIO
[ ]1800 posts SACERDOTE
[ ]2500 posts PRÍNCIPE <----------< AINDA XEGO LA!!!

tibiaa4e

Ex amante de Tibia
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 18/12/05Posts: 912Gênero: MasculinoChar no Tibia: Kohzete

esse npc funfa em 8.4...

 

As funções são as mesmas

Claro se vc usar o tfs

 

Não as distros lixos que tem por ai (exceção do open tibia, porém lá acho q n funfa)

Aposentado de OTserver e Tibia

Meus melhores tutoriais
Enciclopédia Pasta Data
Tutorial de quest

makabrotaliban

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 08/01/09Posts: 331Char no Tibia: Orcshaball

Muito util mesmo....funfa tbm em 8.4 ?

 

- Xtibia.com seu site de Tibia e OTServer ! -

tibiaa4e

Ex amante de Tibia
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 18/12/05Posts: 912Gênero: MasculinoChar no Tibia: Kohzete

sim funciona...

 

Pode ser que de erros, ai reportem que eu tento arrumar

Aposentado de OTserver e Tibia

Meus melhores tutoriais
Enciclopédia Pasta Data
Tutorial de quest

  • 1
  • 2