Skip to content

Commit

Permalink
runelite-client: add mage training arena plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasper-ketelaar authored and Adam- committed Jun 20, 2018
1 parent 7d10744 commit b7b8fc8
Show file tree
Hide file tree
Showing 22 changed files with 1,993 additions and 2 deletions.
7 changes: 7 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/Actor.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,11 @@ public interface Actor extends Renderable
* @return the world area
*/
WorldArea getWorldArea();

/**
* Gets the overhead text that is displayed above the actor
*
* @return the overhead text
*/
String getOverhead();
}
1 change: 1 addition & 0 deletions runelite-api/src/main/java/net/runelite/api/NpcID.java
Original file line number Diff line number Diff line change
Expand Up @@ -6221,6 +6221,7 @@ public final class NpcID
public static final int GALLOW = 6775;
public static final int MAN_6776 = 6776;
public static final int MAZE_GUARDIAN = 6777;
public static final int MAZE_GUARDIAN_MOVING = 6778;
public static final int MAZE_GUARDIAN_6779 = 6779;
public static final int PILIAR = 6780;
public static final int SHAYDA = 6781;
Expand Down
2 changes: 2 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/ProjectileID.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class ProjectileID
public static final int CANNONBALL = 53;
public static final int GRANITE_CANNONBALL = 1443;

public static final int TELEKINETIC_SPELL = 143;

public static final int LIZARDMAN_SHAMAN_AOE = 1293;
public static final int CRAZY_ARCHAEOLOGIST_AOE = 1260;
public static final int ICE_DEMON_RANGED_AOE = 1324;
Expand Down
21 changes: 21 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/coords/WorldArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
*/
package net.runelite.api.coords;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
import lombok.Getter;
import net.runelite.api.Client;
Expand Down Expand Up @@ -643,4 +645,23 @@ public WorldPoint toWorldPoint()
{
return new WorldPoint(x, y, plane);
}

/**
* Accumulates all the WorldPoints that this WorldArea contains and returns them as a list
*
* @return Returns the WorldPoints in this WorldArea
*/
public List<WorldPoint> toWorldPointList()
{
List<WorldPoint> list = new ArrayList<>(width * height);
for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{
list.add(new WorldPoint(getX() + x, getY() + y, getPlane()));
}
}

return list;
}
}
10 changes: 10 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ public class WidgetID
public static final int KINGDOM_GROUP_ID = 392;
public static final int BARROWS_GROUP_ID = 24;
public static final int BLAST_MINE_GROUP_ID = 598;
public static final int MTA_ALCHEMY_GROUP_ID = 194;
public static final int MTA_ENCHANTMENT_GROUP_ID = 195;
public static final int MTA_GRAVEYARD_GROUP_ID = 196;
public static final int MTA_TELEKINETIC_GROUP_ID = 198;

static class WorldMap
{
Expand Down Expand Up @@ -507,4 +511,10 @@ static class Barrows
static final int BARROWS_POTENTIAL = 9;
static final int BARROWS_REWARD_INVENTORY = 3;
}

