Numbering city purchases based on ROR
|
|
add these functions:
function roiSort(a, b) {
if (a.value < b.value) return 1;
if (a.value > b.value) return -1;
return 0;
}
function roiEntry(item, roi) {
this.value = roi;
this.id = item;
}
and then edit datadisplay_ROR:
function datadisplay_ROR() {
+ var roiSet = [];
+ var i = 0;
var income = boss.total_income + boss.job_income - boss.total_upkeep;
=======
var ROR = 100 * itemlist[item].income / total_price;
+ var itemID = parseInt(item.substr(5), 10);
+ if (itemID <= 3) {
+ if (boss.preferences.buy_land)
+ roiSet[i++] = new roiEntry(item, ROR);
+ } else {
+ roiSet[i++] = new roiEntry(item, ROR);
+ }
var td = Utils.getElementsByXPath('//a[@name="' + item + '"]/../../td[position() = 2]')[0];
=======
(at the end of the function)
+ roiSet.sort(roiSort);
+ for (i = 0; i < roiSet.length; i++) {
+ var item = roiSet[i].id;
+ var td = Utils.getElementsByXPath('//a[@name="' + item + '"]/../../td[position() = 2]')[0];
+ var title = td.getElementsByTagName('b')[0];
+ title.innerHTML = "#" + (i+1) + " " + title.innerHTML;
+ }
|
|
|
what does it do? |
|
|
next to each property title in the city listing, it adds "#1 .." "#2 .." "#3 .." based on the ROR value. If you're not auto-buying, it makes it easier to visually scan the list and find the most profitable items to buy, rather than reading the status and finding the list. It ignores undeveloped land based on preferences, but will not ignore beachfront lot or container yard as those cannot be used up at the moment - it lists them as developed land, though it doesn't interfere with the rest of the buying logic - this is purely a visual addition. |