[Release] Fast Mail delete

04/04/2018 12:06 netHoxInc#1
Hey there~ I've decided to setup a Flyff server locally, mainly for testing exploits and/or finding them. But as you can imagine, it get's boring somewhen, so I started to create some source functions which could, or maybe could not improve your Server.

From time to time I might release more Snippet's if people seem to find them useful. If you dont feel like needing it, or got even a better System for this Tasks, you're welcome to leave straight, instead of letting this end in a mess of Flame.


I've could not see anything like this yet released, so, for the Leecher's it might be cool:

Feature: Hold CTRL+ALT and Rightclick your unwanted mails to delete them without Yes/No Prompt.
(Feel free to change the Keys to your prefers and/or add/remove some^^)

Given checks:
- Checks if Inventory has enough Space for Items
- Checks if User has enough Space for the Penya amount
- Gives MessageBoxes if not/interupts Deletition
- If all checks passes, no Message is given, for faster re-use after deletiotion of the mail



Project: Neuz:




Feel free to Leave a comment, suggestions for new small functions, or whatever else you might want to see being released. From time to time I'll start new projects about Flyff and once I'm used to the source a little better, might Release new PvE Systems, Event Systems, or just some other stuff which could be fun, like new GM commands or something.

Credits:
Code: 100% me, netHox
Inspired by: Insanity Flyff's Right-Click on Mail's Menu (Has Get Item and Delete Mail options)
04/07/2018 14:02 Sonraiku#2
Hello there,

i've added it to my server and i found one bug. When i send only an item to a character, i got the message that i have too many penya, although that char was fresh created. When i only send Penya or an item and penya, both works fine. Only sending an item does the message show up and interupts the process.
04/08/2018 06:37 netHoxInc#3
Works in all ways for me, recheck if you correctly inserted code, depending on if you previous made changes to your Mailsystem it might need slight modifications in code in order to work correct with your systems.

Tried:
1. Item only with Space
2. Penya only with Space
3. Item/Penya with Space
4. Item without Space
5. Item/Penya without Space
6. Penya without Space


All worked fine for me, I only got the messages when I had no space for either items or penya.
05/08/2018 21:17 Minotaurr#4
Quote:
Originally Posted by Sonraiku View Post
Hello there,

i've added it to my server and i found one bug. When i send only an item to a character, i got the message that i have too many penya, although that char was fresh created. When i only send Penya or an item and penya, both works fine. Only sending an item does the message show up and interupts the process.
I have exactly the same bug :S
05/04/2020 11:09 Hyellow#5
Sorry wrong thread and found the answer. Pardon me.
05/04/2020 12:17 alfredico#6
Quote:
Originally Posted by Sonraiku View Post
Hello there,

i've added it to my server and i found one bug. When i send only an item to a character, i got the message that i have too many penya, although that char was fresh created. When i only send Penya or an item and penya, both works fine. Only sending an item does the message show up and interupts the process.
Quote:
Originally Posted by Minotaurr View Post
I have exactly the same bug :S
It's because if the mail has no gold, it will throw you the error message.

Quick fix:
Code:
#ifdef __RIGHTCLICK_DELETEMAIL
BOOL CanAdd(DWORD dwGold, int nPlus)
{
	if (nPlus <= 0)		// ´õÇÏ·Á´Â °ªÀÌ 0ÀÌÇÏÀÌ¸é ³Í¼¾½º 
		return FALSE;

	int nGold = dwGold;
	ASSERT(nGold >= 0);
	return ((nGold + nPlus) > nGold);		// ´õÇÑ °ªÀÌ overflowÀÌ¸é ¸·¾Æ¾ßÇÑ´Ù.
}
void CWndPostReceive::OnRButtonUp(UINT nFlags, CPoint point)
{
	if (GetAsyncKeyState(VK_CONTROL) && GetAsyncKeyState(VK_MENU))
	{
		if (m_nMax <= 0)
			return;

		int nSelect = GetSelectIndex(point);
		if (nSelect == -1)
			return;

		m_nSelect = nSelect;

		CMailBox* pMailBox = CMailBox::GetInstance();
		CMailBox& mailbox = *pMailBox;

		if (mailbox[m_nSelect] == NULL)
			return;

		CMail* pMail = mailbox[m_nSelect];
		if (pMail)
		{
			// Get Items if available
			if (pMail->m_pItemElem)
			{
				if (g_pPlayer->m_Inventory.GetEmptyCount() < 1)
				{
					g_WndMng.OpenMessageBox(prj.GetText(TID_GAME_LACKSPACE));
					return;
				}
				g_DPlay.SendQueryGetMailItem(pMail->m_nMail);
			}
			// Get Gold if available
			if (pMail->m_nGold)
			{
				if (CanAdd(g_pPlayer->GetGold(), pMail->m_nGold))
					g_DPlay.SendQueryGetMailGold(pMail->m_nMail);
				else
				{
					g_WndMng.OpenMessageBox(prj.GetText(TID_GAME_TOOMANYMONEY_USE_PERIN));
					return;
				}
			}
			
			// Delete
			g_DPlay.SendQueryRemoveMail(pMail->m_nMail);
		}
	}
}
#endif // __RIGHTCLICK_DELETEMAIL