Fixed pp-sort breaking for sell-mode (#364)
Fixed pp-sort breaking for sell-mode (#364)
This commit is contained in:
@@ -1398,6 +1398,7 @@ CM.Disp.UpdateBuildings = function() {
|
|||||||
|
|
||||||
// Build array of pointers, sort by pp, use array index (+2) as the grid row number
|
// 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)
|
// (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 arr = Object.keys(CM.Cache[target]).map(k =>
|
||||||
{
|
{
|
||||||
var o = CM.Cache[target][k];
|
var o = CM.Cache[target][k];
|
||||||
@@ -1405,14 +1406,24 @@ CM.Disp.UpdateBuildings = function() {
|
|||||||
o.id = Game.Objects[k].id;
|
o.id = Game.Objects[k].id;
|
||||||
return o;
|
return o;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (CM.Config.SortBuildings)
|
|
||||||
arr.sort((a, b) => a.pp - b.pp);
|
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);
|
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.CreateUpgradeBar = function() {
|
||||||
@@ -3102,6 +3113,19 @@ CM.Disp.UpdateAscendState = function() {
|
|||||||
CM.Disp.UpdateBackground();
|
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() {
|
CM.Disp.ToggleSayTime = function() {
|
||||||
if (CM.Config.SayTime == 1) {
|
if (CM.Config.SayTime == 1) {
|
||||||
Game.sayTime = CM.Disp.sayTime;
|
Game.sayTime = CM.Disp.sayTime;
|
||||||
|
|||||||
34
src/Disp.js
34
src/Disp.js
@@ -660,6 +660,7 @@ CM.Disp.UpdateBuildings = function() {
|
|||||||
|
|
||||||
// Build array of pointers, sort by pp, use array index (+2) as the grid row number
|
// 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)
|
// (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 arr = Object.keys(CM.Cache[target]).map(k =>
|
||||||
{
|
{
|
||||||
var o = CM.Cache[target][k];
|
var o = CM.Cache[target][k];
|
||||||
@@ -667,14 +668,24 @@ CM.Disp.UpdateBuildings = function() {
|
|||||||
o.id = Game.Objects[k].id;
|
o.id = Game.Objects[k].id;
|
||||||
return o;
|
return o;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (CM.Config.SortBuildings)
|
|
||||||
arr.sort((a, b) => a.pp - b.pp);
|
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);
|
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.CreateUpgradeBar = function() {
|
||||||
@@ -2364,6 +2375,19 @@ CM.Disp.UpdateAscendState = function() {
|
|||||||
CM.Disp.UpdateBackground();
|
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() {
|
CM.Disp.ToggleSayTime = function() {
|
||||||
if (CM.Config.SayTime == 1) {
|
if (CM.Config.SayTime == 1) {
|
||||||
Game.sayTime = CM.Disp.sayTime;
|
Game.sayTime = CM.Disp.sayTime;
|
||||||
|
|||||||
Reference in New Issue
Block a user