Jump to content

Chatting Window Renewal (Mini Version)


Recommended Posts

4 hours ago, lordsas61 said:

GetGlobalPosition Problem Solution

search ui.py

class DragButton(Button):

 

	def SetRestrictMovementArea(self, x, y, width, height):
		wndMgr.SetRestrictMovementArea(self.hWnd, x, y, width, height)



add under
 

	def GetGlobalPosition(self):
		return wndMgr.GetWindowGlobalPosition(self.hWnd)

 

for me not work

Link to comment
Share on other sites

0921 21:06:29194 :: Traceback (most recent call last):

0921 21:06:29194 ::   File "uiChat.py", line 1213, in OnRender

0921 21:06:29194 ::   File "uiChat.py", line 1158, in Refresh

0921 21:06:29194 ::   File "uiChat.py", line 1182, in RefreshBoardViewState

0921 21:06:29200 :: AttributeError
0921 21:06:29200 :: : 
0921 21:06:29200 :: 'int' object has no attribute 'GetGlobalPosition'
0921 21:06:29200 :: 

yeah..same

Link to comment
Share on other sites

ui.py

 

class Window(object):

search this:

 

	def GetLocalPosition(self):
		return wndMgr.GetWindowLocalPosition(self.hWnd)

add under this:

 

	def GetGlobalPosition(self):
		return wndMgr.GetWindowGlobalPosition(self.hWnd)

I don't know why lordsas wanted to add it to the Dragbutton class.

Edited by SamuraiHUN
Link to comment
Share on other sites

14 minutes ago, SamuraiHUN said:

ui.py

 

class Window(object):

search this:

 

	def GetLocalPosition(self):
		return wndMgr.GetWindowLocalPosition(self.hWnd)

add under this:

 

	def GetGlobalPosition(self):
		return wndMgr.GetWindowGlobalPosition(self.hWnd)

I don't know why lordsas wanted to add it to the Dragbutton class.

i already have it there..

Link to comment
Share on other sites

2 hours ago, SamuraiHUN said:

ui.py

 

class Window(object):

search this:

 

	def GetLocalPosition(self):
		return wndMgr.GetWindowLocalPosition(self.hWnd)

add under this:

 

	def GetGlobalPosition(self):
		return wndMgr.GetWindowGlobalPosition(self.hWnd)

I don't know why lordsas wanted to add it to the Dragbutton class.

I already have this

Link to comment
Share on other sites

  • Honorable Member

252709OrangeWarning.pngPlease, avoid spamming this topic and when you post a problem show us a screenshot or GIF / video to help us identify the problem.

I have reviewed and double checked the entire system on a clean server file "40250", there is no problem with GetGlobalPosition function or the pickle functions, you don’t even need the pickle module in the library because it uses standard C.

About the GetGlobalPosition issue, there is only 1 GetGlobalPosition inside the Window class since 2014 so you don’t need to add another one anywhere else and the system doesn’t even call this function inside the ChatWindow whatsoever.

@Maze, when you teleport, if the setting window is open, it will close, this has been fixed 21 days ago.

If you need a better guide than the tutorial guidelines I made, check the entire file I implemented the system clicking the link below.

This is the hidden content, please

252051BlueInfo.pngTroubleshooting on older clients.

Spoiler

 Error:

<type 'exceptions.TypeError'>:__pack_import() takes at most 4 arguments (5 given)

Solution:

''' 1. @ system.py '''
# Search
def __pack_import(name, globals = None, locals = None, fromlist = None):

# Replace with
def __pack_import(name, globals = None, locals = None, fromlist = None, level = -1):

Error:

File "Lib\copy_reg.py", line 70, in _reduce_ex
<TypeError> can't pickle file objects

Solution: (This has been fixed 15 days ago, check the repository for a detailed log.)

''' 1. @ uiChat.py '''
# Search and remove
					cPickle.dumps(file)

 

Here is also a preview of the system working on an older client which sources and root files are clean / basic.

Preview: https://metin2.download/picture/R9TZiGfo73WdqDZ2rOLpSFJO6flaE9m2/.gif

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 55
  • Eyes 1
  • Dislove 1
  • Not Good 1
  • Confused 1
  • Scream 3
  • Good 14
  • Love 2
  • Love 17
