From 4d45bf565da0f6a763f70aec7985fb98380b68c2 Mon Sep 17 00:00:00 2001 From: NineBerry Date: Fri, 19 Jul 2024 14:53:49 +0200 Subject: [PATCH 1/6] Plugin "Scoreboard": Include information on Machina --- plugins/scoreboard.js | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/plugins/scoreboard.js b/plugins/scoreboard.js index 3ad5c34b2..8172181ed 100644 --- a/plugins/scoreboard.js +++ b/plugins/scoreboard.js @@ -55,7 +55,7 @@ function getPortalsInfo (portals,bounds) { }); if (portals.length) { - [TEAM_RES,TEAM_ENL].forEach(function (teamN) { + [TEAM_RES,TEAM_ENL, 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) : '-'; @@ -65,7 +65,8 @@ function getPortalsInfo (portals,bounds) { }); return { enl: score[TEAM_ENL], - res: score[TEAM_RES] + res: score[TEAM_RES], + mac: score[TEAM_MAC] }; } } @@ -86,6 +87,7 @@ function getEntitiesCount (entities,bounds) { return { enl: counts[window.TEAM_ENL] || 0, res: counts[window.TEAM_RES] || 0, + mac: counts[window.TEAM_MAC] || 0, }; } @@ -93,34 +95,49 @@ function makeTable (portals,linksCount,fieldsCount) { var html = ''; html += '' - + '' + + '' + '' + '' + '' + '' + + '' + '\n'; html += '' +'' - +'' + +'' + +'' + +'' +'' +'' - +'' + +'' + +'' + +'' + '' +'' - +'' + +'' + +'' + +'' +'' +'' - +'' + +'' + +'' + +'' +'' +'' - +'' + +'' + +'' + +'' +'' +'' - +'' + +'' + +'' + +'' +'' +'' - +''; + +'' + +'' + +'' html += '
MetricsEnlightenedResistance__MACHINA__
Portals'+portals.enl.total+''+portals.res.total+'
'+portals.res.total+''+portals.mac.total+'
avg Level'+portals.enl.levels+''+portals.res.levels+'
'+portals.res.levels+''+portals.mac.levels+'
avg Health'+portals.enl.health+''+portals.res.health+'
'+portals.res.health+''+portals.mac.health+'
Level 8'+portals.enl.level8+''+portals.res.level8+'
'+portals.res.level8+''+portals.mac.level8+'
Max Level'+portals.enl.maxLevel+''+portals.res.maxLevel+'
'+portals.res.maxLevel+''+portals.mac.maxLevel+'
Links'+linksCount.enl+''+linksCount.res+'
'+linksCount.res+''+linksCount.mac+'
Fields'+fieldsCount.enl+''+fieldsCount.res+'
'+fieldsCount.res+''+fieldsCount.mac+'
'; return html; @@ -153,6 +170,7 @@ function displayScoreboard () { } else { dialog({ html: html, + width: 400, dialogClass: 'ui-dialog-scoreboard', title: 'Scoreboard', id: 'Scoreboard' @@ -184,7 +202,8 @@ 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'); -} +} \ No newline at end of file From 2a78498d2e6e028222b485ce84bf0cccebc11fb8 Mon Sep 17 00:00:00 2001 From: NineBerry Date: Fri, 19 Jul 2024 15:38:04 +0200 Subject: [PATCH 2/6] Plugin "Scoreboard": Use "auto" width for dialog --- plugins/scoreboard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/scoreboard.js b/plugins/scoreboard.js index 8172181ed..a2af9d9df 100644 --- a/plugins/scoreboard.js +++ b/plugins/scoreboard.js @@ -170,7 +170,7 @@ function displayScoreboard () { } else { dialog({ html: html, - width: 400, + width: 'auto', dialogClass: 'ui-dialog-scoreboard', title: 'Scoreboard', id: 'Scoreboard' From 83e0910f051907a875ad1417b9aae71912c531ca Mon Sep 17 00:00:00 2001 From: Alexander Danilov Date: Tue, 13 Aug 2024 12:08:01 +0500 Subject: [PATCH 3/6] Fix eslint --- plugins/scoreboard.js | 140 +++++++++++++++++++++++++++--------------- 1 file changed, 92 insertions(+), 48 deletions(-) diff --git a/plugins/scoreboard.js b/plugins/scoreboard.js index a2af9d9df..1a3a25366 100644 --- a/plugins/scoreboard.js +++ b/plugins/scoreboard.js @@ -55,7 +55,7 @@ function getPortalsInfo (portals,bounds) { }); if (portals.length) { - [TEAM_RES,TEAM_ENL, TEAM_MAC].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,9 +64,9 @@ function getPortalsInfo (portals,bounds) { team.total = team.placeHolders ? team.total + ' + ' + team.placeHolders : team.total; }); return { - enl: score[TEAM_ENL], - res: score[TEAM_RES], - mac: score[TEAM_MAC] + enl: score[window.TEAM_ENL], + res: score[window.TEAM_RES], + mac: score[window.TEAM_MAC], }; } } @@ -94,50 +94,94 @@ function getEntitiesCount (entities,bounds) { function makeTable (portals,linksCount,fieldsCount) { var html = ''; - html += '' - + '' - + '' - + '' - + '' - + '' - + '' - + '\n'; - - html += '' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - + '' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' + html += + '
MetricsEnlightenedResistance__MACHINA__
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+'
' + + '' + + '' + + '' + + '' + + '' + + '' + + '\n'; + + html += + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + ''; html += '
MetricsEnlightenedResistance__MACHINA__
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 + + '
'; return html; From 6a8b60228db048438f0a9d3bef268a0ec7c99c4e Mon Sep 17 00:00:00 2001 From: Alexander Danilov Date: Tue, 13 Aug 2024 13:00:21 +0500 Subject: [PATCH 4/6] Fix eslint 2 --- plugins/scoreboard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/scoreboard.js b/plugins/scoreboard.js index 1a3a25366..5f2ca9ce5 100644 --- a/plugins/scoreboard.js +++ b/plugins/scoreboard.js @@ -250,4 +250,4 @@ function setup () { #scoreboard .disclaimer { margin-top: 10px; color: yellow; }\ #scoreboard.mobile { position: absolute; top: 0; width: 100%; }\ ').appendTo('head'); -} \ No newline at end of file +} From 10db076c2446bca4030efc9c1775da4339b2546c Mon Sep 17 00:00:00 2001 From: Alexander Danilov Date: Tue, 13 Aug 2024 13:10:40 +0500 Subject: [PATCH 5/6] Add changelog --- plugins/scoreboard.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/scoreboard.js b/plugins/scoreboard.js index 5f2ca9ce5..bf8be0731 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'], From ee0cc17ade5a2c78db47b1a0524de56cba128e58 Mon Sep 17 00:00:00 2001 From: Alexander Danilov Date: Wed, 14 Aug 2024 16:13:33 +0500 Subject: [PATCH 6/6] Using a loop to display a table --- plugins/scoreboard.js | 92 +++++++------------------------------------ 1 file changed, 14 insertions(+), 78 deletions(-) diff --git a/plugins/scoreboard.js b/plugins/scoreboard.js index bf8be0731..e88554eb1 100644 --- a/plugins/scoreboard.js +++ b/plugins/scoreboard.js @@ -108,84 +108,20 @@ function makeTable (portals,linksCount,fieldsCount) { '__MACHINA__' + '\n'; - html += - '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 + - '' + - ''; + 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) => `${cell}`); + return `${cells}`; + }); html += ''; return html;