[PY+Quest] Securitate inventar Full

Avatar utilizator
Louie
Utilizator interzis !

Utilizator interzis !
Mesaje: 50
Membru din: 26 Dec 2017, 07:18
Server: Louie-mt2
Regat: Jinno
Aprecieri: 4  
Mulţumiri: 9  
Medalii

Salut :) .. am tras de par acest sistem acum vreo 2 ani cand incercam sa invat de prin functiile lui Vegas :) .. Respect.
Am vazut pe mai multe forumuri sistemul meu :| dar niciodata full .. si fel si fel de oameni care spuneau ca ei dus mai departe etc. Am revenit in metin2 dupa ceva timp si vreau sa va postez acest sistem . Repet acest sistem este creat de mine DaYellowFlash sau Louie .. M-am inspirat din tutorialul lui Vegas [Negot la distanta pe tasta f8] Respect . Sa incepem
Inainte de toate adaugam un folder nou in /share/locale/romania/quest numit "securitate"
:) Part I - Client side
Pasul 1
Despachetam rootsi adaugam la inceput in constinfo.py

Cod: Selectaţi tot

#Louie Work
SECURIATE_QUESTINDEX = 0
SECURIATE_CONT = 1
INPUT_IGNORE = 0
mallkeyqin = 0
LouieWork = 0
#End Luu work
Pasul 2
Intram in uiinventory.py si cautam functia :

Cod: Selectaţi tot

	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.OpenBoniSwitcherEvent = lambda : None
		self.__LoadWindow()
Sub ea adaugam asta pentru cei FARA COSTUME :

Cod: Selectaţi tot

#Louie Work
	def ParolaInventarWnd(self):
		self.ParolaInventar = ui.BoardWithTitleBar()
		self.ParolaInventar.SetSize(180, 100)
		self.ParolaInventar.SetCenterPosition()
		self.ParolaInventar.AddFlag('movable')
		self.ParolaInventar.AddFlag('float')
		self.ParolaInventar.SetTitleName('Inventar')
		self.ParolaInventar.SetCloseEvent(self.InchidereParolaInventar)
		self.ParolaInventar.Show()
				  
		self.TextParola = ui.TextLine()
		self.TextParola.SetParent(self.ParolaInventar)
		self.TextParola.SetDefaultFontName()
		self.TextParola.SetPosition(15, 35)
		self.TextParola.SetFeather()
		self.TextParola.SetText("Parola inventar:")
		self.TextParola.SetOutline()
		self.TextParola.Show()
	  
		self.SlotParola = ui.SlotBar()
		self.SlotParola.SetParent(self.ParolaInventar)
		self.SlotParola.SetSize(60, 15)
		self.SlotParola.SetPosition(30, 35)
		self.SlotParola.SetWindowHorizontalAlignCenter()
		self.SlotParola.Show()

		self.CampParola = ui.EditLine()
		self.CampParola.SetParent(self.SlotParola)
		self.CampParola.SetSize(60, 15)
		self.CampParola.SetPosition(4, 1)
		self.CampParola.SetMax(4)
		self.CampParola.SetNumberMode()
		self.CampParola.SetFocus()	  
		self.CampParola.Show()
	  
		self.ButonParolaOK = ui.Button()
		self.ButonParolaOK.SetParent(self.ParolaInventar)
		self.ButonParolaOK.SetEvent(self.VerificareParola)
		self.ButonParolaOK.SetPosition(46, 67)
		self.ButonParolaOK.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
		self.ButonParolaOK.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
		self.ButonParolaOK.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
		self.ButonParolaOK.SetText("Deblocare")
		self.ButonParolaOK.Show()
	  
		self.CampParola.SetReturnEvent(ui.__mem_func__(self.VerificareParola))
	  
	def VerificareParola(self):
		self.ParolaInventar.Hide()
		activare_skill2 = constInfo.SECURIATE_QUESTINDEX
		constInfo.NegotFereastraNume = self.CampParola.GetText()
		event.QuestButtonClick(activare_skill2)
	  
	def InchidereParolaInventar(self):
		self.ParolaInventar.Hide()
#End Work
Iar functia :

Cod: Selectaţi tot

	def Show(self):
		self.__LoadWindow()
o inlocuim cu :

Cod: Selectaţi tot

#Louie work
	def Show(self):
		if constInfo.SECURIATE_CONT == 0:
			self.__LoadWindow()

			ui.ScriptWindow.Show(self)
		else:
			self.ParolaInventarWnd()
#End Work 
Acum pentru cei cu costume

Cod: Selectaţi tot

