This commit is contained in:
zjustin
2022-01-10 06:51:37 +11:00
9 changed files with 68 additions and 25 deletions

View File

@@ -1682,6 +1682,13 @@ public interface Client extends GameEngine
*/
void setFriendsChatMembersHidden(boolean state);
/**
* Sets whether or not clan members are hidden.
*
* @param state the new clan chat member hidden state
*/
void setClanChatMembersHidden(boolean state);
/**
* Sets whether or not ignored players are hidden.
*

View File

@@ -332,11 +332,23 @@ public interface RuneLiteConfig extends Config
return FontType.REGULAR;
}
@ConfigItem(
keyName = "infoboxFontType",
name = "Infobox Font",
description = "Configures what font type is used for infoboxes.",
position = 33,
section = overlaySettings
)
default FontType infoboxFontType()
{
return FontType.REGULAR;
}
@ConfigItem(
keyName = "menuEntryShift",
name = "Require Shift for overlay menu",
description = "Overlay right-click menu will require shift to be added",
position = 33,
position = 34,
section = overlaySettings
)
default boolean menuEntryShift()

View File

@@ -69,7 +69,7 @@ public interface EntityHiderConfig extends Config
@ConfigItem(
position = 4,
keyName = "hideClanMates",
keyName = "hideClanMates", // is actually friends chat
name = "Hide Friends Chat members",
description = "Configures whether or not friends chat members are hidden"
)
@@ -80,6 +80,17 @@ public interface EntityHiderConfig extends Config
@ConfigItem(
position = 5,
keyName = "hideClanChatMembers",
name = "Hide Clan Chat members",
description = "Configures whether or not clan chat members are hidden"
)
default boolean hideClanChatMembers()
{
return false;
}
@ConfigItem(
position = 6,
keyName = "hideIgnores",
name = "Hide Ignores",
description = "Configures whether or not ignored players are hidden"
@@ -90,7 +101,7 @@ public interface EntityHiderConfig extends Config
}
@ConfigItem(
position = 6,
position = 7,
keyName = "hideLocalPlayer",
name = "Hide Local Player",
description = "Configures whether or not the local player is hidden"
@@ -101,7 +112,7 @@ public interface EntityHiderConfig extends Config
}
@ConfigItem(
position = 7,
position = 8,
keyName = "hideLocalPlayer2D",
name = "Hide Local Player 2D",
description = "Configures whether or not the local player's 2D elements are hidden"
@@ -112,7 +123,7 @@ public interface EntityHiderConfig extends Config
}
@ConfigItem(
position = 8,
position = 9,
keyName = "hideNPCs",
name = "Hide NPCs",
description = "Configures whether or not NPCs are hidden"
@@ -123,7 +134,7 @@ public interface EntityHiderConfig extends Config
}
@ConfigItem(
position = 9,
position = 10,
keyName = "hideNPCs2D",
name = "Hide NPCs 2D",
description = "Configures whether or not NPCs 2D elements are hidden"
@@ -134,7 +145,7 @@ public interface EntityHiderConfig extends Config
}
@ConfigItem(
position = 10,
position = 11,
keyName = "hidePets",
name = "Hide Pets",
description = "Configures whether or not other player pets are hidden"
@@ -145,7 +156,7 @@ public interface EntityHiderConfig extends Config
}
@ConfigItem(
position = 11,
position = 12,
keyName = "hideAttackers",
name = "Hide Attackers",
description = "Configures whether or not NPCs/players attacking you are hidden"
@@ -156,7 +167,7 @@ public interface EntityHiderConfig extends Config
}
@ConfigItem(
position = 12,
position = 13,
keyName = "hideProjectiles",
name = "Hide Projectiles",
description = "Configures whether or not projectiles are hidden"

View File

@@ -78,6 +78,7 @@ public class EntityHiderPlugin extends Plugin
client.setFriendsHidden(config.hideFriends());
client.setFriendsChatMembersHidden(config.hideFriendsChatMembers());
client.setClanChatMembersHidden(config.hideClanChatMembers());
client.setIgnoresHidden(config.hideIgnores());
client.setLocalPlayerHidden(config.hideLocalPlayer());
@@ -103,6 +104,7 @@ public class EntityHiderPlugin extends Plugin
client.setFriendsHidden(false);
client.setFriendsChatMembersHidden(false);
client.setClanChatMembersHidden(false);
client.setIgnoresHidden(false);
client.setLocalPlayerHidden(false);

View File

@@ -28,7 +28,6 @@ import java.awt.Color;
import java.awt.image.BufferedImage;
import lombok.Getter;
import lombok.ToString;
import net.runelite.api.EquipmentInventorySlot;
import net.runelite.client.ui.overlay.infobox.Counter;
@Getter
@@ -37,21 +36,18 @@ class ItemChargeInfobox extends Counter
{
private final ItemChargePlugin plugin;
private final int item;
private final EquipmentInventorySlot slot;
ItemChargeInfobox(
ItemChargePlugin plugin,
BufferedImage image,
String name,
int charges,
int item,
EquipmentInventorySlot slot)
int item)
{
super(image, plugin, charges);
setTooltip(name);
this.plugin = plugin;
this.item = item;
this.slot = slot;
}
@Override

View File

@@ -627,7 +627,7 @@ public class ItemChargePlugin extends Plugin
final String name = itemManager.getItemComposition(id).getName();
final BufferedImage image = itemManager.getImage(id);
infobox = new ItemChargeInfobox(this, image, name, charges, id, slot);
infobox = new ItemChargeInfobox(this, image, name, charges, id);
infoBoxManager.addInfoBox(infobox);
infoboxes.put(slot, infobox);
}

View File

@@ -40,12 +40,13 @@ import static net.runelite.api.ItemID.*;
import net.runelite.api.Skill;
import net.runelite.api.Varbits;
import net.runelite.api.coords.WorldPoint;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.BeforeRender;
import net.runelite.api.events.GameTick;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@@ -138,6 +139,7 @@ public class RunEnergyPlugin extends Plugin
private boolean localPlayerRunningToDestination;
private WorldPoint prevLocalPlayerLocation;
private String runTimeRemaining;
@Provides
RunEnergyConfig getConfig(ConfigManager configManager)
@@ -170,9 +172,15 @@ public class RunEnergyPlugin extends Plugin
prevLocalPlayerLocation = client.getLocalPlayer().getWorldLocation();
if (energyConfig.replaceOrbText())
runTimeRemaining = energyConfig.replaceOrbText() ? getEstimatedRunTimeRemaining(true) : null;
}
@Subscribe
public void onBeforeRender(BeforeRender beforeRender)
{
if (runTimeRemaining != null)
{
setRunOrbText(getEstimatedRunTimeRemaining(true));
setRunOrbText(runTimeRemaining);
}
}
@@ -218,14 +226,13 @@ public class RunEnergyPlugin extends Plugin
// Return the text
if (inSeconds)
{
return Integer.toString((int) Math.floor(secondsLeft)) + "s";
return (int) Math.floor(secondsLeft) + "s";
}
else
{
final int minutes = (int) Math.floor(secondsLeft / 60.0);
final int seconds = (int) Math.floor(secondsLeft - (minutes * 60.0));
return Integer.toString(minutes) + ":" + StringUtils.leftPad(Integer.toString(seconds), 2, "0");
return minutes + ":" + StringUtils.leftPad(Integer.toString(seconds), 2, "0");
}
}

View File

@@ -27,6 +27,7 @@ package net.runelite.client.ui.overlay.components;
import com.google.common.base.Strings;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Point;
@@ -53,6 +54,7 @@ public class InfoBoxComponent implements LayoutableRenderableEntity
private Dimension preferredSize = new Dimension(DEFAULT_SIZE, DEFAULT_SIZE);
private String text;
private Color color = Color.WHITE;
private Font font;
private boolean outline;
private Color backgroundColor = ComponentConstants.STANDARD_BACKGROUND_COLOR;
private BufferedImage image;
@@ -67,7 +69,7 @@ public class InfoBoxComponent implements LayoutableRenderableEntity
return new Dimension();
}
graphics.setFont(getSize() < DEFAULT_SIZE ? FontManager.getRunescapeSmallFont() : FontManager.getRunescapeFont());
graphics.setFont(getSize() < DEFAULT_SIZE ? FontManager.getRunescapeSmallFont() : font);
final int baseX = preferredLocation.x;
final int baseY = preferredLocation.y;

View File

@@ -28,6 +28,7 @@ package net.runelite.client.ui.overlay.infobox;
import com.google.common.base.Strings;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
@@ -122,6 +123,10 @@ public class InfoBoxOverlay extends OverlayPanel
panelComponent.setPreferredSize(new Dimension(DEFAULT_WRAP_COUNT * (config.infoBoxSize() + GAP), DEFAULT_WRAP_COUNT * (config.infoBoxSize() + GAP)));
panelComponent.setOrientation(orientation);
final Font font = config.infoboxFontType().getFont();
final boolean infoBoxTextOutline = config.infoBoxTextOutline();
final Color overlayBackgroundColor = config.overlayBackgroundColor();
final Dimension preferredSize = new Dimension(config.infoBoxSize(), config.infoBoxSize());
for (InfoBox box : infoBoxes)
{
if (!box.render())
@@ -134,15 +139,16 @@ public class InfoBoxOverlay extends OverlayPanel
final InfoBoxComponent infoBoxComponent = new InfoBoxComponent();
infoBoxComponent.setText(text);
infoBoxComponent.setFont(font);
if (color != null)
{
infoBoxComponent.setColor(color);
}
infoBoxComponent.setOutline(config.infoBoxTextOutline());
infoBoxComponent.setOutline(infoBoxTextOutline);
infoBoxComponent.setImage(box.getScaledImage());
infoBoxComponent.setTooltip(box.getTooltip());
infoBoxComponent.setPreferredSize(new Dimension(config.infoBoxSize(), config.infoBoxSize()));
infoBoxComponent.setBackgroundColor(config.overlayBackgroundColor());
infoBoxComponent.setPreferredSize(preferredSize);
infoBoxComponent.setBackgroundColor(overlayBackgroundColor);
infoBoxComponent.setInfoBox(box);
panelComponent.getChildren().add(infoBoxComponent);
}