Fix building price in store in sell mode (#359)

This commit is contained in:
Chorizorro
2020-11-30 11:25:21 +01:00
parent d257830de8
commit 17f13239ca
2 changed files with 22 additions and 2 deletions

View File

@@ -1424,7 +1424,17 @@ CM.Disp.UpdateBuildings = function() {
} }
else { else {
for (var i in CM.Cache.Objects) { for (var i in CM.Cache.Objects) {
l('productPrice' + Game.Objects[i].id).style.color = ''; var o = Game.Objects[i];
l('productPrice' + o.id).style.color = '';
/*
* Fix sell price displayed in the object in the store.
*
* The buildings sell price displayed by the game itself (without any mod) is incorrect.
* The following line of code fixes this issue, and can be safely removed when the game gets fixed.
*
* This issue is extensively detailed here: https://github.com/Aktanusa/CookieMonster/issues/359#issuecomment-735658262
*/
l('productPrice' + o.id).innerHTML = Beautify(CM.Sim.BuildingSell(o, o.basePrice, o.amount, o.free, Game.buyBulk, 1));
} }
} }

View File

@@ -676,7 +676,17 @@ CM.Disp.UpdateBuildings = function() {
} }
else { else {
for (var i in CM.Cache.Objects) { for (var i in CM.Cache.Objects) {
l('productPrice' + Game.Objects[i].id).style.color = ''; var o = Game.Objects[i];
l('productPrice' + o.id).style.color = '';
/*
* Fix sell price displayed in the object in the store.
*
* The buildings sell price displayed by the game itself (without any mod) is incorrect.
* The following line of code fixes this issue, and can be safely removed when the game gets fixed.
*
* This issue is extensively detailed here: https://github.com/Aktanusa/CookieMonster/issues/359#issuecomment-735658262
*/
l('productPrice' + o.id).innerHTML = Beautify(CM.Sim.BuildingSell(o, o.basePrice, o.amount, o.free, Game.buyBulk, 1));
} }
} }