#Luu work
	def ParolaInventarWnd(self):
		self.ParolaInventar = ui.BoardWithTitleBar()
		self.ParolaInventar.SetSize(180, 100)
		self.ParolaInventar.SetCenterPosition()
		self.ParolaInventar.AddFlag('movable')
		self.ParolaInventar.AddFlag('float')
		self.ParolaInventar.SetTitleName('Inventar')
		self.ParolaInventar.SetCloseEvent(self.InchidereParolaInventar)
		self.ParolaInventar.Show()
				  
		self.TextParola = ui.TextLine()
		self.TextParola.SetParent(self.ParolaInventar)
		self.TextParola.SetDefaultFontName()
		self.TextParola.SetPosition(15, 35)
		self.TextParola.SetFeather()
		self.TextParola.SetText("Parola inventar:")
		self.TextParola.SetOutline()
		self.TextParola.Show()
	  
		self.SlotParola = ui.SlotBar()
		self.SlotParola.SetParent(self.ParolaInventar)
		self.SlotParola.SetSize(60, 15)
		self.SlotParola.SetPosition(30, 35)
		self.SlotParola.SetWindowHorizontalAlignCenter()
		self.SlotParola.Show()	  

		self.CampParola = ui.EditLine()
		self.CampParola.SetParent(self.SlotParola)
		self.CampParola.SetSize(60, 15)
		self.CampParola.SetPosition(4, 1)
		self.CampParola.SetMax(6)
		self.CampParola.SetFocus()	  
		self.CampParola.Show()
	  
		self.ButonParolaOK = ui.Button()
		self.ButonParolaOK.SetParent(self.ParolaInventar)
		self.ButonParolaOK.SetEvent(self.VerificareParola)
		self.ButonParolaOK.SetPosition(46, 67)
		self.ButonParolaOK.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
		self.ButonParolaOK.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
		self.ButonParolaOK.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
		self.ButonParolaOK.SetText("Deblocare")
		self.ButonParolaOK.Show()
	  
		self.CampParola.SetReturnEvent(ui.__mem_func__(self.VerificareParola))
	  
	def VerificareParola(self):
		self.ParolaInventar.Hide()
		activare_skill2 = constInfo.SECURIATE_QUESTINDEX
		constInfo.NegotFereastraNume = self.CampParola.GetText()
		event.QuestButtonClick(activare_skill2)
	  
	def InchidereParolaInventar(self):
		self.ParolaInventar.Hide()
	#End work
Iar functia :

Cod: Selectaţi tot

	def Show(self):
		self.__LoadWindow()

		ui.ScriptWindow.Show(self)
	  
		if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
			self.wndCostume.Show()

		if self.wndBelt:
			self.wndBelt.Show(self.isOpenedBeltWindowWhenClosingInventory)
O inlocuim cu :

Cod: Selectaţi tot

	##Louie work
	def Show(self):
		if constInfo.SECURIATE_CONT == 0:
			self.__LoadWindow()

			ui.ScriptWindow.Show(self)
		  
			if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
				self.wndCostume.Show()
			if self.wndBelt:
				self.wndBelt.Show(self.isOpenedBeltWindowWhenClosingInventory)
		else:
			self.ParolaInventarWnd()
#End work

Cod: Selectaţi tot

Intram in ROOT-->##Game.py si cautam :
"mall"			: self.__InGameShop_Show,

##Iar dupa adaugam : 

			#Louie work
			"key"			: self.__def_key,
			#Louie work
			"getinputbegin"				: self.__Input_Get_Dash_1,
			"getinputend"			: self.__Input_Get_Dash_2,
			"getinput"				: self.__Input_Get_Dash_3, 
			"securitate_index"			: self.SecuriateQuestIndex,
			"sistem_negot_verificare_nume"			: self.__Sistem_negot_verificare_nume,
			"securiate_cont"			: self.SecuriateCont,
			"activareinv"				: self.ActivareInv,
			#END

Acum la final in game.py adaugam : 

#Louie work
	def __Input_Get_Dash_1(self):
		constInfo.INPUT_IGNORE = 1
	
	def __Input_Get_Dash_2(self):		
		constInfo.INPUT_IGNORE = 0

	def __Input_Get_Dash_3(self):
		net.SendQuestInputStringPacket("1") 

	def SecuriateQuestIndex(self, value):
		#chat.AppendChat(chat.CHAT_TYPE_INFO, "index %d" % int(value))
		constInfo.SECURIATE_QUESTINDEX = int(value)

	def __Sistem_negot_verificare_nume(self):
		net.SendQuestInputStringPacket(str(constInfo.LouieWork))

	def SecuriateCont(self):
		constInfo.SECURIATE_CONT = 0

	def ActivareInv(self):
		constInfo.SECURIATE_CONT = 1
	#END	
	
