5 mesaje
  • Mesaje: 50
  • Reacții: 67
  • Mesaje utile: 2
  • Status: Pierd vremea ^.^
  • Regat: Jinno
  • Contact:

    Medalii

    *Problemă/Întrebare: Buna ziua am creat si eu acest system pentru soapta pentru gm el imi apare merge cu sopata cand fac mai mare ca cand apas pe buton nu merge butonul , daca puteti sa ma ajutati sa merge butoanele, am incercat toate modalitatice poate aveti voi niste idei cum poate sa merge butoanele nu merge cand apas pe el.

    *Resursă folosită (sistem/funcție/modificare): l-am facut eu

    *Syserr: nu apare nimic

    *Fișier(e) cu problema (link pastebin / code):

    uiwhisper.py:

    Code:
    import ui
    import os
    import app
    import net
    import player
    import app
    import chat
    import net
    import wndMgr
    import guild
    import chr
    import time
    import nonplayer
    import localeInfo
    import constInfo
    import interfaceModule
    import uiToolTip
    import item
    
    if app.ENABLE_WHISPER_RENEWAL:
    	import whisper
    	b_name = "Typing."
    
    if app.ENABLE_ADD_BLOCK_WHISPER_BUTTON:
    	import uiCommon
    	import messenger
    
    if app.ENABLE_WHISPER_GM:
    	import uiWhisperGM
    
    class WhisperButton(ui.Button):
    	def __init__(self):
    		ui.Button.__init__(self, "TOP_MOST")
    
    	def __del__(self):
    		ui.Button.__del__(self)
    
    	def SetToolTipText(self, text, x=0, y = 32):
    		ui.Button.SetToolTipText(self, text, x, y)
    		self.ToolTipText.Show()
    
    	def SetToolTipTextWithColor(self, text, color, x=0, y = 32):
    		ui.Button.SetToolTipText(self, text, x, y)
    		self.ToolTipText.SetPackedFontColor(color)
    		self.ToolTipText.Show()
    
    	def ShowToolTip(self):
    		if 0 != self.ToolTipText:
    			self.ToolTipText.Show()
    
    	def HideToolTip(self):
    		if 0 != self.ToolTipText:
    			self.ToolTipText.Show()
    
    class WhisperDialog(ui.ScriptWindow):
    
    	class TextRenderer(ui.Window):
    		def SetTargetName(self, targetName):
    			self.targetName = targetName
    
    		def OnRender(self):
    			(x, y) = self.GetGlobalPosition()
    			chat.RenderWhisper(self.targetName, x, y)
    
    	class ResizeButton(ui.DragButton):
    
    		def __init__(self):
    			ui.DragButton.__init__(self)
    
    		def __del__(self):
    			ui.DragButton.__del__(self)
    
    		def OnMouseOverIn(self):
    			app.SetCursor(app.HVSIZE)
    
    		def OnMouseOverOut(self):
    			app.SetCursor(app.NORMAL)
    
    	def __init__(self, eventMinimize, eventClose):
    		ui.ScriptWindow.__init__(self)
    		self.targetName = ""
    		self.eventMinimize = eventMinimize
    		self.eventClose = eventClose
    		self.eventAcceptTarget = None
    	
    		if app.ENABLE_WHISPER_GM:
    			if chr.IsGameMaster(player.GetMainCharacterIndex()):
    				self.gmBoard = uiWhisperGM.WhisperGMBoard()
    				self.gmBoard.SetParent(self)
    				self.gmBoard.Hide()
    
    	def __del__(self):
    		print "---------------------------------------------------------------------------- DELETE WHISPER DIALOG"
    		ui.ScriptWindow.__del__(self)		
    
    	def LoadDialog(self):
    		try:
    			pyScrLoader = ui.PythonScriptLoader()
    			pyScrLoader.LoadScriptFile(self, "UIScript/WhisperDialog.py")
    
    		except:
    			import exception
    			exception.Abort("WhisperDialog.LoadDialog.LoadScript")
    
    		try:
    			GetObject=self.GetChild
    			self.titleName = GetObject("titlename")
    			self.titleNameEdit = GetObject("titlename_edit")
    			self.closeButton = GetObject("closebutton")
    			self.scrollBar = GetObject("scrollbar")
    			self.chatLine = GetObject("chatline")
    			self.minimizeButton = GetObject("minimizebutton")
    			self.ignoreButton = GetObject("ignorebutton")
    			self.reportViolentWhisperButton = GetObject("reportviolentwhisperbutton")
    			self.acceptButton = GetObject("acceptbutton")
    			self.sendButton = GetObject("sendbutton")
    			self.board = GetObject("board")
    			self.editBar = GetObject("editbar")
    			self.gamemasterMark = GetObject("gamemastermark")
    			
    			if app.ENABLE_ADD_BLOCK_WHISPER_BUTTON:
    				self.addFriendButton = self.GetChild("AddFriendButton")
    				self.blockFriendButton = self.GetChild("BlockFrindButton")
    			
    			if app.ENABLE_WHISPER_RENEWAL:
    				self.typing = GetObject("typing")
    
    		except:
    			import exception
    			exception.Abort("DialogWindow.LoadDialog.BindObject")
    
    		self.gamemasterMark.Hide()
    		self.titleName.SetText("")
    		self.titleNameEdit.SetText("")
    		
    		self.minimizeButton.SetEvent(ui.__mem_func__(self.Minimize))
    		self.closeButton.SetEvent(ui.__mem_func__(self.Close))
    		
    		if app.ENABLE_ADD_BLOCK_WHISPER_BUTTON:
    			self.addFriendButton.SetEvent(ui.__mem_func__(self.OnPressAddFriendButton))
    			self.blockFriendButton.SetEvent(ui.__mem_func__(self.OnPressBlockFriendButton))
    		
    		self.scrollBar.SetPos(1.0)
    		self.scrollBar.SetScrollEvent(ui.__mem_func__(self.OnScroll))
    		self.chatLine.SetReturnEvent(ui.__mem_func__(self.SendWhisper))
    		self.chatLine.SetEscapeEvent(ui.__mem_func__(self.Minimize))
    		self.chatLine.SetMultiLine()
    		self.sendButton.SetEvent(ui.__mem_func__(self.SendWhisper))
    		self.titleNameEdit.SetReturnEvent(ui.__mem_func__(self.AcceptTarget))
    		self.titleNameEdit.SetEscapeEvent(ui.__mem_func__(self.Close))
    		self.ignoreButton.SetToggleDownEvent(ui.__mem_func__(self.IgnoreTarget))
    		self.ignoreButton.SetToggleUpEvent(ui.__mem_func__(self.IgnoreTarget))
    		self.reportViolentWhisperButton.SetEvent(ui.__mem_func__(self.ReportViolentWhisper))
    		self.acceptButton.SetEvent(ui.__mem_func__(self.AcceptTarget))
    
    		self.textRenderer = self.TextRenderer()
    		self.textRenderer.SetParent(self)
    		self.textRenderer.SetPosition(20, 28)
    		self.textRenderer.SetTargetName("")
    		self.textRenderer.Show()
    
    		self.resizeButton = self.ResizeButton()
    		self.resizeButton.SetParent(self)
    		self.resizeButton.SetSize(20, 20)
    		self.resizeButton.SetPosition(325, 220)
    		self.resizeButton.SetMoveEvent(ui.__mem_func__(self.ResizeWhisperDialog))
    		self.resizeButton.Show()
    
    		self.UpdateGMBoardPosition()
    		self.ResizeWhisperDialog()
    
    	def Destroy(self):
    
    		self.eventMinimize = None
    		self.eventClose = None
    		self.eventAcceptTarget = None
    
    		self.ClearDictionary()
    		self.scrollBar.Destroy()
    		self.titleName = None
    		self.titleNameEdit = None
    		self.closeButton = None
    		self.scrollBar = None
    		self.chatLine = None
    		self.sendButton = None
    		self.ignoreButton = None
    		self.reportViolentWhisperButton = None
    		self.acceptButton = None
    		self.minimizeButton = None
    		self.textRenderer = None
    		self.board = None
    		self.gmBoard = None
    		self.editBar = None
    		self.resizeButton = None
    
    	def ResizeWhisperDialog(self):
    		(xPos, yPos) = self.resizeButton.GetLocalPosition()
    		if xPos < 325:
    			self.resizeButton.SetPosition(325, yPos)
    			return
    
    		if yPos < 150:
    			self.resizeButton.SetPosition(xPos, 150)
    			return
     
    		self.SetWhisperDialogSize(xPos + 20, yPos + 20)
    
    	def SetWhisperDialogSize(self, width, height):
    		try:
    
    			max = int((width-90)/6) * 3 - 6
    
    			self.board.SetSize(width, height)
    			self.scrollBar.SetPosition(width-25, 35)
    			self.scrollBar.SetScrollBarSize(height-100)
    			self.scrollBar.SetPos(1.0)
    			self.editBar.SetSize(width-18, 50)
    			self.chatLine.SetSize(width-90, 40)
    			self.chatLine.SetLimitWidth(width-90)
    			self.SetSize(width, height)
    
    			if 0 != self.targetName:
    				chat.SetWhisperBoxSize(self.targetName, width - 50, height - 90)			
    			
    			self.textRenderer.SetPosition(20, 28)
    			self.scrollBar.SetPosition(width-25, 35)
    			self.editBar.SetPosition(10, height-60)
    			self.sendButton.SetPosition(width-80, 10)
    			self.minimizeButton.SetPosition(width-42, 12)
    			self.closeButton.SetPosition(width-24, 12)
    
    			self.SetChatLineMax(max)
    
    		except:
    			import exception
    			exception.Abort("WhisperDialog.SetWhisperDialogSize.BindObject")
    
    		if app.ENABLE_WHISPER_GM and hasattr(self, 'gmBoard'):
    			self.UpdateGMBoardPosition()
    
    	if app.ENABLE_WHISPER_GM:
    		def UpdateGMBoardPosition(self):
    			if self.gmBoard and self.gmBoard.IsShowButton():
    				board_width, board_height = self.gmBoard.GetWidth(), self.gmBoard.GetHeight()
    				new_x = (self.GetWidth() - board_width) // 2
    				new_y = self.GetHeight()
    				self.gmBoard.SetPosition(new_x, new_y)
    
    	def SetChatLineMax(self, max):
    		self.chatLine.SetMax(max)
    
    		from grpText import GetSplitingTextLine
    
    		text = self.chatLine.GetText()
    		if text:
    			self.chatLine.SetText(GetSplitingTextLine(text, max, 0))
    
    	def OpenWithTarget(self, targetName):
    		chat.CreateWhisper(targetName)
    		chat.SetWhisperBoxSize(targetName, self.GetWidth() - 60, self.GetHeight() - 90)
    		
    		self.chatLine.SetFocus()
    		self.titleName.SetText(targetName)
    		self.targetName = targetName
    		self.textRenderer.SetTargetName(targetName)
    		self.titleNameEdit.Hide()
    		
    		self.ignoreButton.Hide()
    		
    		if app.IsDevStage():
    			self.reportViolentWhisperButton.Show()
    		else:
    			self.reportViolentWhisperButton.Hide()
    	
    		self.acceptButton.Hide()
    		self.minimizeButton.Show()
    		self.gamemasterMark.Hide()
    		
    		if app.ENABLE_WHISPER_GM:
    			if chr.IsGameMaster(player.GetMainCharacterIndex()):
    				self.gmBoard = uiWhisperGM.WhisperGMBoard()
    				self.gmBoard.SetParent(self)
    				self.gmBoard.SetPosition(10, self.GetHeight() + 10)	 
    				self.gmBoard.Open(player.GetMainCharacterIndex())
    				
    				self.UpdateGMBoardPosition()	
    
    	def OpenWithoutTarget(self, event):
    		self.eventAcceptTarget = event
    		self.titleName.SetText("")
    		self.titleNameEdit.SetText("")
    		self.titleNameEdit.SetFocus()
    		self.targetName = 0
    		self.titleNameEdit.Show()
    		self.ignoreButton.Hide()
    		self.reportViolentWhisperButton.Hide()
    		self.acceptButton.Show()
    		self.minimizeButton.Hide()
    		self.gamemasterMark.Hide()
    
    	def SetGameMasterLook(self):
    		self.gamemasterMark.Show()
    		self.reportViolentWhisperButton.Hide()
    
    	def Minimize(self):
    		self.titleNameEdit.KillFocus()
    		self.chatLine.KillFocus()
    		self.Hide()
    
    		if app.ENABLE_WHISPER_RENEWAL:
    			if whisper.IsSended(self.targetName) and self.targetName:
    				whisper.Remove(self.targetName)
    
    		if app.ENABLE_WHISPER_GM and self.gmBoard:
    			self.gmBoard.Hide()
    
    		if None != self.eventMinimize:
    			self.eventMinimize(self.targetName)
    
    	def Close(self):
    		chat.ClearWhisper(self.targetName)
    		
    		if app.ENABLE_WHISPER_RENEWAL:
    			if self.targetName != 0:
    				if whisper.IsSended(self.targetName) and self.targetName:
    					whisper.Remove(self.targetName)
    		
    		self.titleNameEdit.KillFocus()
    		self.chatLine.KillFocus()
    		self.Hide()
    
    		if app.ENABLE_WHISPER_GM and self.gmBoard:
    			self.gmBoard.Hide()
    
    		if None != self.eventClose:
    			self.eventClose(self.targetName)
    
    	def ReportViolentWhisper(self):
    		net.SendChatPacket("/reportviolentwhisper " + self.targetName)
    
    	def IgnoreTarget(self):
    		net.SendChatPacket("/ignore " + self.targetName)
    
    	def AcceptTarget(self):
    		name = self.titleNameEdit.GetText()
    		if len(name) <= 0:
    			self.Close()
    			return
    
    		if None != self.eventAcceptTarget:
    			self.titleNameEdit.KillFocus()
    			self.eventAcceptTarget(name)
    
    	def OnScroll(self):
    		chat.SetWhisperPosition(self.targetName, self.scrollBar.GetPos())
    
    	if app.ENABLE_WHISPER_RENEWAL:
    		def SetTimer(self):
    			self.endTime = time.clock() + 0.4
    
    		def OnUpdate(self):
    			if self.targetName and self.chatLine:
    				if len(self.chatLine.GetText()) > 0 and not whisper.IsSended(self.targetName):
    					whisper.Add(self.targetName)
    
    				elif not len(self.chatLine.GetText()) > 0 and whisper.IsSended(self.targetName):
    					whisper.Remove(self.targetName)
    
    				if whisper.CheckName(self.targetName):
    					self.typing.Show()
    					lastTime = max(0, self.endTime - time.clock())
    					
    					if 0 == lastTime:
    						if len(self.typing.GetText()) - len(b_name) < 3:
    							self.typing.SetText(self.typing.GetText() + ".")
    						else:
    							self.typing.SetText(b_name)	
    
    						self.SetTimer()
    				else:
    					self.typing.Hide()
    
    	def SendWhisper(self):
    		import time
    		
    		text = self.chatLine.GetText()
    		textLength = len(text)
    
    		if textLength > 0:
    			if app.LINK_IN_CHAT:
    				link = self.GetLink(text)
    				if link != "":
    					import chr
    					
    					if not chr.IsGameMaster():
    						text = text.replace(link, "|cFF00C0FC|h|Hweb:" + link.replace("://", "XxX") + "|h" + link + "|h|r")
    					else:
    						text = text.replace(link, "|cFF00C0FC|h|Hsysweb:" + link.replace("://", "XxX") + "|h" + link + "|h|r")
    
    			if net.IsInsultIn(text):
    				chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_INSULT_STRING)
    				return
    			
    			Saat = time.strftime("%H:%M:%S")
    			net.SendWhisperPacket(self.targetName, " |cFFFFA500|h(Lv. " + str(player.GetStatus(player.LEVEL)) + ") " "(Ora " + Saat + ") :|cff00ff00|h "	 + text)
    			self.chatLine.SetText("")
    
    			chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, self.targetName, player.GetName() + " |cFFFFA500|h(Lv. " + str(player.GetStatus(player.LEVEL)) + ") " "(Ora " + Saat + ") : "	 + text)
    
    	def OnTop(self):
    		self.chatLine.SetFocus()
    	
    	def BindInterface(self, interface):
    		self.interface = interface
    
    	def OnMouseLeftButtonDown(self):
    		hyperlink = ui.GetHyperlink()
    		if hyperlink:
    			if app.IsPressed(app.DIK_LALT):
    				link = chat.GetLinkFromHyperlink(hyperlink)
    				ime.PasteString(link)
    			else:
    				self.interface.MakeHyperlinkTooltip(hyperlink)
    
    	if app.ENABLE_ADD_BLOCK_WHISPER_BUTTON:
    		def OnPressAddFriendButton(self):
    			addFriendButton = uiCommon.AddFriendButton()
    			addFriendButton.SetText(localeInfo.WHISPER_QUEST_FRIEND % (self.targetName))
    			addFriendButton.SetAcceptEvent(ui.__mem_func__(self.OnAddFriend))
    			addFriendButton.SetCancelEvent(ui.__mem_func__(self.OnCancelAddFriend))
    			addFriendButton.Open()
    			
    			self.addFriendButton = addFriendButton
    
    		def OnAddFriend(self):
    			net.SendMessengerAddByNamePacket(self.targetName)
    			self.addFriendButton.Close()
    			self.addFriendButton = None
    			
    			return True
    
    		def OnCancelAddFriend(self):
    			self.addFriendButton.Close()
    			self.addFriendButton = None
    			
    			return True
    
    		def OnPressBlockFriendButton(self):
    			blockFriendButton = uiCommon.BlockFriendButton()
    			blockFriendButton.SetText(localeInfo.WHISPER_QUEST_BLOCK % (self.targetName))
    			blockFriendButton.SetAcceptEvent(ui.__mem_func__(self.OnBlockFriend))
    			blockFriendButton.SetCancelEvent(ui.__mem_func__(self.OnCancelBlockFriend))
    			blockFriendButton.Open()
    			
    			self.blockFriendButton = blockFriendButton
    
    		def OnBlockFriend(self):
    			net.SendMessengerAddBlockByNamePacket(self.targetName)
    			self.blockFriendButton.Close()
    			self.blockFriendButton = None
    			
    			return True
    
    		def OnCancelBlockFriend(self):
    			self.blockFriendButton.Close()
    			self.blockFriendButton = None
    			
    			return True
    
    	if app.LINK_IN_CHAT:
    		def GetLink(self, text):
    			link = ""
    			start = text.find("http://")
    			
    			if start == -1:
    				start = text.find("https://")
    
    			if start == -1:
    				return ""
    
    			return text[start:len(text)].split(" ")[0]
    
    if "__main__" == __name__:
    	import uiTest
    
    	class TestApp(uiTest.App):
    		def OnInit(self):
    			wnd = WhisperDialog(self.OnMax, self.OnMin)
    			wnd.LoadDialog()
    			wnd.OpenWithoutTarget(self.OnNew)
    			wnd.SetPosition(0, 0)
    			wnd.Show()
    
    			self.wnd = wnd
    
    		def OnMax(self):
    			pass
    
    		def OnMin(self):
    			pass
    
    		def OnNew(self):
    			pass
    
    	TestApp().MainLoop()
    
    


    uiwhispergm.py
    Code:
    import ui
    import net
    import player
    import chr
    
    class WhisperGMBoard(ui.ThinBoard):
        BUTTONS = (
            ("Kick", "/dc "),
            ("Stun", "/stun "),
            ("Kill", "/kill "),
            ("Map1", "/map1 "),
        )
    
        def __init__(self):
            ui.ThinBoard.__init__(self)
            self.SetSize(len(self.BUTTONS) * 80, 40)
            self.buttons = []
            self.vid = 0
    
            posX = 10
            for text, command in self.BUTTONS:
                btn = ui.Button()
                btn.SetParent(self)
                btn.SetUpVisual("d:/ymir work/ui/public/small_thin_button_01.sub")
                btn.SetOverVisual("d:/ymir work/ui/public/small_thin_button_02.sub")
                btn.SetDownVisual("d:/ymir work/ui/public/small_thin_button_03.sub")
                btn.SetText(text)
                btn.SetPosition(posX, 10)
                btn.SAFE_SetEvent(self.OnCommand, command)
                btn.Show()
                self.buttons.append(btn)
                posX += 80
    
            self.Hide()
    
        def Open(self, vid):
            self.vid = vid
            self.Show()
    
        def IsShowButton(self):
            return self.IsShow()
    
        def OnCommand(self, command):
            if not self.vid:
                return
            targetName = chr.GetNameByVID(self.vid)
            if not targetName:
                return
    
            net.SendChatPacket(command + targetName)
    
    


    *Poze / Video: las si poza aici

    Problema soapta - Mesaj 1 - Imagine 1

    🔥 Hai pe Discord! - Chat activ și support direct

    Te așteptăm și pe serverul de Discord - aici ne-am strâns toată comunitatea de Metin2 din România.

    Alătură-te acum!
    1300+ de membri activi!
    Robot Discord
    Roboțelu'
    Anunț
    Robot Robot
  • Mesaje: 122
  • Reacții: 0
  • Mesaje utile: 0
  • Status: Sunt doar un Bot :)
  • Regat: Shinsoo
  • Contact:

    Medalii

    Avatar utilizator
    Robot
    Robot

    Mesaj de Uriel »

    Salut, mrpower8098!

    Îți recomand câteva link-uri utile care te pot ajuta să rezolvi problema mai rapid:

    - Alte probleme rezolvate
    - Fixuri Metin2
    - Tutoriale
    - Cum resetez parola MySQL
    - Compilare sursă Metin2
    - Lista FreeBSD pentru compilare


    Și dacă vrei ajutor direct, te așteptăm pe serverul nostru de Discord — chat activ, suport live și o comunitate faină gata să te ajute! Pentru a intra pe serverul de Discord: Click aici
  • Mesaje: 6
  • Reacții: 3
  • Mesaje utile: 0
  • Status: Pierd vremea ^.^
  • Regat: Jinno
  • Medalii

    in uiwhispergm.py

    Schimba
    Code:
    btn.SAFE_SetEvent(self.OnCommand, command)
    
    Cu
    Code:
    btn.SetEvent(ui.__mem_func__(self.OnCommand), command)
  • Mesaje: 50
  • Reacții: 67
  • Mesaje utile: 2
  • Status: Pierd vremea ^.^
  • Regat: Jinno
  • Contact:

    Medalii

    am bagat da tot nu merge sa apas pe buton nu pot sa dau kill sau alt ceva
    Moderator Moderator
  • Mesaje: 163
  • Reacții: 2096
  • Mesaje utile: 7
  • Status: Recuperator de taxe .
  • Regat: Jinno
  • [ID Discord]
  • Contact:

    Medalii

    Avatar utilizator
    Moderator
    Moderator

    Mesaj de annoyed__ »

    sal ai mai multe greseli
    prima si aia care nu ti da voie sa dai click e ca ai setparent self in init in uiwishper si automat ce e inafara chatului nu e clickabil
    in openwithtarget deschizi cu vid u tau :)))
    si deja ai pus in init self.gmBoard = uiWhisperGM.WhisperGMBoard() deci nu l mai pui inca odata acolo
    ca sa faci sa fie lipita de fereastra de chat dar inafara ai mai multe optiuni , ancorezi sau faci butoanele in interioru chatului :)
    daca ancorezi trebuie sa pui in on update sa verifice mereu pozitia la chat , daca pui in interioru chatului cu settop nu ai sa ai probleme :)
    See full signature

    📢 Resurse Metin2 Premium!

    Zeci de resurse Metin2 Premium - exclusive și 100% funcționale începând cu 15.99€!.

    Vezi resursele Cumpără premium
    Premium
    Premium
    Anunț
    Închis

    Înapoi la “Arhivă probleme”

    Informații

    Utilizatori ce navighează pe acest forum: Niciun utilizator înregistrat și 1 vizitator

    Discord ID copiat: