Merge pull request #589 from Lucwousin/asasakkaskakskakaskamkskanmsa

Revert temporary fixes as they've been permanently fixed
This commit is contained in:
Tyler Bochard
2019-06-13 17:43:57 -04:00
committed by GitHub
4 changed files with 44 additions and 120 deletions

View File

@@ -484,8 +484,8 @@ public class MenuManager
{
continue;
}
//todo once bytecodes work again, re-enable
/* event.consume();
event.consume();
client.invokeMenuAction(
event.getActionParam(),
@@ -496,7 +496,7 @@ public class MenuManager
"do not edit",
client.getMouseCanvasPosition().getX(),
client.getMouseCanvasPosition().getY()
);*/
);
break;
}
@@ -504,17 +504,14 @@ public class MenuManager
if (!event.getMenuTarget().equals("do not edit") &&
!leftClickObjects.isEmpty() &&
event.getMenuAction() == MenuAction.GAME_OBJECT_FIRST_OPTION &&
(
leftClickObjects.contains(event.getId())
||
event.getMenuAction() == MenuAction.GAME_OBJECT_FIRST_OPTION && (
leftClickObjects.contains(event.getId()) ||
client.getObjectDefinition(event.getId()) != null &&
client.getObjectDefinition(event.getId()).getImpostorIds() != null &&
client.getObjectDefinition(event.getId()).getImpostor() != null &&
client.getObjectDefinition(event.getId()).getImpostor().getId() == event.getId()))
client.getObjectDefinition(event.getId()).getImpostorIds() != null &&
client.getObjectDefinition(event.getId()).getImpostor() != null &&
client.getObjectDefinition(event.getId()).getImpostor().getId() == event.getId()))
{
//todo once bytecodes work again, re-enable
/* event.consume();
event.consume();
client.invokeMenuAction(
event.getActionParam(),
@@ -525,7 +522,7 @@ public class MenuManager
"do not edit",
client.getMouseCanvasPosition().getX(),
client.getMouseCanvasPosition().getY()
);*/
);
}
if (event.getMenuAction() != MenuAction.RUNELITE)
@@ -648,6 +645,11 @@ public class MenuManager
addSwap(option, target, option2, target, true, false);
}
public void removeSwap(String option, String target, String option2)
{
removeSwap(option, target, option2, target, true, false);
}
/**
* Adds to the map of swaps.
*/
@@ -835,7 +837,7 @@ public class MenuManager
}
/**
* Adds to the set of hidden entries - Pre-baked Abstract entry
* Adds to the set of hidden entries - Pre-baked Comparable entry
*/
public void addHiddenEntry(ComparableEntry entry)
{

View File

@@ -53,7 +53,6 @@ class Hydra
}
@Getter
@Setter
private NPC npc;
@Getter

View File

@@ -24,21 +24,18 @@
*/
package net.runelite.client.plugins.alchemicalhydra;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import lombok.Getter;
import net.runelite.api.AnimationID;
import net.runelite.api.NpcID;
import net.runelite.api.ProjectileID;
import net.runelite.api.SpriteID;
import net.runelite.api.coords.WorldPoint;
enum HydraPhase
{ // Sorry for the autism
ONE(3, AnimationID.HYDRA_1_1, AnimationID.HYDRA_1_2, ProjectileID.HYDRA_POISON, 0, SpriteID.BIG_ASS_GUTHIX_SPELL, new WorldPoint(1371, 10263, 0), NpcID.ALCHEMICAL_HYDRA),
TWO(3, AnimationID.HYDRA_2_1, AnimationID.HYDRA_2_2, ProjectileID.HYDRA_LIGHTNING, AnimationID.HYDRA_LIGHTNING, SpriteID.BIG_SPEC_TRANSFER, new WorldPoint(1371, 10272, 0), NpcID.ALCHEMICAL_HYDRA_8619),
THREE(3, AnimationID.HYDRA_3_1, AnimationID.HYDRA_3_2, 0, AnimationID.HYDRA_FIRE, SpriteID.BIG_SUPERHEAT, new WorldPoint(1362, 10272, 0), NpcID.ALCHEMICAL_HYDRA_8620),
FOUR(1, AnimationID.HYDRA_4_1, AnimationID.HYDRA_4_2, ProjectileID.HYDRA_POISON, 0, SpriteID.BIG_ASS_GUTHIX_SPELL, null, NpcID.ALCHEMICAL_HYDRA_8621);
ONE(3, AnimationID.HYDRA_1_1, AnimationID.HYDRA_1_2, ProjectileID.HYDRA_POISON, 0, SpriteID.BIG_ASS_GUTHIX_SPELL, new WorldPoint(1371, 10263, 0)),
TWO(3, AnimationID.HYDRA_2_1, AnimationID.HYDRA_2_2, 0, AnimationID.HYDRA_LIGHTNING, SpriteID.BIG_SPEC_TRANSFER, new WorldPoint(1371, 10272, 0)),
THREE(3, AnimationID.HYDRA_3_1, AnimationID.HYDRA_3_2, 0, AnimationID.HYDRA_FIRE, SpriteID.BIG_SUPERHEAT, new WorldPoint(1362, 10272, 0)),
FOUR(1, AnimationID.HYDRA_4_1, AnimationID.HYDRA_4_2, ProjectileID.HYDRA_POISON, 0, SpriteID.BIG_ASS_GUTHIX_SPELL, null);
@Getter
private final int attacksPerSwitch;
@@ -61,30 +58,7 @@ enum HydraPhase
@Getter
private WorldPoint fountain;
@Getter
private int npcID;
@Getter
private static final ImmutableSet<Integer> idSet;
private static final ImmutableMap<Integer, HydraPhase> idMap;
static
{
ImmutableMap.Builder<Integer, HydraPhase> mapBuilder = new ImmutableMap.Builder<>();
ImmutableSet.Builder<Integer> setBuilder = new ImmutableSet.Builder<>();
for (HydraPhase p : values())
{
mapBuilder.put(p.getNpcID(), p);
setBuilder.add(p.getNpcID());
}
idMap = mapBuilder.build();
idSet = setBuilder.build();
}
HydraPhase(int attacksPerSwitch, int deathAnim1, int deathAnim2, int specProjectileId, int specAnimationId, int specImage, WorldPoint fountain, int npcID)
HydraPhase(int attacksPerSwitch, int deathAnim1, int deathAnim2, int specProjectileId, int specAnimationId, int specImage, WorldPoint fountain)
{
this.attacksPerSwitch = attacksPerSwitch;
this.deathAnim1 = deathAnim1;
@@ -93,11 +67,5 @@ enum HydraPhase
this.specAnimationId = specAnimationId;
this.specImage = specImage;
this.fountain = fountain;
this.npcID = npcID;
}
static HydraPhase getFromId(int ID)
{
return idMap.get(ID);
}
}

