hunter plugin: update location translation for lizard traps

Now that getWorldLocation() returns the south-west corner, the
translations for the open trap to the closed trap need to be inverted
This commit is contained in:
Adam
2021-03-20 15:30:35 -04:00
parent b9e290c9d2
commit 1bc9e5232f

View File

@@ -40,12 +40,12 @@ import net.runelite.api.Tile;
import net.runelite.api.coords.Direction;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameTick;
import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@@ -118,14 +118,6 @@ public class HunterPlugin extends Plugin
* ------------------------------------------------------------------------------
*/
case ObjectID.DEADFALL: // Deadfall trap placed
if (localPlayer.getWorldLocation().distanceTo(trapLocation) <= 2)
{
log.debug("Trap placed by \"{}\" on {}", localPlayer.getName(), trapLocation);
traps.put(trapLocation, new HunterTrap(gameObject));
lastActionTime = Instant.now();
}
break;
case ObjectID.MONKEY_TRAP: // Maniacal monkey trap placed
// If player is right next to "object" trap assume that player placed the trap
if (localPlayer.getWorldLocation().distanceTo(trapLocation) <= 2)
@@ -166,15 +158,15 @@ public class HunterPlugin extends Plugin
switch (trapOrientation)
{
case NORTH:
translatedTrapLocation = trapLocation.dy(1);
case SOUTH:
translatedTrapLocation = trapLocation.dy(-1);
break;
case EAST:
translatedTrapLocation = trapLocation.dx(1);
case WEST:
translatedTrapLocation = trapLocation.dx(-1);
break;
}
log.debug("Trap placed by \"{}\" on {}", localPlayer.getName(), translatedTrapLocation);
log.debug("Trap placed by \"{}\" on {} facing {}", localPlayer.getName(), translatedTrapLocation, trapOrientation);
traps.put(translatedTrapLocation, new HunterTrap(gameObject));
lastActionTime = Instant.now();
}