Link to comment
Share on other sites

8 hours ago, Owsap said:

252709OrangeWarning.pngPlease, avoid spamming this topic and when you post a problem show us a screenshot or GIF / video to help us identify the problem.

I have reviewed and double checked the entire system on a clean server file "40250", there is no problem with GetGlobalPosition function or the pickle functions, you don’t even need the pickle module in the library because it uses standard C.

About the GetGlobalPosition issue, there is only 1 GetGlobalPosition inside the Window class since 2014 so you don’t need to add another one anywhere else and the system doesn’t even call this function inside the ChatWindow whatsoever.

@Maze, when you teleport, if the setting window is open, it will close, this has been fixed 21 days ago.

If you need a better guide than the tutorial guidelines I made, check the entire file I implemented the system clicking the link below.

 

252051BlueInfo.pngTroubleshooting on older clients.

  Reveal hidden contents

 Error:

<type 'exceptions.TypeError'>:__pack_import() takes at most 4 arguments (5 given)

Solution:

''' 1. @ system.py '''
# Search
def __pack_import(name, globals = None, locals = None, fromlist = None):

# Replace with
def __pack_import(name, globals = None, locals = None, fromlist = None, level = -1):

Error:

File "Lib\copy_reg.py", line 70, in _reduce_ex
<TypeError> can't pickle file objects

Solution: (This has been fixed 15 days ago, check the repository for a detailed log.)

''' 1. @ uiChat.py '''
# Search and remove
					cPickle.dumps(file)

 

Here is also a preview of the system working on an older client which sources and root files are clean / basic.

Preview: https://metin2.download/picture/R9TZiGfo73WdqDZ2rOLpSFJO6flaE9m2/.gif

Here is the video

Here is my uiChat.py

https://pastebin.com/fy5abTU7

just compared like 5 times with the uichat.py you posted above.

(also re-checked the client source part)

and here is the error the people get

0922 10:53:17367 :: Traceback (most recent call last):

0922 10:53:17367 ::   File "uiChat.py", line 1205, in OnRender

0922 10:53:17368 ::   File "uiChat.py", line 1150, in Refresh

0922 10:53:17368 ::   File "uiChat.py", line 1174, in RefreshBoardViewState

0922 10:53:17368 :: AttributeError
0922 10:53:17368 :: : 
0922 10:53:17368 :: 'int' object has no attribute 'GetGlobalPosition'
0922 10:53:17368 :: 

as i understand, when you warp Destroy will set self.btnChatSizing = 0

and will remain like that,it will not set

self.btnChatSizing = btnChatSizing again

commenting #define ENABLE_CHATTING_WINDOW_RENEWAL

in local_inc.h (disabling the sistem) solves the problem,the error doesn't appear anymore.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Confused 1
Link to comment
Share on other sites

3 hours ago, HaiosMotan said:

Here is the video

Here is my uiChat.py

 

Hidden Content

  • Give reaction to this post to see the hidden content.

 

just compared like 5 times with the uichat.py you posted above.

(also re-checked the client source part)

and here is the error the people get

0922 10:53:17367 :: Traceback (most recent call last):

0922 10:53:17367 ::   File "uiChat.py", line 1205, in OnRender

0922 10:53:17368 ::   File "uiChat.py", line 1150, in Refresh

0922 10:53:17368 ::   File "uiChat.py", line 1174, in RefreshBoardViewState

0922 10:53:17368 :: AttributeError
0922 10:53:17368 :: : 
0922 10:53:17368 :: 'int' object has no attribute 'GetGlobalPosition'
0922 10:53:17368 :: 

as i understand, when you warp Destroy will set self.btnChatSizing = 0

and will remain like that,it will not set

self.btnChatSizing = btnChatSizing again

commenting #define ENABLE_CHATTING_WINDOW_RENEWAL

in local_inc.h (disabling the sistem) solves the problem,the error doesn't appear anymore.

Is it possible that you didn't call locale_inc.h from the Userinterface project somewhere?

Link to comment
Share on other sites

You guys are looking for the solution by looking at the wrong problem. The syserr may tell you something related to GetGlobalPosition, but that's not really the problem. The solution is easier than it sounds:

#--1
#In the def __init__ from the class ChatSettingWindow:
#Replace this:
		def __init__(self, parent):