static class MTA
{
static final int BONUS_COMPONENT = 7;
static final int BONUS_TEXT_COMPONENT = 12;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,11 @@ public enum WidgetInfo
BARROWS_BROTHERS(WidgetID.BARROWS_GROUP_ID, WidgetID.Barrows.BARROWS_BROTHERS),
BARROWS_POTENTIAL(WidgetID.BARROWS_GROUP_ID, WidgetID.Barrows.BARROWS_POTENTIAL),
BARROWS_REWARD_INVENTORY(WidgetID.BARROWS_REWARD_GROUP_ID, WidgetID.Barrows.BARROWS_REWARD_INVENTORY),

BLAST_MINE(WidgetID.BLAST_MINE_GROUP_ID, 0);

BLAST_MINE(WidgetID.BLAST_MINE_GROUP_ID, 0),

MTA_ENCHANTMENT_BONUS_TEXT(WidgetID.MTA_ENCHANTMENT_GROUP_ID, WidgetID.MTA.BONUS_TEXT_COMPONENT),
MTA_ENCHANTMENT_BONUS(WidgetID.MTA_ENCHANTMENT_GROUP_ID, WidgetID.MTA.BONUS_COMPONENT);

private final int groupId;
private final int childId;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Copyright (c) 2018, Jasper Ketelaar <[email protected]>
* 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.client.plugins.mta;

import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;

@ConfigGroup(
keyName = "mta",
name = "Mage Training Arena",
description = "Configuration for the Mage Training Arena plugin"
)
public interface MTAConfig extends Config
{
@ConfigItem(
keyName = "alchemy",
name = "Enable alchemy room",
description = "Configures whether or not the alchemy room overlay is enabled.",
position = 0
)
default boolean alchemy()
{
return true;
}

@ConfigItem(
keyName = "graveyard",
name = "Enable graveyard room",
description = "Configures whether or not the graveyard room overlay is enabled.",
position = 1
)
default boolean graveyard()
{
return true;
}

@ConfigItem(
keyName = "telekinetic",
name = "Enable telekinetic room",
description = "Configures whether or not the telekinetic room overlay is enabled.",
position = 2
)
default boolean telekinetic()
{
return true;
}

@ConfigItem(
keyName = "enchantment",
name = "Enable enchantment room",
description = "Configures whether or not the enchantment room overlay is enabled.",
position = 3
)
default boolean enchantment()
{
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright (c) 2018, Jasper Ketelaar <[email protected]>
* 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.client.plugins.mta;

import java.awt.Dimension;
import java.awt.Graphics2D;
import javax.inject.Inject;
import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;

public class MTAInventoryOverlay extends Overlay
{
private final MTAPlugin plugin;

@Inject
public MTAInventoryOverlay(MTAPlugin plugin)
{
this.plugin = plugin;
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_WIDGETS);
}

@Override
public Dimension render(Graphics2D graphics)
{
for (MTARoom room : plugin.getRooms())
{
if (room.inside())
{
graphics.setFont(FontManager.getRunescapeBoldFont());
room.over(graphics);
}
}

return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* Copyright (c) 2018, Jasper Ketelaar <[email protected]>
* 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.client.plugins.mta;

import com.google.common.eventbus.EventBus;
import com.google.inject.Provides;
import javax.inject.Inject;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.mta.alchemy.AlchemyRoom;
import net.runelite.client.plugins.mta.enchantment.EnchantmentRoom;
import net.runelite.client.plugins.mta.graveyard.GraveyardRoom;
import net.runelite.client.plugins.mta.telekinetic.TelekineticRoom;
import net.runelite.client.ui.overlay.OverlayManager;

@PluginDescriptor(name = "Mage Training Arena")
public class MTAPlugin extends Plugin
{
@Inject
private Client client;

@Inject
private OverlayManager overlayManager;

@Inject
private AlchemyRoom alchemyRoom;
@Inject
private GraveyardRoom graveyardRoom;
@Inject
private TelekineticRoom telekineticRoom;
@Inject
private EnchantmentRoom enchantmentRoom;

@Inject
private EventBus eventBus;
@Inject
private MTASceneOverlay sceneOverlay;
@Inject
private MTAInventoryOverlay inventoryOverlay;

@Getter(AccessLevel.PROTECTED)
private MTARoom[] rooms;

@Provides
public MTAConfig getConfig(ConfigManager manager)
{
return manager.getConfig(MTAConfig.class);
}

@Override
public void startUp()
{
overlayManager.add(sceneOverlay);
overlayManager.add(inventoryOverlay);

this.rooms = new MTARoom[]{alchemyRoom, graveyardRoom, telekineticRoom, enchantmentRoom};

for (MTARoom room : rooms)
{
eventBus.register(room);
}
}

@Override
public void shutDown()
{
overlayManager.remove(sceneOverlay);
overlayManager.remove(inventoryOverlay);

for (MTARoom room : rooms)
{
eventBus.unregister(room);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (c) 2018, Jasper Ketelaar <[email protected]>
* 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.client.plugins.mta;

import java.awt.Graphics2D;
import javax.inject.Inject;
import lombok.AccessLevel;
import lombok.Getter;

public abstract class MTARoom
{
@Getter(AccessLevel.PROTECTED)
protected final MTAConfig config;

@Inject
protected MTARoom(MTAConfig config)
{
this.config = config;
}

public abstract boolean inside();

public void under(Graphics2D graphics2D)
{
}

public void over(Graphics2D graphics2D)
{
}
}
Loading

0 comments on commit b7b8fc8

Please sign in to comment.