From c5ea4029f5aac2e87f972487cb09e6bf291289b3 Mon Sep 17 00:00:00 2001 From: Exodus4D Date: Mon, 24 Apr 2017 21:03:41 +0200 Subject: [PATCH] - Bugfixes - updated "notice" panel for upcoming release --- js/app/map/local.js | 9 +++---- js/app/map/map.js | 2 +- js/app/map/util.js | 1 + js/app/util.js | 42 ++++++++++++++++++++++++++++--- public/js/v1.2.2/app/map/local.js | 9 +++---- public/js/v1.2.2/app/map/map.js | 2 +- public/js/v1.2.2/app/map/util.js | 1 + public/js/v1.2.2/app/util.js | 42 ++++++++++++++++++++++++++++--- public/templates/ui/notice.html | 8 +++--- 9 files changed, 90 insertions(+), 26 deletions(-) diff --git a/js/app/map/local.js b/js/app/map/local.js index 807b73fe..53a878b0 100644 --- a/js/app/map/local.js +++ b/js/app/map/local.js @@ -1,5 +1,5 @@ /** - * map overlay functions + * map overlay functions for "Near by" table * Created by Exodus on 13.04.2017. */ @@ -34,10 +34,7 @@ define([ tableCellEllipsisClass: 'pf-table-cell-ellipsis', tableCellEllipsis80Class: 'pf-table-cell-80', - tableCellEllipsis90Class: 'pf-table-cell-90', - - // default "search" radius (jumps) for "near by" pilots - jumps: 3 + tableCellEllipsis90Class: 'pf-table-cell-90' }; /** @@ -322,7 +319,7 @@ define([ }).append( $('', { class: ['badge', 'txt-color', 'txt-color-grayLight'].join(' '), - text: config.jumps + text: MapUtil.config.defaultLocalJumpRadius }).attr('title', 'jumps') ) diff --git a/js/app/map/map.js b/js/app/map/map.js index 8f96b117..6f308f4b 100644 --- a/js/app/map/map.js +++ b/js/app/map/map.js @@ -2894,7 +2894,7 @@ define([ currentSystemData = currentSystemData[0]; // check for active users "near by" (x jumps radius) - let nearBySystemData = Util.getNearBySystemData(currentSystemData, currentMapData, 3); + let nearBySystemData = Util.getNearBySystemData(currentSystemData, currentMapData, MapUtil.config.defaultLocalJumpRadius); let nearByCharacterData = Util.getNearByCharacterData(nearBySystemData, userData.data.systems); // update "local" table in overlay diff --git a/js/app/map/util.js b/js/app/map/util.js index aeeff14d..06b0fc3f 100644 --- a/js/app/map/util.js +++ b/js/app/map/util.js @@ -12,6 +12,7 @@ define([ let config = { mapSnapToGridDimension: 20, // px for grid snapping (grid YxY) + defaultLocalJumpRadius: 3, // default search radius (in jumps) for "near by" pilots // local storage characterLocalStoragePrefix: 'character_', // prefix for character data local storage key diff --git a/js/app/util.js b/js/app/util.js index 8b193465..09d43199 100644 --- a/js/app/util.js +++ b/js/app/util.js @@ -1822,7 +1822,7 @@ define([ * @param foundSystemIds * @returns {{systemData: *, tree: {}}} */ - let getNearBySystemData = (currentSystemData, currentMapData, jumps, foundSystemIds = []) => { + let getNearBySystemData = (currentSystemData, currentMapData, jumps, foundSystemIds = {}) => { // look for systemData by ID let getSystemData = (systemId) => { @@ -1836,7 +1836,7 @@ define([ }; // skip systems that are already found in recursive calls - foundSystemIds.push(currentSystemData.id); + foundSystemIds[currentSystemData.id] = {distance: jumps}; let nearBySystems = { systemData: currentSystemData, @@ -1844,7 +1844,7 @@ define([ }; jumps--; - if(jumps > 0){ + if(jumps >= 0){ for(let i = 0; i < currentMapData.data.connections.length; i++){ let connectionData = currentMapData.data.connections[i]; let type = ''; // "source" OR "target" @@ -1856,7 +1856,10 @@ define([ if( type && - foundSystemIds.indexOf(connectionData[type]) === -1 + ( + foundSystemIds[connectionData[type]] === undefined || + foundSystemIds[connectionData[type]].distance < jumps + ) ){ let newSystemData = getSystemData(connectionData[type]); if(newSystemData){ @@ -1888,9 +1891,40 @@ define([ return []; }; + let filterFinalCharData = function(tmpFinalCharData){ + return this.id !== tmpFinalCharData.id; + }; + let characterData = getCharacterDataBySystemId(nearBySystems.systemData.systemId); if(characterData.length){ + // filter (remove) characterData for "already" added chars + characterData = characterData.filter(function(tmpCharacterData, index, allData){ + let keepData = true; + + for(let tmpJump in data) { + // just scan systems with > jumps than current system + if(tmpJump > jumps){ + let filteredFinalData = data[tmpJump].filter(filterFinalCharData, tmpCharacterData); + + if(filteredFinalData.length > 0){ + data[tmpJump] = filteredFinalData; + }else{ + delete data[tmpJump]; + } + }else{ + for(let k = 0; k < data[tmpJump].length; k++){ + if(data[tmpJump][k].id === tmpCharacterData.id){ + keepData = false; + break; + } + } + } + } + + return keepData; + }); + data[jumps] = data[jumps] ? data[jumps] : []; data[jumps] = [...data[jumps], ...characterData]; } diff --git a/public/js/v1.2.2/app/map/local.js b/public/js/v1.2.2/app/map/local.js index 807b73fe..53a878b0 100644 --- a/public/js/v1.2.2/app/map/local.js +++ b/public/js/v1.2.2/app/map/local.js @@ -1,5 +1,5 @@ /** - * map overlay functions + * map overlay functions for "Near by" table * Created by Exodus on 13.04.2017. */ @@ -34,10 +34,7 @@ define([ tableCellEllipsisClass: 'pf-table-cell-ellipsis', tableCellEllipsis80Class: 'pf-table-cell-80', - tableCellEllipsis90Class: 'pf-table-cell-90', - - // default "search" radius (jumps) for "near by" pilots - jumps: 3 + tableCellEllipsis90Class: 'pf-table-cell-90' }; /** @@ -322,7 +319,7 @@ define([ }).append( $('', { class: ['badge', 'txt-color', 'txt-color-grayLight'].join(' '), - text: config.jumps + text: MapUtil.config.defaultLocalJumpRadius }).attr('title', 'jumps') ) diff --git a/public/js/v1.2.2/app/map/map.js b/public/js/v1.2.2/app/map/map.js index 8f96b117..6f308f4b 100644 --- a/public/js/v1.2.2/app/map/map.js +++ b/public/js/v1.2.2/app/map/map.js @@ -2894,7 +2894,7 @@ define([ currentSystemData = currentSystemData[0]; // check for active users "near by" (x jumps radius) - let nearBySystemData = Util.getNearBySystemData(currentSystemData, currentMapData, 3); + let nearBySystemData = Util.getNearBySystemData(currentSystemData, currentMapData, MapUtil.config.defaultLocalJumpRadius); let nearByCharacterData = Util.getNearByCharacterData(nearBySystemData, userData.data.systems); // update "local" table in overlay diff --git a/public/js/v1.2.2/app/map/util.js b/public/js/v1.2.2/app/map/util.js index aeeff14d..06b0fc3f 100644 --- a/public/js/v1.2.2/app/map/util.js +++ b/public/js/v1.2.2/app/map/util.js @@ -12,6 +12,7 @@ define([ let config = { mapSnapToGridDimension: 20, // px for grid snapping (grid YxY) + defaultLocalJumpRadius: 3, // default search radius (in jumps) for "near by" pilots // local storage characterLocalStoragePrefix: 'character_', // prefix for character data local storage key diff --git a/public/js/v1.2.2/app/util.js b/public/js/v1.2.2/app/util.js index 8b193465..09d43199 100644 --- a/public/js/v1.2.2/app/util.js +++ b/public/js/v1.2.2/app/util.js @@ -1822,7 +1822,7 @@ define([ * @param foundSystemIds * @returns {{systemData: *, tree: {}}} */ - let getNearBySystemData = (currentSystemData, currentMapData, jumps, foundSystemIds = []) => { + let getNearBySystemData = (currentSystemData, currentMapData, jumps, foundSystemIds = {}) => { // look for systemData by ID let getSystemData = (systemId) => { @@ -1836,7 +1836,7 @@ define([ }; // skip systems that are already found in recursive calls - foundSystemIds.push(currentSystemData.id); + foundSystemIds[currentSystemData.id] = {distance: jumps}; let nearBySystems = { systemData: currentSystemData, @@ -1844,7 +1844,7 @@ define([ }; jumps--; - if(jumps > 0){ + if(jumps >= 0){ for(let i = 0; i < currentMapData.data.connections.length; i++){ let connectionData = currentMapData.data.connections[i]; let type = ''; // "source" OR "target" @@ -1856,7 +1856,10 @@ define([ if( type && - foundSystemIds.indexOf(connectionData[type]) === -1 + ( + foundSystemIds[connectionData[type]] === undefined || + foundSystemIds[connectionData[type]].distance < jumps + ) ){ let newSystemData = getSystemData(connectionData[type]); if(newSystemData){ @@ -1888,9 +1891,40 @@ define([ return []; }; + let filterFinalCharData = function(tmpFinalCharData){ + return this.id !== tmpFinalCharData.id; + }; + let characterData = getCharacterDataBySystemId(nearBySystems.systemData.systemId); if(characterData.length){ + // filter (remove) characterData for "already" added chars + characterData = characterData.filter(function(tmpCharacterData, index, allData){ + let keepData = true; + + for(let tmpJump in data) { + // just scan systems with > jumps than current system + if(tmpJump > jumps){ + let filteredFinalData = data[tmpJump].filter(filterFinalCharData, tmpCharacterData); + + if(filteredFinalData.length > 0){ + data[tmpJump] = filteredFinalData; + }else{ + delete data[tmpJump]; + } + }else{ + for(let k = 0; k < data[tmpJump].length; k++){ + if(data[tmpJump][k].id === tmpCharacterData.id){ + keepData = false; + break; + } + } + } + } + + return keepData; + }); + data[jumps] = data[jumps] ? data[jumps] : []; data[jumps] = [...data[jumps], ...characterData]; } diff --git a/public/templates/ui/notice.html b/public/templates/ui/notice.html index 510717e8..63feb25e 100644 --- a/public/templates/ui/notice.html +++ b/public/templates/ui/notice.html @@ -7,10 +7,10 @@
    -
  • NEW signature overlays (signatures can be bind to connections) Youtube
  • -
  • NEW wormhole overlays ("updated"/"created" information)
  • -
  • NEW keyboard shortcuts (beta)
  • -
  • Added ~80 missing static WHs for "Shattered wormholes"
  • +
  • New "Near by" map overlay shows active pilots within 3 jumps around your current location
  • +
  • Switch to CCPs new ESI API. Replaces CREST API.
  • +
  • New UI options added. E.g. Remote open inGame information windows
  • +
  • Added new filter option for "Frigat wormholes" to route finder
  • Complete changelog