Merge pull request #1214 from Ganom/projectile-update

events: reduce projectilemoved usage as much as possible
This commit is contained in:
Owain van Brakel
2019-08-02 13:46:38 +02:00
committed by GitHub
9 changed files with 494 additions and 743 deletions

View File

@@ -27,7 +27,6 @@ package net.runelite.client.plugins.cannon;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Provides;
import java.awt.Color;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
@@ -52,7 +51,7 @@ import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.ProjectileMoved;
import net.runelite.api.events.ProjectileSpawned;
import net.runelite.client.Notifier;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
@@ -60,7 +59,6 @@ import net.runelite.client.eventbus.EventBus;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.task.Schedule;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.client.util.ItemUtil;
@@ -77,57 +75,39 @@ public class CannonPlugin extends Plugin
private static final ImmutableSet<Integer> CANNON_PARTS = ImmutableSet.of(
ItemID.CANNON_BASE, ItemID.CANNON_STAND, ItemID.CANNON_BARRELS, ItemID.CANNON_FURNACE
);
private CannonCounter counter;
private boolean skipProjectileCheckThisTick;
@Getter(AccessLevel.PACKAGE)
private int cballsLeft;
@Getter(AccessLevel.PACKAGE)
private boolean cannonPlaced;
@Getter(AccessLevel.PACKAGE)
private WorldPoint cannonPosition;
@Getter(AccessLevel.PACKAGE)
private GameObject cannon;
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> spotPoints = new ArrayList<>();
@Inject
private ItemManager itemManager;
@Inject
private InfoBoxManager infoBoxManager;
@Inject
private Notifier notifier;
@Inject
private OverlayManager overlayManager;
@Inject
private CannonOverlay cannonOverlay;
@Inject
private CannonSpotOverlay cannonSpotOverlay;
@Inject
private CannonConfig config;
@Inject
private Client client;
@Inject
private ClientThread clientThread;
@Inject
private EventBus eventbus;
private boolean lock;
private boolean showEmptyCannonNotification;
private boolean showInfobox;
@Getter(AccessLevel.PACKAGE)
@@ -178,7 +158,7 @@ public class CannonPlugin extends Plugin
eventbus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventbus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
eventbus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
eventbus.subscribe(ProjectileMoved.class, this, this::onProjectileMoved);
eventbus.subscribe(ProjectileSpawned.class, this, this::onProjectileSpawned);
eventbus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventbus.subscribe(GameTick.class, this, this::onGameTick);
}
@@ -211,37 +191,13 @@ public class CannonPlugin extends Plugin
}
}
}
}
@Schedule(
period = 1,
unit = ChronoUnit.SECONDS
)
public void checkSpots()
{
if (!this.showCannonSpots)
{
return;
}
spotPoints.clear();
for (WorldPoint spot : CannonSpots.getCannonSpots())
{
if (spot.getPlane() != client.getPlane() || !spot.isInScene(client))
{
continue;
}
spotPoints.add(spot);
}
}
private void onGameObjectSpawned(GameObjectSpawned event)
{
GameObject gameObject = event.getGameObject();
final GameObject gameObject = event.getGameObject();
Player localPlayer = client.getLocalPlayer();
final Player localPlayer = client.getLocalPlayer();
if (gameObject.getId() == CANNON_BASE && !cannonPlaced &&
localPlayer.getWorldLocation().distanceTo(gameObject.getWorldLocation()) <= 2 &&
localPlayer.getAnimation() == AnimationID.BURYING_BONES)
@@ -251,22 +207,15 @@ public class CannonPlugin extends Plugin
}
}
private void onProjectileMoved(ProjectileMoved event)
private void onProjectileSpawned(ProjectileSpawned event)
{
Projectile projectile = event.getProjectile();
final Projectile projectile = event.getProjectile();
if ((projectile.getId() == CANNONBALL || projectile.getId() == GRANITE_CANNONBALL) && cannonPosition != null)
{
WorldPoint projectileLoc = WorldPoint.fromLocal(client, projectile.getX1(), projectile.getY1(), client.getPlane());
final WorldPoint projectileLoc = WorldPoint.fromLocal(client, projectile.getX1(), projectile.getY1(), client.getPlane());
//Check to see if projectile x,y is 0 else it will continuously decrease while ball is flying.
if (projectileLoc.equals(cannonPosition) && projectile.getX() == 0 && projectile.getY() == 0 &&
// When there's a chat message about cannon reloaded/unloaded/out of ammo,
// the message event runs before the projectile event. However they run
// in the opposite order on the server. So if both fires in the same tick,
// we don't want to update the cannonball counter if it was set to a specific
// amount.
!skipProjectileCheckThisTick)
if (projectileLoc.equals(cannonPosition) && !skipProjectileCheckThisTick)
{
cballsLeft--;
}

View File

@@ -86,7 +86,7 @@ public class CoxInfoBox extends Overlay
if (System.currentTimeMillis() < (plugin.getLastPrayTime() + 120000) && plugin.getPrayAgainstOlm() != null)
{
InfoBoxComponent prayComponent = new InfoBoxComponent();
BufferedImage prayImg = scaleImg(getPrayerImage(plugin.prayAgainstOlm));
BufferedImage prayImg = scaleImg(getPrayerImage(plugin.getPrayAgainstOlm()));
prayComponent.setImage(prayImg);
prayComponent.setColor(Color.WHITE);
prayComponent.setBackgroundColor(client.isPrayerActive(prayAgainst.getPrayer())

View File

@@ -25,6 +25,7 @@
package net.runelite.client.plugins.coxhelper;
import com.google.common.collect.ImmutableSet;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
@@ -32,6 +33,7 @@ import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.util.List;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Actor;
@@ -53,6 +55,9 @@ import net.runelite.client.ui.overlay.OverlayUtil;
@Singleton
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 CoxPlugin plugin;
@@ -105,7 +110,6 @@ public class CoxOverlay extends Overlay
if (plugin.isTektonTickCounter())
{
ticksLeft = npcs.getTicksUntilAttack();
int attackTicksleft = plugin.getTektonAttackTicks();
if (ticksLeft > 0)
{
if (ticksLeft == 1)
@@ -214,67 +218,67 @@ public class CoxOverlay extends Overlay
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);
Color tickcolor;
if (ticksLeft >= 0)
switch (victim.getType())
{
if (ticksLeft == 34 ||
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);
case ACID:
if (ticksLeft > 0)
{
if (ticksLeft > 1)
{
tickcolor = new Color(69, 241, 44, 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);
}
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 (ticksLeft > 0)
{
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;
}
}
}
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 > 1)
{
tickcolor = new Color(69, 241, 44, 255);
}
else
{
tickcolor = new Color(255, 255, 255, 255);
}
final String ticksLeftStr = String.valueOf(ticksLeft);
Point canvasPoint = actor.getCanvasTextLocation(graphics, ticksLeftStr, 0);
renderTextLocation(graphics, ticksLeftStr, plugin.getTextSize(), plugin.getFontStyle().getFont(), tickcolor, canvasPoint);
}
}
}
if (plugin.isTpOverlay())
{
if (plugin.getTeleportTarget() != null)
{
renderActorOverlay(graphics, plugin.getTeleportTarget(), new Color(193, 255, 245, 255), 2, 100, 10);
});
}
}

