Jump to content

HaiosMotan

Member
  • Posts

    73
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by HaiosMotan

  1. there is one check here

    bool CPythonNetworkStream::SendItemUsePacket(TItemPos pos)
    {
    	if (!__CanActMainInstance())
    		return true;
    
    	if (__IsEquipItemInSlot(pos))
    	{
    		if (CPythonExchange::Instance().isTrading())
    		{
    			PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_AppendNotifyMessage", Py_BuildValue("(s)", "CANNOT_EQUIP_EXCHANGE"));
    			return true;
    		}
    
    		if (CPythonShop::Instance().IsOpen())
    		{
    			PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_AppendNotifyMessage", Py_BuildValue("(s)", "CANNOT_EQUIP_SHOP"));
    			return true;
    		}
    
    		if (__IsPlayerAttacking())
    			return true;
    	}

    but as you can see it's only for when you right click on an equiped item,you can delete that check " if (__IsEquipItemInSlot(pos)) " and it will be for all. (i think)

  2. uiinventory.py

    def UseItemSlot(self, slotIndex):

    find at the bottom

     

    			self.__UseItem(slotIndex)
    			mouseModule.mouseController.DeattachObject()
    			self.OverOutItem()

    add above

    			if exchange.isTrading():
    				chat.AppendChat(1, "[Exchange]You can't do this while exchanging.")
    				return
    			if shop.IsOpen():
    				chat.AppendChat(1, "[Shop]You can't do this while shoping.")
    				return

    be sure you have

    import exchgange
    import shop

     

  3. 39 minutes ago, ReFresh said:

    @HaiosMotan In this case items are stacked only when you drop them to the floor and pick up them again, they aren't stacking in inventory directly.

    uiInventory.py

    def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):

    def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):

    search 

    USE_CHANGE_ATTRIBUTE

    change for both

    			elif "USE_CHANGE_ATTRIBUTE" == useType:	
    				if self.__CanChangeItemAttrList(dstSlotPos) or srcItemVNum == player.GetItemIndex(dstSlotPos):
    					return True
    			elif "USE_ADD_ATTRIBUTE" == useType:		
    				if self.__CanAddItemAttr(dstSlotPos) or srcItemVNum == player.GetItemIndex(dstSlotPos):
    					return True

     

  4. 14 hours ago, blaxis said:

    Thank you very much 🙂 

    I'm just wondering one thing.
    What exactly is the "experience" feature? I want to test it but I don't understand what it is.

    char.cpp

    case POINT_EXP:
     

    					if (test_server)
    						ChatPacket(CHAT_TYPE_INFO, "You have gained %d exp.", amount);

    comment if(test_server) and change CHAT_TYPE_INFO to CHAT_TYPE_EXP_INFO

    (from SCOOB)

    • Love 1
  5. 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

  6. 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.

    • Metin2 Dev 1
    • Confused 1
  7. 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..

  8. 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

  9. 19 hours ago, martysama0134 said:

    I used GetWindowRect to calculate the dropshadow area automatically:

    		AdjustSize(m_pySystem.GetWidth(), m_pySystem.GetHeight());
    
    		if (Windowed)
    		{
    			m_isWindowed = true;
    			RECT rc{};
    			GetClientRect(&rc);
    			auto windowWidth = rc.right - rc.left;
    			auto windowHeight = (rc.bottom - rc.top);
    			//TraceError("windowWidth %d == %d windowHeight %d == %d", windowWidth, m_pySystem.GetWidth(), windowHeight, m_pySystem.GetHeight());
    			RECT rc2{};
    			GetWindowRect(&rc2);
    			auto windowWidth2 = rc2.right - rc2.left;
    			auto windowHeight2 = (rc2.bottom - rc2.top);
    			//TraceError("windowWidth2 %d windowHeight2 %d", windowWidth2, windowHeight2);
    			auto windowWidthDiff = windowWidth2 - windowWidth;
    			auto windowHeightDiff = windowHeight2 - windowHeight;
    			//TraceError("windowWidthDiff %d windowHeightDiff %d", windowWidthDiff, windowHeightDiff);
    			//TraceError("GetLastError %d", ::GetLastError());
    			constexpr auto taskbarSize = 80;
    			auto dropshadowSize = (windowWidthDiff / 2 != 0) ? (windowWidthDiff / 2 - 1) : 0;
    			CMSApplication::SetPosition(((GetScreenWidth() - windowWidth) / 2) - dropshadowSize, (GetScreenHeight() - windowHeight - taskbarSize) / 2);
    		}
    		else
    		{
    			m_isWindowed = false;
    			SetPosition(0, 0);
    		}

    This one is for 1920x1080 res

    https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getwindowrect

    Old way with second window:

    		AdjustSize(m_pySystem.GetWidth(), m_pySystem.GetHeight());
    
    		if (Windowed)
    		{
    			m_isWindowed = true;
    			RECT rc{};
    			GetClientRect(&rc);
    			auto windowWidth = rc.right - rc.left;
    			auto windowHeight = (rc.bottom - rc.top);
    			//TraceError("windowWidth %d == %d windowHeight %d == %d", windowWidth, m_pySystem.GetWidth(), windowHeight, m_pySystem.GetHeight());
    			RECT rc2{};
    			GetWindowRect(&rc2);
    			auto windowWidth2 = rc2.right - rc2.left;
    			auto windowHeight2 = (rc2.bottom - rc2.top);
    			//TraceError("windowWidth2 %d windowHeight2 %d", windowWidth2, windowHeight2);
    			auto windowWidthDiff = windowWidth2 - windowWidth;
    			auto windowHeightDiff = windowHeight2 - windowHeight;
    			//TraceError("windowWidthDiff %d windowHeightDiff %d", windowWidthDiff, windowHeightDiff);
    			//TraceError("GetLastError %d", ::GetLastError());
    			auto dropshadowSize = (windowWidthDiff / 2 != 0) ? (windowWidthDiff / 2 - 1) : 0;
    #ifdef ENABLE_CENTERED_CLIENT_WINDOW
    			constexpr auto taskbarSize = 80;
    			CMSApplication::SetPosition(((GetScreenWidth() - windowWidth) / 2) - dropshadowSize, (GetScreenHeight() - windowHeight - taskbarSize) / 2);
    #else
    			constexpr auto taskbarSize = 73;
    			constexpr auto titlebarSize = 10;
    			if (bAnotherWindow)
    				CMSApplication::SetPosition(GetScreenWidth() - windowWidth - dropshadowSize, GetScreenHeight() - windowHeight - taskbarSize);
    			else
    				SetPosition(-dropshadowSize, -titlebarSize);
    #endif
    		}
    		else
    		{
    			m_isWindowed = false;
    			SetPosition(0, 0);
    		}

     

    isn't there any way of using

    HWND taskBar = FindWindow(L"Shell_traywnd", NULL);

    to find the exact height of the taskbar? some use big taskbar(default) others use "Use small taskbar buttons".

    tried 2 ways from the comments and both leave gaps between m2 client and taskbar(ofcourse,i can increase the number of pixels for me,but it could make it worse for others)

    • Metin2 Dev 2
  10. 4 minutes ago, TMP4 said:

    Can we edit the playable area? I think the best method to solve the height problem is to subtract some pixel, if it's possible.
    (So the taskbar will not hide the bottom of the client)

    isn't this what marty said above?

     

    2 hours ago, martysama0134 said:

    I cut it in order to see the whole client in 1920x1080 res (otherwise the Windows taskbar will eat up some pixels), Set titlebarSize to 0, otherwise set titlebarSize to 0 only if m_pySystem.GetHeight() >= 1000.

    auto titlebarSize = (m_pySystem.GetHeight() >= 1000) ? 10 : 0;

     

     

×
×
  • 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.