Pasul 3
Adaugam la inceput in uiinventory.py

Cod: Selectaţi tot

 import event 
Apoi cautam :

Cod: Selectaţi tot

 self.costumeButton = self.GetChild2("CostumeButton") 
sub el adaugam :

Cod: Selectaţi tot

			#Louie work
			self.Key = self.GetChild2("Key")
			#Louie work
Cautam :

Cod: Selectaţi tot

 self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton)) 
Adaugam sub el :

Cod: Selectaţi tot

#Louie Work
		if self.Key:
			self.Key.SetEvent(ui.__mem_func__(self.ClickKey))
#Louie Work
Cautam :

Cod: Selectaţi tot

 def ClickDSSButton(self): 
Adaugam sub

Cod: Selectaţi tot

 self.interface.ToggleDragonSoulWindow() 
asta :

Cod: Selectaţi tot

#Louie Work
	def ClickKey(self):
		import event
		qid = constInfo.mallkeyqin
		event.QuestButtonClick(qid)
#Louie
Pasul 4
intram in Game.py si cautam functia :

Cod: Selectaţi tot

 def OpenQuestWindow(self, skin, idx): 
si o inlocuiti cu aceasta :

Cod: Selectaţi tot

	def OpenQuestWindow(self, skin, idx):
		if constInfo.INPUT_IGNORE == 1:
			return
		else:
			self.interface.OpenQuestWindow(skin, idx)
 
Cautati in Game.py :

Cod: Selectaţi tot

 #Louie work 
Sub asta adaugam :

Cod: Selectaţi tot

			 "key"			: self.__def_key, 
tot aici cautam :

Cod: Selectaţi tot

				serverCommandItem[0], serverCommandItem[1]
			) 
si adaugam sub :

Cod: Selectaţi tot

#Louie work
	def __def_key(self, qid):
		constInfo.mallkeyqin = int(qid)
#End
Pasul 5
Intram in locale/Inventorywindow.py si cautam :

Cod: Selectaţi tot

							"down_image" : "d:/ymir work/ui/game/taskbar/costume_Button_03.tga",
						}, 
si adaugam sub el :

Cod: Selectaţi tot

			#Lui Work
						{
						"name" : "Key",
						"type" : "button",
					  
						"x" : 120,
						"y" : 68,
					  
						"tooltip_text" : "Key",
						
							"default_image" : "d:/ymir work/Louie/key.tga",
							"over_image" : "d:/ymir work/Louie/key1.tga",
							"down_image" : "d:/ymir work/Louie/key1.tga",
						},
			#End work
extragem arhiva : http://www.girlshare.ro/3490002096.9 in pack si adaugam in Index :

Cod: Selectaţi tot

*
Louie
*
Parola arhivei :

Cod: Selectaţi tot

 Louie 
Part II - Server Side
Pasul 1
Intram in questfunctions si adaugam :

Cod: Selectaţi tot

citire_parola
file_exists
resetare_parola
setare_parola
Pasul 2
Adaugam in questlib.lua :

Cod: Selectaţi tot

DirectorSecuritate = get_locale_base_path().."/quest/securitate/"

function citire_parola()
	local FisierPassword = DirectorSecuritate..pc.get_name().."_securitate.txt"
	local parola  
	if io.open(FisierPassword, "r") != nil then
		io.input(FisierPassword)
		parola = tonumber(io.read())
		io.input():close()
	else
		parola = 0
	end
	return parola
end

function file_exists()
	local name = DirectorSecuritate..pc.get_name().."_securitate.txt"
	local f=io.open(name,"r")
	if f!=nil then
		io.close(f)
		return true
	else
		return false
	end
end

function setare_parola(nr_buton)
	local name = DirectorSecuritate..pc.get_name().."_securitate.txt"
	io.output(name)
	io.write(tostring(nr_buton))
	io.flush()
	io.close()

end

function resetare_parola()
	local name = DirectorSecuritate..pc.get_name().."_securitate.txt"	  
	os.remove(name)
end 
Pasul 3
Adaugam cele 2 questuri :

Cod: Selectaţi tot

--------Louie Work----------------------------------------
quest securitate_inv begin
	state start begin
		function GetPassword()
			cmdchat("getinputbegin")
			password = input(cmdchat("sistem_negot_verificare_nume"))
			cmdchat("getinputend")
			return password
		end
		when login begin
				cmdchat("securitate_index "..q.getcurrentquestindex())
			if file_exists() != true then
				cmdchat("securiate_cont")
			else
				cmdchat("activareinv")
			end
		end
	  
		when button or info begin
			local password = securitate_inv.GetPassword()
			if tonumber(password) == tonumber(citire_parola()) then
				cmdchat("securiate_cont")
			end
		  end
	end
