@ -13,6 +13,7 @@ Available Plugins
|
||||
- [**Draw Tools**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/draw-tools.user.js) allows to draw circles and lines on the map to aid you with planning your next big field. [View screenshot](http://breunigs.github.com/ingress-intel-total-conversion/screenshots/plugin_draw_tools.png)
|
||||
- [**Guess Player Level**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/guess-player-levels.user.js) looks for the highest placed resonator per player in the current view to guess the player level.
|
||||
- [**Highlight Weakened Portals**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/show-portal-weakness.user.js) fill portals with red to indicate portal's state of disrepair. The brighter the color the more attention needed (recharge, shields, resonators). A dashed portal means a resonator is missing. Red, needs energy and shields. Orange, only needs energy (either recharge or resonators). Yellow, only needs shields.
|
||||
- [**Max-Links**]((https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/max-links.user.js) Calculates how to link the portals to create the maximum number of fields. [View screenshot](http://breunigs.github.com/ingress-intel-total-conversion/screenshots/plugin_max_links.png)
|
||||
- [**Player Tracker**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/player-tracker.user.js) Draws trails for user actions in the last hour. At the last known location there’s a tooltip that shows the data in a table. [View screenshot](http://breunigs.github.com/ingress-intel-total-conversion/screenshots/plugin_player_tracker.png).
|
||||
- [**Render Limit Increase**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/render-limit-increase.user.js) increases render limits. Good for high density areas (e.g. London, UK) and faster PCs.
|
||||
- [**Resonator Display Zoom Level Decrease**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/resonator-display-zoom-level-decrease.user.js) Resonator start displaying earlier.
|
||||
|
137
plugins/max-links.user.js
Normal file
137
plugins/max-links.user.js
Normal file
@ -0,0 +1,137 @@
|
||||
// ==UserScript==
|
||||
// @id max-links@boombuler
|
||||
// @name iitc: Max-Links-Plugin
|
||||
// @version 0.1
|
||||
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/max-links.user.js
|
||||
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/max-links.user.js
|
||||
// @description Calculates how to link the portals to create the maximum number of fields.
|
||||
// @include http://www.ingress.com/intel*
|
||||
// @match http://www.ingress.com/intel*
|
||||
// ==/UserScript==
|
||||
|
||||
function wrapper() {
|
||||
|
||||
// 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.maxLinks = function() {};
|
||||
|
||||
// const values
|
||||
window.plugin.maxLinks.MAX_DRAWN_LINKS = 400;
|
||||
window.plugin.maxLinks.MAX_DRAWN_LINKS_INCREASED_LIMIT = 1000;
|
||||
window.plugin.maxLinks.STROKE_STYLE = {
|
||||
color: '#FF0000',
|
||||
opacity: 1,
|
||||
weight:2,
|
||||
clickable: false,
|
||||
smoothFactor: 10
|
||||
};
|
||||
window.plugin.maxLinks._delaunayScriptLocation = 'https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist/delaunay.js';
|
||||
|
||||
window.plugin.maxLinks.layer = null;
|
||||
|
||||
window.plugin.maxLinks._updating = false;
|
||||
window.plugin.maxLinks._renderLimitReached = false;
|
||||
|
||||
window.plugin.maxLinks.updateLayer = function() {
|
||||
if (window.plugin.maxLinks._updating ||
|
||||
window.plugin.maxLinks.layer === null ||
|
||||
!window.map.hasLayer(window.plugin.maxLinks.layer))
|
||||
return;
|
||||
window.plugin.maxLinks._updating = true;
|
||||
window.plugin.maxLinks.layer.clearLayers();
|
||||
|
||||
var locations = [];
|
||||
var minX = 0;
|
||||
var minY = 0;
|
||||
|
||||
$.each(window.portals, function(guid, portal) {
|
||||
var loc = portal.options.details.locationE6;
|
||||
var nloc = { x: loc.lngE6, y: loc.latE6 };
|
||||
if (nloc.x < minX)
|
||||
minX = nloc.x;
|
||||
if (nloc.y < minY)
|
||||
minY = nloc.y;
|
||||
locations.push(nloc);
|
||||
});
|
||||
|
||||
$.each(locations, function(idx, nloc) {
|
||||
nloc.x += Math.abs(minX);
|
||||
nloc.y += Math.abs(minY);
|
||||
});
|
||||
|
||||
var triangles = window.delaunay.triangulate(locations);
|
||||
var drawnLinks = 0;
|
||||
window.plugin.maxLinks._renderLimitReached = false;
|
||||
var renderlimit = window.USE_INCREASED_RENDER_LIMIT ?
|
||||
window.plugin.maxLinks.MAX_DRAWN_LINKS_INCREASED_LIMIT :
|
||||
window.plugin.maxLinks.MAX_DRAWN_LINKS;
|
||||
$.each(triangles, function(idx, triangle) {
|
||||
if (drawnLinks <= renderlimit) {
|
||||
triangle.draw(window.plugin.maxLinks.layer, minX, minY)
|
||||
drawnLinks += 3;
|
||||
} else {
|
||||
window.plugin.maxLinks._renderLimitReached = true;
|
||||
}
|
||||
});
|
||||
window.plugin.maxLinks._updating = false;
|
||||
window.renderUpdateStatus();
|
||||
}
|
||||
|
||||
window.plugin.maxLinks.setup = function() {
|
||||
load(window.plugin.maxLinks._delaunayScriptLocation).thenRun(function() {
|
||||
|
||||
window.delaunay.Triangle.prototype.draw = function(layer, divX, divY) {
|
||||
var drawLine = function(src, dest) {
|
||||
var poly = L.polyline([[(src.y + divY)/1E6, (src.x + divX)/1E6], [(dest.y + divY)/1E6, (dest.x + divX)/1E6]], window.plugin.maxLinks.STROKE_STYLE);
|
||||
poly.addTo(layer);
|
||||
};
|
||||
|
||||
drawLine(this.a, this.b);
|
||||
drawLine(this.b, this.c);
|
||||
drawLine(this.c, this.a);
|
||||
}
|
||||
|
||||
window.plugin.maxLinks.layer = L.layerGroup([]);
|
||||
|
||||
window.addHook('checkRenderLimit', function(e) {
|
||||
if (window.map.hasLayer(window.plugin.maxLinks.layer) &&
|
||||
window.plugin.maxLinks._renderLimitReached)
|
||||
e.reached = true;
|
||||
});
|
||||
|
||||
window.addHook('portalDataLoaded', function(e) {
|
||||
if (window.map.hasLayer(window.plugin.maxLinks.layer))
|
||||
window.plugin.maxLinks.updateLayer();
|
||||
});
|
||||
|
||||
window.map.on('layeradd', function(e) {
|
||||
if (e.layer === window.plugin.maxLinks.layer)
|
||||
window.plugin.maxLinks.updateLayer();
|
||||
});
|
||||
window.map.on('zoomend moveend', window.plugin.maxLinks.updateLayer);
|
||||
window.layerChooser.addOverlay(window.plugin.maxLinks.layer, 'Maximum Links');
|
||||
});
|
||||
}
|
||||
var setup = window.plugin.maxLinks.setup;
|
||||
|
||||
// PLUGIN END //////////////////////////////////////////////////////////
|
||||
if(window.iitcLoaded && typeof setup === 'function') {
|
||||
setup();
|
||||
} else {
|
||||
if(window.bootPlugins)
|
||||
window.bootPlugins.push(setup);
|
||||
else
|
||||
window.bootPlugins = [setup];
|
||||
}
|
||||
|
||||
} // wrapper end
|
||||
|
||||
// inject code into site context
|
||||
var script = document.createElement('script');
|
||||
script.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||
(document.body || document.head || document.documentElement).appendChild(script);
|
@ -39,7 +39,7 @@ window.plugin.renderLimitIncrease.setHigherLimits = function() {
|
||||
window.MAX_DRAWN_PORTALS = 3000;
|
||||
window.MAX_DRAWN_LINKS = 1000;
|
||||
window.MAX_DRAWN_FIELDS = 500;
|
||||
|
||||
window.USE_INCREASED_RENDER_LIMIT = true; // Used for other plugins
|
||||
};
|
||||
|
||||
var setup = window.plugin.renderLimitIncrease.setHigherLimits;
|
||||
|
Reference in New Issue
Block a user