Remove deprecated GroundObjectQuery class
This commit is contained in:
@@ -1,64 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package net.runelite.api.queries;
|
|
||||||
|
|
||||||
import net.runelite.api.Client;
|
|
||||||
import net.runelite.api.GroundObject;
|
|
||||||
import net.runelite.api.Tile;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used for getting ground objects in view,deprecated as of existence of Item spawn events
|
|
||||||
*
|
|
||||||
* @see net.runelite.api.events.ItemSpawned
|
|
||||||
* @see net.runelite.api.events.ItemDespawned
|
|
||||||
* @see net.runelite.api.events.ItemQuantityChanged
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class GroundObjectQuery extends TileObjectQuery<GroundObject, GroundObjectQuery>
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public GroundObject[] result(Client client)
|
|
||||||
{
|
|
||||||
return getGroundObjects(client).stream()
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.filter(predicate)
|
|
||||||
.distinct()
|
|
||||||
.toArray(GroundObject[]::new);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Collection<GroundObject> getGroundObjects(Client client)
|
|
||||||
{
|
|
||||||
Collection<GroundObject> objects = new ArrayList<>();
|
|
||||||
for (Tile tile : getTiles(client))
|
|
||||||
{
|
|
||||||
objects.add(tile.getGroundObject());
|
|
||||||
}
|
|
||||||
return objects;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -56,10 +56,10 @@ import net.runelite.api.coords.WorldArea;
|
|||||||
import net.runelite.api.coords.WorldPoint;
|
import net.runelite.api.coords.WorldPoint;
|
||||||
import net.runelite.api.events.GameStateChanged;
|
import net.runelite.api.events.GameStateChanged;
|
||||||
import net.runelite.api.events.GameTick;
|
import net.runelite.api.events.GameTick;
|
||||||
|
import net.runelite.api.events.GroundObjectSpawned;
|
||||||
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.WallObjectSpawned;
|
import net.runelite.api.events.WallObjectSpawned;
|
||||||
import net.runelite.api.queries.GroundObjectQuery;
|
|
||||||
import net.runelite.api.widgets.WidgetID;
|
import net.runelite.api.widgets.WidgetID;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.plugins.mta.MTAConfig;
|
import net.runelite.client.plugins.mta.MTAConfig;
|
||||||
@@ -79,6 +79,7 @@ public class TelekineticRoom extends MTARoom
|
|||||||
private Stack<Direction> moves = new Stack<>();
|
private Stack<Direction> moves = new Stack<>();
|
||||||
private LocalPoint destination;
|
private LocalPoint destination;
|
||||||
private WorldPoint location;
|
private WorldPoint location;
|
||||||
|
private WorldPoint finishLocation;
|
||||||
private Rectangle bounds;
|
private Rectangle bounds;
|
||||||
private NPC guardian;
|
private NPC guardian;
|
||||||
private Maze maze;
|
private Maze maze;
|
||||||
@@ -92,6 +93,7 @@ public class TelekineticRoom extends MTARoom
|
|||||||
|
|
||||||
public void resetRoom()
|
public void resetRoom()
|
||||||
{
|
{
|
||||||
|
finishLocation = null;
|
||||||
telekineticWalls.clear();
|
telekineticWalls.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,6 +120,16 @@ public class TelekineticRoom extends MTARoom
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onGroundObjectSpawned(GroundObjectSpawned event)
|
||||||
|
{
|
||||||
|
final GroundObject object = event.getGroundObject();
|
||||||
|
if (object.getId() == TELEKINETIC_FINISH)
|
||||||
|
{
|
||||||
|
finishLocation = object.getWorldLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameTick(GameTick event)
|
public void onGameTick(GameTick event)
|
||||||
{
|
{
|
||||||
@@ -159,9 +171,8 @@ public class TelekineticRoom extends MTARoom
|
|||||||
log.debug("Updating guarding location {} -> {}", location, current);
|
log.debug("Updating guarding location {} -> {}", location, current);
|
||||||
|
|
||||||
location = current;
|
location = current;
|
||||||
final LocalPoint finish = finish();
|
|
||||||
|
|
||||||
if (finish != null && location.equals(WorldPoint.fromLocal(client, finish)))
|
if (location.equals(finishLocation))
|
||||||
{
|
{
|
||||||
client.clearHintArrow();
|
client.clearHintArrow();
|
||||||
}
|
}
|
||||||
@@ -338,8 +349,6 @@ public class TelekineticRoom extends MTARoom
|
|||||||
|
|
||||||
private Stack<Direction> build(WorldPoint start)
|
private Stack<Direction> build(WorldPoint start)
|
||||||
{
|
{
|
||||||
LocalPoint finish = finish();
|
|
||||||
|
|
||||||
Queue<WorldPoint> visit = new LinkedList<>();
|
Queue<WorldPoint> visit = new LinkedList<>();
|
||||||
Set<WorldPoint> closed = new HashSet<>();
|
Set<WorldPoint> closed = new HashSet<>();
|
||||||
Map<WorldPoint, Integer> scores = new HashMap<>();
|
Map<WorldPoint, Integer> scores = new HashMap<>();
|
||||||
@@ -379,7 +388,7 @@ public class TelekineticRoom extends MTARoom
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return build(edges, WorldPoint.fromLocal(client, finish));
|
return build(edges, finishLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Stack<Direction> build(Map<WorldPoint, WorldPoint> edges, WorldPoint finish)
|
private Stack<Direction> build(Map<WorldPoint, WorldPoint> edges, WorldPoint finish)
|
||||||
@@ -463,21 +472,6 @@ public class TelekineticRoom extends MTARoom
|
|||||||
return LocalPoint.fromWorld(client, worldPoint);
|
return LocalPoint.fromWorld(client, worldPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LocalPoint finish()
|
|
||||||
{
|
|
||||||
GroundObjectQuery qry = new GroundObjectQuery()
|
|
||||||
.idEquals(TELEKINETIC_FINISH);
|
|
||||||
|
|
||||||
GroundObject[] result = qry.result(client);
|
|
||||||
|
|
||||||
if (result.length > 0)
|
|
||||||
{
|
|
||||||
return result[0].getLocalLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Rectangle getBounds(WallObject[] walls)
|
private Rectangle getBounds(WallObject[] walls)
|
||||||
{
|
{
|
||||||
int minX = Integer.MAX_VALUE;
|
int minX = Integer.MAX_VALUE;
|
||||||
|
|||||||
Reference in New Issue
Block a user