end

Cod: Selectaţi tot

---------Luu work --------
quest securitate_opt begin
	state start begin
		when login begin
			cmdchat("key " .. q . getcurrentquestindex ())
		end
		when button or info begin
				say_title("Securitate Inventar.")
				say("Acesta este un sistem foarte bun")
				say("care va protejaza de persoanele")
				say("care intr-un fel sau altul va intra")
				say("pe cont.Puteti sa setati parola la inventar")
				say("pe care sa o cunoasteti decat Dumneavoastra.")
			local s = select("Setare/Dezactivare parola.","Reseteaza parola.", "Poate mai tarziu")
				if s == 1 then
					local p = select("Setare parola.","Dezactivare parola.")
						if p == 1 then
							if file_exists() != true then
								say("Setati parola.")
								local item_vnum = input()
								setare_parola(item_vnum)
								cmdchat("activareinv")
							else
								say("In cazul in care va uitati parola de la inventar")
								say("luati legatura cu un Administrator !")  
								end
						elseif p == 2 then
							if file_exists() != true then
								say("Nu ati setat nici o parola pana acum.")
							else
								say("Introduceti parola")
								local item_vnum = input()
								if tonumber(item_vnum) == tonumber(citire_parola()) then
									resetare_parola()
								else
									say("Parola este gresita!!")
								end
								end
								end
				elseif s == 2 then
					if file_exists() != true then
						say("Nu ati setat nici o parola pana acum.")
					else
						say("Introduceti parola veche")
						local item_vnum = input()
						if tonumber(item_vnum) == tonumber(citire_parola()) then
							say("introduceti parola noua")
							local item_vnum1 = input()
							resetare_parola()
							setare_parola(item_vnum1)
						else
							say("Parola este gresita!!")
					end
				end
		  if s == 3 then
	end
	end
		end
	end
end
Cateva imagini :
Imagine Imagine Imagine Imagine Imagine Imagine Imagine
Daca te-am ajutat nu uita sa dai un thx :) .

Edit: Tutorial cu tab-uri :
Ultima oară modificat 11 Ian 2018, 08:58 de către Louie, modificat de 9 ori în total.
Pentru acest mesaj, Louie a primit 3 (de) mulţumiri
deycrusader25 • BRTSERGIU2 • misoginul97
Avatar utilizator
-DND-
Utilizatorul Lunii Ianuarie

Utilizatorul Lunii Ianuarie
Mesaje: 1464
Membru din: 22 Ian 2017, 16:40
Server: Serverfiles By DnD
Regat: Jinno
Aprecieri: 116  
Mulţumiri: 2249  
Discord: Copiază ID
 Contact:
Medalii

Bun . În sfarsit s-a gandit cineva sa-l faca.

[ Postat de pe Android ] Imagine
Ultima oară modificat 04 Feb 2018, 15:44 de către S. Ionuț Valentin, modificat 1 dată în total.
Motiv: Corectat gramatical
Avatar utilizator
Asky
Ţepar / Untrusted User

Ţepar / Untrusted User
Mesaje: 1472
Membru din: 08 Oct 2014, 17:32
Regat: Chunjo
Aprecieri: 98  
Mulţumiri: 4811  
Discord: Copiază ID
 Contact:
Medalii

Mie personal nu-mi place securitatea la inventar :)) dar totuși bravo pentru ce ai reușit să faci !
Imagine
Afișează semnătura
Avatar utilizator
Louie
Utilizator interzis !

Utilizator interzis !
Mesaje: 50
Membru din: 26 Dec 2017, 07:18
Server: Louie-mt2
Regat: Jinno
Aprecieri: 4  
Mulţumiri: 9  
Medalii

Asky scrie:Mie personal nu-mi place securitatea la inventar :)) dar totuși bravo pentru ce ai reușit să faci !
Multumesc :) voi reveni cu update-uri

[ Postat de pe iPhone ] Imagine
Avatar utilizator
.Horus
Map Creator

Map Creator
Mesaje: 644
Membru din: 22 Aug 2016, 02:53
Server: Devias2
Regat: Chunjo
Aprecieri: 124  
Mulţumiri: 1166  
Discord: Copiază ID
 Contact:
Medalii

Frumos , felicitari!
Afișează semnătura
Avatar utilizator
[ST]SSH
Membru Club

