diff --git a/core/code/chat.js b/core/code/chat.js index fff821b83..6e73cefc2 100644 --- a/core/code/chat.js +++ b/core/code/chat.js @@ -356,7 +356,7 @@ window.chat.updateOldNewHash = function(newData, storageHash, isOlderMsgs, isAsc } }; -window.chat.parseMsgData = function(data) { +window.chat.parseMsgData = function (data) { var categories = data[2].plext.categories; var isPublic = (categories & 1) === 1; var isSecure = (categories & 2) === 2; @@ -365,7 +365,7 @@ window.chat.parseMsgData = function(data) { var msgToPlayer = msgAlert && (isPublic || isSecure); var time = data[1]; - var team = data[2].plext.team === 'RESISTANCE' ? TEAM_RES : TEAM_ENL; + var team = window.teamStringToId(data[2].plext.team); var auto = data[2].plext.plextType !== 'PLAYER_GENERATED'; var systemNarrowcast = data[2].plext.plextType === 'SYSTEM_NARROWCAST'; @@ -374,17 +374,17 @@ window.chat.parseMsgData = function(data) { var nick = ''; markup.forEach(function(ent) { switch (ent[0]) { - case 'SENDER': // user generated messages - nick = ent[1].plain.replace(/: $/, ''); // cut “: ” at end - break; + case 'SENDER': // user generated messages + nick = ent[1].plain.replace(/: $/, ''); // cut “: ” at end + break; - case 'PLAYER': // automatically generated messages - nick = ent[1].plain; - team = ent[1].team === 'RESISTANCE' ? TEAM_RES : TEAM_ENL; - break; + case 'PLAYER': // automatically generated messages + nick = ent[1].plain; + team = window.teamStringToId(ent[1].team); + break; - default: - break; + default: + break; } }); @@ -457,8 +457,9 @@ window.chat.renderPortal = function (portal) { }; window.chat.renderFactionEnt = function (faction) { - var name = faction.team === 'ENLIGHTENED' ? 'Enlightened' : 'Resistance'; - var spanClass = faction.team === 'ENLIGHTENED' ? TEAM_TO_CSS[TEAM_ENL] : TEAM_TO_CSS[TEAM_RES]; + var teamId = window.teamStringToId(faction.team); + var name = window.TEAM_NAMES[teamId]; + var spanClass = window.TEAM_TO_CSS[teamId]; return $('
').html($('') .attr('class', spanClass) .text(name)).html(); @@ -545,8 +546,8 @@ window.chat.renderMsgRow = function(data) { var timeCell = chat.renderTimeCell(data.time, timeClass); var nickClasses = ['nickname']; - if (data.player.team === TEAM_ENL || data.player.team === TEAM_RES) { - nickClasses.push(TEAM_TO_CSS[data.player.team]); + if (window.TEAM_TO_CSS[data.player.team]) { + nickClasses.push(window.TEAM_TO_CSS[data.player.team]); } // highlight things said/done by the player in a unique colour // (similar to @player mentions from others in the chat text itself) diff --git a/plugins/images/marker-machina.png b/plugins/images/marker-machina.png new file mode 100644 index 000000000..27d80ffa2 Binary files /dev/null and b/plugins/images/marker-machina.png differ diff --git a/plugins/machina-tracker.css b/plugins/machina-tracker.css new file mode 100644 index 000000000..25f1e8b4b --- /dev/null +++ b/plugins/machina-tracker.css @@ -0,0 +1,33 @@ +.plugin-machina-tracker-popup a { + color: inherit; + text-decoration: underline; + text-decoration-style: dashed; + -moz-text-decoration-style: dashed; + -webkit-text-decoration-style: dashed; +} + +.plugin-machina-tracker-popup-header { + white-space: nowrap; +} + +ul.plugin-machina-tracker-link-list { + list-style: none; + padding-left: 1em; +} + +ul.plugin-machina-tracker-link-list li { + position: relative; + display: flex; + justify-content: space-between; + white-space: nowrap; +} + +ul.plugin-machina-tracker-link-list li a { + margin-right: 3px; +} + +ul.plugin-machina-tracker-link-list li::before { + content: '↴'; + position: absolute; + left: -1em; +} diff --git a/plugins/machina-tracker.js b/plugins/machina-tracker.js new file mode 100644 index 000000000..7ba51ac4f --- /dev/null +++ b/plugins/machina-tracker.js @@ -0,0 +1,212 @@ +// @name Machina tracker +// @author McBen +// @category Layer +// @version 1.0.0 +// @description Show locations of Machina activities + +/* exported setup --eslint */ +/* global L */ + +// ensure plugin framework is there, even if iitc is not yet loaded +if (typeof window.plugin !== 'function') window.plugin = function () {}; + +// PLUGIN START //////////////////////////////////////////////////////// +// use own namespace for plugin +window.plugin.machinaTracker = function () {}; +var machinaTracker = window.plugin.machinaTracker; + +machinaTracker.MACHINA_TRACKER_MAX_TIME = 8 * 60 * 60 * 1000; +machinaTracker.MACHINA_TRACKER_MIN_ZOOM = 9; + +machinaTracker.events = []; + +machinaTracker.setup = () => { + $('