View File

@@ -38,12 +38,10 @@ import net.runelite.api.GameState;
import net.runelite.api.NPC;
import net.runelite.api.NpcID;
import net.runelite.api.Projectile;
import net.runelite.api.ProjectileID;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.events.AnimationChanged;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.NpcSpawned;
import net.runelite.api.events.ProjectileMoved;
import net.runelite.client.eventbus.Subscribe;
@@ -59,7 +57,6 @@ import net.runelite.client.ui.overlay.OverlayManager;
type = PluginType.PVM,
enabledByDefault = false
)
@Slf4j
public class HydraPlugin extends Plugin
{
@@ -107,57 +104,6 @@ public class HydraPlugin extends Plugin
lastAttackTick = -1;
}
@Subscribe
private void onGameTick(GameTick event)
{
if (!inHydraInstance || hydra == null)
{
return;
}
NPC hydraNpc = hydra.getNpc();
for (NPC npc : client.getNpcs())
{
if (!HydraPhase.getIdSet().contains(npc.getId()))
{
continue;
}
HydraPhase phase = HydraPhase.getFromId(npc.getId());
if (hydra.getPhase() != phase)
{
log.debug("Hydra phase changed!");
changePhase(phase);
}
if (hydraNpc != npc)
{
log.debug("Hydra npc changed!");
hydra.setNpc(npc);
}
return;
}
if (!poisonProjectiles.isEmpty())
{
Set<LocalPoint> exPoisonProjectiles = new HashSet<>();
for (Map.Entry<LocalPoint, Projectile> entry : poisonProjectiles.entrySet())
{
if (entry.getValue().getEndCycle() < client.getGameCycle())
{
exPoisonProjectiles.add(entry.getKey());
}
}
for (LocalPoint toRemove : exPoisonProjectiles)
{
poisonProjectiles.remove(toRemove);
}
}
}
@Subscribe
private void onGameStateChanged(GameStateChanged state)
{
@@ -201,7 +147,6 @@ public class HydraPlugin extends Plugin
return;
}
log.debug("Hydra spawned");
hydra = new Hydra(event.getNpc());
addOverlays();
}
@@ -216,7 +161,6 @@ public class HydraPlugin extends Plugin
return;
}
log.debug("Animation changed: {}, {}", actor.getName(), actor.getAnimation());
HydraPhase phase = hydra.getPhase();
if (actor.getAnimation() == phase.getDeathAnim2() &&
@@ -250,6 +194,24 @@ public class HydraPlugin extends Plugin
{
hydra.setNextSpecial(hydra.getNextSpecial() + 9);
}
if (poisonProjectiles.isEmpty())
{
return;
}
Set<LocalPoint> exPoisonProjectiles = new HashSet<>();
for (Map.Entry<LocalPoint, Projectile> entry : poisonProjectiles.entrySet())
{
if (entry.getValue().getEndCycle() < client.getGameCycle())
{
exPoisonProjectiles.add(entry.getKey());
}
}
for (LocalPoint toRemove : exPoisonProjectiles)
{
poisonProjectiles.remove(toRemove);
}
}
@Subscribe
@@ -272,10 +234,7 @@ public class HydraPlugin extends Plugin
hydra.setNextSpecial(hydra.getNextSpecial() + 9);
}
if (id == ProjectileID.HYDRA_POISON)
{
poisonProjectiles.put(event.getPosition(), projectile);
}
poisonProjectiles.put(event.getPosition(), projectile);
}
else if (client.getTickCount() != lastAttackTick
&& (id == Hydra.AttackStyle.MAGIC.getProjId() || id == Hydra.AttackStyle.RANGED.getProjId()))
@@ -288,16 +247,12 @@ public class HydraPlugin extends Plugin
@Subscribe
public void onChatMessage(ChatMessage event)
{
if (event.getMessage().equals("The chemicals neutralise the Alchemical Hydra's defences!"))
if (!event.getMessage().equals("The chemicals neutralise the Alchemical Hydra's defences!"))
{
hydra.setWeakened(true);
}
else if (event.getMessage().startsWith("Your Alchemical Hydra kill count is"))
{
hydra = null;
poisonProjectiles.clear();
removeOverlays();
return;
}
hydra.setWeakened(true);
}
private boolean checkArea()