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;
}
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;
}
}
Aggregations