View File

@@ -31,8 +31,10 @@ import com.google.inject.Provides;
import java.awt.Color;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
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.NpcDespawned;
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.client.chat.ChatMessageManager;
import net.runelite.client.config.ConfigManager;
@@ -80,123 +82,77 @@ import net.runelite.client.util.Text;
@Slf4j
@Singleton
@Getter(AccessLevel.PACKAGE)
public class CoxPlugin extends Plugin
{
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 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
@Getter(AccessLevel.NONE)
private Client client;
@Inject
@Getter(AccessLevel.NONE)
private ChatMessageManager chatMessageManager;
@Inject
@Getter(AccessLevel.NONE)
private CoxOverlay coxOverlay;
@Inject
@Getter(AccessLevel.NONE)
private CoxInfoBox coxInfoBox;
@Inject
@Getter(AccessLevel.NONE)
private CoxConfig config;
@Inject
@Getter(AccessLevel.NONE)
private OverlayManager overlayManager;
@Inject
@Getter(AccessLevel.NONE)
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private boolean HandCripple;
@Getter(AccessLevel.PACKAGE)
private boolean handCripple;
private boolean runOlm;
@Getter(AccessLevel.PACKAGE)
private int vanguards;
@Getter(AccessLevel.PACKAGE)
private boolean tektonActive;
@Getter(AccessLevel.PACKAGE)
private NPC hand;
@Getter(AccessLevel.PACKAGE)
private NPC Olm_NPC;
@Getter(AccessLevel.PACKAGE)
private NPC OlmMelee_NPC;
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> Olm_Crystals = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> Olm_Heal = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> Olm_TP = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> Olm_PSN = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private List<Actor> burnTarget = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private Actor teleportTarget;
@Getter(AccessLevel.PACKAGE)
private Set<Victim> victims = new HashSet<>();
private Actor acidTarget;
@Getter(AccessLevel.PACKAGE)
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;
@Getter(AccessLevel.PACKAGE)
private int tektonAttackTicks;
@Getter(AccessLevel.PACKAGE)
private int OlmPhase = 0;
@Getter(AccessLevel.PACKAGE)
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
@Getter(AccessLevel.PACKAGE)
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<>();
@Getter(AccessLevel.PACKAGE)
@Setter(AccessLevel.PACKAGE)
private PrayAgainst prayAgainstOlm;
private long lastPrayTime;
private int sleepcount = 0;
private boolean needOlm = false;
private boolean muttadile;
@Getter(AccessLevel.PACKAGE)
private boolean tekton;
@Getter(AccessLevel.PACKAGE)
private boolean tektonTickCounter;
@Getter(AccessLevel.PACKAGE)
private boolean guardians;
@Getter(AccessLevel.PACKAGE)
private boolean guardinTickCounter;
@Getter(AccessLevel.PACKAGE)
private boolean vangHighlight;
@Getter(AccessLevel.PACKAGE)
private boolean vangHealth;
@Getter(AccessLevel.PACKAGE)
private boolean configPrayAgainstOlm;
@Getter(AccessLevel.PACKAGE)
private boolean timers;
@Getter(AccessLevel.PACKAGE)
private boolean tpOverlay;
@Getter(AccessLevel.PACKAGE)
private boolean olmTick;
@Getter(AccessLevel.PACKAGE)
private Color muttaColor;
@Getter(AccessLevel.PACKAGE)
private Color guardColor;
@Getter(AccessLevel.PACKAGE)
private Color tektonColor;
@Getter(AccessLevel.PACKAGE)
private Color burnColor;
@Getter(AccessLevel.PACKAGE)
private Color acidColor;
@Getter(AccessLevel.PACKAGE)
private Color tpColor;
@Getter(AccessLevel.PACKAGE)
private CoxConfig.FontStyle fontStyle;
@Getter(AccessLevel.PACKAGE)
private int textSize;
@Getter(AccessLevel.PACKAGE)
private boolean shadows;
@Provides
@@ -213,16 +169,12 @@ public class CoxPlugin extends Plugin
overlayManager.add(coxOverlay);
overlayManager.add(coxInfoBox);
HandCripple = false;
handCripple = false;
hand = null;
acidTarget = null;
teleportTarget = null;
Olm_TP.clear();
prayAgainstOlm = null;
burnTarget.clear();
victims.clear();
crippleTimer = 45;
burnTicks = 40;
acidTicks = 25;
teleportTicks = 10;
vanguards = 0;
}
@@ -231,7 +183,6 @@ public class CoxPlugin extends Plugin
protected void shutDown()
{
eventBus.unregister(this);
overlayManager.remove(coxOverlay);
overlayManager.remove(coxInfoBox);
}
@@ -240,203 +191,231 @@ public class CoxPlugin extends Plugin
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
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(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
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)
{
if (!inRaid())
{
return;
}
if (event.getType() == ChatMessageType.GAMEMESSAGE)
{
final Matcher tpMatcher = TP_REGEX.matcher(event.getMessage());
if (tpMatcher.matches())
{
Matcher tpMatcher = TP_REGEX.matcher(chatMessage.getMessage());
if (tpMatcher.matches())
for (Player player : client.getPlayers())
{
log.info("TP Matcher has found a match");
for (Actor actor : client.getPlayers())
if (player.getName().equals(tpMatcher.group(1)))
{
if (actor.getName().equals(tpMatcher.group(1)))
{
log.info("Teleport Target Assigned");
teleportTarget = actor;
}
victims.add(new Victim(player, Victim.Type.TELEPORT));
}
}
switch (Text.standardize(chatMessage.getMessageNode().getValue()))
{
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 flame.":
case "the great olm is giving its all. this is its final stand.":
if (!runOlm)
{
Olm_ActionCycle = -1;
Olm_TicksUntilAction = 4;
}
else
{
Olm_ActionCycle = -1;
Olm_TicksUntilAction = 3;
}
OlmPhase = 0;
runOlm = true;
needOlm = true;
crippleTimer = 45;
Olm_NextSpec = -1;
break;
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.":
prayAgainstOlm = PrayAgainst.MELEE;
lastPrayTime = System.currentTimeMillis();
break;
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.":
prayAgainstOlm = PrayAgainst.MAGIC;
lastPrayTime = System.currentTimeMillis();
break;
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.":
prayAgainstOlm = PrayAgainst.RANGED;
lastPrayTime = System.currentTimeMillis();
break;
case "the great olm's left claw clenches to protect itself temporarily.":
HandCripple = true;
}
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 crystal.":
case "the great olm rises with the power of flame.":
case "the great olm is giving its all. this is its final stand.":
if (!runOlm)
{
Olm_ActionCycle = -1;
Olm_TicksUntilAction = 4;
}
else
{
Olm_ActionCycle = -1;
Olm_TicksUntilAction = 3;
}
OlmPhase = 0;
runOlm = true;
needOlm = true;
crippleTimer = 45;
Olm_NextSpec = -1;
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.":
prayAgainstOlm = PrayAgainst.MELEE;
lastPrayTime = System.currentTimeMillis();
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.":
prayAgainstOlm = PrayAgainst.MAGIC;
lastPrayTime = System.currentTimeMillis();
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.":
prayAgainstOlm = PrayAgainst.RANGED;
lastPrayTime = System.currentTimeMillis();
break;
case "the great olm's left claw clenches to protect itself temporarily.":
handCripple = true;
}
}
}
}
private void onProjectileMoved(ProjectileMoved event)
private void onProjectileSpawned(ProjectileSpawned event)
{
if (inRaid())
if (!inRaid())
{
Projectile projectile = event.getProjectile();
if (projectile.getId() == ProjectileID.OLM_MAGE_ATTACK)
{
return;
}
final Projectile projectile = event.getProjectile();
switch (projectile.getId())
{
case ProjectileID.OLM_MAGE_ATTACK:
prayAgainstOlm = PrayAgainst.MAGIC;
lastPrayTime = System.currentTimeMillis();
}
if (projectile.getId() == ProjectileID.OLM_RANGE_ATTACK)
{
break;
case ProjectileID.OLM_RANGE_ATTACK:
prayAgainstOlm = PrayAgainst.RANGED;
lastPrayTime = System.currentTimeMillis();
}
if (projectile.getId() == ProjectileID.OLM_ACID_TRAIL)
{
break;
case ProjectileID.OLM_ACID_TRAIL:
acidTarget = projectile.getInteracting();
}
break;
}
}
private void onSpotAnimationChanged(SpotAnimationChanged graphicChanged)
private void onSpotAnimationChanged(SpotAnimationChanged event)
{
if (inRaid())
if (!inRaid())
{
Actor actor = graphicChanged.getActor();
if (actor.getSpotAnimation() == GraphicID.OLM_BURN)
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 (!burnTarget.contains(actor))
if (victim.getPlayer().getName().equals(player.getName()))
{
burnTarget.add(actor);
add++;
}
}
if (add == 0)
{
victims.add(new Victim(player, Victim.Type.BURN));
}
}
}
private void onNpcSpawned(NpcSpawned npcSpawned)
private void onNpcSpawned(NpcSpawned event)
{
if (inRaid())
{
NPC npc = npcSpawned.getNpc();
switch (npc.getId())
{
case NpcID.TEKTON:
case NpcID.TEKTON_7541:
case NpcID.TEKTON_7542:
case NpcID.TEKTON_7545:
case NpcID.TEKTON_ENRAGED:
case NpcID.TEKTON_ENRAGED_7544:
npcContainer.put(npc, new NPCContainer(npc));
tektonAttackTicks = 27;
break;
case NpcID.MUTTADILE:
case NpcID.MUTTADILE_7562:
case NpcID.MUTTADILE_7563:
case NpcID.GUARDIAN:
case NpcID.GUARDIAN_7570:
npcContainer.put(npc, new NPCContainer(npc));
break;
case NpcID.VANGUARD:
case NpcID.VANGUARD_7526:
case NpcID.VANGUARD_7527:
case NpcID.VANGUARD_7528:
case NpcID.VANGUARD_7529:
vanguards++;
npcContainer.put(npc, new NPCContainer(npc));
break;
case NpcID.GREAT_OLM_LEFT_CLAW:
case NpcID.GREAT_OLM_LEFT_CLAW_7555:
hand = npc;
break;
}
return;
}
final NPC npc = event.getNpc();
switch (npc.getId())
{
case NpcID.TEKTON:
case NpcID.TEKTON_7541:
case NpcID.TEKTON_7542:
case NpcID.TEKTON_7545:
case NpcID.TEKTON_ENRAGED:
case NpcID.TEKTON_ENRAGED_7544:
npcContainer.put(npc, new NPCContainer(npc));
tektonAttackTicks = 27;
break;
case NpcID.MUTTADILE:
case NpcID.MUTTADILE_7562:
case NpcID.MUTTADILE_7563:
case NpcID.GUARDIAN:
case NpcID.GUARDIAN_7570:
npcContainer.put(npc, new NPCContainer(npc));
break;
case NpcID.VANGUARD:
case NpcID.VANGUARD_7526:
case NpcID.VANGUARD_7527:
case NpcID.VANGUARD_7528:
case NpcID.VANGUARD_7529:
vanguards++;
npcContainer.put(npc, new NPCContainer(npc));
break;
case NpcID.GREAT_OLM_LEFT_CLAW:
case NpcID.GREAT_OLM_LEFT_CLAW_7555:
hand = npc;
break;
}
}
private void onNpcDespawned(NpcDespawned event)
{
if (inRaid())
if (!inRaid())
{
NPC npc = event.getNpc();
switch (npc.getId())
{
case NpcID.TEKTON:
case NpcID.TEKTON_7541:
case NpcID.TEKTON_7542:
case NpcID.TEKTON_7545:
case NpcID.TEKTON_ENRAGED:
case NpcID.TEKTON_ENRAGED_7544:
case NpcID.MUTTADILE:
case NpcID.MUTTADILE_7562:
case NpcID.MUTTADILE_7563:
case NpcID.GUARDIAN:
case NpcID.GUARDIAN_7570:
case NpcID.GUARDIAN_7571:
case NpcID.GUARDIAN_7572:
if (npcContainer.remove(event.getNpc()) != null && !npcContainer.isEmpty())
{
npcContainer.remove(event.getNpc());
}
break;
case NpcID.VANGUARD:
case NpcID.VANGUARD_7526:
case NpcID.VANGUARD_7527:
case NpcID.VANGUARD_7528:
case NpcID.VANGUARD_7529:
if (npcContainer.remove(event.getNpc()) != null && !npcContainer.isEmpty())
{
npcContainer.remove(event.getNpc());
}
vanguards--;
break;
case NpcID.GREAT_OLM_RIGHT_CLAW_7553:
case NpcID.GREAT_OLM_RIGHT_CLAW:
HandCripple = false;
break;
}
return;
}
final NPC npc = event.getNpc();
switch (npc.getId())
{
case NpcID.TEKTON:
case NpcID.TEKTON_7541:
case NpcID.TEKTON_7542:
case NpcID.TEKTON_7545:
case NpcID.TEKTON_ENRAGED:
case NpcID.TEKTON_ENRAGED_7544:
case NpcID.MUTTADILE:
case NpcID.MUTTADILE_7562:
case NpcID.MUTTADILE_7563:
case NpcID.GUARDIAN:
case NpcID.GUARDIAN_7570:
case NpcID.GUARDIAN_7571:
case NpcID.GUARDIAN_7572:
if (npcContainer.remove(event.getNpc()) != null && !npcContainer.isEmpty())
{
npcContainer.remove(event.getNpc());
}
break;
case NpcID.VANGUARD:
case NpcID.VANGUARD_7526:
case NpcID.VANGUARD_7527:
case NpcID.VANGUARD_7528:
case NpcID.VANGUARD_7529:
if (npcContainer.remove(event.getNpc()) != null && !npcContainer.isEmpty())
{
npcContainer.remove(event.getNpc());
}
vanguards--;
break;
case NpcID.GREAT_OLM_RIGHT_CLAW_7553:
case NpcID.GREAT_OLM_RIGHT_CLAW:
handCripple = false;
break;
}
}
@@ -449,7 +428,7 @@ public class CoxPlugin extends Plugin
sleepcount = 0;
Olm_Heal.clear();
npcContainer.clear();
burnTarget.clear();
victims.clear();
Olm_NPC = null;
hand = null;
prayAgainstOlm = null;
@@ -457,7 +436,8 @@ public class CoxPlugin extends Plugin
return;
}
npcHandler();
handleNpcs();
handleVictims();
if (needOlm = true)
{
@@ -472,57 +452,32 @@ public class CoxPlugin extends Plugin
}
}
if (teleportTarget != null)
{
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)
if (handCripple)
{
crippleTimer--;
if (crippleTimer <= 0)
{
HandCripple = false;
handCripple = false;
crippleTimer = 45;
}
}
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())
{
@@ -605,7 +560,7 @@ public class CoxPlugin extends Plugin
}
}
private void olmHandler()
private void handleOlm()
{
Olm_Crystals.clear();
Olm_Heal.clear();
@@ -706,14 +661,6 @@ public class CoxPlugin extends Plugin
return client.getVar(Varbits.IN_RAID) == 1;
}
private void onConfigChanged(ConfigChanged configChanged)
{
if (configChanged.getGroup().equals("Cox"))
{
updateConfig();
}
}
private void updateConfig()
{
this.muttadile = config.muttadile();

View File

@@ -34,43 +34,25 @@ import net.runelite.api.Actor;
import net.runelite.api.NPC;
import net.runelite.api.NPCDefinition;
@Getter(AccessLevel.PACKAGE)
class NPCContainer
{
@Getter(AccessLevel.PACKAGE)
private NPC npc;
@Getter(AccessLevel.PACKAGE)
private int npcIndex;
@Getter(AccessLevel.PACKAGE)
private String npcName;
@Getter(AccessLevel.PACKAGE)
private int npcSize;
@Setter(AccessLevel.PACKAGE)
@Getter(AccessLevel.PACKAGE)
private int ticksUntilAttack;
@Setter(AccessLevel.PACKAGE)
@Getter(AccessLevel.PACKAGE)
private int intermissionPeriod;
@Setter(AccessLevel.PACKAGE)
@Getter(AccessLevel.PACKAGE)
private int npcSpeed;
@Setter(AccessLevel.PACKAGE)
@Getter(AccessLevel.PACKAGE)
private Actor npcInteracting;
@Setter(AccessLevel.PACKAGE)
@Getter(AccessLevel.PACKAGE)
private Specials specials;
@Setter(AccessLevel.PACKAGE)
@Getter(AccessLevel.PACKAGE)
private Attackstyle attackStyle;

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

View File

@@ -24,12 +24,14 @@
*/
package net.runelite.client.plugins.demonicgorilla;
import com.google.common.collect.ImmutableSet;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -54,7 +56,7 @@ import net.runelite.api.events.NpcDespawned;
import net.runelite.api.events.NpcSpawned;
import net.runelite.api.events.PlayerDespawned;
import net.runelite.api.events.PlayerSpawned;
import net.runelite.api.events.ProjectileMoved;
import net.runelite.api.events.ProjectileSpawned;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.plugins.Plugin;
@@ -69,6 +71,8 @@ import net.runelite.client.ui.overlay.OverlayManager;
@Singleton
public class DemonicGorillaPlugin extends Plugin
{
private static final Set<Integer> DEMONIC_PROJECTILES = ImmutableSet.of(ProjectileID.DEMONIC_GORILLA_RANGED, ProjectileID.DEMONIC_GORILLA_MAGIC, ProjectileID.DEMONIC_GORILLA_BOULDER);
@Inject
private Client client;
@@ -118,7 +122,7 @@ public class DemonicGorillaPlugin extends Plugin
private void addSubscriptions()
{
eventBus.subscribe(ProjectileMoved.class, this, this::onProjectileMoved);
eventBus.subscribe(ProjectileSpawned.class, this, this::onProjectileSpawned);
eventBus.subscribe(HitsplatApplied.class, this, this::onHitsplatApplied);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(PlayerSpawned.class, this, this::onPlayerSpawned);
@@ -175,8 +179,7 @@ public class DemonicGorillaPlugin extends Plugin
npcId == NpcID.DEMONIC_GORILLA_7149;
}
private void checkGorillaAttackStyleSwitch(DemonicGorilla gorilla,
final DemonicGorilla.AttackStyle... protectedStyles)
private void checkGorillaAttackStyleSwitch(DemonicGorilla gorilla, final DemonicGorilla.AttackStyle... protectedStyles)
{
if (gorilla.getAttacksUntilSwitch() <= 0 ||
gorilla.getNextPosibleAttackStyles().isEmpty())
@@ -545,35 +548,27 @@ public class DemonicGorillaPlugin extends Plugin
}
}
private void onProjectileMoved(ProjectileMoved event)
private void onProjectileSpawned(ProjectileSpawned event)
{
Projectile projectile = event.getProjectile();
int projectileId = projectile.getId();
if (projectileId != ProjectileID.DEMONIC_GORILLA_RANGED &&
projectileId != ProjectileID.DEMONIC_GORILLA_MAGIC &&
projectileId != ProjectileID.DEMONIC_GORILLA_BOULDER)
final Projectile projectile = event.getProjectile();
final int projectileId = projectile.getId();
if (!DEMONIC_PROJECTILES.contains(projectileId))
{
return;
}
// The event fires once before the projectile starts moving,
// and we only want to check each projectile once
if (client.getGameCycle() >= projectile.getStartMovementCycle())
{
return;
}
final WorldPoint loc = WorldPoint.fromLocal(client, projectile.getX1(), projectile.getY1(), client.getPlane());
if (projectileId == ProjectileID.DEMONIC_GORILLA_BOULDER)
{
recentBoulders.add(WorldPoint.fromLocal(client, event.getPosition()));
recentBoulders.add(loc);
}
else
{
WorldPoint projectileSourcePosition = WorldPoint.fromLocal(
client, projectile.getX1(), projectile.getY1(), client.getPlane());
for (DemonicGorilla gorilla : gorillas.values())
{
if (gorilla.getNpc().getWorldLocation().distanceTo(projectileSourcePosition) == 0)
if (gorilla.getNpc().getWorldLocation().distanceTo(loc) == 0)
{
gorilla.setRecentProjectileId(projectile.getId());
}

View File

@@ -10,8 +10,6 @@ package net.runelite.client.plugins.theatre;
import com.google.inject.Provides;
import java.awt.Color;
import java.util.LinkedList;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.AccessLevel;
@@ -28,12 +26,9 @@ import net.runelite.api.events.NpcDefinitionChanged;
import net.runelite.api.events.NpcDespawned;
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.VarbitChanged;
import net.runelite.api.events.WidgetLoaded;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.graphics.ModelOutlineRenderer;
@@ -57,103 +52,55 @@ import net.runelite.client.ui.overlay.OverlayManager;
)
@Singleton
@Slf4j
@Getter
public class TheatrePlugin extends Plugin
{
@Getter(AccessLevel.PUBLIC)
@Setter(AccessLevel.PUBLIC)
private TheatreRoom room;
@Getter(AccessLevel.PUBLIC)
private MaidenHandler maidenHandler;
@Getter(AccessLevel.PUBLIC)
private BloatHandler bloatHandler;
@Getter(AccessLevel.PUBLIC)
private NyloHandler nyloHandler;
@Getter(AccessLevel.PUBLIC)
private SotetsegHandler sotetsegHandler;
@Getter(AccessLevel.PUBLIC)
private XarpusHandler xarpusHandler;
@Getter(AccessLevel.PUBLIC)
private VerzikHandler verzikHandler;
@Inject
private Client client;
@Inject
private EventBus eventBus;
private Widget widget = null;
@Getter(AccessLevel.PUBLIC)
@Inject
private OverlayManager overlayManager;
@Inject
private TheatreOverlay overlay;
@Inject
private TheatreConfig config;
@Inject
private ModelOutlineRenderer modelOutline;
@Getter
private boolean showMaidenBloodToss;
@Getter
private boolean showMaidenBloodSpawns;
@Getter
private boolean showNyloFreezeHighlights;
@Getter
private boolean showBloatIndicator;
@Getter
private boolean showBloatHands;
@Getter
private BloatHandler bloatHandler;
private MaidenHandler maidenHandler;
private NyloHandler nyloHandler;
private SotetsegHandler sotetsegHandler;
@Setter(AccessLevel.PUBLIC)
private TheatreRoom room;
private VerzikHandler verzikHandler;
private XarpusHandler xarpusHandler;
private boolean BloatFeetIndicatorRaveEdition;
@Getter
private boolean showBloatTimer;
@Getter
private boolean showNyloPillarHealth;
@Getter
private TheatreConfig.NYLOOPTION showNylocasExplosions;
@Getter
private boolean showNylocasAmount;
@Getter
private boolean highlightNyloAgros;
@Getter
private boolean showSotetsegAttacks;
@Getter
private boolean showSotetsegMaze;
@Getter
private boolean showSotetsegSolo;
@Getter
private Color mazeTileColour;
@Getter
private boolean showXarpusHeals;
@Getter
private boolean showXarpusTick;
@Getter
private boolean showVerzikAttacks;
@Getter
private boolean showVerzikYellows;
@Getter
private boolean showCrabTargets;
@Getter
private boolean VerzikTankTile;
@Getter
private boolean verzikRangeAttacks;
@Getter
private boolean extraTimers;
@Getter
private boolean highlightNyloAgros;
private boolean p1attacks;
@Getter
private boolean p2attacks;
@Getter
private boolean p3attacks;
private boolean showBloatHands;
private boolean showBloatIndicator;
private boolean showBloatTimer;
private boolean showCrabTargets;
private boolean showMaidenBloodSpawns;
private boolean showMaidenBloodToss;
private boolean showNylocasAmount;
private boolean showNyloFreezeHighlights;
private boolean showNyloPillarHealth;
private boolean showSotetsegAttacks;
private boolean showSotetsegMaze;
private boolean showSotetsegSolo;
private boolean showVerzikAttacks;
private boolean showVerzikYellows;
private boolean showXarpusHeals;
private boolean showXarpusTick;
private boolean verzikRangeAttacks;
private boolean VerzikTankTile;
private Color mazeTileColour;
private TheatreConfig.NYLOOPTION showNylocasExplosions;
@Provides
TheatreConfig getConfig(ConfigManager configManager)
@@ -166,16 +113,13 @@ public class TheatrePlugin extends Plugin
{
updateConfig();
addSubscriptions();
room = TheatreRoom.UNKNOWN;
maidenHandler = new MaidenHandler(client, this, modelOutline);
bloatHandler = new BloatHandler(client, this);
nyloHandler = new NyloHandler(client, this);
sotetsegHandler = new SotetsegHandler(client, this);
xarpusHandler = new XarpusHandler(client, this);
verzikHandler = new VerzikHandler(client, this);
overlayManager.add(overlay);
}
@@ -183,52 +127,111 @@ public class TheatrePlugin extends Plugin
protected void shutDown()
{
eventBus.unregister(this);
maidenHandler.onStop();
maidenHandler = null;
bloatHandler.onStop();
bloatHandler = null;
nyloHandler.startTime = 0L;
nyloHandler.onStop();
nyloHandler = null;
sotetsegHandler.onStop();
sotetsegHandler = null;
xarpusHandler.onStop();
xarpusHandler = null;
verzikHandler.onStop();
verzikHandler = null;
room = TheatreRoom.UNKNOWN;
overlayManager.remove(overlay);
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(SpotAnimationChanged.class, this, this::onSpotAnimationChanged);
eventBus.subscribe(NpcDefinitionChanged.class, this, this::onNpcDefinitionChanged);
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(GroundObjectSpawned.class, this, this::onGroundObjectSpawned);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
eventBus.subscribe(NpcDefinitionChanged.class, this, this::onNpcDefinitionChanged);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(ProjectileMoved.class, this, this::onProjectileMoved);
eventBus.subscribe(ProjectileSpawned.class, this, this::onProjectileSpawned);
eventBus.subscribe(SpotAnimationChanged.class, this, this::onSpotAnimationChanged);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
}
private void onSpotAnimationChanged(SpotAnimationChanged event)
private void onAnimationChanged(AnimationChanged event)
{
if (verzikHandler != null)
{
verzikHandler.onAnimationChanged(event);
}
}
private void onChatMessage(ChatMessage event)
{
if (maidenHandler != null)
{
maidenHandler.onSpotAnimationChanged(event);
maidenHandler.onChatMessage(event);
}
}
private void onConfigChanged(ConfigChanged event)
{
if (!event.getGroup().equals("Theatre"))
{
return;
}
if (nyloHandler != null)
{
nyloHandler.onConfigChanged();
}
}
private void onGameTick(GameTick event)
{
if (maidenHandler != null)
{
maidenHandler.onGameTick();
}
if (bloatHandler != null)
{
bloatHandler.onGameTick();
}
if (nyloHandler != null)
{
nyloHandler.onGameTick();
}
if (sotetsegHandler != null)
{
sotetsegHandler.onGameTick();
}
if (xarpusHandler != null)
{
xarpusHandler.onGameTick();
}
if (verzikHandler != null)
{
verzikHandler.onGameTick();
}
}
private void onGroundObjectSpawned(GroundObjectSpawned event)
{
if (sotetsegHandler != null)
{
sotetsegHandler.onGroundObjectSpawned(event);
}
if (xarpusHandler != null)
{
xarpusHandler.onGroundObjectSpawned(event);
}
}
@@ -240,6 +243,35 @@ public class TheatrePlugin extends Plugin
}
}
private void onNpcDespawned(NpcDespawned event)
{
if (maidenHandler != null)
{
maidenHandler.onNpcDespawned(event);
}
if (bloatHandler != null)
{
bloatHandler.onNpcDespawned(event);
}
if (nyloHandler != null)
{
nyloHandler.onNpcDespawned(event);
}
if (sotetsegHandler != null)
{
sotetsegHandler.onNpcDespawned(event);
}
if (xarpusHandler != null)
{
xarpusHandler.onNpcDespawned(event);
}
}
private void onNpcSpawned(NpcSpawned event)
{
if (maidenHandler != null)
@@ -274,214 +306,28 @@ public class TheatrePlugin extends Plugin
}
private void onNpcDespawned(NpcDespawned event)
{
if (maidenHandler != null)
{
maidenHandler.onNpcDespawned(event);
}
if (bloatHandler != null)
{
bloatHandler.onNpcDespawned(event);
}
if (nyloHandler != null)
{
nyloHandler.onNpcDespawned(event);
}
if (sotetsegHandler != null)
{
sotetsegHandler.onNpcDespawned(event);
}
if (xarpusHandler != null)
{
xarpusHandler.onNpcDespawned(event);
}
}
private void onAnimationChanged(AnimationChanged event)
private void onProjectileMoved(ProjectileMoved event)
{
if (verzikHandler != null)
{
verzikHandler.onAnimationChanged(event);
verzikHandler.onProjectileMoved(event);
}
}
private void onChatMessage(ChatMessage event)
{
if (maidenHandler != null)
{
maidenHandler.onChatMessage(event);
}
}
private void onWidgetLoaded(WidgetLoaded event)
{
if (event.getGroupId() != WidgetID.PERFORMERS_FOR_THE_THEATRE_GROUPS_GROUP_ID && event.getGroupId() != WidgetID.PERFORMERS_FOR_THE_THEATRE_PLAYERS_GROUP_ID)
{
return;
}
if (event.getGroupId() == WidgetID.PERFORMERS_FOR_THE_THEATRE_GROUPS_GROUP_ID)
{
widget = client.getWidget(WidgetID.PERFORMERS_FOR_THE_THEATRE_GROUPS_GROUP_ID, 0);
}
if (event.getGroupId() == WidgetID.PERFORMERS_FOR_THE_THEATRE_PLAYERS_GROUP_ID)
{
widget = client.getWidget(WidgetID.PERFORMERS_FOR_THE_THEATRE_PLAYERS_GROUP_ID, 0);
}
}
private void onGameTick(GameTick event)
{
if (maidenHandler != null)
{
maidenHandler.onGameTick();
}
if (bloatHandler != null)
{
bloatHandler.onGameTick();
}
if (nyloHandler != null)
{
nyloHandler.onGameTick();
}
if (sotetsegHandler != null)
{
sotetsegHandler.onGameTick();
}
if (xarpusHandler != null)
{
xarpusHandler.onGameTick();
}
if (verzikHandler != null)
{
verzikHandler.onGameTick();
}
if (widget == null)
{
return;
}
// recheck if the widget is still active
int p_id = WidgetInfo.TO_GROUP(widget.getId());
List<Widget> widgetList = new LinkedList<>();
if (p_id == WidgetID.PERFORMERS_FOR_THE_THEATRE_GROUPS_GROUP_ID)
{
Widget w = client.getWidget(p_id, 16);
if (w == null)
{
return;
}
Widget[] ws = w.getStaticChildren();
for (Widget widget : ws)
{
Widget[] widgets = widget.getDynamicChildren();
if (widgets.length > 3)
{
widgetList.add(widgets[3]);
}
}
}
else if (p_id == WidgetID.PERFORMERS_FOR_THE_THEATRE_PLAYERS_GROUP_ID)
{
Widget w1 = client.getWidget(p_id, 26);
if (w1 != null)
{
Widget[] dChildsAccepted = w1.getDynamicChildren();
if (dChildsAccepted.length > 2)
{
for (int i = 1; i < dChildsAccepted.length; i += 11)
{
if (!dChildsAccepted[i].getText().equals("-"))
{
widgetList.add(dChildsAccepted[i]);
}
}
}
}
Widget w2 = client.getWidget(p_id, 41);
if (w2 != null)
{
Widget[] dChildsApplied = w2.getDynamicChildren();
if (dChildsApplied.length > 2)
{
for (int i = 1; i < dChildsApplied.length; i += 11)
{
if (!dChildsApplied[i].getText().equals("-"))
{
widgetList.add(dChildsApplied[i]);
}
}
}
}
}
for (Widget w : widgetList)
{
String wtext = w.getText();
if (client.isFriended(wtext, false))
{
w.setTextColor(Color.green.getRGB());
continue;
}
for (int i = 0; i < client.getIgnoreCount(); i++)
{
String name = client.getIgnores()[i].getName();
if (name.replace('\u00A0', ' ').equals(wtext))
{
w.setTextColor(Color.red.getRGB());
break;
}
}
}
widget = null;
}
private void onGroundObjectSpawned(GroundObjectSpawned event)
private void onProjectileSpawned(ProjectileSpawned event)
{
if (sotetsegHandler != null)
{
sotetsegHandler.onGroundObjectSpawned(event);
}
sotetsegHandler.onProjectileSpawned(event);
if (xarpusHandler != null)
{
xarpusHandler.onGroundObjectSpawned(event);
}
}
private void onConfigChanged(ConfigChanged event)
private void onSpotAnimationChanged(SpotAnimationChanged event)
{
if (!event.getGroup().equals("Theatre"))
if (maidenHandler != null)
{
return;
}
if (nyloHandler != null)
{
nyloHandler.onConfigChanged();
maidenHandler.onSpotAnimationChanged(event);
}
}
@@ -498,19 +344,6 @@ public class TheatrePlugin extends Plugin
}
}
private void onProjectileMoved(ProjectileMoved event)
{
if (sotetsegHandler != null)
{
sotetsegHandler.onProjectileMoved(event);
}
if (verzikHandler != null)
{
verzikHandler.onProjectileMoved(event);
}
}
private void updateConfig()
{
this.showMaidenBloodToss = config.showMaidenBloodToss();

View File

@@ -6,9 +6,11 @@ import java.awt.Graphics2D;
import java.awt.Polygon;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.Client;
@@ -22,7 +24,7 @@ import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.GroundObjectSpawned;
import net.runelite.api.events.NpcDespawned;
import net.runelite.api.events.NpcSpawned;
import net.runelite.api.events.ProjectileMoved;
import net.runelite.api.events.ProjectileSpawned;
import net.runelite.client.plugins.theatre.RoomHandler;
import net.runelite.client.plugins.theatre.TheatreConstant;
import net.runelite.client.plugins.theatre.TheatrePlugin;
@@ -43,7 +45,7 @@ public class SotetsegHandler extends RoomHandler
private final List<WorldPoint> blackUnderworld = new ArrayList<>();
private final List<WorldPoint> redUnderworld = new ArrayList<>();
private final List<Point> gridPath = new ArrayList<>();
private final Map<Projectile, WorldPoint> soteyProjectiles = new HashMap<>();
private final Set<Projectile> soteyProjectiles = new HashSet<>();
private NPC npc;
public SotetsegHandler(final Client client, final TheatrePlugin plugin)
@@ -120,7 +122,7 @@ public class SotetsegHandler extends RoomHandler
{
Map<Projectile, String> projectileMap = new HashMap<>();
for (Projectile p : soteyProjectiles.keySet())
for (Projectile p : soteyProjectiles)
{
final int ticksRemaining = p.getRemainingCycles() / 30;
int id = p.getId();
@@ -140,15 +142,14 @@ public class SotetsegHandler extends RoomHandler
}
}
public void onProjectileMoved(ProjectileMoved event)
public void onProjectileSpawned(ProjectileSpawned event)
{
Projectile projectile = event.getProjectile();
final Projectile projectile = event.getProjectile();
//1604 ball
if (event.getPosition().getX() == playerX && event.getPosition().getY() == playerY || event.getProjectile().getId() == 1604)
if (projectile.getId() == 1604 && projectile.getInteracting() == client.getLocalPlayer())
{
WorldPoint p = WorldPoint.fromLocal(client, event.getPosition());
soteyProjectiles.put(projectile, p);
soteyProjectiles.add(projectile);
}
}
@@ -241,7 +242,7 @@ public class SotetsegHandler extends RoomHandler
//Remove projectiles that are about to die
if (!soteyProjectiles.isEmpty())
{
soteyProjectiles.keySet().removeIf(p -> p.getRemainingCycles() < 1);
soteyProjectiles.removeIf(p -> p.getRemainingCycles() <= 0);
}
boolean sotetsegFighting = false;