cox: Use projectile spawned instead of moved, and various other fixes.

This commit is contained in:
Ganom
2019-08-01 01:09:38 -04:00
parent 3fe1b5ef7a
commit 40114b528d
3 changed files with 316 additions and 325 deletions

View File

@@ -25,6 +25,7 @@
package net.runelite.client.plugins.coxhelper; package net.runelite.client.plugins.coxhelper;
import com.google.common.collect.ImmutableSet;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
@@ -32,6 +33,7 @@ import java.awt.Font;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Polygon; import java.awt.Polygon;
import java.util.List; import java.util.List;
import java.util.Set;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import net.runelite.api.Actor; import net.runelite.api.Actor;
@@ -53,6 +55,9 @@ import net.runelite.client.ui.overlay.OverlayUtil;
@Singleton @Singleton
public class CoxOverlay extends Overlay public class CoxOverlay extends Overlay
{ {
private static final Set<Integer> GAP = ImmutableSet.of(
34, 33, 26, 25, 18, 17, 10, 9, 2, 1
);
private final Client client; private final Client client;
private final CoxPlugin plugin; private final CoxPlugin plugin;
@@ -105,7 +110,6 @@ public class CoxOverlay extends Overlay
if (plugin.isTektonTickCounter()) if (plugin.isTektonTickCounter())
{ {
ticksLeft = npcs.getTicksUntilAttack(); ticksLeft = npcs.getTicksUntilAttack();
int attackTicksleft = plugin.getTektonAttackTicks();
if (ticksLeft > 0) if (ticksLeft > 0)
{ {
if (ticksLeft == 1) if (ticksLeft == 1)
@@ -214,45 +218,16 @@ public class CoxOverlay extends Overlay
if (plugin.isTimers()) if (plugin.isTimers())
{ {
if (plugin.getBurnTarget().size() > 0) if (plugin.getVictims().size() > 0)
{ {
for (Actor actor : plugin.getBurnTarget()) plugin.getVictims().forEach(victim ->
{ {
final int ticksLeft = plugin.getBurnTicks(); final int ticksLeft = victim.getTicks();
String ticksLeftStr = String.valueOf(ticksLeft); String ticksLeftStr = String.valueOf(ticksLeft);
Color tickcolor; Color tickcolor;
if (ticksLeft >= 0) switch (victim.getType())
{ {
if (ticksLeft == 34 || case ACID:
ticksLeft == 33 ||
ticksLeft == 26 ||
ticksLeft == 25 ||
ticksLeft == 18 ||
ticksLeft == 17 ||
ticksLeft == 10 ||
ticksLeft == 9 ||
ticksLeft == 2 ||
ticksLeft == 1)
{
tickcolor = new Color(255, 0, 0, 255);
ticksLeftStr = "GAP";
}
else
{
tickcolor = new Color(255, 255, 255, 255);
}
Point canvasPoint = actor.getCanvasTextLocation(graphics, ticksLeftStr, 0);
renderTextLocation(graphics, ticksLeftStr, plugin.getTextSize(), plugin.getFontStyle().getFont(), tickcolor, canvasPoint);
}
}
}
if (plugin.getAcidTarget() != null)
{
Actor actor = plugin.getAcidTarget();
renderActorOverlay(graphics, actor, plugin.getAcidColor(), 2, 100, 10);
final int ticksLeft = plugin.getAcidTicks();
Color tickcolor;
if (ticksLeft > 0) if (ticksLeft > 0)
{ {
if (ticksLeft > 1) if (ticksLeft > 1)
@@ -263,18 +238,47 @@ public class CoxOverlay extends Overlay
{ {
tickcolor = new Color(255, 255, 255, 255); tickcolor = new Color(255, 255, 255, 255);
} }
final String ticksLeftStr = String.valueOf(ticksLeft); Point canvasPoint = victim.getPlayer().getCanvasTextLocation(graphics, ticksLeftStr, 0);
Point canvasPoint = actor.getCanvasTextLocation(graphics, ticksLeftStr, 0);
renderTextLocation(graphics, ticksLeftStr, plugin.getTextSize(), plugin.getFontStyle().getFont(), tickcolor, canvasPoint); renderTextLocation(graphics, ticksLeftStr, plugin.getTextSize(), plugin.getFontStyle().getFont(), tickcolor, canvasPoint);
} }
break;
case BURN:
if (ticksLeft > 0)
{
if (GAP.contains(ticksLeft))
{
tickcolor = new Color(255, 0, 0, 255);
ticksLeftStr = "GAP";
} }
else
{
tickcolor = new Color(255, 255, 255, 255);
} }
Point canvasPoint = victim.getPlayer().getCanvasTextLocation(graphics, ticksLeftStr, 0);
renderTextLocation(graphics, ticksLeftStr, plugin.getTextSize(), plugin.getFontStyle().getFont(), tickcolor, canvasPoint);
}
break;
case TELEPORT:
if (plugin.isTpOverlay()) if (plugin.isTpOverlay())
{ {
if (plugin.getTeleportTarget() != null) if (ticksLeft > 0)
{ {
renderActorOverlay(graphics, plugin.getTeleportTarget(), new Color(193, 255, 245, 255), 2, 100, 10); if (ticksLeft > 1)
{
tickcolor = new Color(193, 255, 245, 255);
}
else
{
tickcolor = new Color(255, 255, 255, 255);
}
Point canvasPoint = victim.getPlayer().getCanvasTextLocation(graphics, ticksLeftStr, 0);
renderTextLocation(graphics, ticksLeftStr, plugin.getTextSize(), plugin.getFontStyle().getFont(), tickcolor, canvasPoint);
}
renderActorOverlay(graphics, victim.getPlayer(), new Color(193, 255, 245, 255), 2, 100, 10);
}
break;
}
});
} }
} }

View File

@@ -31,8 +31,10 @@ import com.google.inject.Provides;
import java.awt.Color; import java.awt.Color;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.inject.Inject; import javax.inject.Inject;
@@ -59,7 +61,7 @@ import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcDespawned;
import net.runelite.api.events.NpcSpawned; import net.runelite.api.events.NpcSpawned;
import net.runelite.api.events.ProjectileMoved; import net.runelite.api.events.ProjectileSpawned;
import net.runelite.api.events.SpotAnimationChanged; import net.runelite.api.events.SpotAnimationChanged;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
@@ -80,123 +82,77 @@ import net.runelite.client.util.Text;
@Slf4j @Slf4j
@Singleton @Singleton
@Getter(AccessLevel.PACKAGE)
public class CoxPlugin extends Plugin public class CoxPlugin extends Plugin
{ {
private static final int ANIMATION_ID_G1 = 430; private static final int ANIMATION_ID_G1 = 430;
private static final String OLM_HAND_CRIPPLE = "The Great Olm\'s left claw clenches to protect itself temporarily."; private static final String OLM_HAND_CRIPPLE = "The Great Olm\'s left claw clenches to protect itself temporarily.";
private static final Pattern TP_REGEX = Pattern.compile("You have been paired with <col=ff0000>(.*)</col>! The magical power will enact soon..."); private static final Pattern TP_REGEX = Pattern.compile("You have been paired with <col=ff0000>(.*)</col>! The magical power will enact soon...");
@Setter
@Getter(AccessLevel.PACKAGE)
protected PrayAgainst prayAgainstOlm;
@Getter(AccessLevel.PACKAGE)
protected long lastPrayTime;
private int sleepcount = 0;
private boolean needOlm = false;
private GraphicsObject teleportObject;
@Inject @Inject
@Getter(AccessLevel.NONE)
private Client client; private Client client;
@Inject @Inject
@Getter(AccessLevel.NONE)
private ChatMessageManager chatMessageManager; private ChatMessageManager chatMessageManager;
@Inject @Inject
@Getter(AccessLevel.NONE)
private CoxOverlay coxOverlay; private CoxOverlay coxOverlay;
@Inject @Inject
@Getter(AccessLevel.NONE)
private CoxInfoBox coxInfoBox; private CoxInfoBox coxInfoBox;
@Inject @Inject
@Getter(AccessLevel.NONE)
private CoxConfig config; private CoxConfig config;
@Inject @Inject
@Getter(AccessLevel.NONE)
private OverlayManager overlayManager; private OverlayManager overlayManager;
@Inject @Inject
@Getter(AccessLevel.NONE)
private EventBus eventBus; private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) private boolean handCripple;
private boolean HandCripple;
@Getter(AccessLevel.PACKAGE)
private boolean runOlm; private boolean runOlm;
@Getter(AccessLevel.PACKAGE)
private int vanguards; private int vanguards;
@Getter(AccessLevel.PACKAGE)
private boolean tektonActive; private boolean tektonActive;
@Getter(AccessLevel.PACKAGE)
private NPC hand; private NPC hand;
@Getter(AccessLevel.PACKAGE)
private NPC Olm_NPC; private NPC Olm_NPC;
@Getter(AccessLevel.PACKAGE)
private NPC OlmMelee_NPC;
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> Olm_Crystals = new ArrayList<>(); private List<WorldPoint> Olm_Crystals = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> Olm_Heal = new ArrayList<>(); private List<WorldPoint> Olm_Heal = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> Olm_TP = new ArrayList<>(); private List<WorldPoint> Olm_TP = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> Olm_PSN = new ArrayList<>(); private List<WorldPoint> Olm_PSN = new ArrayList<>();
@Getter(AccessLevel.PACKAGE) private Set<Victim> victims = new HashSet<>();
private List<Actor> burnTarget = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private Actor teleportTarget;
@Getter(AccessLevel.PACKAGE)
private Actor acidTarget; private Actor acidTarget;
@Getter(AccessLevel.PACKAGE)
private int crippleTimer = 45; private int crippleTimer = 45;
@Getter(AccessLevel.PACKAGE)
private int burnTicks = 41;
@Getter(AccessLevel.PACKAGE)
private int acidTicks = 25;
@Getter(AccessLevel.PACKAGE)
private int teleportTicks = 10; private int teleportTicks = 10;
@Getter(AccessLevel.PACKAGE)
private int tektonAttackTicks; private int tektonAttackTicks;
@Getter(AccessLevel.PACKAGE)
private int OlmPhase = 0; private int OlmPhase = 0;
@Getter(AccessLevel.PACKAGE)
private int Olm_TicksUntilAction = -1; private int Olm_TicksUntilAction = -1;
@Getter(AccessLevel.PACKAGE)
private int Olm_ActionCycle = -1; //4:0 = auto 3:0 = null 2:0 = auto 1:0 = spec + actioncycle =4 private int Olm_ActionCycle = -1; //4:0 = auto 3:0 = null 2:0 = auto 1:0 = spec + actioncycle =4
@Getter(AccessLevel.PACKAGE)
private int Olm_NextSpec = -1; // 1= crystals 2=lightnig 3=portals 4= heal hand if p4 private int Olm_NextSpec = -1; // 1= crystals 2=lightnig 3=portals 4= heal hand if p4
@Getter(AccessLevel.PACKAGE)
private float percent;
@Getter(AccessLevel.PACKAGE)
private Map<NPC, NPCContainer> npcContainer = new HashMap<>(); private Map<NPC, NPCContainer> npcContainer = new HashMap<>();
@Setter(AccessLevel.PACKAGE)
@Getter(AccessLevel.PACKAGE) private PrayAgainst prayAgainstOlm;
private long lastPrayTime;
private int sleepcount = 0;
private boolean needOlm = false;
private boolean muttadile; private boolean muttadile;
@Getter(AccessLevel.PACKAGE)
private boolean tekton; private boolean tekton;
@Getter(AccessLevel.PACKAGE)
private boolean tektonTickCounter; private boolean tektonTickCounter;
@Getter(AccessLevel.PACKAGE)
private boolean guardians; private boolean guardians;
@Getter(AccessLevel.PACKAGE)
private boolean guardinTickCounter; private boolean guardinTickCounter;
@Getter(AccessLevel.PACKAGE)
private boolean vangHighlight; private boolean vangHighlight;
@Getter(AccessLevel.PACKAGE)
private boolean vangHealth; private boolean vangHealth;
@Getter(AccessLevel.PACKAGE)
private boolean configPrayAgainstOlm; private boolean configPrayAgainstOlm;
@Getter(AccessLevel.PACKAGE)
private boolean timers; private boolean timers;
@Getter(AccessLevel.PACKAGE)
private boolean tpOverlay; private boolean tpOverlay;
@Getter(AccessLevel.PACKAGE)
private boolean olmTick; private boolean olmTick;
@Getter(AccessLevel.PACKAGE)
private Color muttaColor; private Color muttaColor;
@Getter(AccessLevel.PACKAGE)
private Color guardColor; private Color guardColor;
@Getter(AccessLevel.PACKAGE)
private Color tektonColor; private Color tektonColor;
@Getter(AccessLevel.PACKAGE)
private Color burnColor; private Color burnColor;
@Getter(AccessLevel.PACKAGE)
private Color acidColor; private Color acidColor;
@Getter(AccessLevel.PACKAGE)
private Color tpColor; private Color tpColor;
@Getter(AccessLevel.PACKAGE)
private CoxConfig.FontStyle fontStyle; private CoxConfig.FontStyle fontStyle;
@Getter(AccessLevel.PACKAGE)
private int textSize; private int textSize;
@Getter(AccessLevel.PACKAGE)
private boolean shadows; private boolean shadows;
@Provides @Provides
@@ -213,16 +169,12 @@ public class CoxPlugin extends Plugin
overlayManager.add(coxOverlay); overlayManager.add(coxOverlay);
overlayManager.add(coxInfoBox); overlayManager.add(coxInfoBox);
HandCripple = false; handCripple = false;
hand = null; hand = null;
acidTarget = null;
teleportTarget = null;
Olm_TP.clear(); Olm_TP.clear();
prayAgainstOlm = null; prayAgainstOlm = null;
burnTarget.clear(); victims.clear();
crippleTimer = 45; crippleTimer = 45;
burnTicks = 40;
acidTicks = 25;
teleportTicks = 10; teleportTicks = 10;
vanguards = 0; vanguards = 0;
} }
@@ -231,7 +183,6 @@ public class CoxPlugin extends Plugin
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this); eventBus.unregister(this);
overlayManager.remove(coxOverlay); overlayManager.remove(coxOverlay);
overlayManager.remove(coxInfoBox); overlayManager.remove(coxInfoBox);
} }
@@ -240,33 +191,44 @@ public class CoxPlugin extends Plugin
{ {
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged); eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage); eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(ProjectileMoved.class, this, this::onProjectileMoved); eventBus.subscribe(ProjectileSpawned.class, this, this::onProjectileSpawned);
eventBus.subscribe(SpotAnimationChanged.class, this, this::onSpotAnimationChanged); eventBus.subscribe(SpotAnimationChanged.class, this, this::onSpotAnimationChanged);
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned); eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned); eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(GameTick.class, this, this::onGameTick); eventBus.subscribe(GameTick.class, this, this::onGameTick);
} }
private void onChatMessage(ChatMessage chatMessage) private void onConfigChanged(ConfigChanged event)
{ {
if (inRaid()) if (event.getGroup().equals("Cox"))
{ {
if (chatMessage.getType() == ChatMessageType.GAMEMESSAGE) updateConfig();
}
}
private void onChatMessage(ChatMessage event)
{ {
Matcher tpMatcher = TP_REGEX.matcher(chatMessage.getMessage()); if (!inRaid())
{
return;
}
if (event.getType() == ChatMessageType.GAMEMESSAGE)
{
final Matcher tpMatcher = TP_REGEX.matcher(event.getMessage());
if (tpMatcher.matches()) if (tpMatcher.matches())
{ {
log.info("TP Matcher has found a match"); for (Player player : client.getPlayers())
for (Actor actor : client.getPlayers())
{ {
if (actor.getName().equals(tpMatcher.group(1))) if (player.getName().equals(tpMatcher.group(1)))
{ {
log.info("Teleport Target Assigned"); victims.add(new Victim(player, Victim.Type.TELEPORT));
teleportTarget = actor;
} }
} }
} }
switch (Text.standardize(chatMessage.getMessageNode().getValue()))
switch (Text.standardize(event.getMessageNode().getValue()))
{ {
case "the great olm rises with the power of acid.": case "the great olm rises with the power of acid.":
case "the great olm rises with the power of crystal.": case "the great olm rises with the power of crystal.":
@@ -289,79 +251,94 @@ public class CoxPlugin extends Plugin
Olm_NextSpec = -1; Olm_NextSpec = -1;
break; break;
case "the great olm fires a sphere of aggression your way. your prayers have been sapped.": case "the great olm fires a sphere of aggression your way. your prayers have been sapped.":
prayAgainstOlm = PrayAgainst.MELEE;
lastPrayTime = System.currentTimeMillis();
break;
case "the great olm fires a sphere of aggression your way.": case "the great olm fires a sphere of aggression your way.":
prayAgainstOlm = PrayAgainst.MELEE; prayAgainstOlm = PrayAgainst.MELEE;
lastPrayTime = System.currentTimeMillis(); lastPrayTime = System.currentTimeMillis();
break; break;
case "the great olm fires a sphere of magical power your way. your prayers have been sapped.": case "the great olm fires a sphere of magical power your way. your prayers have been sapped.":
prayAgainstOlm = PrayAgainst.MAGIC;
lastPrayTime = System.currentTimeMillis();
break;
case "the great olm fires a sphere of magical power your way.": case "the great olm fires a sphere of magical power your way.":
prayAgainstOlm = PrayAgainst.MAGIC; prayAgainstOlm = PrayAgainst.MAGIC;
lastPrayTime = System.currentTimeMillis(); lastPrayTime = System.currentTimeMillis();
break; break;
case "the great olm fires a sphere of accuracy and dexterity your way. your prayers have been sapped.": case "the great olm fires a sphere of accuracy and dexterity your way. your prayers have been sapped.":
prayAgainstOlm = PrayAgainst.RANGED;
lastPrayTime = System.currentTimeMillis();
break;
case "the great olm fires a sphere of accuracy and dexterity your way.": case "the great olm fires a sphere of accuracy and dexterity your way.":
prayAgainstOlm = PrayAgainst.RANGED; prayAgainstOlm = PrayAgainst.RANGED;
lastPrayTime = System.currentTimeMillis(); lastPrayTime = System.currentTimeMillis();
break; break;
case "the great olm's left claw clenches to protect itself temporarily.": case "the great olm's left claw clenches to protect itself temporarily.":
HandCripple = true; handCripple = true;
} }
} }
} }
private void onProjectileSpawned(ProjectileSpawned event)
{
if (!inRaid())
{
return;
} }
private void onProjectileMoved(ProjectileMoved event) final Projectile projectile = event.getProjectile();
{
if (inRaid()) switch (projectile.getId())
{
Projectile projectile = event.getProjectile();
if (projectile.getId() == ProjectileID.OLM_MAGE_ATTACK)
{ {
case ProjectileID.OLM_MAGE_ATTACK:
prayAgainstOlm = PrayAgainst.MAGIC; prayAgainstOlm = PrayAgainst.MAGIC;
lastPrayTime = System.currentTimeMillis(); lastPrayTime = System.currentTimeMillis();
} break;
if (projectile.getId() == ProjectileID.OLM_RANGE_ATTACK) case ProjectileID.OLM_RANGE_ATTACK:
{
prayAgainstOlm = PrayAgainst.RANGED; prayAgainstOlm = PrayAgainst.RANGED;
lastPrayTime = System.currentTimeMillis(); lastPrayTime = System.currentTimeMillis();
} break;
if (projectile.getId() == ProjectileID.OLM_ACID_TRAIL) case ProjectileID.OLM_ACID_TRAIL:
{
acidTarget = projectile.getInteracting(); acidTarget = projectile.getInteracting();
break;
}
}
private void onSpotAnimationChanged(SpotAnimationChanged event)
{
if (!inRaid())
{
return;
}
if (!(event.getActor() instanceof Player))
{
return;
}
final Player player = (Player) event.getActor();
if (player.getSpotAnimation() == GraphicID.OLM_BURN)
{
int add = 0;
for (Victim victim : victims)
{
if (victim.getPlayer().getName().equals(player.getName()))
{
add++;
}
}
if (add == 0)
{
victims.add(new Victim(player, Victim.Type.BURN));
} }
} }
} }
private void onSpotAnimationChanged(SpotAnimationChanged graphicChanged) private void onNpcSpawned(NpcSpawned event)
{ {
if (inRaid()) if (inRaid())
{ {
Actor actor = graphicChanged.getActor(); return;
if (actor.getSpotAnimation() == GraphicID.OLM_BURN)
{
if (!burnTarget.contains(actor))
{
burnTarget.add(actor);
}
}
}
} }
private void onNpcSpawned(NpcSpawned npcSpawned) final NPC npc = event.getNpc();
{
if (inRaid())
{
NPC npc = npcSpawned.getNpc();
switch (npc.getId()) switch (npc.getId())
{ {
case NpcID.TEKTON: case NpcID.TEKTON:
@@ -394,13 +371,16 @@ public class CoxPlugin extends Plugin
break; break;
} }
} }
}
private void onNpcDespawned(NpcDespawned event) private void onNpcDespawned(NpcDespawned event)
{ {
if (inRaid()) if (!inRaid())
{ {
NPC npc = event.getNpc(); return;
}
final NPC npc = event.getNpc();
switch (npc.getId()) switch (npc.getId())
{ {
case NpcID.TEKTON: case NpcID.TEKTON:
@@ -434,11 +414,10 @@ public class CoxPlugin extends Plugin
break; break;
case NpcID.GREAT_OLM_RIGHT_CLAW_7553: case NpcID.GREAT_OLM_RIGHT_CLAW_7553:
case NpcID.GREAT_OLM_RIGHT_CLAW: case NpcID.GREAT_OLM_RIGHT_CLAW:
HandCripple = false; handCripple = false;
break; break;
} }
} }
}
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
@@ -449,7 +428,7 @@ public class CoxPlugin extends Plugin
sleepcount = 0; sleepcount = 0;
Olm_Heal.clear(); Olm_Heal.clear();
npcContainer.clear(); npcContainer.clear();
burnTarget.clear(); victims.clear();
Olm_NPC = null; Olm_NPC = null;
hand = null; hand = null;
prayAgainstOlm = null; prayAgainstOlm = null;
@@ -457,7 +436,8 @@ public class CoxPlugin extends Plugin
return; return;
} }
npcHandler(); handleNpcs();
handleVictims();
if (needOlm = true) if (needOlm = true)
{ {
@@ -472,57 +452,32 @@ public class CoxPlugin extends Plugin
} }
} }
if (teleportTarget != null) if (handCripple)
{
log.info(teleportTarget.getName());
Player target = (Player) teleportTarget;
client.setHintArrow(target);
teleportTicks--;
if (teleportTicks <= 0)
{
client.clearHintArrow();
teleportTarget = null;
teleportTicks = 10;
}
}
if (acidTarget != null)
{
acidTicks--;
if (acidTicks <= 0)
{
acidTarget = null;
acidTicks = 25;
}
}
if (burnTarget.size() > 0)
{
burnTicks--;
if (burnTicks <= 0)
{
burnTarget.clear();
burnTicks = 41;
}
}
if (HandCripple)
{ {
crippleTimer--; crippleTimer--;
if (crippleTimer <= 0) if (crippleTimer <= 0)
{ {
HandCripple = false; handCripple = false;
crippleTimer = 45; crippleTimer = 45;
} }
} }
if (runOlm) if (runOlm)
{ {
olmHandler(); handleOlm();
} }
} }
private void npcHandler() private void handleVictims()
{
if (victims.size() > 0)
{
victims.forEach(Victim::updateTicks);
victims.removeIf(victim -> victim.getTicks() <= 0);
}
}
private void handleNpcs()
{ {
for (NPCContainer npcs : getNpcContainer().values()) for (NPCContainer npcs : getNpcContainer().values())
{ {
@@ -605,7 +560,7 @@ public class CoxPlugin extends Plugin
} }
} }
private void olmHandler() private void handleOlm()
{ {
Olm_Crystals.clear(); Olm_Crystals.clear();
Olm_Heal.clear(); Olm_Heal.clear();
@@ -706,14 +661,6 @@ public class CoxPlugin extends Plugin
return client.getVar(Varbits.IN_RAID) == 1; return client.getVar(Varbits.IN_RAID) == 1;
} }
private void onConfigChanged(ConfigChanged configChanged)
{
if (configChanged.getGroup().equals("Cox"))
{
updateConfig();
}
}
private void updateConfig() private void updateConfig()
{ {
this.muttadile = config.muttadile(); this.muttadile = config.muttadile();

View File

@@ -0,0 +1,40 @@
package net.runelite.client.plugins.coxhelper;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.runelite.api.Player;
@Getter(AccessLevel.PACKAGE)
class Victim
{
private Player player;
private Type type;
private int ticks;
Victim(Player player, Type type)
{
this.player = player;
this.type = type;
this.ticks = type.getTicks();
}
void updateTicks()
{
if (ticks > 0)
{
ticks--;
}
}
@AllArgsConstructor
@Getter(AccessLevel.PACKAGE)
enum Type
{
BURN(41),
ACID(23),
TELEPORT(10);
private int ticks;
}
}