Jump to content

CORKY

Premium
  • Posts

    85
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by CORKY

  1. 12 hours ago, Refuse1337 said:

    I found 1 bug, if press or hold in right corner on the top (where is close, minimize etc..), the client still freezing 

    You need to handle manually the min/max/close buttons. You can do it like the following:

     

    		case WM_NCLBUTTONDOWN:
    			{
    				switch (wParam)
    				{
    					case HTMINBUTTON:
    						ShowWindow(hWnd, SW_MINIMIZE);
    						return 0;
    					case HTMAXBUTTON:
    					case HTSYSMENU:
    						return 0;
    					case HTCLOSE:
    						RunPressExitKey();
    						return 0;
    					case HTCAPTION:
    						if (!IsUserMovingMainWindow())
    							SetUserMovingMainWindow(true);
    
    					return 0;
    				}
    
    				break;
    			}


    Additionally, I've also blocked the HTSYSMENU param, otherwise, the players can click on the application icon that's in the non-client area and it'll pop up the system menu, which will, again, freeze the application.
     

    • Metin2 Dev 1
    • Good 1
  2. I've fixed it entirely by creating a separate detached thread for the process function. I've tested it for about 1 hour doing duels/killing mobs, trying to fuck it up.
    If you want to try this method, revert the changes done from the main post and do the following:


    PythonApplication.cpp

    
    // Add #include <thread> if you don't have it already.
    
    // Replace CPythonApplication:Loop() with the following:
    
    void CPythonApplication::Loop()
    {
    	static bool m_started = false;
    	while (true)
    	{
    		if (IsMessage())
    		{
    			if (!MessageProcess())
    				break;
    		}
    		else
    		{
    			if (!m_started)
    			{
    				std::thread process_thread([this]()
    				{
    					while (1)
    					{
    						if (!Process())
    							break;
    					}
    				});
    
    				m_started = true;
    				process_thread.detach();
    			}
    		}
    	}
    }

     

    The result (I've spammed clicks on the window bar, moved it, constantly calling the message): 
     

    Spoiler

     

     

  3. Here's a proof of concept that does what you showed in the gif when using the cloak of courage (70038). You can remove the poly effect from the SetPolymorph function or add an argument so you can control when to spawn it or not.

    char_battle.cpp
     

    Spoiler
    //Modify FuncAggregateMonster as the following:
    
    struct FuncAggregateMonster
    {
    	LPCHARACTER m_ch;
    	FuncAggregateMonster(LPCHARACTER ch)
    	{
    		m_ch = ch;
    	}
    	void operator()(LPENTITY ent)
    	{
    		if (ent->IsType(ENTITY_CHARACTER))
    		{
    			LPCHARACTER ch = (LPCHARACTER) ent;
    			if (ch->IsPC())
    				return;
    			if (!ch->IsMonster())
    				return;
    			if (ch->GetVictim())
    				return;
    
    			if (number(1, 100) <= 50) // Temporarily attracts enemies with a 50% chance
    				if (DISTANCE_APPROX(ch->GetX() - m_ch->GetX(), ch->GetY() - m_ch->GetY()) < 5000)
    					if (ch->CanBeginFight())
    					{
    						ch->SetPolymorph(101, true); // Set polymorph to mobs that were attracted to dog (vnum 101)
    						ch->BeginFight(m_ch);
    					}
    		}
    	}
    };

     

    b7a7fcd9138b54f6f806e0069574fa35.gif

  4. It might be from LOD models. You might've deleted the _lod granny models for the specific armour but you've kept the LOD loading enabled from the client's binary.

    Check the following topic first


     if it doesn't solve your problem, disable LOD models from the client's source:

     

    Spoiler

    Locale_inc.h

     

    #define __DISABLE_LOD_LOADING__


    GameLib/ActorInstanceData.cpp
     

    // Search inside CActorInstance::SetShape(DWORD eShape, float fSpecular)
    
    			std::string stLODModelFileName;
    
    			char szLODModelFileNameEnd[256];
    			for (UINT uLODIndex=1; uLODIndex<=3; ++uLODIndex)
    			{
    				sprintf(szLODModelFileNameEnd, "_lod_%.2d.gr2", uLODIndex);
    				stLODModelFileName = CFileNameHelper::NoExtension(pkShape->m_stModelFileName) + szLODModelFileNameEnd;
    				if (!rkResMgr.IsFileExist(stLODModelFileName.c_str()))
    					break;
    				
    				CGraphicThing* pLODModelThing = (CGraphicThing *)rkResMgr.GetResourcePointer(stLODModelFileName.c_str());
    				if (!pLODModelThing)
    					break;
    
    				RegisterLODThing(0, pLODModelThing);
    			}
    
    
    
    // Replace it with:
    
    #ifndef __DISABLE_LOD_LOADING__
    		{
    			std::string stLODModelFileName;
    
    			char szLODModelFileNameEnd[256];
    			for (UINT uLODIndex=1; uLODIndex<=3; ++uLODIndex)
    			{
    				sprintf(szLODModelFileNameEnd, "_lod_%.2d.gr2", uLODIndex);
    				stLODModelFileName = CFileNameHelper::NoExtension(pkShape->m_stModelFileName) + szLODModelFileNameEnd;
    				if (!rkResMgr.IsFileExist(stLODModelFileName.c_str()))
    					break;
    				
    				CGraphicThing* pLODModelThing = (CGraphicThing *)rkResMgr.GetResourcePointer(stLODModelFileName.c_str());
    				if (!pLODModelThing)
    					break;
    
    				RegisterLODThing(0, pLODModelThing);
    			}
    		}
    #endif



    GameLib/RaceData.cpp
     

    // Search inside  CGraphicThing * CRaceData::GetLODModelThing()
    
    	if (!m_pLODModelThing)
    	{
    		std::string strLODFileName = CFileNameHelper::NoExtension(m_strBaseModelFileName) + "_lod_01.gr2";
    		if (CResourceManager::Instance().IsFileExist(strLODFileName.c_str()))
    		{
    			m_pLODModelThing = (CGraphicThing *)CResourceManager::Instance().GetResourcePointer(strLODFileName.c_str());
    		}
    	}
    
    // Replace it with:
    
    #ifndef __DISABLE_LOD_LOADING__
    	if (!m_pLODModelThing)
    	{
    		std::string strLODFileName = CFileNameHelper::NoExtension(m_strBaseModelFileName) + "_lod_01.gr2";
    		if (CResourceManager::Instance().IsFileExist(strLODFileName.c_str()))
    		{
    			m_pLODModelThing = (CGraphicThing *)CResourceManager::Instance().GetResourcePointer(strLODFileName.c_str());
    		}
    	}
    #endif

     

     

  5. In your db (you'll enter from navicat for example) you'll have a table inside player called "skill_proto". Search your desired skill from it's vnum (In my example we'll modify Aura of Sword which is the vnum 4) and modify the szDurationPoly column value. In some special cases, you'll need to modify szDurationPoly2, so keep that in mind if it doesn't work for your skill.

    Open it up and modify the cooldown values like it:
     

    Spoiler

    spacer.png

     

    Save the table, then go into your locale folder from the client and sync the skill_table with the new values like the following:
    skill_table
     

    Spoiler

    spacer.png

     

  6. Download Center

    This is the hidden content, please

     

     

     

    Example of usage is provided in the files. You can extend it and call it from server when a event starts for example, I'm sure you can find a usage for it.
    Don't forget to also replace the MSS.H from extern/include, it contains a different name for the C8 define to not interfere with windows's "implements.h" header's templates

     

    For more details, check out WinToast's official repo:
     

    This is the hidden content, please

     

     

    • Metin2 Dev 20
    • Good 4
    • muscle 1
    • Love 9
  7. Wanted to point out that on device reset, you might get your whole client frozen. That happens because the imgui's objects aren't invalidated & created again.

    To fix it, use Imgui's own implementations inside CGraphicDevice::Reset:

     

    bool CGraphicDevice::Reset()
    {
    	HRESULT hr;
    	if (FAILED(hr = ms_lpd3dDevice->TestCooperativeLevel()))
    	{
    		if (hr == D3DERR_DEVICELOST)
    			return false;
    		
    		if (hr == D3DERR_DEVICENOTRESET)
    		{
    			__DestroyPDTVertexBufferList();
    			ImGui_ImplDX9_InvalidateDeviceObjects();
    			
    			if (FAILED(hr = ms_lpd3dDevice->Reset(&ms_d3dPresentParameter))) {
    				TraceError("Failed to reset device");
    				return false;
    			}
    			
    			m_pStateManager->SetDefaultState();
    			if (!__CreatePDTVertexBufferList())
    				return false;
    			
    			ImGui_ImplDX9_CreateDeviceObjects();
    		}
    	}
    	
    	return true;
    }


    Don't forget to include imgui.h and imgui_impl_dx9.h (or imgui_impl_dx8.h depending on what you're using)

    • Love 1
  8. 14 minutes ago, Amun said:

    Actually, it does. I can use the keyboard normally(move, attack, write) while dragging/keeping the window(left click). I've not thought about fixing the right click as well(for some reason). Also, I was extremely busy, so I've not checked to see if Dumita's change will help in that regard.

     

    These being said, however, you can trigger/close the thread when entering and exiting the context menu. I don't see why you wouldn't be able to use the same solution for the right click as well.

     

    Edit: Just noticed(forgot about it) I also have a video of me moving when dragging the client:

     

    Regards,

    Amun

    What Intel was saying is that if you're holding the left/right click on the bar without moving the mouse at all, the game will still freeze for around 300-500ms.
    My post was only related to the context menu (because it was freezing the client while it was opened) so it just removes that option since no one was using it anyway.

  9. On 10/26/2022 at 11:25 PM, Tatsumaru said:

    In response to my special announcement about decorating the logo, one of the owners of the Seishin server wrote to me. Since no one else took the opportunity I decided to decorate just this logo. Here are the results:

    qZuLmBu.png

    A simple edit, but I think a nice one.

     

    Looks awesome! Great work

    • Love 1
  10. Try this:
     

    	def SetToolTipText(self, text, x = 0, y = -19):
    		if not self.toolTipText:
    			textLine = ui.TextLine()
    			textLine.SetParent(self)
    			textLine.SetHorizontalAlignCenter()
    			textLine.SetSize(0, 0)
    			textLine.SetOutline()
    			textLine.Hide()
    			self.toolTipText = textLine
    
    		self.toolTipText.SetText(text)
    		w, h = self.toolTipText.GetTextSize()
    		self.toolTipText.SetPosition(max(0, x + self.GetWidth()/2 - w/2), y)

     

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