#With this:
		def __init__(self):

#In the same define, search and delete:
			self.parent = parent

#--2
#In this define
		def __OnClickSave(self):
#Delete this:
			if self.parent:
				self.parent.RefreshChatWindow()

#--3
#In this define
		def __QuestionPopupAccept(self):
#Delete this:
			if self.parent:
				self.parent.RefreshChatWindow()

# --4
#Replace this:
self.wndChatSettingOption = ChatSettingWindow(self)
#With this:
self.wndChatSettingOption = ChatSettingWindow()

Try again, and the "OnRender" after teleport will works good. 😉

Edited by Schyck
Added 4th step
  • Metin2 Dev 1
  • Love 2
Link to comment
Share on other sites

26 minutes ago, Schyck said:

You guys are looking for the solution by looking at the wrong problem. The syserr may tell you something related to GetGlobalPosition, but that's not really the problem. The solution is easier than it sounds:

#--1
#In the def __init__ from the class ChatSettingWindow:
#Replace this:
		def __init__(self, parent):
#With this:
		def __init__(self):

#In the same define, search and delete:
			self.parent = parent

#--2
#In this define
		def __OnClickSave(self):
#Delete this:
			if self.parent:
				self.parent.RefreshChatWindow()

#--3
#In this define
		def __QuestionPopupAccept(self):
#Delete this:
			if self.parent:
				self.parent.RefreshChatWindow()

Try again, and the "OnRender" after teleport will works good. 😉

first thing

you need to change

self.wndChatSettingOption = ChatSettingWindow(self)

to 

self.wndChatSettingOption = ChatSettingWindow()

but after you done this all,the system doesn't work as intended,because you just deleted the RefreshChatWindow()

so,if you un-check an option and save,the chat will not refresh => the messages you want to dissapear,don't dissapear

Link to comment
Share on other sites

Spoiler
10 minutes ago, HaiosMotan said:

first thing

you need to change

self.wndChatSettingOption = ChatSettingWindow(self)

to 

self.wndChatSettingOption = ChatSettingWindow()

but after you done this all,the system doesn't work as intended,because you just deleted the RefreshChatWindow()

so,if you un-check an option and save,the chat will not refresh => the messages you want to dissapear,don't dissapear

 

Yes, I forgot to put that part in the post I made. But what I put was the solution for the problem you were having. What you comment now can be easily solved if you use your reasoning a little.

Here we go:

# Just delete all related with "RefreshChatWindow" (except define, obviously), and change this define like this:
	def OnUpdate(self):
		if self.boardState == chatm2g.BOARD_STATE_EDIT:
			if app.ENABLE_CHATTING_WINDOW_RENEWAL:
				self.RefreshChatWindow()
			chatm2g.Update(self.chatID)
		elif self.boardState == chatm2g.BOARD_STATE_VIEW:
			if systemSetting.IsViewChat():
				if app.ENABLE_CHATTING_WINDOW_RENEWAL:
					self.RefreshChatWindow()
				chatm2g.Update(self.chatID)

# That's all!

 

Edited by Schyck
  • Metin2 Dev 1
  • Love 4
Link to comment
Share on other sites

2 hours ago, Schyck said:
  Hide contents

 

Yes, I forgot to put that part in the post I made. But what I put was the solution for the problem you were having. What you comment now can be easily solved if you use your reasoning a little.

Here we go:

# Just delete all related with "RefreshChatWindow" (except define, obviously), and change this define like this:
	def OnUpdate(self):
		if self.boardState == chatm2g.BOARD_STATE_EDIT:
			if app.ENABLE_CHATTING_WINDOW_RENEWAL:
				self.RefreshChatWindow()
			chatm2g.Update(self.chatID)
		elif self.boardState == chatm2g.BOARD_STATE_VIEW:
			if systemSetting.IsViewChat():
				if app.ENABLE_CHATTING_WINDOW_RENEWAL:
					self.RefreshChatWindow()
				chatm2g.Update(self.chatID)

# That's all!

 

FIXED. Thanks ❤️

  • Love 1
Link to comment
Share on other sites

  • Active+ Member
On 9/22/2021 at 7:33 PM, Schyck said:
  Reveal hidden contents

 

