Fixed pp-sort breaking for sell-mode

This commit is contained in:
Daniel van Noord
2020-11-29 14:57:48 +01:00
parent 7128df5d50
commit f7192d1e90
2 changed files with 74 additions and 26 deletions

View File

@@ -1398,6 +1398,7 @@ CM.Disp.UpdateBuildings = function() {
// Build array of pointers, sort by pp, use array index (+2) as the grid row number
// (grid rows are 1-based indexing, and row 1 is the bulk buy/sell options)
if (Game.buyMode == 1 && CM.Config.SortBuildings) {
var arr = Object.keys(CM.Cache[target]).map(k =>
{
var o = CM.Cache[target][k];
@@ -1405,15 +1406,25 @@ CM.Disp.UpdateBuildings = function() {
o.id = Game.Objects[k].id;
return o;
});
if (CM.Config.SortBuildings)
arr.sort((a, b) => a.pp - b.pp);
else
arr.sort((a, b) => a.id - b.id);
for (var x = 0; x < arr.length; x++)
for (var x = 0; x < arr.length; x++) {
Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2);
}
} else {
var arr = Object.keys(CM.Cache.Objects).map(k =>
{
var o = CM.Cache.Objects[k];
o.name = k;
o.id = Game.Objects[k].id;
return o;
});
arr.sort((a, b) => a.id - b.id);
for (var x = 0; x < arr.length; x++) {
Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2);
}
}
}
CM.Disp.CreateUpgradeBar = function() {
CM.Disp.UpgradeBar = document.createElement('div');
@@ -3102,6 +3113,19 @@ CM.Disp.UpdateAscendState = function() {
CM.Disp.UpdateBackground();
}
CM.Disp.UpdateAuraDescription = function() {
return "function(aura)\
{\
l('dragonAuraInfo').innerHTML=\
'<div style=\"min-width:200px;text-align:center;\"><h4>'+Game.dragonAuras[aura].name+'</h4>'+\
'<div class=\"line\"></div>'+\
Game.dragonAuras[aura].desc+\
'<div class=\"line\"></div>'+\
CM.\
'</div>';\
}"
}
CM.Disp.ToggleSayTime = function() {
if (CM.Config.SayTime == 1) {
Game.sayTime = CM.Disp.sayTime;

View File

@@ -660,6 +660,7 @@ CM.Disp.UpdateBuildings = function() {
// Build array of pointers, sort by pp, use array index (+2) as the grid row number
// (grid rows are 1-based indexing, and row 1 is the bulk buy/sell options)
if (Game.buyMode == 1 && CM.Config.SortBuildings) {
var arr = Object.keys(CM.Cache[target]).map(k =>
{
var o = CM.Cache[target][k];
@@ -667,15 +668,25 @@ CM.Disp.UpdateBuildings = function() {
o.id = Game.Objects[k].id;
return o;
});
if (CM.Config.SortBuildings)
arr.sort((a, b) => a.pp - b.pp);
else
arr.sort((a, b) => a.id - b.id);
for (var x = 0; x < arr.length; x++)
for (var x = 0; x < arr.length; x++) {
Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2);
}
} else {
var arr = Object.keys(CM.Cache.Objects).map(k =>
{
var o = CM.Cache.Objects[k];
o.name = k;
o.id = Game.Objects[k].id;
return o;
});
arr.sort((a, b) => a.id - b.id);
for (var x = 0; x < arr.length; x++) {
Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2);
}
}
}
CM.Disp.CreateUpgradeBar = function() {
CM.Disp.UpgradeBar = document.createElement('div');
@@ -2364,6 +2375,19 @@ CM.Disp.UpdateAscendState = function() {
CM.Disp.UpdateBackground();
}
CM.Disp.UpdateAuraDescription = function() {
return "function(aura)\
{\
l('dragonAuraInfo').innerHTML=\
'<div style=\"min-width:200px;text-align:center;\"><h4>'+Game.dragonAuras[aura].name+'</h4>'+\
'<div class=\"line\"></div>'+\
Game.dragonAuras[aura].desc+\
'<div class=\"line\"></div>'+\
CM.\
'</div>';\
}"
}
CM.Disp.ToggleSayTime = function() {
if (CM.Config.SayTime == 1) {
Game.sayTime = CM.Disp.sayTime;