[Release] Single-Right Click to use Items

04/04/2018 23:28 netHoxInc#1
As seen on some Servers, you can use a Right-Click on Items in your Inventory to use/activate them, instead of the painful double-left-clicking. (Specially annoying on awakes/Upgrade processes)

Here I'm releasing a basic code making your Inventory be able to use a single-right-click instead.

So here's what we're about to edit:

Neuz project:



Credits: 100% me, netHox
Inspiration: various P-servers


Update: Delete Items directly without Yes/No prompt from Inventory by holding alt+shift+rightclicking the Item

Preview:
[Only registered and activated users can see links. Click Here To Register...]

Source-Code Snippet's above have this included now, if you dont wish to use it, just dont define:
Code:
__DELETEITEM_INSTANT
04/05/2018 08:24 Rhea03#2
very nice. but the question is for the player wrong right click to the item will dmd.
04/05/2018 10:35 babyminion#3
im don't have intelligent on c++ codes. but i think this feature may can help in game thank for this sir :)

Edit: Sir i got this? can you help me please?
[Only registered and activated users can see links. Click Here To Register...]
04/05/2018 11:14 FlyServices#4
Quote:
Originally Posted by babyminion View Post
im don't have intelligent on c++ codes. but i think this feature may can help in game thank for this sir :)

Edit: Sir i got this? can you help me please?
[Only registered and activated users can see links. Click Here To Register...]
Your for loop have an incorrect syntaxe and you forgot a }
04/05/2018 11:17 netHoxInc#5
Quote:
Originally Posted by babyminion View Post
im don't have intelligent on c++ codes. but i think this feature may can help in game thank for this sir :)

Edit: Sir i got this? can you help me please?
[Only registered and activated users can see links. Click Here To Register...]
The errors dont tell any much detailed stuff, you should check the code arround the error locations, you maybe copied something to a wrong location, or are using an older sourcecode maybe? (this uses Visual Studio 2017)

Better re-check twice for miss-copying ^^
04/05/2018 11:18 babyminion#6
Quote:
Originally Posted by FlyServices View Post
Your for loop have an incorrect syntaxe and you forgot a }
i just copied from what the thread say's :D and im just a leecher idk how it works well lmfao :D

Quote:
Originally Posted by netHoxInc View Post
The errors dont tell any much detailed stuff, you should check the code arround the error locations, you maybe copied something to a wrong location, or are using an older sourcecode maybe? (this uses Visual Studio 2017)

Better re-check twice for miss-copying ^^
yes sir im using old source i think im using erendora files and thats what i got. and im using vs2003 only lmfao pizup! :handsdown:
04/05/2018 11:43 netHoxInc#7
Im not 100% sure if all functions included will work in VS2003, but usual c++ knownledge should be enough to fix it. Im not a c++ pro myself so, I dont know the differenced of version in exact.

But as long as you put it into the right location, the code should only spit our reference or syntax errors, which shouldnt be hard to fix by googling them.

