Jump to content
×
×
  • Create New...

Fix SlotWindow-OverInEvent for Every Each Slot


Recommended Posts

  • Honorable Member

Hello devs.

I think that webzen already fixxed this, because I can't reverse the CSlotWindow::OnMouseOver it may be virtualized 😭
The problem is that, when you are trying to make conditions for the slot with runtime mouse overin, the slot doesn't handle the overin event until now.

Here is a demonstration video to show the fixxed problem.
 

Spoiler

 

Without this fix the MouseOverIn event was running down if your cursor came to the slotboard which is the board of the slots 😐 instead of the slot. It's difficult to explain.

Spoiler

				## Slot
				{
					"name" : "CombItemSlot",
					"type" : "slot",#THIS IS THE SLOTBOARD

					"image" : "d:/ymir work/ui/public/slot_base.sub",

					"x" : 8,
					"y" : 30,

					#THIS IS THE SIZE OF THE SLOTBOARD
					"width" : 190,
					"height" : 340,
					#Without the fix if the mouse arrives onto this pattern the overin runs down!

					#THESE THE SLOTS
					"slot" : (
						{"index":0, "x":78, "y":12, "width":31, "height":31},  # ˝şĹ©·Ń
						{"index":1, "x":28, "y":68, "width":31, "height":96},  # ¸ŢŔÎÄÚ˝şĆ¬
						{"index":2, "x":129, "y":68, "width":31, "height":96}, # Ŕç·áÄÚ˝şĆ¬
						{"index":3, "x":79, "y":185, "width":31, "height":96}, # °á°úÄÚ˝şĆ¬
					),

					"children" :
					(
						{ "name":"Slot1_Name", "type":"text", "x":43, "y":170, "text" : uiScriptLocale.COMB_APPEARANCE, "text_horizontal_align":"center" },
						{ "name":"Slot2_Name", "type":"text", "x":143, "y":170, "text" : uiScriptLocale.COMB_ATTRIBUTE, "text_horizontal_align":"center" },
					),
				},

 

 

 

Before you start to implement it, make safety backup of your files!

1.) Define the new OverIn event into the SlotWindow class in the ui.py file:

Spoiler

class SlotWindow(Window):
	def __init__(self):
		## Add these line into the __init__ function:
		self.eventOverIn = None
		self.eventOverOut = None
		##
	def __del__(self):
		## Add these line into the __init__ function:
		self.eventOverIn = None
		self.eventOverOut = None
		##

	## Add the functions into the SlotWindow class:
	def SetOverInEvent(self, event):
		self.eventOverIn = event

	def SetOverOutEvent(self, event):
		self.eventOverOut = event

	def OnOverIn(self, slotNumber):
		if self.eventOverIn:
			self.eventOverIn(slotNumber)

	def OnOverOut(self):
		if self.eventOverOut:
			self.eventOverOut()
	##
#DONE

 

 

2.) Define new functions and a helper variable into the eterPythonLib\PythonSlotWindow.h.

Spoiler

// Add these:
			// OverInSlot
			BOOL OnOverIn(DWORD dwSlotNumber);
			void OnOverOut();
// Above of this:
			// ToolTip
			BOOL OnOverInItem(DWORD dwSlotNumber);
			void OnOverOutItem();
//##

// Add this:
			DWORD m_dwOverInSlotNumber;
// Below of this:
			DWORD m_dwToolTipSlotNumber;
//##DONE

 

 

3.) Make fit, and add the new functions into the eterPythonLib\PythonSlotWindow.cpp.

Spoiler

//## Replace the OnMouseOverIn and OnMouseOverOut functions in the CSlotButton class with these:
		void OnMouseOverIn()
		{
			if (IsEnable())
				SetCurrentVisual(&m_overVisual);

			//m_pParent->OnOverInItem(m_dwSlotNumber);
			//m_pParent->OnOverIn(m_dwSlotNumber);
			TSlot * pSlot;
			if (m_pParent->GetSlotPointer(m_dwSlotNumber, &pSlot))
			{
				if (pSlot->isItem)
					m_pParent->OnOverInItem(m_dwSlotNumber);
				else
					m_pParent->OnOverIn(m_dwSlotNumber);
			}
		}

		void OnMouseOverOut()
		{
			if (IsEnable())
			{
				SetUp();
				SetCurrentVisual(&m_upVisual);
			}

			//m_pParent->OnOverOutItem();
			//m_pParent->OnOverOut();
			TSlot * pSlot;
			if (m_pParent->GetSlotPointer(m_dwSlotNumber, &pSlot))
			{
				if (pSlot->isItem)
					m_pParent->OnOverOutItem();
				else
					m_pParent->OnOverOut();
			}
		}
//##

