IITC-CE / ingress-intel-total-conversion

intel.ingress.com total conversion user script with some new features. Should allow easier extension of the intel map.
https://iitc.app
ISC License
284 stars 110 forks source link

View Portal Keys owned on map (C.O.R.E. members) #438

Open evertonberz opened 3 years ago

evertonberz commented 3 years ago

Hi, as a C.O.R.E. subscription member, agents can see a list of portal keys in stock Intel.

Could you add a feature for this in IITC-CE? I think it could be a layer with pins at portals that you have keys. Similar to bookmark pins.

/r/getInventory provides the following structure:

    [
      "a8e2d7371xxxxxx obfuscated - I do not know what is this xxxxxx",
      16128362xxxxxx obfuscated - I do not know what is this xxxxxx,
      {
        "portalCoupler": {
          "portalGuid": "75f696ea68b646e68a084d933be61045.16",
          "portalLocation": "fe3ba2f0,fcf92482",
          "portalImageUrl": "http://lh3.googleusercontent.com/soxyL79o2Nj8i_Snf5KOiXw5nhJjMy0XJsDVrnAsP3zp63-O06qTyFmYgIYi16YtrFu6WrMXLm53APWHKjZlg3psVg",
          "portalTitle": "Prefeitura Municipal de Taquara",
          "portalAddress": "Rua Nelson Henck, 2851-3021, Taquara - Rio Grande do Sul, 95600-000, Brazil"
        },
        "resource": {
          "resourceType": "PORTAL_LINK_KEY",
          "resourceRarity": "VERY_COMMON"
        },
        "inInventory": {
          "playerId": "xxxxxx obfuscated xxxxxx.c",
          "acquisitionTimestampMs": "1612836237550"
        }
      }
    ]

It seems portal location is hashed but it's not using standard geohash. Any idea how to decode?

Thanks!

le-jeu commented 3 years ago

You can try :

var [lat, lng] = item[2].portalCoupler.portalLocation
                        .split(',')
                        .map(a => (Number.parseInt(a,16)&(-1))*1e-6);
Jormund commented 3 years ago

To explain further, portalLocation is lat,lng multiplied by 1 million encoded as hexadecimal. The &(-1) handles the case were the value is negative. It's a trick that will interpret the value as signed 32 bit integer but will keep the value unchanged.

EisFrei commented 3 years ago

If you want you can include my plugin to do that: https://github.com/EisFrei/IngressLiveInventory

fortepc commented 2 years ago

Could we just update the existing Keys plugin to use C.O.R.E keys?