Cheers
04/05/2018 12:56 FlyServices#8
Code:
void CWndItemCtrl::OnLButtonDblClk( UINT nFlags, CPoint point )
{
	if( !g_pPlayer )
		return;

	if( !m_pItemContainer )
		return;

	if( GetAsyncKeyState( VK_LCONTROL ) & 0x8000 )
		return;

	if( CWndBase::m_GlobalShortcut.IsEmpty() == FALSE )
		return;

	int nItem = HitTest( point );
	if( nItem == -1 )	return;

	CItemElem* pItemElem = NULL;
	pItemElem = GetItem( nItem );

#ifdef __DELETEITEM_INSTANT
	if (/*pItemElem && GetAsyncKeyState(VK_MENU)&& */GetAsyncKeyState(VK_SHIFT))
		g_DPlay.SendRemoveItem( pItemElem, pItemElem->m_nItemNum );
	else
#endif // __DELETEITEM_INSTANT
	{
#if __VER >= 8 // __CSC_VER8_5
		if( IsUsableItem( pItemElem ) || (m_useDieFlag && pItemElem != NULL))
#else // __CSC_VER8_5
		if( IsUsableItem( pItemElem ) )
#endif // __CSC_VER8_5
		{
			if( IsSelectedItem( nItem ) == FALSE )
			{
				m_dwSelectAry.RemoveAll();
				m_dwSelectAry.Add( nItem );
				m_nCurSelect = nItem;
				m_pFocusItem = pItemElem;
			}

			CWndBase* pParent = (CWndBase*)GetParentWnd();
			pParent->OnChildNotify( WIN_DBLCLK,m_nIdWnd,(LRESULT*)m_pFocusItem); 
		}
	}
}
Code:
void CWndInventory::OnRButtonDown(UINT nFlags, CPoint point)
{
#ifdef __DOUBLECLICK_ITEMUSE
	for( int i = PARTS_UPPER_BODY; i < MAX_HUMAN_PARTS; i++ )
	{
		if( m_InvenRect[i].PtInRect( point ))
		{
			CItemElem* pItemElem = NULL;
			pItemElem = (CItemElem*)g_pPlayer->GetEquipItem(i);
			if( pItemElem )
				g_DPlay.SendDoEquip(pItemElem, i);
		}
	}
#endif //__DOUBLECLICK_ITEMUSE
	BaseMouseCursor();
}
04/05/2018 14:02 babyminion#9
Quote:
Originally Posted by FlyServices View Post
Code:
void CWndItemCtrl::OnLButtonDblClk( UINT nFlags, CPoint point )
{
	if( !g_pPlayer )
		return;

	if( !m_pItemContainer )
		return;

	if( GetAsyncKeyState( VK_LCONTROL ) & 0x8000 )
		return;

	if( CWndBase::m_GlobalShortcut.IsEmpty() == FALSE )
		return;

	int nItem = HitTest( point );
	if( nItem == -1 )	return;

	CItemElem* pItemElem = NULL;
	pItemElem = GetItem( nItem );

#ifdef __DELETEITEM_INSTANT
	if (/*pItemElem && GetAsyncKeyState(VK_MENU)&& */GetAsyncKeyState(VK_SHIFT))
		g_DPlay.SendRemoveItem( pItemElem, pItemElem->m_nItemNum );
	else
#endif // __DELETEITEM_INSTANT
	{
#if __VER >= 8 // __CSC_VER8_5
		if( IsUsableItem( pItemElem ) || (m_useDieFlag && pItemElem != NULL))
#else // __CSC_VER8_5
		if( IsUsableItem( pItemElem ) )
#endif // __CSC_VER8_5
		{
			if( IsSelectedItem( nItem ) == FALSE )
			{
				m_dwSelectAry.RemoveAll();
				m_dwSelectAry.Add( nItem );
				m_nCurSelect = nItem;
				m_pFocusItem = pItemElem;
			}

			CWndBase* pParent = (CWndBase*)GetParentWnd();
			pParent->OnChildNotify( WIN_DBLCLK,m_nIdWnd,(LRESULT*)m_pFocusItem); 
		}
	}
}
Code:
void CWndInventory::OnRButtonDown(UINT nFlags, CPoint point)
{
#ifdef __DOUBLECLICK_ITEMUSE
	for( int i = PARTS_UPPER_BODY; i < MAX_HUMAN_PARTS; i++ )
	{
		if( m_InvenRect[i].PtInRect( point ))
		{
			CItemElem* pItemElem = NULL;
			pItemElem = (CItemElem*)g_pPlayer->GetEquipItem(i);
			if( pItemElem )
				g_DPlay.SendDoEquip(pItemElem, i);
		}
	}
#endif //__DOUBLECLICK_ITEMUSE
	BaseMouseCursor();
}
compile has success! sir :) thanks for recoding it <3. but feature is not functioning. the only effect of the feature is ( when i right click a item its automatically equip. but when i wear a item and try to try to right click to remove its not working ) and about the SHIFT+ALT+RIGHT THE ITEM its not also working with the code that you give :(
04/05/2018 15:01 netHoxInc#10
Quote:
Originally Posted by babyminion View Post
compile has success! sir :) thanks for recoding it <3. but feature is not functioning. the only effect of the feature is ( when i right click a item its automatically equip. but when i wear a item and try to try to right click to remove its not working ) and about the SHIFT+ALT+RIGHT THE ITEM its not also working sad :(
Maybe you're using a different Inventory/Equipment window code? Im not sure why it wouldnt do it else.

You could send me the files which you implemented it on on PM, and I'll check if there's something misscopied, but else i got no clue.

For me It works perfectly and i explicitly only did the changes I mentioned above, and the code is original code for these actions, just copied onto these Key functions.
04/05/2018 16:20 babyminion#11
Quote:
Originally Posted by netHoxInc View Post
Maybe you're using a different Inventory/Equipment window code? Im not sure why it wouldnt do it else.

You could send me the files which you implemented it on on PM, and I'll check if there's something misscopied, but else i got no clue.

For me It works perfectly and i explicitly only did the changes I mentioned above, and the code is original code for these actions, just copied onto these Key functions.
ok sir. i already pm you now :)
04/05/2018 16:34 Mushpoie#12
Quote:
Originally Posted by netHoxInc View Post
Maybe you're using a different Inventory/Equipment window code? Im not sure why it wouldnt do it else.