//## Replace the whole CSlotWindow::RefreshSlot or compare it with yourself and make it fit with this:
void CSlotWindow::RefreshSlot()
{
	OnRefreshSlot();

	// NOTE : Refresh µÉ¶§ ToolTip µµ °»˝Ĺ ÇŐ´Ď´Ů - [levites]
	if (IsRendering())
	{
		TSlot * pSlot;
		if (GetPickedSlotPointer(&pSlot))
		{
			if (pSlot->isItem)
			{
				OnOverOutItem();
				OnOverInItem(pSlot->dwSlotNumber);
			}
			else
			{
				OnOverOut();
				OnOverIn(pSlot->dwSlotNumber);
			}
		}
	}
}
//##

//## Add this call into the CSlotWindow::OnMouseOverOut() function:
OnOverOut();
//##

//## Replace the whole CSlotWindow::OnMouseOver() with this:
void CSlotWindow::OnMouseOver()
{
	// FIXME : Ŕ©µµżě¸¦ µĺ·ˇ±ë ÇĎ´Â µµÁßżˇ SetTopŔĚ µÇľîąö¸®¸é Capture°ˇ Ç®ľîÁ® ąö¸°´Ů. ±×°ÍŔÇ ąćÁö ÄÚµĺ.
	//         Á» ´ő ±Ůş»ŔűŔÎ ÇŘ°áĂĄŔ» ĂŁľĆľß ÇŇ µí - [levites]
//	if (UI::CWindowManager::Instance().IsCapture())
//	if (!UI::CWindowManager::Instance().IsAttaching())
//		return;

	TSlot * pSlot;
	CWindow * pPointWindow = UI::CWindowManager::Instance().GetPointWindow();
	if (this == pPointWindow)
	{
		if (GetPickedSlotPointer(&pSlot))
		{
			if (OnOverInItem(pSlot->dwSlotNumber))
				return;
			else
				OnOverOutItem();

			if (OnOverIn(pSlot->dwSlotNumber))
				return;
			else
				OnOverOut();

			return;
		}
	}

	OnOverOutItem();
	OnOverOut();
}
//##

//## Add the new functions above of the CSlotWindow::OnOverInItem function:
BOOL CSlotWindow::OnOverIn(DWORD dwSlotNumber)
{
	TSlot * pSlot;
	if (!GetSlotPointer(dwSlotNumber, &pSlot))
		return FALSE;

	if (pSlot->isItem)
		return FALSE;

	if (pSlot->dwSlotNumber == m_dwOverInSlotNumber)
		return TRUE;

	m_dwOverInSlotNumber = dwSlotNumber;
	PyCallClassMemberFunc(m_poHandler, "OnOverIn", Py_BuildValue("(i)", dwSlotNumber));
	return TRUE;
}

void CSlotWindow::OnOverOut()
{
	if (SLOT_NUMBER_NONE == m_dwOverInSlotNumber)
		return;

	m_dwOverInSlotNumber = SLOT_NUMBER_NONE;
	PyCallClassMemberFunc(m_poHandler, "OnOverOut", Py_BuildValue("()"));
}
//##

//## Initialize the new helper variable in the CSlotWindow::__Initialize function:
	m_dwOverInSlotNumber = SLOT_NUMBER_NONE;
//##

//## Replace this line: pSlot->isItem = TRUE; in the CSlotWindow::SetSlot function with this:
	pSlot->isItem = (dwVirtualNumber > 0) ? TRUE : FALSE;
//##DONE

 

 

Example usage:

	def LoadObj(self):
		self.wndItem = self.GetChild("ItemSlot")
		self.wndItem.SetOverInEvent(ui.__mem_func__(self.OverIn))
		self.wndItem.SetOverOutEvent(ui.__mem_func__(self.OverOut))

	def OverIn(self, selectedSlotPos):
		chat.AppendChat(chat.CHAT_TYPE_INFO, "OverIn %d", selectedSlotPos)

	def OverOut(self):
		chat.AppendChat(chat.CHAT_TYPE_INFO, "OverOut")

 

  • Love 9
  • Good 1
Link to comment
Share on other sites

  • 11 months later...
  • 3 months later...
  • Premium

Example usage:

	def LoadObj(self):
		self.wndItem = self.GetChild("ItemSlot")
		self.wndItem.SetOverInEvent(ui.__mem_func__(self.OverIn))
		self.wndItem.SetOverOutEvent(ui.__mem_func__(self.OverOut))

	def OverIn(self, selectedSlotPos):
		chat.AppendChat(chat.CHAT_TYPE_INFO, "OverIn %d", selectedSlotPos)

	def OverOut(self):
		chat.AppendChat(chat.CHAT_TYPE_INFO, "OverOut")

 

@xP3NG3Rx How do you use it for attrtansfer and pet system ?

  • Lmao 1
Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.


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.