Galaxy Flight Duration

    • Info: A script to display flight duration inside Galaxy.
    • Author: LukaNebo
    • Support: Discord
    • Download: https://openuserjs.org/scripts…bo/Galaxy_Flight_Duration
    • Screenshot: See below
    • Browser: Chrome, Firefox, and all chromium based browsers with Tampermonkey or Greasemonkey support
    • Compability: Computers, Android phones (via Kiwi Browser or Mozilla Firefox)
    • Languages: English, German, French, Italian, Portuguese (Brazilian), Slovenian



    Galaxy Flight Duration is a simple script that calculates and shows distance and flight duration for three different types of ships inside Galaxy.

    Few use cases: It allows you to easily compare your flight duration to the enemy mission flight duration seen from Sensor Phalanx, for example. Or it allows you to easily determine which planet/moon is closer to a target. It also shows you if a distance is bigger than 20000, so it would be quicker to send a mission from neighbouring galaxy.

    The script adds a bar under Galaxy view and it looks like this:
    gfd-galaxy-View.png


    Each section or buttons can be pressed to change its state (apart from "distance"). From left to right they are as follows

    • Distance (Visual display of distance value; colored red if it is bigger than 20000, i.e. the distance to neighbouring galaxy)
    • Universe fleet speed settings (Can be clicked to toggle PEACEFUL [colored green], WAR [colored red], or HOLDING [colored orange] fleet speed.)
    • Flight briefing selector (Can be clicked to toggle ONE [ > ] or TWO WAY [ < ] flight duration or ARRIVAL [ >| ] or RETURN [ |< ] time calculation.)
    • Speed modifier (Can be clicked to change the values from 100% down to 10%.)
    • First ship type (Can be clicked to cycle through all ships.)
    • Second ship type (Can be clicked to cycle through all ships.)
    • Third ship type (Can be clicked to cycle through all ships.)
    • Info button (Can be hovered over with a mouse to display all saved speed values and other saved settings.)




    Quick guide:


    Flight duration values are colored red if the speed values are not yet updated.

    gfd-bar-red-Values.png


    To update speed values, go to Fleet page (Fleetdispatch). Script updates the values every time you visit Fleetdispatch. When you have updated speed values, the flight duration values will be colored white (if one way flight duration is selected) or gray (if two way flight duration is selected). You can left-click on any of the buttons to change its value (e.g. select next ship), or right-click to go to the previous value (e.g. select previous ship). The values are saved automatically.



    From version 1.4.0, script supports flight duration calculation in universes where "Fleet ignore empty system" and/or "Fleet ignore inactive system" settings are enabled! You can hover with your mouse over the Distance to see exact number of systems that are ignored (empty, inactive, and total number of systems to ignore). The Distance is colored green if any system is being ignored between your co-ordinates and viewed co-ordinates in Galaxy View.




    Cheers,
    LukaNebo



    P.S.: This is my first project in JavaScript, so any feedback or suggestions are more than welcome.

    Edited 16 times, last by LukaNebo: Updated tutorial to reflect version 1.5.1 changes. ().

  • RiV-

    Approved the thread.
  • This script is tolerated. 16.01.2024


    Few suggestions that are unrelated to toleration:

    • Would it be possible to let us choose every ship in every slot? Basically more freedom.
    • Instead of requiring the user to click S(ave) every time, personally I would save the settings automatically on change.
    • Clicking through every ship's detail view to fetch speed values is tedious, especially with Lifeform bonuses constantly changing. Instead you could fetch the speed values from window object fleetDispatcher.fleetHelper.shipsData when the user visits fleetdispatch page.
    • Instead of using setInterval to check for changes / mutations in the DOM, you could look into using MutationObserver.


    Great tool and cool idea!

  • v1.2.0 Changelog:

    • Added a feature to update ships' speed from Fleetdispatch page once per day (instead of manually from Shipyard; this feature was removed). (Thanks to RiV- !)
    • Clicking on buttons automatically saves their state. Changed save button [S] to info button [ i ].
    • "Cargo", "Fast", and "Slow" ship types were changed to "First", "Second", and "Third" ship type, where a player can select any ship.
    • Prepared the script to support more languages. (Selected language is currently set only on "Messages" page from meta tag; if I find a better way to implement this, I will change it.)
    • Added support for slovene (SI) language.
    • Changed from setInterval to MutationObserver method for determining when co-ordinates were changed or when galaxy view was refreshed.
    • Various other improvements.
  • What's the reason to limit this to once per day? IMO it can be updated every time the player visits fleetdispatch, no?

    I thought that it would save few milliseconds for each fleetdispatch page load. Maybe this does not matter because it maybe takes only few nanoseconds... I could easily change it so the speed values are saved every time you load a fleetdispatch.


    Thanks for the feedback!

  • v1.3.0 Changelog

    • Added option to right-click buttons: returns to previous selection (previous instead of next ship, +10% speed modifier instead of -10%, etc.).
    • Ships' speed are updated every time you visit Fleetdispatch page (instead of once per day).
    • Added support for German (DE) and French (FR) language.*


    *My German and especially French are not very good and I have mostly used Google Translate for the translations. If you find any mistakes or have any other feedback, please contact me. Also, I tried my best with abbreviated names for ships. Please contact me, if there is any community's convention concerning these acronyms that I have missed. (Keep in mind that the shortened names can be at most 10 characters long!) I am also open to support more languages in the future.

  • v1.4.0 Changelog

    • Added support for universes with "Fleet ignore empty system" or "Fleet ignore inactive system" settings. (Thanks to Wonkydonky!)
    • Added additional information to tooltips (number of systems to ignore under "Distance", and which missions are for which fleet speed type under "Fleet Speed").
    • Changed from Math.floor to Math.round in function that calculates flight duration.
  • v1.4.1 Changelog

    • Fixed the bug where opening Sensor Phalanx on universes with fleet ignore empty/inactive systems settings return error message.
    • Added support for Italian (IT) language.
  • v1.4.2 Changelog (2024-02-22)

    • Fixed Italian (IT) language.



    v1.5.0 Changelog

    • (User selected) language is now set from cookies (oglocale inside document.cookie).
    • Added option to display arrival and return time calculation (in addition to one or two way flight duration).


    *Saved settings (selected ships, speed modifier, etc.) are reseted to default because of a change in its local storage object.

  • v1.5.1 Changelog

    • (User selected) language is fetched only on Galaxy page (instead on every page).
    • Fixed the bug where not supported language prevented the display of Galaxy Flight Duration bar. (Right now, if user selected language is not supported, it is set to default, i.e. english.)
    • Added support for Portuguese (Brazilian) (BR) language.