Skip to content

Commit

Permalink
Merge pull request open-osrs#3221 from open-osrs/wowthathugecodechain…
Browse files Browse the repository at this point in the history
…looksawful
  • Loading branch information
Owain94 authored Jun 17, 2022
2 parents 76f77ee + fbd4a39 commit fb60b7e
Show file tree
Hide file tree
Showing 15 changed files with 417 additions and 51 deletions.
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

object ProjectVersions {
const val launcherVersion = "3.0.0"
const val rlVersion = "1.8.23"
const val rlVersion = "1.8.24"

const val openosrsVersion = "4.30.0"
const val openosrsVersion = "4.31.0"

const val rsversion = 206
const val cacheversion = 165
Expand Down
9 changes: 9 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/ParamID.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,13 @@ public final class ParamID
public static final int SETTING_SLIDER_IS_DRAGGABLE = 1108;
public static final int SETTING_SLIDER_DEADZONE = 1109;
public static final int SETTING_SLIDER_DEADTIME = 1110;

public static final int OC_ITEM_OP1 = 451;
public static final int OC_ITEM_OP2 = 452;
public static final int OC_ITEM_OP3 = 453;
public static final int OC_ITEM_OP4 = 454;
public static final int OC_ITEM_OP5 = 455;
public static final int OC_ITEM_OP6 = 456;
public static final int OC_ITEM_OP7 = 457;
public static final int OC_ITEM_OP8 = 458;
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,12 @@ private void renderNpcOverlay(Graphics2D graphics, HighlightedNpc highlightedNpc

if (highlightedNpc.isSwTile())
{
int size = npcComposition.getSize();
LocalPoint lp = actor.getLocalLocation();

int x = lp.getX() - ((size - 1) * Perspective.LOCAL_TILE_SIZE / 2);
int y = lp.getY() - ((size - 1) * Perspective.LOCAL_TILE_SIZE / 2);

Polygon southWestTilePoly = Perspective.getCanvasTilePoly(client, new LocalPoint(x, y));

renderPoly(graphics, borderColor, borderWidth, fillColor, southWestTilePoly);
LocalPoint lp = LocalPoint.fromWorld(client, actor.getWorldLocation());
if (lp != null)
{
Polygon tilePoly = Perspective.getCanvasTilePoly(client, lp);
renderPoly(graphics, borderColor, borderWidth, fillColor, tilePoly);
}
}

if (highlightedNpc.isOutline())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ public interface CorpConfig extends Config
{
String GROUP = "corp";

@ConfigItem(
keyName = "leftClickCore",
name = "Left click walk on core",
description = "Prioritizes Walk here over Attack on the Dark energy core",
position = 1
)
default boolean leftClickCore()
{
return true;
}

@ConfigItem(
keyName = "showDamage",
name = "Show damage overlay",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
import net.runelite.api.NPC;
import net.runelite.api.NpcID;
import net.runelite.api.Varbits;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.HitsplatApplied;
import net.runelite.api.events.InteractingChanged;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.NpcDespawned;
import net.runelite.api.events.NpcSpawned;
import net.runelite.api.events.VarbitChanged;
Expand All @@ -66,6 +69,9 @@
@Slf4j
public class CorpPlugin extends Plugin
{
private static final String ATTACK = "Attack";
private static final String DARK_ENERGY_CORE = "Dark energy core";

@Getter(AccessLevel.PACKAGE)
private NPC corp;

Expand Down Expand Up @@ -243,4 +249,24 @@ public void onVarbitChanged(VarbitChanged varbitChanged)
}
}
}

@Subscribe
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
{
final MenuEntry menuEntry = menuEntryAdded.getMenuEntry();
final NPC npc = menuEntry.getNpc();
if (npc == null || !DARK_ENERGY_CORE.equals(npc.getName()))
{
return;
}

if (menuEntry.getType() != MenuAction.NPC_SECOND_OPTION
|| !menuEntry.getOption().equals(ATTACK)
|| !config.leftClickCore())
{
return;
}

menuEntry.setDeprioritized(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,15 @@ default boolean hideProjectiles()
{
return false;
}

@ConfigItem(
position = 14,
keyName = "hideDeadNpcs",
name = "Hide Dead NPCs",
description = "Hides NPCs when their health reaches 0"
)
default boolean hideDeadNpcs()
{
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public class EntityHiderPlugin extends Plugin
private boolean hideLocalPlayer2D;
private boolean hideNPCs;
private boolean hideNPCs2D;
private boolean hideDeadNpcs;
private boolean hidePets;
private boolean hideAttackers;
private boolean hideProjectiles;
Expand Down Expand Up @@ -118,6 +119,7 @@ private void updateConfig()

hideNPCs = config.hideNPCs();
hideNPCs2D = config.hideNPCs2D();
hideDeadNpcs = config.hideDeadNpcs();

hidePets = config.hidePets();

Expand Down Expand Up @@ -187,6 +189,12 @@ else if (renderable instanceof NPC)
return !hidePets;
}

// dead npcs can also be interacting so prioritize it over the interacting check
if (npc.isDead() && hideDeadNpcs)
{
return false;
}

if (npc.getInteracting() == client.getLocalPlayer())
{
boolean b = hideAttackers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private JPanel buildActionsPanel()
SwingUtil.removeButtonDecorations(collapseBtn);
collapseBtn.setIcon(EXPAND_ICON);
collapseBtn.setSelectedIcon(COLLAPSE_ICON);
SwingUtil.addModalTooltip(collapseBtn, "Collapse All", "Un-Collapse All");
SwingUtil.addModalTooltip(collapseBtn, "Expand All", "Collapse All");
collapseBtn.setBackground(ColorScheme.DARKER_GRAY_COLOR);
collapseBtn.setUI(new BasicButtonUI()); // substance breaks the layout
collapseBtn.addActionListener(ev -> changeCollapse());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -878,4 +878,15 @@ default boolean swapTemporossLeave()
{
return false;
}

@ConfigItem(
keyName = "removeDeadNpcMenus",
name = "Remove dead npc menus",
description = "Remove menu options such as Attack and Talk-to from dead npcs",
section = npcSection
)
default boolean removeDeadNpcMenus()
{
return false;
}
}
Loading

0 comments on commit fb60b7e

Please sign in to comment.