Yes, I forgot to put that part in the post I made. But what I put was the solution for the problem you were having. What you comment now can be easily solved if you use your reasoning a little.

Here we go:

# Just delete all related with "RefreshChatWindow" (except define, obviously), and change this define like this:
	def OnUpdate(self):
		if self.boardState == chatm2g.BOARD_STATE_EDIT:
			if app.ENABLE_CHATTING_WINDOW_RENEWAL:
				self.RefreshChatWindow()
			chatm2g.Update(self.chatID)
		elif self.boardState == chatm2g.BOARD_STATE_VIEW:
			if systemSetting.IsViewChat():
				if app.ENABLE_CHATTING_WINDOW_RENEWAL:
					self.RefreshChatWindow()
				chatm2g.Update(self.chatID)

# That's all!

 

It's even nicer this way because it updates in real time, thank you for the fix!

spacer.png

Link to comment
Share on other sites

  • Active Member
2 hours ago, blaxis said:

How can I position the place I marked?

(Dice's no problem. I removed.)

spacer.png

In chatsettingwindow.py you need edit 

Quote

                ## Experiencia y casilla
                {
                    "name" : "chatting_setting_exp_bg", "type" : "image", "x" : 18, "y" : XXX, <-Edit only this x e y
                    "image" : CHATTING_PATH + "chattingoption_sub_large_bg.sub",
                    "children" :
                    (
                        { "name" : "chatting_setting_exp", "type" : "text", "x" : 0, "y" : 0, "text" : uiScriptLocale.CHATTING_SETTING_EXP, "all_align":"center" },
                    ),
                },
                ## Items y casilla
                {
                    "name" : "chatting_setting_item_bg", "type" : "image", "x" : 18, "y" : XXX, <-Edit only this x e y
                    "image" : CHATTING_PATH + "chattingoption_sub_large_bg.sub",
                    "children" :
                    (
                        { "name" : "chatting_setting_item", "type" : "text", "x" : 0, "y" : 0, "text" : uiScriptLocale.CHATTING_SETTING_ITEM, "all_align":"center" },
                    ),
                },
                ## Yang y casilla
                {
                    "name" : "chatting_setting_gold_bg", "type" : "image", "x" : 18, "y" : XXX, <-Edit only this x e y
                    "image" : CHATTING_PATH + "chattingoption_sub_large_bg.sub",
                    "children" :
                    (
                        { "name" : "chatting_setting_gold", "type" : "text", "x" : 0, "y" : 0, "text" : uiScriptLocale.CHATTING_SETTING_GOLD, "all_align":"center" },
                    ),
                },

edit only XXX, <-Edit only this x e y with numbers if don't remember bad you need add 18 i mean  exp = 10 item = 10+18 =28 etc

Edited by Metin2 Dev
Core X - External 2 Internal

KH.jpg

Nicks: Nazox Krone Nagato Yahiko Yakiro
Proyecto: Trabajando en el.
Compañeros & firma: DreamHQ  - 2009-2015 [Nostalgia]

Link to comment
Share on other sites

  • Active+ Member
29 minutes ago, nazox said:

In chatsettingwindow.py you need edit 

edit only XXX, <-Edit only this x e y with numbers if don't remember bad you need add 18 i mean  exp = 10 item = 10+18 =28 etc

I tried it but it didn't work. I couldn't find the location setting of the CheckBox.

spacer.png

@nazox I solved, thank you

uichat.py;

if key >= OPTION_CHECKBOX_EXP_INFO:
	yPos = 64 + (31 * 2)

I changed with;

if key >= OPTION_CHECKBOX_EXP_INFO:
	yPos = 64 + (31 * 2.6)

spacer.png

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Good 1
Link to comment
Share on other sites

  • Active Member
20 minutes ago, blaxis said:

Lo intenté pero no funcionó. No pude encontrar la configuración de ubicación de CheckBox.

spacer.png

@nazox Lo resolví, gracias

uichat.py;

     

Me cambié con;

     

spacer.png

 

Good! if you need help to remove dice tell me 🙂

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1

KH.jpg

Nicks: Nazox Krone Nagato Yahiko Yakiro
Proyecto: Trabajando en el.
Compañeros & firma: DreamHQ  - 2009-2015 [Nostalgia]

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.