You could send me the files which you implemented it on on PM, and I'll check if there's something misscopied, but else i got no clue.

For me It works perfectly and i explicitly only did the changes I mentioned above, and the code is original code for these actions, just copied onto these Key functions.
Your code works fine, he just expects you to do it for him. This is how he always rolls with his 13+ help threads a day. No effort, complains it doesn't work till someone directly implements it for him.

Nice release nonetheless.
04/05/2018 18:31 babyminion#13
Quote:
Originally Posted by Mushpoie View Post
Your code works fine, he just expects you to do it for him. This is how he always rolls with his 13+ help threads a day. No effort, complains it doesn't work till someone directly implements it for him.

Nice release nonetheless.
im just a leecher what are you expecting for? like i said on my previous replies i dont have enough intelligent on c++. btw i dont have server and i dont want to make im just exploring things regarding flyff/developing and how gm's/admins doing. and coz i love playing flyff since 2004. and i didnt expect that he do it for me sir. and i think theres no problem to post error problems on help desk lmfao :D :handsdown:
04/05/2018 21:00 netHoxInc#14
PM answered, you included code into wrong functions, I've fixed it up just insert the whole code back.

#Leechnote: I dont mind about that, as long as it doesnt end in requesting any other thing. I'm supporting what I've released, as best I can, even to people who aren't cappable of copying things into the correct sections.

But I also have to say, this is an very easy Task, and if @[Only registered and activated users can see links. Click Here To Register...] would've followed the instructions 'correctly', it'd be working fine.

As in this example, he did the WndCtrlItem.cpp in wrong way, he did not seek the function and then

Code:
CPoint pt;
	pt.y = 0;
	pt.y += m_wndScrollBar.GetScrollPos() * nWidth;
Instead he searched this code piece at first, resulting in being copied into the wrong function, as earlier functions uses this code snippet aswell.

So please @[Only registered and activated users can see links. Click Here To Register...]echers, Read the Instructions closely. :rtfm:
04/05/2018 22:14 babyminion#15
Quote:
Originally Posted by netHoxInc View Post
PM answered, you included code into wrong functions, I've fixed it up just insert the whole code back.

#Leechnote: I dont mind about that, as long as it doesnt end in requesting any other thing. I'm supporting what I've released, as best I can, even to people who aren't cappable of copying things into the correct sections.

But I also have to say, this is an very easy Task, and if @[Only registered and activated users can see links. Click Here To Register...] would've followed the instructions 'correctly', it'd be working fine.

As in this example, he did the WndCtrlItem.cpp in wrong way, he did not seek the function and then

Code:
CPoint pt;
	pt.y = 0;
	pt.y += m_wndScrollBar.GetScrollPos() * nWidth;
Instead he searched this code piece at first, resulting in being copied into the wrong function, as earlier functions uses this code snippet aswell.

So please @[Only registered and activated users can see links. Click Here To Register...]echers, Read the Instructions closely. :rtfm:
sorry i didn't check it first before i put the codes my bad :) btw. the codes are now functionable but i saw a little bug thing.

Scenario:
- i try to unequip 4 of my equipments in inventory and i try to reput it again. backwards EX: i unequip item1 then item2 and item3 item4 now i try to wear items backwards first i equip item4 using right click feature. then i was shock! i dont know if its a coincidence or what but i try to rightclick item4 but it's not just that instead it wear's item1 idk how did happen maybe its a bug but its not a big deal i think. btw i just want to report it to you to help sir btw thanks for being kind people godbless :handsdown:


Edit: regarding shift + alt + rightclick = delete
I think the shift + alt + rightclick is not good sometimes because I tried pressing once the shift and i try to walk and do something else and i accidentally press alt and try to unequip one of my things and re-equip again and its gone. im just wondering if someone has official server and player accidentally happened especially if he got very rare item maybe that player will be quit automatically lmfao! That's just my opinion :D