Membru Club
Mesaje: 1704
Membru din: 12 Apr 2016, 23:54
Server: Fost Eluria2
Regat: Jinno
Aprecieri: 132  
Mulţumiri: 245  
 Contact:
Medalii

Bravo,frumos :P
Avatar utilizator
Goku99
Utilizator interzis !

Utilizator interzis !
Mesaje: 74
Membru din: 16 Dec 2014, 18:28
Server: Smith metin2
Regat: Chunjo
Aprecieri: 16  
Mulţumiri: 0
Medalii

Merge perfect ,multumesc !
Avatar utilizator
Louie
Utilizator interzis !

Utilizator interzis !
Mesaje: 50
Membru din: 26 Dec 2017, 07:18
Server: Louie-mt2
Regat: Jinno
Aprecieri: 4  
Mulţumiri: 9  
Medalii

#UP

[ Postat de pe iPhone ] Imagine
Avatar utilizator
BRTSERGIU2
Utilizator interzis !

Utilizator interzis !
Mesaje: 600
Membru din: 25 Aug 2014, 21:28
Server: Metin2Ro
Regat: Chunjo
Aprecieri: 28  
Mulţumiri: 77  
Medalii

Louie scrie:Salut :) .. am tras de par acest sistem acum vreo 2 ani cand incercam sa invat de prin functiile lui Vegas :) .. Respect.
Am vazut pe mai multe forumuri sistemul meu :| dar niciodata full .. si fel si fel de oameni care spuneau ca ei dus mai departe etc. Am revenit in metin2 dupa ceva timp si vreau sa va postez acest sistem . Repet acest sistem este creat de mine DaYellowFlash sau Louie .. M-am inspirat din tutorialul lui Vegas [Negot la distanta pe tasta f8] Respect . Sa incepem :) Part I - Client side
Pasul 1
Despachetam root.eix si adaugam la inceput in

Cod: Selectaţi tot

#Louie Work
SECURIATE_QUESTINDEX = 0
SECURIATE_CONT = 1
INPUT_IGNORE = 0
mallkeyqin = 0
LouieWork = 0
#End Luu work
Pasul 2
Intram in uiinventory.py si cautam functia :

Cod: Selectaţi tot

	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.OpenBoniSwitcherEvent = lambda : None
		self.__LoadWindow()
Sub ea adaugam asta pentru cei FARA COSTUME :

Cod: Selectaţi tot

#Louie Work
	def ParolaInventarWnd(self):
		self.ParolaInventar = ui.BoardWithTitleBar()
		self.ParolaInventar.SetSize(180, 100)
		self.ParolaInventar.SetCenterPosition()
		self.ParolaInventar.AddFlag('movable')
		self.ParolaInventar.AddFlag('float')
		self.ParolaInventar.SetTitleName('Inventar')
		self.ParolaInventar.SetCloseEvent(self.InchidereParolaInventar)
		self.ParolaInventar.Show()
				  
		self.TextParola = ui.TextLine()
		self.TextParola.SetParent(self.ParolaInventar)
		self.TextParola.SetDefaultFontName()
		self.TextParola.SetPosition(15, 35)
		self.TextParola.SetFeather()
		self.TextParola.SetText("Parola inventar:")
		self.TextParola.SetOutline()
		self.TextParola.Show()
	  
		self.SlotParola = ui.SlotBar()
		self.SlotParola.SetParent(self.ParolaInventar)
		self.SlotParola.SetSize(60, 15)
		self.SlotParola.SetPosition(30, 35)
		self.SlotParola.SetWindowHorizontalAlignCenter()
		self.SlotParola.Show()

		self.CampParola = ui.EditLine()
		self.CampParola.SetParent(self.SlotParola)
		self.CampParola.SetSize(60, 15)
		self.CampParola.SetPosition(4, 1)
		self.CampParola.SetMax(4)
		self.CampParola.SetNumberMode()
		self.CampParola.SetFocus()	  
		self.CampParola.Show()
	  
		self.ButonParolaOK = ui.Button()
		self.ButonParolaOK.SetParent(self.ParolaInventar)
		self.ButonParolaOK.SetEvent(self.VerificareParola)
		self.ButonParolaOK.SetPosition(46, 67)
		self.ButonParolaOK.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
		self.ButonParolaOK.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
		self.ButonParolaOK.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
		self.ButonParolaOK.SetText("Deblocare")
		self.ButonParolaOK.Show()
	  
		self.CampParola.SetReturnEvent(ui.__mem_func__(self.VerificareParola))
	  
	def VerificareParola(self):
		self.ParolaInventar.Hide()
		activare_skill2 = constInfo.SECURIATE_QUESTINDEX
		constInfo.NegotFereastraNume = self.CampParola.GetText()
		event.QuestButtonClick(activare_skill2)
	  
	def InchidereParolaInventar(self):
		self.ParolaInventar.Hide()
