Search in sources :

Example 1 with IdentificationHolder

use of com.wynntils.modules.utilities.instances.IdentificationHolder in project Wynntils by Wynntils.

the class ConsumableTimerOverlay method updateActiveEffects.

private static void updateActiveEffects() {
    Map<String, IdentificationHolder> effects = new HashMap<>();
    for (ConsumableContainer consumable : activeConsumables) {
        for (String cEf : consumable.getEffects().keySet()) {
            IdentificationHolder holder = consumable.getEffects().get(cEf);
            if (effects.containsKey(cEf)) {
                effects.get(cEf).sumAmount(holder.getCurrentAmount());
                continue;
            }
            effects.put(cEf, new IdentificationHolder(holder.getCurrentAmount(), holder.getModifier()));
        }
    }
    activeEffects = effects;
}
Also used : IdentificationHolder(com.wynntils.modules.utilities.instances.IdentificationHolder) ConsumableContainer(com.wynntils.modules.utilities.instances.ConsumableContainer)

Example 2 with IdentificationHolder

use of com.wynntils.modules.utilities.instances.IdentificationHolder in project Wynntils by Wynntils.

the class ConsumableTimerOverlay method render.

@Override
public void render(RenderGameOverlayEvent.Pre event) {
    event.setCanceled(false);
    if (activeConsumables.isEmpty())
        return;
    Iterator<ConsumableContainer> it = activeConsumables.iterator();
    // id names
    int extraY = 0;
    while (it.hasNext()) {
        ConsumableContainer consumable = it.next();
        if (consumable.hasExpired()) {
            // remove if expired
            // update active effects
            removeActiveEffect(consumable);
            it.remove();
            continue;
        }
        drawString(consumable.getName() + " (" + StringUtils.timeLeft(consumable.getExpirationTime() - McIf.getSystemTime() + 1000) + ")", 0, extraY, CommonColors.WHITE, OverlayConfig.ConsumableTimer.INSTANCE.textAlignment, OverlayConfig.ConsumableTimer.INSTANCE.textShadow);
        extraY += 10;
    }
    // effects
    if (!OverlayConfig.ConsumableTimer.INSTANCE.showEffects || activeEffects.isEmpty())
        return;
    extraY += 10;
    for (Map.Entry<String, IdentificationHolder> entry : activeEffects.entrySet()) {
        drawString(entry.getValue().getAsLore(entry.getKey()), 0, extraY, CommonColors.WHITE, OverlayConfig.ConsumableTimer.INSTANCE.textAlignment, OverlayConfig.ConsumableTimer.INSTANCE.textShadow);
        extraY += 10;
    }
}
Also used : IdentificationHolder(com.wynntils.modules.utilities.instances.IdentificationHolder) ConsumableContainer(com.wynntils.modules.utilities.instances.ConsumableContainer) SkillPoint(com.wynntils.core.framework.enums.SkillPoint)

Aggregations

ConsumableContainer (com.wynntils.modules.utilities.instances.ConsumableContainer)2 IdentificationHolder (com.wynntils.modules.utilities.instances.IdentificationHolder)2 SkillPoint (com.wynntils.core.framework.enums.SkillPoint)1