Jump to content

Safebox Money System


Recommended Posts

  • Honorable Member

M2 Download Center

This is the hidden content, please
( Internal )

This is the hidden content, please
( GitHub )

 

Spoiler

173758giphy-1-.gif
173758giphy.gif

 

  • Metin2 Dev 58
  • Eyes 1
  • Dislove 1
  • Think 1
  • Confused 4
  • Scream 1
  • Good 12
  • Love 2
  • Love 35

 

Link to comment
Share on other sites

  • Management
Link to comment
Share on other sites

  • 4 weeks later...
  • 8 months later...
  • 2 years later...

@ Mali How to increase yang limit for withdraw?

When I increase limit to 9 (dlgPickMoney.SetMax(9)) and trying withdraw for example -> my inventory 1.999.999.999 Yang -> my Safebox 1.000.000.000 Yang ->  My withdraw from safebox -> 10.000 Yang so its works and I got message "You cannot withdraw anymore gold." but when I try to withdraw for example 888.888.888 Yang my inventory stay still same (because 2kkk limit) but from safebox are gold destroyed without this check:

		if (ch->GetGold() + static_cast<int>(p->lMoney) >= GOLD_MAX)
		{
			ch->ChatPacket(CHAT_TYPE_INFO, "You cannot withdraw anymore gold.");
			return;
		}



EDIT: Can be problem int type for lMoney when my inventory is too int and trying check value more than 2147483647? Because 1.999.999.999 + 888.888.888 withdraw?

Edited by Filachilla
Link to comment
Share on other sites

Solved
 

	case SAFEBOX_MONEY_STATE_WITHDRAW:
		if (pSafebox->GetSafeboxMoney() < p->lMoney)
		{
			ch->ChatPacket(CHAT_TYPE_INFO, "You don't have enough gold.");
			return;
		}

		if (ch->GetGold() + static_cast<int64_t>(p->lMoney) >= GOLD_MAX)
		{
			ch->ChatPacket(CHAT_TYPE_INFO, "You cannot withdraw anymore gold.");
			return;
		}
		pSafebox->SetSafeboxMoney(pSafebox->GetSafeboxMoney() - p->lMoney);
		ch->PointChange(POINT_GOLD, static_cast<int>(p->lMoney));
		break;
	}

OR

	case SAFEBOX_MONEY_STATE_WITHDRAW:
		if (pSafebox->GetSafeboxMoney() < p->lMoney)
		{
			ch->ChatPacket(CHAT_TYPE_INFO, "You don't have enough gold.");
			return;
		}

		const int64_t nTotalMoney = static_cast<int64_t>(ch->GetGold()) + static_cast<int64_t>(p->lMoney);
		if (GOLD_MAX <= nTotalMoney)
		{
			ch->ChatPacket(CHAT_TYPE_INFO, "You cannot withdraw anymore gold.");
			return;
		}
		pSafebox->SetSafeboxMoney(pSafebox->GetSafeboxMoney() - p->lMoney);
		ch->PointChange(POINT_GOLD, static_cast<int>(p->lMoney));
		break;

 

Edited by Filachilla
Link to comment
Share on other sites

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.