#End Work
Iar functia :

Cod: Selectaţi tot

	def Show(self):
		self.__LoadWindow()
o inlocuim cu :

Cod: Selectaţi tot

#Louie work
	def Show(self):
		if constInfo.SECURIATE_CONT == 0:
			self.__LoadWindow()

			ui.ScriptWindow.Show(self)
		else:
			self.ParolaInventarWnd()
#End Work 
Acum pentru cei cu costume

Cod: Selectaţi tot

#Luu work
	def ParolaInventarWnd(self):
		self.ParolaInventar = ui.BoardWithTitleBar()
		self.ParolaInventar.SetSize(180, 100)
		self.ParolaInventar.SetCenterPosition()
		self.ParolaInventar.AddFlag('movable')
		self.ParolaInventar.AddFlag('float')
		self.ParolaInventar.SetTitleName('Inventar')
		self.ParolaInventar.SetCloseEvent(self.InchidereParolaInventar)
		self.ParolaInventar.Show()
				  
		self.TextParola = ui.TextLine()
		self.TextParola.SetParent(self.ParolaInventar)
		self.TextParola.SetDefaultFontName()
		self.TextParola.SetPosition(15, 35)
		self.TextParola.SetFeather()
		self.TextParola.SetText("Parola inventar:")
		self.TextParola.SetOutline()
		self.TextParola.Show()
	  
		self.SlotParola = ui.SlotBar()
		self.SlotParola.SetParent(self.ParolaInventar)
		self.SlotParola.SetSize(60, 15)
		self.SlotParola.SetPosition(30, 35)
		self.SlotParola.SetWindowHorizontalAlignCenter()
		self.SlotParola.Show()	  

		self.CampParola = ui.EditLine()
		self.CampParola.SetParent(self.SlotParola)
		self.CampParola.SetSize(60, 15)
		self.CampParola.SetPosition(4, 1)
		self.CampParola.SetMax(6)
		self.CampParola.SetFocus()	  
		self.CampParola.Show()
	  
		self.ButonParolaOK = ui.Button()
		self.ButonParolaOK.SetParent(self.ParolaInventar)
		self.ButonParolaOK.SetEvent(self.VerificareParola)
		self.ButonParolaOK.SetPosition(46, 67)
		self.ButonParolaOK.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
		self.ButonParolaOK.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
		self.ButonParolaOK.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
		self.ButonParolaOK.SetText("Deblocare")
		self.ButonParolaOK.Show()
	  
		self.CampParola.SetReturnEvent(ui.__mem_func__(self.VerificareParola))
	  
	def VerificareParola(self):
		self.ParolaInventar.Hide()
		activare_skill2 = constInfo.SECURIATE_QUESTINDEX
		constInfo.NegotFereastraNume = self.CampParola.GetText()
		event.QuestButtonClick(activare_skill2)
	  
	def InchidereParolaInventar(self):
		self.ParolaInventar.Hide()
	#End work
Iar functia :

Cod: Selectaţi tot

	def Show(self):
		self.__LoadWindow()

		ui.ScriptWindow.Show(self)
	  
		if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
			self.wndCostume.Show()

		if self.wndBelt:
			self.wndBelt.Show(self.isOpenedBeltWindowWhenClosingInventory)
O inlocuim cu :

Cod: Selectaţi tot

	##Louie work
	def Show(self):
		if constInfo.SECURIATE_CONT == 0:
			self.__LoadWindow()

			ui.ScriptWindow.Show(self)
		  
			if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
				self.wndCostume.Show()
			if self.wndBelt:
				self.wndBelt.Show(self.isOpenedBeltWindowWhenClosingInventory)
		else:
			self.ParolaInventarWnd()
#End work

Cod: Selectaţi tot

Intram in ROOT-->##Game.py si cautam :
"mall"			: self.__InGameShop_Show,

##Iar dupa adaugam : 

			#Louie work
			"key"			: self.__def_key,
			#Louie work
			"getinputbegin"				: self.__Input_Get_Dash_1,
			"getinputend"			: self.__Input_Get_Dash_2,
			"getinput"				: self.__Input_Get_Dash_3, 
			"securitate_index"			: self.SecuriateQuestIndex,
			"sistem_negot_verificare_nume"			: self.__Sistem_negot_verificare_nume,
			"securiate_cont"			: self.SecuriateCont,
			"activareinv"				: self.ActivareInv,
			#END

