@@ -24,22 +24,10 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.runecraft;
|
package net.runelite.client.plugins.runecraft;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import static net.runelite.api.ItemID.AIR_RUNE;
|
import static net.runelite.api.ItemID.*;
|
||||||
import static net.runelite.api.ItemID.BLOOD_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.BODY_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.CHAOS_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.COSMIC_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.DEATH_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.EARTH_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.FIRE_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.LAW_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.MIND_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.NATURE_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.SOUL_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.WATER_RUNE;
|
|
||||||
import net.runelite.api.ObjectID;
|
import net.runelite.api.ObjectID;
|
||||||
|
|
||||||
public enum AbyssRifts
|
public enum AbyssRifts
|
||||||
@@ -64,18 +52,14 @@ public enum AbyssRifts
|
|||||||
@Getter
|
@Getter
|
||||||
private final int itemId;
|
private final int itemId;
|
||||||
|
|
||||||
private static final Map<Integer, AbyssRifts> rifts;
|
private static final Map<Integer, AbyssRifts> rifts = new HashMap<>();
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
ImmutableMap.Builder<Integer, AbyssRifts> builder = new ImmutableMap.Builder<>();
|
|
||||||
|
|
||||||
for (AbyssRifts s : values())
|
for (AbyssRifts s : values())
|
||||||
{
|
{
|
||||||
builder.put(s.getObjectId(), s);
|
rifts.put(s.getObjectId(), s);
|
||||||
}
|
}
|
||||||
|
|
||||||
rifts = builder.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AbyssRifts(int objectId, int itemId)
|
AbyssRifts(int objectId, int itemId)
|
||||||
|
|||||||
@@ -220,11 +220,11 @@ public interface RunecraftConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "opLavas",
|
keyName = "Lavas",
|
||||||
name = "Op lavas",
|
name = "Lavas",
|
||||||
description = "Op orange dorito mode - Only does something if you're wearing fire tiara"
|
description = "Swaps Ring of dueling menu entry depending on location, requires fire tiara or RC cape to be worn."
|
||||||
)
|
)
|
||||||
default boolean opLavas()
|
default boolean Lavas()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package net.runelite.client.plugins.runecraft;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
import net.runelite.client.ui.overlay.components.ComponentOrientation;
|
||||||
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
|
public class RunecraftOverlay extends Overlay
|
||||||
|
{
|
||||||
|
private final RunecraftPlugin plugin;
|
||||||
|
private final Client client;
|
||||||
|
private final PanelComponent panel = new PanelComponent();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
RunecraftOverlay(RunecraftPlugin plugin, Client client)
|
||||||
|
{
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.client = client;
|
||||||
|
setPosition(OverlayPosition.CANVAS_TOP_RIGHT);
|
||||||
|
panel.setOrientation(ComponentOrientation.VERTICAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
String text = "Pouch Has Degraded";
|
||||||
|
panel.getChildren().clear();
|
||||||
|
if (plugin.isDegradedPouchInInventory())
|
||||||
|
{
|
||||||
|
panel.getChildren().add(TitleComponent.builder()
|
||||||
|
.text("Pouch Has Degraded")
|
||||||
|
.color(Color.red)
|
||||||
|
.build());
|
||||||
|
panel.setPreferredSize(new Dimension(graphics.getFontMetrics().stringWidth(text) + 5, 5));
|
||||||
|
return panel.render(graphics);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,7 +40,6 @@ import net.runelite.api.EquipmentInventorySlot;
|
|||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.InventoryID;
|
import net.runelite.api.InventoryID;
|
||||||
import net.runelite.api.Item;
|
import net.runelite.api.Item;
|
||||||
import net.runelite.api.ItemContainer;
|
|
||||||
import net.runelite.api.ItemID;
|
import net.runelite.api.ItemID;
|
||||||
import net.runelite.api.MenuEntry;
|
import net.runelite.api.MenuEntry;
|
||||||
import net.runelite.api.NPC;
|
import net.runelite.api.NPC;
|
||||||
@@ -63,6 +62,7 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
|||||||
import static net.runelite.client.util.MenuUtil.swap;
|
import static net.runelite.client.util.MenuUtil.swap;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
|
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Runecraft",
|
name = "Runecraft",
|
||||||
description = "Show minimap icons and clickboxes for abyssal rifts",
|
description = "Show minimap icons and clickboxes for abyssal rifts",
|
||||||
@@ -70,6 +70,10 @@ import net.runelite.client.util.Text;
|
|||||||
)
|
)
|
||||||
public class RunecraftPlugin extends Plugin
|
public class RunecraftPlugin extends Plugin
|
||||||
{
|
{
|
||||||
|
private static final int[] CASTLE_WARS = {9776};
|
||||||
|
private static final int[] FIRE_ALTAR = {10315};
|
||||||
|
|
||||||
|
|
||||||
private static final String POUCH_DECAYED_NOTIFICATION_MESSAGE = "Your rune pouch has decayed.";
|
private static final String POUCH_DECAYED_NOTIFICATION_MESSAGE = "Your rune pouch has decayed.";
|
||||||
private static final String POUCH_DECAYED_MESSAGE = "Your pouch has decayed through use.";
|
private static final String POUCH_DECAYED_MESSAGE = "Your pouch has decayed through use.";
|
||||||
private static final List<Integer> DEGRADED_POUCHES = ImmutableList.of(
|
private static final List<Integer> DEGRADED_POUCHES = ImmutableList.of(
|
||||||
@@ -84,6 +88,7 @@ public class RunecraftPlugin extends Plugin
|
|||||||
ItemID.GIANT_POUCH
|
ItemID.GIANT_POUCH
|
||||||
);
|
);
|
||||||
private boolean wearingTiara;
|
private boolean wearingTiara;
|
||||||
|
private boolean wearingCape;
|
||||||
|
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private final Set<DecorativeObject> abyssObjects = new HashSet<>();
|
private final Set<DecorativeObject> abyssObjects = new HashSet<>();
|
||||||
@@ -103,6 +108,9 @@ public class RunecraftPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private AbyssOverlay abyssOverlay;
|
private AbyssOverlay abyssOverlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private RunecraftOverlay runecraftOverlay;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private RunecraftConfig config;
|
private RunecraftConfig config;
|
||||||
|
|
||||||
@@ -120,6 +128,7 @@ public class RunecraftPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
overlayManager.add(abyssOverlay);
|
overlayManager.add(abyssOverlay);
|
||||||
abyssOverlay.updateConfig();
|
abyssOverlay.updateConfig();
|
||||||
|
overlayManager.add(runecraftOverlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -129,6 +138,7 @@ public class RunecraftPlugin extends Plugin
|
|||||||
abyssObjects.clear();
|
abyssObjects.clear();
|
||||||
darkMage = null;
|
darkMage = null;
|
||||||
degradedPouchInInventory = false;
|
degradedPouchInInventory = false;
|
||||||
|
overlayManager.remove(runecraftOverlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -157,51 +167,72 @@ public class RunecraftPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuEntryAdded(MenuEntryAdded entry)
|
public void onMenuEntryAdded(MenuEntryAdded entry)
|
||||||
{
|
{
|
||||||
if (!wearingTiara)
|
if (wearingCape || wearingTiara)
|
||||||
{
|
{
|
||||||
return;
|
final String option = Text.removeTags(entry.getOption()).toLowerCase();
|
||||||
}
|
final String target = Text.removeTags(entry.getTarget()).toLowerCase();
|
||||||
|
final int id = entry.getIdentifier();
|
||||||
|
final int type = entry.getType();
|
||||||
|
|
||||||
final String option = Text.removeTags(entry.getOption()).toLowerCase();
|
if (target.contains("pouch") && !target.startsWith("rune"))
|
||||||
final String target = Text.removeTags(entry.getTarget()).toLowerCase();
|
|
||||||
final int id = entry.getIdentifier();
|
|
||||||
final int type = entry.getType();
|
|
||||||
|
|
||||||
if (target.contains("pouch") && !target.startsWith("rune"))
|
|
||||||
{
|
|
||||||
if (option.equals("deposit-all") && type == 57 && id == 2)
|
|
||||||
{
|
{
|
||||||
swap(client, "fill", option, target);
|
if (option.contains("deposit") && type == 57 && id == 2) //swap pouches based on empty/full and in ban
|
||||||
swap(client, "cancel", option, "", target);
|
{
|
||||||
|
swap(client, "fill", option, target);
|
||||||
|
swap(client, "cancel", option, "", target);
|
||||||
|
}
|
||||||
|
else if (option.equals("fill") && id != 9)
|
||||||
|
{
|
||||||
|
swap(client, "empty", option, target); //Due to RuneLite issues the "Deposit" menutext will always show even though it is on fill
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (target.contains("ring of dueling") && option.contains("withdraw"))//withdraw-1 ring of dueling
|
||||||
|
{
|
||||||
|
swap(client, "withdraw-1", option, target);
|
||||||
|
}
|
||||||
|
else if (target.contains("binding necklace") && option.contains("withdraw")) //withdraw-1 binding necklace
|
||||||
|
{
|
||||||
|
swap(client, "withdraw-1", option, target);
|
||||||
|
}
|
||||||
|
else if (target.contains("stamina") && option.contains("withdraw"))
|
||||||
|
{ //withdraw-1 stam
|
||||||
|
swap(client, "withdraw-1", option, target);
|
||||||
|
}
|
||||||
|
else if (target.contains("ring of dueling") && option.contains("remove"))
|
||||||
|
{
|
||||||
|
if (client.getLocalPlayer().getWorldLocation().getRegionID() != 10315)
|
||||||
|
{ //changes duel ring teleport options based on location
|
||||||
|
swap(client, "duel arena", option, target);
|
||||||
|
}
|
||||||
|
else if (client.getLocalPlayer().getWorldLocation().getRegionID() == 10315)
|
||||||
|
{
|
||||||
|
swap(client, "castle wars", option, target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (target.contains("crafting cape") && option.contains("remove")) //teleport for crafting cape
|
||||||
|
{
|
||||||
|
swap(client, "Teleport", option, target);
|
||||||
|
}
|
||||||
|
else if (target.contains("max cape") && option.contains("remove")) //teleport for max cape
|
||||||
|
{
|
||||||
|
swap(client, "Crafting Guild", option, target);
|
||||||
|
}
|
||||||
|
else if (target.contains("altar") && option.contains("craft")) // Don't accidentally click the altar to craft
|
||||||
|
{
|
||||||
|
hide(option, target, true);
|
||||||
|
}
|
||||||
|
else if (target.contains("pure") && option.contains("use")) // Don't accidentally use pure essence on altar
|
||||||
|
{
|
||||||
|
hide("use", target, true);
|
||||||
|
hide("drop", target, true);
|
||||||
}
|
}
|
||||||
else if (option.equals("fill") && id != 9)
|
else if (option.equals("fill") && id != 9)
|
||||||
{
|
{
|
||||||
swap(client, "empty", option, target);
|
swap(client, "empty", option, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (target.contains("ring of dueling") && option.contains("remove"))
|
|
||||||
{
|
|
||||||
if (target.contains("7") || target.contains("5") || target.contains("3") || target.contains("1"))
|
|
||||||
{
|
|
||||||
swap(client, "castle wars", option, target);
|
|
||||||
}
|
|
||||||
else if (wearingBindingNeck())
|
|
||||||
{
|
|
||||||
swap(client, "duel arena", option, target);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (target.contains("altar") && option.contains("craft")) // Don't accidentally click the altar to craft
|
|
||||||
{
|
|
||||||
hide(option, target, true);
|
|
||||||
}
|
|
||||||
else if (target.contains("pure") && option.contains("use")) // Don't accidentally use pure essence on altar
|
|
||||||
{
|
|
||||||
hide(option, target, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hide(String option, String target, boolean contains)
|
private void hide(String option, String target, boolean contains)
|
||||||
{
|
{
|
||||||
final MenuEntry[] entries = client.getMenuEntries();
|
final MenuEntry[] entries = client.getMenuEntries();
|
||||||
@@ -246,6 +277,7 @@ public class RunecraftPlugin extends Plugin
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
|
public void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
|
||||||
{
|
{
|
||||||
@@ -292,7 +324,10 @@ public class RunecraftPlugin extends Plugin
|
|||||||
else if (event.getItemContainer() == client.getItemContainer(InventoryID.EQUIPMENT))
|
else if (event.getItemContainer() == client.getItemContainer(InventoryID.EQUIPMENT))
|
||||||
{
|
{
|
||||||
final Item[] items = event.getItemContainer().getItems();
|
final Item[] items = event.getItemContainer().getItems();
|
||||||
wearingTiara = config.opLavas() && items[EquipmentInventorySlot.HEAD.getSlotIdx()].getId() == ItemID.FIRE_TIARA;
|
wearingTiara = config.Lavas() && items[EquipmentInventorySlot.HEAD.getSlotIdx()].getId() == ItemID.FIRE_TIARA;
|
||||||
|
wearingCape = config.Lavas() && items[EquipmentInventorySlot.CAPE.getSlotIdx()].getId() == ItemID.RUNECRAFT_CAPE || config.Lavas() && items[EquipmentInventorySlot.CAPE.getSlotIdx()].getId() == ItemID.RUNECRAFT_CAPET || config.Lavas() && items[EquipmentInventorySlot.CAPE.getSlotIdx()].getId() == ItemID.MAX_CAPE_13342;
|
||||||
|
|
||||||
|
System.out.println("item changed" + wearingCape);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,15 +350,4 @@ public class RunecraftPlugin extends Plugin
|
|||||||
darkMage = null;
|
darkMage = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean wearingBindingNeck()
|
|
||||||
{
|
|
||||||
final ItemContainer worn = client.getItemContainer(InventoryID.EQUIPMENT);
|
|
||||||
if (worn == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return worn.getItems()[EquipmentInventorySlot.AMULET.getSlotIdx()].getId() == ItemID.BINDING_NECKLACE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user