Ishadijcks / MooLite

Open source Milky Way Idle client
11 stars 4 forks source link

Add time left counter #85

Open Pentro opened 1 year ago

Pentro commented 1 year ago

What part of the game does your Plugin relate to? Related to non-combat actions.

What should your feature do? When crafting/gathering show the total time left based on amount of actions left.

What kind of input and output does your feature need? Possibly just a time left counter in the xp tracker or a seperate menu or somewhere around the progress bar on top.

Ishadijcks commented 1 year ago

I think this is an interesting issue, it is a good test of the reflection system.

We know the action, and it's base duration. From the equipment bonuses, we should be able to calculate how long a single action takes.

Then with efficiency from levels/boosts/buffs, we should be able to calculate how long the entire queue is expected to take

seashairo commented 4 months ago

How does this look as an example of how it could be done (minus the queue time calculation)?

// Plugin.enable
if (!this.labelRef) {
    const progressBarText = document.querySelectorAll("[class*='ProgressBar_text']")[0];
    if (progressBarText) {
        (progressBarText as HTMLElement).style.setProperty("gap", "8px");
        this.labelRef = document.createElement("span");
        progressBarText.appendChild(this.labelRef);
    }
}

// Plugin.onActionQueueUpdated
if(this.labelRef) {
  const queueTime = calculateTimeRemaining(queue)
  this.labelRef.innerHTML = `(~${queueTime})`
}

image