Acum la final in game.py adaugam : 

#Louie work
	def __Input_Get_Dash_1(self):
		constInfo.INPUT_IGNORE = 1
	
	def __Input_Get_Dash_2(self):		
		constInfo.INPUT_IGNORE = 0

	def __Input_Get_Dash_3(self):
		net.SendQuestInputStringPacket("1") 

	def SecuriateQuestIndex(self, value):
		#chat.AppendChat(chat.CHAT_TYPE_INFO, "index %d" % int(value))
		constInfo.SECURIATE_QUESTINDEX = int(value)

	def __Sistem_negot_verificare_nume(self):
		net.SendQuestInputStringPacket(str(constInfo.LouieWork))

	def SecuriateCont(self):
		constInfo.SECURIATE_CONT = 0

	def ActivareInv(self):
		constInfo.SECURIATE_CONT = 1
	#END	
	
Pasul 3
Adaugam la inceput in uiinventory.py

Cod: Selectaţi tot

 import event 
Apoi cautam :

Cod: Selectaţi tot

 self.costumeButton = self.GetChild2("CostumeButton") 
sub el adaugam :

Cod: Selectaţi tot

			#Louie work
			self.Key = self.GetChild2("Key")
			#Louie work
Cautam :

Cod: Selectaţi tot

 self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton)) 
Adaugam sub el :

Cod: Selectaţi tot

#Louie Work
		if self.Key:
			self.Key.SetEvent(ui.__mem_func__(self.ClickKey))
#Louie Work
Cautam :

Cod: Selectaţi tot

 def ClickDSSButton(self): 
Adaugam sub

Cod: Selectaţi tot

 self.interface.ToggleDragonSoulWindow() 
asta :

Cod: Selectaţi tot

#Louie Work
	def ClickKey(self):
		import event
		qid = constInfo.mallkeyqin
		event.QuestButtonClick(qid)
#Louie
Pasul 4
intram in Game.py si cautam functia :

Cod: Selectaţi tot

 def OpenQuestWindow(self, skin, idx): 
si o inlocuiti cu aceasta :

Cod: Selectaţi tot

	def OpenQuestWindow(self, skin, idx):
		if constInfo.INPUT_IGNORE == 1:
			return
		else:
			self.interface.OpenQuestWindow(skin, idx)
 
Cautati in Game.py :

Cod: Selectaţi tot

 #Louie work 
Sub asta adaugam :

Cod: Selectaţi tot

			 "key"			: self.__def_key, 
tot aici cautam :

Cod: Selectaţi tot

				serverCommandItem[0], serverCommandItem[1]
			) 
si adaugam sub :

Cod: Selectaţi tot

#Louie work
	def __def_key(self, qid):
		constInfo.mallkeyqin = int(qid)
#End
Pasul 5
Intram in locale/Inventorywindow.py si cautam :

Cod: Selectaţi tot

							"down_image" : "d:/ymir work/ui/game/taskbar/costume_Button_03.tga",
						}, 
si adaugam sub el :

Cod: Selectaţi tot

			#Lui Work
						{
						"name" : "Key",
						"type" : "button",
					  
						"x" : 120,
						"y" : 68,
					  
						"tooltip_text" : "Key",
						
							"default_image" : "d:/ymir work/Louie/key.tga",
							"over_image" : "d:/ymir work/Louie/key1.tga",
							"down_image" : "d:/ymir work/Louie/key1.tga",
						},
			#End work
extragem arhiva : http://www.girlshare.ro/3490002096.9 in pack si adaugam in Index :

Cod: Selectaţi tot

*
Louie
*
Parola arhivei :

Cod: Selectaţi tot

 Louie 
Part II - Server Side
Pasul 1
Intram in questfunctions si adaugam :

Cod: Selectaţi tot

citire_parola
file_exists
resetare_parola
setare_parola
Pasul 2
Adaugam in questlib.lua :

Cod: Selectaţi tot

DirectorSecuritate = get_locale_base_path().."/quest/securitate/"

function citire_parola()
	local FisierPassword = DirectorSecuritate..pc.get_name().."_securitate.txt"
	local parola  
	if io.open(FisierPassword, "r") != nil then
		io.input(FisierPassword)
		parola = tonumber(io.read())
		io.input():close()
	else
		parola = 0
	end
	return parola
end

function file_exists()
	local name = DirectorSecuritate..pc.get_name().."_securitate.txt"
	local f=io.open(name,"r")
	if f!=nil then
		io.close(f)
		return true
	else
		return false
	end
end

