Removing next hit notifier as its redundant
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
package net.runelite.client.plugins.nexthitnotifier;
|
||||
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
|
||||
@ConfigGroup("nexthitnotifier")
|
||||
public interface NextHitNotifierConfig extends Config
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package net.runelite.client.plugins.nexthitnotifier;
|
||||
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||
import net.runelite.client.util.MiscUtils;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
|
||||
public class NextHitNotifierOverlay extends Overlay
|
||||
{
|
||||
private final Client client;
|
||||
private final NextHitNotifierPlugin plugin;
|
||||
private final NextHitNotifierConfig config;
|
||||
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
private final Dimension panelSize = new Dimension(48, 0);
|
||||
|
||||
@Inject
|
||||
private NextHitNotifierOverlay(Client client, NextHitNotifierPlugin plugin, NextHitNotifierConfig config)
|
||||
{
|
||||
setPosition(OverlayPosition.BOTTOM_LEFT);
|
||||
//setPosition(OverlayPosition.DYNAMIC);
|
||||
//setPosition(OverlayPosition.DETACHED);
|
||||
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
panelComponent.getChildren().clear();
|
||||
panelComponent.setPreferredSize(panelSize);
|
||||
|
||||
String lastHitText = Integer.toString(plugin.lastHit);
|
||||
int lastHit = plugin.lastHit;
|
||||
|
||||
if (plugin.showTime < 0)
|
||||
{
|
||||
lastHitText = "0";
|
||||
lastHit = 0;
|
||||
}
|
||||
|
||||
int g = (int)MiscUtils.clamp((float)Math.floor(lastHit / 30.f) * 255.f, 0.f, 255.f);
|
||||
int r = 255 - g;
|
||||
|
||||
Color textColor = Color.getHSBColor(Color.RGBtoHSB(r, g, 0, null)[0], 1.f, 1.f);
|
||||
|
||||
panelComponent.getChildren().add(TitleComponent.builder().text("Next hit:").color(Color.YELLOW).build());
|
||||
panelComponent.getChildren().add(TitleComponent.builder().text(lastHitText).color(textColor).build());
|
||||
|
||||
return panelComponent.render(graphics);
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
package net.runelite.client.plugins.nexthitnotifier;
|
||||
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.events.ExperienceChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Next Hit Notifier",
|
||||
description = "Shows estimated next hit based on xp drop.",
|
||||
tags = { "experience", "damage", "overlay", "pking", "bogla" },
|
||||
enabledByDefault = false,
|
||||
type = "utility"
|
||||
)
|
||||
public class NextHitNotifierPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private NextHitNotifierOverlay overlay;
|
||||
|
||||
private int lastHpXp = 0;
|
||||
int lastHit = 0;
|
||||
int showTime = 0;
|
||||
|
||||
@Provides
|
||||
NextHitNotifierConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(NextHitNotifierConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
lastHpXp = client.getSkillExperience(Skill.HITPOINTS);
|
||||
lastHit = 0;
|
||||
showTime = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastHpXp = 0;
|
||||
lastHit = 0;
|
||||
showTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick event)
|
||||
{
|
||||
if (showTime > 0)
|
||||
showTime--;
|
||||
else
|
||||
lastHit = 0;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onExperienceChanged(ExperienceChanged event)
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
{
|
||||
lastHpXp = 0;
|
||||
lastHit = 0;
|
||||
showTime = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
final Skill skill = event.getSkill();
|
||||
|
||||
if (skill != Skill.HITPOINTS)
|
||||
return;
|
||||
|
||||
final int currentXp = client.getSkillExperience(skill);
|
||||
|
||||
int gainedXp = currentXp - lastHpXp;
|
||||
|
||||
//filter out big xp drops (such as login)
|
||||
if (gainedXp > 1000)
|
||||
{
|
||||
lastHpXp = client.getSkillExperience(skill);
|
||||
return;
|
||||
}
|
||||
|
||||
lastHit = (int)Math.rint(gainedXp / 1.33f);
|
||||
lastHpXp = currentXp;
|
||||
showTime = 3;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user