PDA

View Full Version : Money bug fix


Yodason
06-11-2003, 06:33 AM
void Client::AddMoneyToPP(uint32 copper,bool updateclient){

uint32 tmp;

uint32 tmp2;

tmp = copper;

tmp2 = tmp/1000;

pp.platinum = pp.platinum + tmp2;

tmp-=tmp2*1000;

if (updateclient)

SendClientMoneyUpdate(3,tmp2);



tmp2 = tmp/100;

tmp-=tmp2*100;

pp.gold = pp.gold + tmp2;

if (updateclient)

SendClientMoneyUpdate(2,tmp2);



tmp2 = tmp/10;

tmp-=tmp2*10;

pp.silver = pp.silver + tmp2;

if (updateclient)

SendClientMoneyUpdate(1,tmp2);



if (updateclient)

SendClientMoneyUpdate(0,tmp);

pp.copper = pp.copper + tmp;

Save();

LogFile->write(EQEMuLog::Debug, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), pp.platinum, pp.gold, pp.silver, pp.copper);

}

Trumpcard
06-11-2003, 06:50 AM
What was the original bug Yoda? Miscalculation of money?

fnemo
06-11-2003, 07:09 AM
merchant robering the client ... i think .

gej302
06-11-2003, 08:59 AM
I think it's the bug where your money gets recreated on all the sub levels when you zone after selling something. May not always happen, but you would at least occasionally end up with 293p 293xg 293xxs 293xxxc if you sold about 293p worth of gear as I recall, might have also happened when you altered your money denomination but didn't bank it... I can't recall exactly

Trumpcard
06-11-2003, 10:15 AM
Ah, when converting, the converted amount was never deducted from the original amount...

101 copper should be 101/1000 = 0 by integer division, then 101/100 = 1, so 1 gold, so new amount is now 101-100 = 1 remainder, 1 /10 = 0 silver, then +1 copper, so 101 copper = 1 gold 1 copper.

Good catch on that Yoda. Just merged the fix in.