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();