diff --git a/binaries/data/mods/public/simulation/ai/petra/queueManager.js b/binaries/data/mods/public/simulation/ai/petra/queueManager.js index 996a6a5601..b5ba275085 100644 --- a/binaries/data/mods/public/simulation/ai/petra/queueManager.js +++ b/binaries/data/mods/public/simulation/ai/petra/queueManager.js @@ -37,7 +37,7 @@ m.QueueManager = function(Config, queues) this.queueArrays.push([p, this.queues[p]]); } var priorities = this.priorities; - this.queueArrays.sort(function (a,b) { return (priorities[b[0]] - priorities[a[0]]); }); + this.queueArrays.sort((a,b) => priorities[b[0]] - priorities[a[0]]); }; m.QueueManager.prototype.getAvailableResources = function(gameState) @@ -182,60 +182,6 @@ m.QueueManager.prototype.printQueues = function(gameState) API3.warn("------------------------------------"); }; -// nice readable HTML version. -m.QueueManager.prototype.HTMLprintQueues = function(gameState) -{ - var strToSend = []; - strToSend.push(" Aegis Queue Manager "); - for (var i in this.queues) - { - strToSend.push(""); - - var q = this.queues[i]; - var str = ""); - for (var j in q.queue) { - if (q.queue[j].isGo(gameState)) - strToSend.push(""; - strToSend.push(qStr); - } - strToSend.push(""); - } - strToSend.push("
Aegis Build Order
" + i + " (" + this.priorities[i] + ")
"; - for (var k of this.accounts[i].types) - { - str += this.accounts[i][k] + k.substr(0,1).toUpperCase() ; - if (k != "metal") str += " / "; - } - strToSend.push(str + "
"); - else - strToSend.push(""); - - var qStr = ""; - if (q.queue[j].number) - qStr += q.queue[j].number + " "; - qStr += q.queue[j].type; - qStr += "
"; - var costs = q.queue[j].getCost(); - for (var k of costs.types) - { - qStr += costs[k] + k.substr(0,1).toUpperCase() ; - if (k != "metal") - qStr += " / "; - } - qStr += "
"); - /*strToSend.push("

Accounts

"); - for (var p in this.accounts) - { - strToSend.push("

" + p + ": " + uneval(this.accounts[p]) + "

"); - }*/ - strToSend.push("

Wanted Gather Rate:" + uneval(this.wantedGatherRates(gameState)) + "

"); - strToSend.push("

Current Resources:" + uneval(gameState.getResources()) + "

"); - strToSend.push("

Available Resources:" + uneval(this.getAvailableResources(gameState)) + "

"); - strToSend.push(""); - for (var logged of strToSend) - log(logged); -}; - m.QueueManager.prototype.clear = function() { for (var i in this.queues) @@ -554,7 +500,7 @@ m.QueueManager.prototype.addQueue = function(queueName, priority) for (var p in this.queues) this.queueArrays.push([p, this.queues[p]]); var priorities = this.priorities; - this.queueArrays.sort(function (a,b) { return (priorities[b[0]] - priorities[a[0]]); }); + this.queueArrays.sort((a,b) => priorities[b[0]] - priorities[a[0]]); }; m.QueueManager.prototype.removeQueue = function(queueName) @@ -570,7 +516,7 @@ m.QueueManager.prototype.removeQueue = function(queueName) for (var p in this.queues) this.queueArrays.push([p, this.queues[p]]); var priorities = this.priorities; - this.queueArrays.sort(function (a,b) { return (priorities[b[0]] - priorities[a[0]]); }); + this.queueArrays.sort((a,b) => priorities[b[0]] - priorities[a[0]]); }; m.QueueManager.prototype.getPriority = function(queueName) @@ -585,7 +531,7 @@ m.QueueManager.prototype.changePriority = function(queueName, newPriority) if (this.queues[queueName] !== undefined) this.priorities[queueName] = newPriority; var priorities = this.priorities; - this.queueArrays.sort(function (a,b) { return (priorities[b[0]] - priorities[a[0]]); }); + this.queueArrays.sort((a,b) => priorities[b[0]] - priorities[a[0]]); }; m.QueueManager.prototype.Serialize = function() @@ -624,7 +570,7 @@ m.QueueManager.prototype.Deserialize = function(gameState, data) this.accounts[p].Deserialize(data.accounts[p]); this.queueArrays.push([p, this.queues[p]]); } - this.queueArrays.sort(function (a,b) { return (data.priorities[b[0]] - data.priorities[a[0]]); }); + this.queueArrays.sort((a,b) => data.priorities[b[0]] - data.priorities[a[0]]); }; return m;