Skip to content

Commit

Permalink
Merge remote-tracking branch 'runelite/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Owain94 committed Jun 23, 2022
2 parents 795a8ef + 003a92f commit badddd9
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 12 deletions.
3 changes: 3 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/ScriptID.java
Original file line number Diff line number Diff line change
Expand Up @@ -433,4 +433,7 @@ public final class ScriptID
*/
@ScriptArguments(string = 1)
public static final int TOB_HUD_SOTETSEG_FADE = 2308;

@ScriptArguments(integer = 3)
public static final int RAIDS_STORAGE_PRIVATE_ITEMS = 1607;
}
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,11 @@ static class Raids
static final int POINTS_INFOBOX = 3;
}

static class ChambersOfXericStorageUnitPrivate
{
static final int PRIVATE_CHEST_ITEM_CONTAINER = 6;
}

static class Tob
{
static final int PARTY_INTERFACE = 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,8 @@ public enum WidgetInfo

RAIDS_POINTS_INFOBOX(WidgetID.RAIDS_GROUP_ID, WidgetID.Raids.POINTS_INFOBOX),

RAIDS_PRIVATE_STORAGE_ITEM_CONTAINER(WidgetID.CHAMBERS_OF_XERIC_STORAGE_UNIT_PRIVATE_GROUP_ID, WidgetID.ChambersOfXericStorageUnitPrivate.PRIVATE_CHEST_ITEM_CONTAINER),

TOB_PARTY_INTERFACE(WidgetID.TOB_GROUP_ID, WidgetID.Tob.PARTY_INTERFACE),
TOB_PARTY_STATS(WidgetID.TOB_GROUP_ID, WidgetID.Tob.PARTY_STATS),
TOB_HEALTH_BAR(WidgetID.TOB_GROUP_ID, WidgetID.Tob.HEALTHBAR_CONTAINER),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ private void onScriptPostFired(ScriptPostFired ev)
}
}
}
else if (ev.getScriptId() == ScriptID.RAIDS_STORAGE_PRIVATE_ITEMS)
{
setCoxDragDelay(config.dragDelay());
}
}

private static void applyDragDelay(Widget widget, int delay)
Expand All @@ -238,10 +242,12 @@ private void setBankDragDelay(int delay)
final Widget bankItemContainer = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER);
final Widget bankInventoryItemsContainer = client.getWidget(WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER);
final Widget bankDepositContainer = client.getWidget(WidgetInfo.DEPOSIT_BOX_INVENTORY_ITEMS_CONTAINER);
final Widget coxPrivateChest = client.getWidget(WidgetInfo.RAIDS_PRIVATE_STORAGE_ITEM_CONTAINER);

applyDragDelay(bankItemContainer, delay);
applyDragDelay(bankInventoryItemsContainer, delay);
applyDragDelay(bankDepositContainer, delay);
applyDragDelay(coxPrivateChest, delay);
}

private void setInvDragDelay(int delay)
Expand All @@ -250,13 +256,20 @@ private void setInvDragDelay(int delay)
applyDragDelay(inventory, delay);
}

private void setCoxDragDelay(int delay)
{
final Widget coxChest = client.getWidget(WidgetInfo.RAIDS_PRIVATE_STORAGE_ITEM_CONTAINER);
applyDragDelay(coxChest, delay);
}

private void setDragDelay()
{
final int delay = config.dragDelay();
log.debug("Set delay to {}", delay);
client.setInventoryDragDelay(delay);
setInvDragDelay(delay);
setBankDragDelay(delay);
setCoxDragDelay(delay);
}

private void resetDragDelay()
Expand All @@ -265,6 +278,7 @@ private void resetDragDelay()
client.setInventoryDragDelay(DEFAULT_DELAY);
setInvDragDelay(DEFAULT_DELAY);
setBankDragDelay(DEFAULT_DELAY);
setCoxDragDelay(DEFAULT_DELAY);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

@AllArgsConstructor
@Getter
enum SpecialWeapon
public enum SpecialWeapon
{
DRAGON_WARHAMMER("Dragon Warhammer", new int[]{ItemID.DRAGON_WARHAMMER}, false, SpecialCounterConfig::dragonWarhammerThreshold),
ARCLIGHT("Arclight", new int[]{ItemID.ARCLIGHT}, false, SpecialCounterConfig::arclightThreshold),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
Expand All @@ -52,6 +51,8 @@ public class TooltipOverlay extends Overlay
private final Client client;
private final RuneLiteConfig runeLiteConfig;

private int prevWidth, prevHeight;

@Inject
private TooltipOverlay(Client client, TooltipManager tooltipManager, final RuneLiteConfig runeLiteConfig)
{
Expand Down Expand Up @@ -91,15 +92,13 @@ private Dimension renderTooltips(Graphics2D graphics, List<Tooltip> tooltips)
final int canvasWidth = client.getCanvasWidth();
final int canvasHeight = client.getCanvasHeight();
final net.runelite.api.Point mouseCanvasPosition = client.getMouseCanvasPosition();
final Rectangle prevBounds = getBounds();

final int tooltipX = Math.min(canvasWidth - prevBounds.width, mouseCanvasPosition.getX());
final int tooltipX = Math.min(canvasWidth - prevWidth, mouseCanvasPosition.getX());
final int tooltipY = runeLiteConfig.tooltipPosition() == TooltipPositionType.ABOVE_CURSOR
? Math.max(0, mouseCanvasPosition.getY() - prevBounds.height)
: Math.min(canvasHeight - prevBounds.height, mouseCanvasPosition.getY() + UNDER_OFFSET);

final Rectangle newBounds = new Rectangle(tooltipX, tooltipY, 0, 0);
? Math.max(0, mouseCanvasPosition.getY() - prevHeight)
: Math.min(canvasHeight - prevHeight, mouseCanvasPosition.getY() + UNDER_OFFSET);

int width = 0, height = 0;
for (Tooltip tooltip : tooltips)
{
final LayoutableRenderableEntity entity;
Expand All @@ -121,14 +120,16 @@ private Dimension renderTooltips(Graphics2D graphics, List<Tooltip> tooltips)
entity = tooltipComponent;
}

entity.setPreferredLocation(new Point(tooltipX, tooltipY + newBounds.height));
entity.setPreferredLocation(new Point(tooltipX, tooltipY + height));
final Dimension dimension = entity.render(graphics);

// Create incremental tooltip newBounds
newBounds.height += dimension.height + PADDING;
newBounds.width = Math.max(newBounds.width, dimension.width);
height += dimension.height + PADDING;
width = Math.max(width, dimension.width);
}

return newBounds.getSize();
prevWidth = width;
prevHeight = height;
return null;
}
}

0 comments on commit badddd9

Please sign in to comment.