Merge pull request #225 from Toocanzs/lizardman

Add AoE warning plugin
This commit is contained in:
Adam
2017-11-26 11:18:16 -05:00
committed by GitHub
13 changed files with 773 additions and 24 deletions

View File

@@ -244,13 +244,41 @@ public class Perspective
*/
public static Polygon getCanvasTilePoly(Client client, Point localLocation)
{
int plane = client.getPlane();
int halfTile = Perspective.LOCAL_TILE_SIZE / 2;
return getCanvasTileAreaPoly(client, localLocation, 1);
}
Point p1 = Perspective.worldToCanvas(client, localLocation.getX() - halfTile, localLocation.getY() - halfTile, plane);
Point p2 = Perspective.worldToCanvas(client, localLocation.getX() - halfTile, localLocation.getY() + halfTile, plane);
Point p3 = Perspective.worldToCanvas(client, localLocation.getX() + halfTile, localLocation.getY() + halfTile, plane);
Point p4 = Perspective.worldToCanvas(client, localLocation.getX() + halfTile, localLocation.getY() - halfTile, plane);
/**
* Returns a polygon representing an area.
*
* @param client
* @param localLocation Center location of the AoE
* @param size size of the area. Ex. Lizardman Shaman AoE is a 3x3, so
* size = 3
* @return a polygon representing the tiles in the area
*/
public static Polygon getCanvasTileAreaPoly(Client client, Point localLocation, int size)
{
int plane = client.getPlane();
int halfTile = LOCAL_TILE_SIZE / 2;
// If the size is 5, we need to shift it up and left 2 units, then expand by 5 units to make a 5x5
int aoeSize = size / 2;
// Shift over one half tile as localLocation is the center point of the tile, and then shift the area size
Point topLeft = new Point(localLocation.getX() - (aoeSize * LOCAL_TILE_SIZE) - halfTile,
localLocation.getY() - (aoeSize * LOCAL_TILE_SIZE) - halfTile);
// expand by size
Point bottomRight = new Point(topLeft.getX() + size * LOCAL_TILE_SIZE,
topLeft.getY() + size * LOCAL_TILE_SIZE);
// Take the x of top left and the y of bottom right to create bottom left
Point bottomLeft = new Point(topLeft.getX(), bottomRight.getY());
// Similarly for top right
Point topRight = new Point(bottomRight.getX(), topLeft.getY());
Point p1 = worldToCanvas(client, topLeft.getX(), topLeft.getY(), plane);
Point p2 = worldToCanvas(client, topRight.getX(), topRight.getY(), plane);
Point p3 = worldToCanvas(client, bottomRight.getX(), bottomRight.getY(), plane);
Point p4 = worldToCanvas(client, bottomLeft.getX(), bottomLeft.getY(), plane);
if (p1 == null || p2 == null || p3 == null || p4 == null)
{

View File

@@ -0,0 +1,32 @@
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* 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;
public interface Projectile
{
int getId();
Actor getInteracting();
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* 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;
public class ProjectileID
{
public static final int LIZARDMAN_SHAMAN_AOE = 1293;
public static final int ICE_DEMON_RANGED_AOE = 1324;
public static final int ICE_DEMON_ICE_BARRAGE_AOE = 366;
public static final int VASA_AWAKEN_AOE = 1327;
public static final int VASA_RANGED_AOE = 1329;
public static final int TEKTON_METEOR_AOE = 660;
}