Jump to content

Recommended Posts

Hi

I've added the automatic converter for yang to won, but I've encountered a bug. It works as it should, but in the inventory, after 1,000,000,000 yang are converted to 1 won, I still see 1,000,000,000 yang (it's only visual). I can't figure out where I need to check. I've tried looking in game/char.cpp and root/uiinventory.py, but the issue persists. In char.cpp, I added some code, and now when I reach 1,000,000,000 yang, it goes to 0 for half a second and then back to 1,000,000,000.

 

		case POINT_GOLD:
			{
				const int64_t nTotalMoney = static_cast<int64_t>(GetGold()) + static_cast<int64_t>(amount);

				if (GOLD_MAX <= nTotalMoney)
				{
					sys_err("[OVERFLOW_GOLD] OriGold %d AddedGold %d id %u Name %s ", GetGold(), amount, GetPlayerID(), GetName());
					LogManager::instance().CharLog(this, GetGold() + amount, "OVERFLOW_GOLD", "");
					return;
				}

				// 청소년보호
				if (LC_IsNewCIBN() && amount > 0)
				{
					if (IsOverTime(OT_NONE))
					{
						dev_log(LOG_DEB0, "<GOLD_LOG> %s = NONE", GetName());
					}
					else if (IsOverTime(OT_3HOUR))
					{
						amount = (amount / 2);
						dev_log(LOG_DEB0, "<GOLD_LOG> %s = 3HOUR", GetName());
					}
					else if (IsOverTime(OT_5HOUR))
					{
						amount = 0;
						dev_log(LOG_DEB0, "<GOLD_LOG> %s = 5HOUR", GetName());
					}
				}

				SetGold(GetGold() + amount);
				val = GetGold();
#ifdef OTO_YANG_WON
				if (GetGold() >= AUTO_WON_AMOUNT) {

					int new_gold = GetGold() - AUTO_WON_AMOUNT;
					int new_cheque = GetCheque() + 1;
					

					SetGold(new_gold);
					SetCheque(new_cheque);
					

					PointsPacket();
					

					ChatPacket(CHAT_TYPE_INFO, "Hai convertito automaticamente %d yang in 1 won.", AUTO_WON_AMOUNT);
					

					ComputePoints();
					UpdatePacket();
					
					ChatPacket(CHAT_TYPE_COMMAND, "RefreshStatus");
					PointsPacket();
				}
#endif
			}
			break;

 

This happens in root/uiinventory.py

	def RefreshStatus(self):
		money = player.GetElk()
		cheque = player.GetCheque()
		import dbg
		dbg.TraceError("RefreshStatus - Before update: Money: %d" % player.GetElk())

		self.wndMoney.SetText(localeInfo.NumberToMoneyString(money))
		if app.ENABLE_CHEQUE_SYSTEM:
			self.wndCheque.SetText(localeInfo.NumberToChequeString(cheque))

		self.wndMoney.UpdateRect()
		if app.ENABLE_CHEQUE_SYSTEM:
			self.wndCheque.UpdateRect()

		dbg.TraceError("RefreshStatus - Money: %d, Cheque: %d" % (money, cheque))

		dbg.TraceError("RefreshStatus - After update: Money: %d" % player.GetElk())

		self.RefreshItemSlot()

 

Can someone help me please? Atleast a tip?

Sorry I'm dumb, solved.

I had to put the code between:

SetGold(GetGold() + amount);

val = GetGold();

Edited by Aioria
Link to comment
https://metin2.dev/topic/33045-auto-yang-won-converter/
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.