Jump to content

[Py] Taskbar Skill Slot 'Hover' Problem


Go to solution Solved by VegaS™,

Recommended Posts

  • Forum Moderator
  • Solution

The bug is caused by self.RefreshQuickSlot() which is called in OnUpdate() at each 0.5 seconds.

It also affects the emotion slots, not just the skills.

Inside of RefreshQuickSlot is the following snippet:

	elif player.SLOT_TYPE_SKILL == Type:
		[...]
		slot.SetCoverButton(slotNumber)

	elif player.SLOT_TYPE_EMOTION == Type:
		[...]
		slot.SetCoverButton(slotNumber)

That part of the code resets the cover button for each slot and resets the up/over/down states.

How-To-Fix:

f0ddf9a18cd1222e354b0df0ca566587.gif

  • root/uiTaskBar.py
# Search for: (x2 times)
					slot.SetCoverButton(slotNumber)
# Replace it with:
					if not slot.HasCoverButton(slotNumber):
						slot.SetCoverButton(slotNumber)
  • root/ui.py
# Search for:
	def EnableCoverButton(self, slotIndex):
		wndMgr.EnableCoverButton(self.hWnd, slotIndex)
# Add after:
	def HasCoverButton(self, slot_index):
		return wndMgr.HasCoverButton(self.hWnd, slot_index)
  • Src/Client/EterPythonLib/PythonSlotWindow.h
// Search for:
			void HideSlotBaseImage(DWORD dwIndex);
// Add after:
			bool HasCoverButton(const DWORD slot_index)
			{
				TSlot * slot;
				if (!GetSlotPointer(slot_index, &slot))
					return false;

				return slot->pCoverButton != nullptr;
			}
  • Src/Client/EterPythonLib/PythonWindowManagerModule.cpp
// Search for:
PyObject * wndMgrHideSlotBaseImage(PyObject * poSelf, PyObject * poArgs)
{
	[...]
}
// Add after:
PyObject* wndMgrHasCoverButton(PyObject*, PyObject* poArgs)
{
	UI::CWindow* window;
	PyTuple_GetWindow(poArgs, 0, &window);

	int slot_index;
	PyTuple_GetInteger(poArgs, 1, &slot_index);

	auto* const slot = dynamic_cast<UI::CSlotWindow*>(window);
	return Py_BuildValue("b", slot->HasCoverButton(slot_index));
}

// Search for:
		{ "HideSlotBaseImage",			wndMgrHideSlotBaseImage,			METH_VARARGS },
// Add after:
		{ "HasCoverButton",			wndMgrHasCoverButton,				METH_VARARGS },
Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 2
  • Good 2
  • Love 6
Link to comment
Share on other sites

  • Active+ Member
2 hours ago, VegaS™ said:

The bug is caused by self.RefreshQuickSlot() which is called in OnUpdate() at each 0.5 seconds.

It also affects the emotion slots, not just the skills.

Inside of RefreshQuickSlot is the following snippet:

	elif player.SLOT_TYPE_SKILL == Type:
		[...]
		slot.SetCoverButton(slotNumber)

	elif player.SLOT_TYPE_EMOTION == Type:
		[...]
		slot.SetCoverButton(slotNumber)

That part of the code resets the cover button for each slot and resets the up/over/down states.

How-To-Fix:

f0ddf9a18cd1222e354b0df0ca566587.gif

  • root/uiTaskBar.py
# Search for: (x2 times)
					slot.SetCoverButton(slotNumber)
# Replace it with:
					if not slot.HasCoverButton(slotNumber):
						slot.SetCoverButton(slotNumber)
  • Src/Client/EterPythonLib/PythonWindow.h
// Search for:
			BOOL IsDisableCoverButton(DWORD dwIndex);
// Add after:
			bool HasCoverButton(const DWORD slot_index)
			{
				TSlot * slot;
				if (!GetSlotPointer(slot_index, &slot))
					return false;

				return slot->pCoverButton != nullptr;
			}
  • Src/Client/EterPythonLib/PythonWindowManagerModule.cpp
// Search for:
PyObject * wndMgrIsDisableCoverButton(PyObject * poSelf, PyObject * poArgs)
{
	[...]
}
// Add after:
PyObject* wndMgrHasCoverButton(PyObject*, PyObject* poArgs)
{
	UI::CWindow* window;
	PyTuple_GetWindow(poArgs, 0, &window);

	int slot_index;
	PyTuple_GetInteger(poArgs, 1, &slot_index);

	auto* const slot = dynamic_cast<UI::CSlotWindow*>(window);
	return Py_BuildValue("b", slot->HasCoverButton(slot_index));
}

// Search for:
		{ "IsDisableCoverButton",		wndMgrIsDisableCoverButton,			METH_VARARGS },
// Add after:
		{ "HasCoverButton",			wndMgrHasCoverButton,				METH_VARARGS },

Thank you so much !

But, I dont' have IsDisableCoverButton in client src. I'm using novaline.

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

  • Forum Moderator
7 minutes ago, blaxis said:

But, I dont' have IsDisableCoverButton in client src. I'm using novaline.

Doesn't have relevance, just add it where you want in that file, following the code syntax from other functions.

As an example, instead of searching for wndMgrIsDisableCoverButton, search for wndMgrHideSlotBaseImage and HideSlotBaseImage.

I updated the first post, check it.

Edited by VegaS™
  • Love 1
Link to comment
Share on other sites

  • Honorable Member
17 minutes ago, VegaS™ said:

Doesn't have relevance, just add it where you want in that file, following the code syntax from other functions.

As an example, instead of searching for wndMgrIsDisableCoverButton, search for wndMgrHideSlotBaseImage and HideSlotBaseImage.

I updated the first post, check it.

Still something is wrong.
PythonWindow.h or PythonSlotWindow.h?

0828 22:30:13428 ::   File "networkModule.py", line 247, in SetGamePhase

0828 22:30:13428 ::   File "game.py", line 100, in __init__

0828 22:30:13428 ::   File "interfaceModule.py", line 290, in MakeInterface

0828 22:30:13429 ::   File "interfaceModule.py", line 126, in __MakeTaskBar

0828 22:30:13429 ::   File "uiTaskBar.py", line 543, in LoadWindow

0828 22:30:13429 ::   File "uiTaskBar.py", line 799, in RefreshQuickSlot

0828 22:30:13429 :: AttributeError
0828 22:30:13429 :: : 
0828 22:30:13429 :: 'GridSlotWindow' object has no attribute 'HasCoverButton'
0828 22:30:13429 :: 

  • Lmao 1

GhwYizE.gif

Link to comment
Share on other sites

  • Active+ Member
25 minutes ago, VegaS™ said:

Doesn't have relevance, just add it where you want in that file, following the code syntax from other functions.

As an example, instead of searching for wndMgrIsDisableCoverButton, search for wndMgrHideSlotBaseImage and HideSlotBaseImage.

I updated the first post, check it.

Sorry for my carelessness. You wrote PythonWindow.h, but it should have been PythonSlotWindow.h 🙂

I completed the steps but error loading screen.

0828 23:31:28911 ::   File "uiTaskBar.py", line 940, in RefreshQuickSlot

0828 23:31:28911 :: AttributeError
0828 23:31:28911 :: : 
0828 23:31:28911 :: 'GridSlotWindow' object has no attribute 'HasCoverButton'
0828 23:31:28911 :: 

 

 

 

Edited by blaxis
Link to comment
Share on other sites

  • Forum Moderator

I forgot the ui.py part, I updated the first reply, check it now. 🥸

Edited by VegaS™
  • Love 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

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.