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
279 stars 105 forks source link

Level 1 portals show incorrect "resonator level(s) needed for next portal level" #734

Open Artoria2e5 opened 1 month ago

Artoria2e5 commented 1 month ago

I have a portal that's level 1 from a single level 5 resonator. It should require 11 more resonator levels to become level 2. However, IITC says 8, probably because it doesn't quite understand how level 1 works differently from all other levels:

Screenshot from 2024-05-17 23-08-44

Artoria2e5 commented 1 month ago

Specifically, https://github.com/IITC-CE/ingress-intel-total-conversion/blob/199c9f7bdc0acb79db3855f9f5cd7c0cd516ec66/core/code/portal_info.js#L14 applies a minimum clamp to the level, so that it does not return a number less than 1 when there's a resonator. However, https://github.com/IITC-CE/ingress-intel-total-conversion/blob/199c9f7bdc0acb79db3855f9f5cd7c0cd516ec66/core/code/portal_detail_display.js#L121 naively treats the detailed level as total level / 8.

Artoria2e5 commented 1 month ago

Considering that the only references to getPortalLevel in this whole organization are:

I'd think we can get away with removing the Math.max() in getPortalLevel. The only place where the max makes sense is in getPortalRange() -- we can just put it there!

McBen commented 1 month ago

and https://github.com/IITC-CE/ingress-intel-total-conversion/blob/199c9f7bdc0acb79db3855f9f5cd7c0cd516ec66/core/code/portal_info.js#L366-L370 it would handle the "without max" case, but makes the comments invalid