function setare_parola(nr_buton)
	local name = DirectorSecuritate..pc.get_name().."_securitate.txt"
	io.output(name)
	io.write(tostring(nr_buton))
	io.flush()
	io.close()

end

function resetare_parola()
	local name = DirectorSecuritate..pc.get_name().."_securitate.txt"	  
	os.remove(name)
end 
Pasul 3
Adaugam cele 2 questuri :

Cod: Selectaţi tot

--------Louie Work----------------------------------------
quest securitate_inv begin
	state start begin
		function GetPassword()
			cmdchat("getinputbegin")
			password = input(cmdchat("Luu"))
			cmdchat("getinputend")
			return password
		end
		when login begin
				cmdchat("securitate_index "..q.getcurrentquestindex())
			if file_exists() != true then
				cmdchat("securiate_cont")
			else
				cmdchat("activareinv")
			end
		end
	  
		when button or info begin
			local password = securitate_inv.GetPassword()
			if tonumber(password) == tonumber(citire_parola()) then
				cmdchat("securiate_cont")
			end
		  end
	end
end

Cod: Selectaţi tot

---------Luu work --------
quest securitate_opt begin
	state start begin
		when login begin
			cmdchat("key " .. q . getcurrentquestindex ())
		end
		when button or info begin
				say_title("Securitate Inventar.")
				say("Acesta este un sistem foarte bun")
				say("care va protejaza de persoanele")
				say("care intr-un fel sau altul va intra")
				say("pe cont.Puteti sa setati parola la inventar")
				say("pe care sa o cunoasteti decat Dumneavoastra.")
			local s = select("Setare/Dezactivare parola.","Reseteaza parola.", "Poate mai tarziu")
				if s == 1 then
					local p = select("Setare parola.","Dezactivare parola.")
						if p == 1 then
							if file_exists() != true then
								say("Setati parola.")
								local item_vnum = input()
								setare_parola(item_vnum)
								cmdchat("activareinv")
							else
								say("In cazul in care va uitati parola de la inventar")
								say("luati legatura cu un Administrator !")  
								end
						elseif p == 2 then
							if file_exists() != true then
								say("Nu ati setat nici o parola pana acum.")
							else
								say("Introduceti parola")
								local item_vnum = input()
								if tonumber(item_vnum) == tonumber(citire_parola()) then
									resetare_parola()
								else
									say("Parola este gresita!!")
								end
								end
								end
				elseif s == 2 then
					if file_exists() != true then
						say("Nu ati setat nici o parola pana acum.")
					else
						say("Introduceti parola veche")
						local item_vnum = input()
						if tonumber(item_vnum) == tonumber(citire_parola()) then
							say("introduceti parola noua")
							local item_vnum1 = input()
							resetare_parola()
							setare_parola(item_vnum1)
						else
							say("Parola este gresita!!")
					end
				end
		  if s == 3 then
	end
	end
		end
	end
end
Cateva imagini :
Imagine Imagine Imagine Imagine Imagine Imagine Imagine
Uitati aici un pastebin pentru cei ce se pierd la taburi :


Daca te-am ajutat nu uita sa dai un thx :) .
dupa ce pun parola nu se deschide inventarul..
0107 13:56:24146 :: Unknown Server Command Luu | Luu
vreo idee?
Avatar utilizator
Louie
Utilizator interzis !

Utilizator interzis !
Mesaje: 50
Membru din: 26 Dec 2017, 07:18
Server: Louie-mt2
Regat: Jinno
Aprecieri: 4  
Mulţumiri: 9  
Medalii

AI urmat tutorialul din paste bin ☺️ Nu i am facut update-ul care l am facut in post revin in seara asta cu update si la link ul cu pastebin .. daca nu vrei sa astepti fa tutorialul din post si din pastebin copiezi doar tab-urile ;)

EDIT : gata am pus pastebin bun in post.

O rezolvare pentru tine pentru a nu lua tot tutorialul de la cap :

in primul quest modifici :

Cod: Selectaţi tot

quest securitate_inv begin
	state start begin
		function GetPassword()
			cmdchat("getinputbegin")
			password = input(cmdchat("Luu"))
Cu :

Cod: Selectaţi tot

quest securitate_inv begin
	state start begin
		function GetPassword()
			cmdchat("getinputbegin")
			password = input(cmdchat("sistem_negot_verificare_nume"))
[ Postat de pe iPhone ] Imagine
Închis
Răspunsuri
1
Vizualizări
309
Răspunsuri
2
Vizualizări
288
Răspunsuri
4
Vizualizări
369

Înapoi la “Arhivă”

  • Informaţie
  • Cine este conectat

    Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 7 vizitatori