diff --git a/plugins/scoreboard.js b/plugins/scoreboard.js index 3ad5c34b2..e88554eb1 100644 --- a/plugins/scoreboard.js +++ b/plugins/scoreboard.js @@ -1,6 +1,6 @@ // @author Costaspap // @name Localized scoreboard -// @version 0.3.4 +// @version 0.4.0 // @category Info // @description Display a scoreboard about all visible portals with statistics about both teams,like average portal level,link & field counts etc. @@ -8,6 +8,10 @@ /* exported setup, changelog --eslint */ var changelog = [ + { + version: '0.4.0', + changes: ['Includes information on Machina'], + }, { version: '0.3.4', changes: ['IITC.toolbox API is used to create plugin buttons'], @@ -55,7 +59,7 @@ function getPortalsInfo (portals,bounds) { }); if (portals.length) { - [TEAM_RES,TEAM_ENL].forEach(function (teamN) { + [window.TEAM_RES, window.TEAM_ENL, window.TEAM_MAC].forEach(function (teamN) { var team = score[teamN]; team.health = team.total ? (team.health/team.total).toFixed(1)+'%' : '-'; team.levels = team.total ? (team.levels/team.total).toFixed(1) : '-'; @@ -64,8 +68,9 @@ function getPortalsInfo (portals,bounds) { team.total = team.placeHolders ? team.total + ' + ' + team.placeHolders : team.total; }); return { - enl: score[TEAM_ENL], - res: score[TEAM_RES] + enl: score[window.TEAM_ENL], + res: score[window.TEAM_RES], + mac: score[window.TEAM_MAC], }; } } @@ -86,41 +91,37 @@ function getEntitiesCount (entities,bounds) { return { enl: counts[window.TEAM_ENL] || 0, res: counts[window.TEAM_RES] || 0, + mac: counts[window.TEAM_MAC] || 0, }; } function makeTable (portals,linksCount,fieldsCount) { var html = ''; - html += '' - + '' - + '' - + '' - + '' - + '' - + '\n'; - - html += '' - +'' - +'' - +'' - +'' - +'' - + '' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +''; + html += + '
MetricsEnlightenedResistance
Portals'+portals.enl.total+''+portals.res.total+'
avg Level'+portals.enl.levels+''+portals.res.levels+'
avg Health'+portals.enl.health+''+portals.res.health+'
Level 8'+portals.enl.level8+''+portals.res.level8+'
Max Level'+portals.enl.maxLevel+''+portals.res.maxLevel+'
Links'+linksCount.enl+''+linksCount.res+'
Fields'+fieldsCount.enl+''+fieldsCount.res+'
' + + '' + + '' + + '' + + '' + + '' + + '' + + '\n'; + + const lines = [ + ['Portals', portals.enl.total, portals.res.total, portals.mac.total], + ['avg Level', portals.enl.levels, portals.res.levels, portals.mac.levels], + ['avg Health', portals.enl.health, portals.res.health, portals.mac.health], + ['Level 8', portals.enl.level8, portals.res.level8, portals.mac.level8], + ['Max Level', portals.enl.maxLevel, portals.res.maxLevel, portals.mac.maxLevel], + ['Links', linksCount.enl, linksCount.res, linksCount.mac], + ['Fields', fieldsCount.enl, fieldsCount.res, fieldsCount.mac], + ]; + + html += lines.map((line) => { + const cells = line.map((cell) => ``); + return `${cells}`; + }); html += '
MetricsEnlightenedResistance__MACHINA__
${cell}
'; return html; @@ -153,6 +154,7 @@ function displayScoreboard () { } else { dialog({ html: html, + width: 'auto', dialogClass: 'ui-dialog-scoreboard', title: 'Scoreboard', id: 'Scoreboard' @@ -184,6 +186,7 @@ function setup () { #scoreboard td, #scoreboard th { padding: 3px 10px; text-align: left; }\ #scoreboard col.enl { background-color: #017f01; }\ #scoreboard col.res { background-color: #005684; }\ + #scoreboard col.mac { background-color: #7f3333; }\ #scoreboard .disclaimer { margin-top: 10px; color: yellow; }\ #scoreboard.mobile { position: absolute; top: 0; width: 100%; }\ ').appendTo('head');