runelite-client: upstream to 85a953e76b
This commit is contained in:
@@ -27,6 +27,7 @@ package net.runelite.client.config;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
|
||||
import java.awt.Font;
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -367,6 +367,7 @@ public interface RuneLiteConfig extends Config
|
||||
return false;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "overlayBackgroundColor",
|
||||
name = "Overlay Color",
|
||||
@@ -374,7 +375,6 @@ public interface RuneLiteConfig extends Config
|
||||
position = 44,
|
||||
section = overlaySettings
|
||||
)
|
||||
@Alpha
|
||||
default Color overlayBackgroundColor()
|
||||
{
|
||||
return ComponentConstants.STANDARD_BACKGROUND_COLOR;
|
||||
|
||||
@@ -76,7 +76,7 @@ import okhttp3.Response;
|
||||
public class ExternalPluginManager
|
||||
{
|
||||
private static final String PLUGIN_LIST_KEY = "externalPlugins";
|
||||
public static Class<? extends Plugin>[] builtinExternals = null;
|
||||
private static Class<? extends Plugin>[] builtinExternals = null;
|
||||
|
||||
@Inject
|
||||
@Named("safeMode")
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.runelite.client.plugins.agility;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Alpha;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -97,6 +98,7 @@ public interface AgilityConfig extends Config
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "overlayColor",
|
||||
name = "Overlay Color",
|
||||
@@ -119,6 +121,7 @@ public interface AgilityConfig extends Config
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "markHighlight",
|
||||
name = "Mark Highlight Color",
|
||||
@@ -141,6 +144,7 @@ public interface AgilityConfig extends Config
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "portalsHighlight",
|
||||
name = "Portals Highlight Color",
|
||||
@@ -174,6 +178,7 @@ public interface AgilityConfig extends Config
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "trapHighlight",
|
||||
name = "Trap Overlay Color",
|
||||
@@ -218,6 +223,7 @@ public interface AgilityConfig extends Config
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "stickHighlightColor",
|
||||
name = "Stick Highlight Color",
|
||||
@@ -241,6 +247,7 @@ public interface AgilityConfig extends Config
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "sepulchreHighlightColor",
|
||||
name = "Projectile Color",
|
||||
|
||||
@@ -45,6 +45,7 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
class AgilityOverlay extends Overlay
|
||||
{
|
||||
@@ -131,11 +132,10 @@ class AgilityOverlay extends Overlay
|
||||
}
|
||||
|
||||
graphics.draw(objectClickbox);
|
||||
graphics.setColor(new Color(configColor.getRed(), configColor.getGreen(), configColor.getBlue(), 50));
|
||||
graphics.setColor(ColorUtil.colorWithAlpha(configColor, configColor.getAlpha() / 5));
|
||||
graphics.fill(objectClickbox);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (config.highlightMarks() && !marksOfGrace.isEmpty())
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.blastmine;
|
||||
|
||||
import net.runelite.client.config.Alpha;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -77,6 +78,7 @@ public interface BlastMinePluginConfig extends Config
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "hexTimerColor",
|
||||
@@ -88,6 +90,7 @@ public interface BlastMinePluginConfig extends Config
|
||||
return new Color(217, 54, 0);
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "hexWarningColor",
|
||||
|
||||
@@ -47,6 +47,7 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.components.ProgressPieComponent;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
public class BlastMineRockOverlay extends Overlay
|
||||
{
|
||||
@@ -199,7 +200,7 @@ public class BlastMineRockOverlay extends Overlay
|
||||
|
||||
if (poly != null)
|
||||
{
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 100));
|
||||
graphics.setColor(ColorUtil.colorWithAlpha(color, (int) (color.getAlpha() / 2.5)));
|
||||
graphics.fillPolygon(poly);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,11 +132,6 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
|
||||
{
|
||||
addZoomTooltip(sideSlider);
|
||||
}
|
||||
|
||||
Widget settingsInit = client.getWidget(WidgetInfo.SETTINGS_INIT);
|
||||
if (settingsInit != null)
|
||||
{
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -157,11 +152,6 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
|
||||
{
|
||||
sideSlider.setOnMouseRepeatListener((Object[]) null);
|
||||
}
|
||||
|
||||
Widget settingsInit = client.getWidget(WidgetInfo.SETTINGS_INIT);
|
||||
if (settingsInit != null)
|
||||
{
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -89,6 +89,7 @@ import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.ui.DynamicGridLayout;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.PluginPanel;
|
||||
import net.runelite.client.ui.components.ColorJButton;
|
||||
import net.runelite.client.ui.components.ComboBoxListRenderer;
|
||||
import net.runelite.client.ui.components.colorpicker.ColorPickerManager;
|
||||
import net.runelite.client.ui.components.colorpicker.RuneliteColorPicker;
|
||||
@@ -407,24 +408,23 @@ class ConfigPanel extends PluginPanel
|
||||
|
||||
if (cid.getType() == Color.class)
|
||||
{
|
||||
String existing = configManager.getConfiguration(cd.getGroup().value(), cid.getItem().keyName());
|
||||
Color existing = configManager.getConfiguration(cd.getGroup().value(), cid.getItem().keyName(), Color.class);
|
||||
|
||||
Color existingColor;
|
||||
JButton colorPickerBtn;
|
||||
ColorJButton colorPickerBtn;
|
||||
|
||||
boolean alphaHidden = cid.getAlpha() == null;
|
||||
|
||||
if (existing == null)
|
||||
{
|
||||
existingColor = Color.BLACK;
|
||||
colorPickerBtn = new JButton("Pick a color");
|
||||
colorPickerBtn = new ColorJButton("Pick a color", Color.BLACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
existingColor = ColorUtil.fromString(existing);
|
||||
colorPickerBtn = new JButton(ColorUtil.toHexColor(existingColor).toUpperCase());
|
||||
String colorHex = "#" + (alphaHidden ? ColorUtil.colorToHexCode(existing) : ColorUtil.colorToAlphaHexCode(existing)).toUpperCase();
|
||||
colorPickerBtn = new ColorJButton(colorHex, existing);
|
||||
}
|
||||
|
||||
colorPickerBtn.setFocusable(false);
|
||||
colorPickerBtn.setBackground(existingColor);
|
||||
colorPickerBtn.addMouseListener(new MouseAdapter()
|
||||
{
|
||||
@Override
|
||||
@@ -432,14 +432,14 @@ class ConfigPanel extends PluginPanel
|
||||
{
|
||||
RuneliteColorPicker colorPicker = colorPickerManager.create(
|
||||
SwingUtilities.windowForComponent(ConfigPanel.this),
|
||||
colorPickerBtn.getBackground(),
|
||||
colorPickerBtn.getColor(),
|
||||
cid.getItem().name(),
|
||||
cid.getAlpha() == null);
|
||||
alphaHidden);
|
||||
colorPicker.setLocation(getLocationOnScreen());
|
||||
colorPicker.setOnColorChange(c ->
|
||||
{
|
||||
colorPickerBtn.setBackground(c);
|
||||
colorPickerBtn.setText(ColorUtil.toHexColor(c).toUpperCase());
|
||||
colorPickerBtn.setColor(c);
|
||||
colorPickerBtn.setText("#" + (alphaHidden ? ColorUtil.colorToHexCode(c) : ColorUtil.colorToAlphaHexCode(c)).toUpperCase());
|
||||
});
|
||||
colorPicker.setOnClose(c -> changeConfiguration(colorPicker, cd, cid));
|
||||
colorPicker.setVisible(true);
|
||||
|
||||
@@ -90,7 +90,6 @@ public class CrowdsourcingZMI
|
||||
case GROUND_ITEM_THIRD_OPTION:
|
||||
case GROUND_ITEM_FOURTH_OPTION:
|
||||
case GROUND_ITEM_FIFTH_OPTION:
|
||||
case ITEM_DROP:
|
||||
illegalActionTick = client.getTickCount();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.runelite.client.plugins.driftnet;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Alpha;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -84,6 +85,7 @@ public interface DriftNetConfig extends Config
|
||||
return 60;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "untaggedFishColor",
|
||||
name = "Untagged fish color",
|
||||
@@ -106,6 +108,7 @@ public interface DriftNetConfig extends Config
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "annetteTagColor",
|
||||
name = "Annette tag color",
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.runelite.client.plugins.fishing;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Alpha;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -77,6 +78,7 @@ public interface FishingConfig extends Config
|
||||
return false;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "overlayColor",
|
||||
name = "Overlay Color",
|
||||
@@ -88,6 +90,7 @@ public interface FishingConfig extends Config
|
||||
return Color.CYAN;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "minnowsOverlayColor",
|
||||
name = "Minnows Overlay Color",
|
||||
@@ -99,6 +102,7 @@ public interface FishingConfig extends Config
|
||||
return Color.RED;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "aerialOverlayColor",
|
||||
name = "Aerial Overlay Color",
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.runelite.client.plugins.grounditems;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Alpha;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -219,6 +220,7 @@ public interface GroundItemsConfig extends Config
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "defaultColor",
|
||||
name = "Default items color",
|
||||
@@ -230,6 +232,7 @@ public interface GroundItemsConfig extends Config
|
||||
return Color.WHITE;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "highlightedColor",
|
||||
name = "Highlighted items color",
|
||||
@@ -241,6 +244,7 @@ public interface GroundItemsConfig extends Config
|
||||
return Color.decode("#AA00FF");
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "hiddenColor",
|
||||
name = "Hidden items color",
|
||||
@@ -252,6 +256,7 @@ public interface GroundItemsConfig extends Config
|
||||
return Color.GRAY;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "lowValueColor",
|
||||
name = "Low value items color",
|
||||
@@ -274,6 +279,7 @@ public interface GroundItemsConfig extends Config
|
||||
return 20000;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "mediumValueColor",
|
||||
name = "Medium value items color",
|
||||
@@ -296,6 +302,7 @@ public interface GroundItemsConfig extends Config
|
||||
return 100000;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "highValueColor",
|
||||
name = "High value items color",
|
||||
@@ -318,6 +325,7 @@ public interface GroundItemsConfig extends Config
|
||||
return 1000000;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "insaneValueColor",
|
||||
name = "Insane value items color",
|
||||
|
||||
@@ -680,7 +680,7 @@ public class GroundItemsPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
|
||||
{
|
||||
if (menuOptionClicked.getMenuAction() == MenuAction.ITEM_DROP)
|
||||
if (menuOptionClicked.getMenuAction() == MenuAction.ITEM_FIFTH_OPTION)
|
||||
{
|
||||
int itemId = menuOptionClicked.getId();
|
||||
// Keep a queue of recently dropped items to better detect
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.runelite.client.plugins.herbiboars;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Alpha;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -54,6 +55,7 @@ public interface HerbiboarConfig extends Config
|
||||
return false;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "colorStart",
|
||||
@@ -76,6 +78,7 @@ public interface HerbiboarConfig extends Config
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "colorTunnel",
|
||||
@@ -98,6 +101,7 @@ public interface HerbiboarConfig extends Config
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 6,
|
||||
keyName = "colorGameObject",
|
||||
@@ -120,6 +124,7 @@ public interface HerbiboarConfig extends Config
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 8,
|
||||
keyName = "colorTrail",
|
||||
|
||||
@@ -37,6 +37,7 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
class HerbiboarOverlay extends Overlay
|
||||
{
|
||||
@@ -126,7 +127,7 @@ class HerbiboarOverlay extends Overlay
|
||||
Shape clickbox = object.getClickbox();
|
||||
if (clickbox != null)
|
||||
{
|
||||
Color clickBoxColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), 20);
|
||||
Color clickBoxColor = ColorUtil.colorWithAlpha(color, color.getAlpha() / 12);
|
||||
|
||||
graphics.setColor(color);
|
||||
graphics.draw(clickbox);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.runelite.client.plugins.hunter;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Alpha;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -32,6 +33,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
@ConfigGroup("hunterplugin")
|
||||
public interface HunterConfig extends Config
|
||||
{
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "hexColorOpenTrap",
|
||||
@@ -43,6 +45,7 @@ public interface HunterConfig extends Config
|
||||
return Color.YELLOW;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "hexColorFullTrap",
|
||||
@@ -54,6 +57,7 @@ public interface HunterConfig extends Config
|
||||
return Color.GREEN;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "hexColorEmptyTrap",
|
||||
@@ -65,6 +69,7 @@ public interface HunterConfig extends Config
|
||||
return Color.RED;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "hexColorTransTrap",
|
||||
|
||||
@@ -37,6 +37,7 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.components.ProgressPieComponent;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
/**
|
||||
* Represents the overlay that shows timers on traps that are placed by the
|
||||
@@ -81,13 +82,13 @@ public class TrapOverlay extends Overlay
|
||||
public void updateConfig()
|
||||
{
|
||||
colorEmptyBorder = config.getEmptyTrapColor();
|
||||
colorEmpty = new Color(colorEmptyBorder.getRed(), colorEmptyBorder.getGreen(), colorEmptyBorder.getBlue(), 100);
|
||||
colorEmpty = ColorUtil.colorWithAlpha(colorEmptyBorder, (int)(colorEmptyBorder.getAlpha() / 2.5));
|
||||
colorFullBorder = config.getFullTrapColor();
|
||||
colorFull = new Color(colorFullBorder.getRed(), colorFullBorder.getGreen(), colorFullBorder.getBlue(), 100);
|
||||
colorFull = ColorUtil.colorWithAlpha(colorFullBorder, (int)(colorFullBorder.getAlpha() / 2.5));
|
||||
colorOpenBorder = config.getOpenTrapColor();
|
||||
colorOpen = new Color(colorOpenBorder.getRed(), colorOpenBorder.getGreen(), colorOpenBorder.getBlue(), 100);
|
||||
colorOpen = ColorUtil.colorWithAlpha(colorOpenBorder, (int)(colorOpenBorder.getAlpha() / 2.5));
|
||||
colorTransBorder = config.getTransTrapColor();
|
||||
colorTrans = new Color(colorTransBorder.getRed(), colorTransBorder.getGreen(), colorTransBorder.getBlue(), 100);
|
||||
colorTrans = ColorUtil.colorWithAlpha(colorTransBorder, (int)(colorTransBorder.getAlpha() / 2.5));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.runelite.client.plugins.implings;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Alpha;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -63,6 +64,7 @@ public interface ImplingsConfig extends Config
|
||||
return ImplingMode.NONE;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "babyColor",
|
||||
@@ -87,6 +89,7 @@ public interface ImplingsConfig extends Config
|
||||
return ImplingMode.NONE;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "youngColor",
|
||||
@@ -111,6 +114,7 @@ public interface ImplingsConfig extends Config
|
||||
return ImplingMode.NONE;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 6,
|
||||
keyName = "gourmetColor",
|
||||
@@ -135,6 +139,7 @@ public interface ImplingsConfig extends Config
|
||||
return ImplingMode.NONE;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 8,
|
||||
keyName = "earthColor",
|
||||
@@ -159,6 +164,7 @@ public interface ImplingsConfig extends Config
|
||||
return ImplingMode.NONE;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 10,
|
||||
keyName = "essenceColor",
|
||||
@@ -183,6 +189,7 @@ public interface ImplingsConfig extends Config
|
||||
return ImplingMode.NONE;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 12,
|
||||
keyName = "eclecticColor",
|
||||
@@ -207,6 +214,7 @@ public interface ImplingsConfig extends Config
|
||||
return ImplingMode.NONE;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 14,
|
||||
keyName = "natureColor",
|
||||
@@ -231,6 +239,7 @@ public interface ImplingsConfig extends Config
|
||||
return ImplingMode.NONE;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 16,
|
||||
keyName = "magpieColor",
|
||||
@@ -255,6 +264,7 @@ public interface ImplingsConfig extends Config
|
||||
return ImplingMode.NONE;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 18,
|
||||
keyName = "ninjaColor",
|
||||
@@ -279,6 +289,7 @@ public interface ImplingsConfig extends Config
|
||||
return ImplingMode.NONE;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 20,
|
||||
keyName = "crystalColor",
|
||||
@@ -303,6 +314,7 @@ public interface ImplingsConfig extends Config
|
||||
return ImplingMode.HIGHLIGHT;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 22,
|
||||
keyName = "dragonColor",
|
||||
@@ -327,6 +339,7 @@ public interface ImplingsConfig extends Config
|
||||
return ImplingMode.HIGHLIGHT;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 24,
|
||||
keyName = "luckyColor",
|
||||
@@ -350,6 +363,7 @@ public interface ImplingsConfig extends Config
|
||||
return false;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 26,
|
||||
keyName = "spawnColor",
|
||||
|
||||
@@ -64,6 +64,12 @@ enum ItemIdentification
|
||||
DWARF_WEED(Type.HERB, "Dwarf", "D", ItemID.DWARF_WEED, ItemID.GRIMY_DWARF_WEED),
|
||||
TORSTOL(Type.HERB, "Torstol", "TOR", ItemID.TORSTOL, ItemID.GRIMY_TORSTOL),
|
||||
|
||||
ARDRIGAL(Type.HERB, "Ardrig", "ARD", ItemID.ARDRIGAL, ItemID.GRIMY_ARDRIGAL),
|
||||
ROGUES_PURSE(Type.HERB, "Rogue", "ROG", ItemID.ROGUES_PURSE, ItemID.GRIMY_ROGUES_PURSE),
|
||||
SITO_FOIL(Type.HERB, "Sito", "SF", ItemID.SITO_FOIL, ItemID.GRIMY_SITO_FOIL),
|
||||
SNAKE_WEED(Type.HERB, "Snake", "SW", ItemID.SNAKE_WEED, ItemID.GRIMY_SNAKE_WEED),
|
||||
VOLENCIA_MOSS(Type.HERB, "Volenc", "V", ItemID.VOLENCIA_MOSS, ItemID.GRIMY_VOLENCIA_MOSS),
|
||||
|
||||
//Saplings
|
||||
OAK_SAPLING(Type.SAPLING, "Oak", "OAK", ItemID.OAK_SAPLING, ItemID.OAK_SEEDLING, ItemID.OAK_SEEDLING_W),
|
||||
WILLOW_SAPLING(Type.SAPLING, "Willow", "WIL", ItemID.WILLOW_SAPLING, ItemID.WILLOW_SEEDLING, ItemID.WILLOW_SEEDLING_W),
|
||||
|
||||
@@ -144,7 +144,6 @@ public interface ItemStatConfig extends Config
|
||||
return new Color(0x9CEE33);
|
||||
}
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "colorBetterCapped",
|
||||
name = "Better (Capped)",
|
||||
@@ -155,6 +154,7 @@ public interface ItemStatConfig extends Config
|
||||
{
|
||||
return new Color(0xEEEE33);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "colorNoChange",
|
||||
name = "No change",
|
||||
|
||||
@@ -105,6 +105,16 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE,
|
||||
MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB);
|
||||
|
||||
private static final Set<MenuAction> ITEM_MENU_TYPES = ImmutableSet.of(
|
||||
MenuAction.ITEM_FIRST_OPTION,
|
||||
MenuAction.ITEM_SECOND_OPTION,
|
||||
MenuAction.ITEM_THIRD_OPTION,
|
||||
MenuAction.ITEM_FOURTH_OPTION,
|
||||
MenuAction.ITEM_FIFTH_OPTION,
|
||||
MenuAction.EXAMINE_ITEM,
|
||||
MenuAction.ITEM_USE
|
||||
);
|
||||
|
||||
private static final Set<MenuAction> NPC_MENU_TYPES = ImmutableSet.of(
|
||||
MenuAction.NPC_FIRST_OPTION,
|
||||
MenuAction.NPC_SECOND_OPTION,
|
||||
@@ -476,28 +486,28 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
ItemComposition itemComposition = client.getItemDefinition(itemId);
|
||||
String itemName = itemComposition.getName();
|
||||
String option = "Use";
|
||||
int shiftClickActionIndex = itemComposition.getShiftClickActionIndex();
|
||||
String[] inventoryActions = itemComposition.getInventoryActions();
|
||||
ItemComposition itemComposition = itemManager.getItemComposition(itemId);
|
||||
MenuAction shiftClickAction = MenuAction.ITEM_USE;
|
||||
final int shiftClickActionIndex = itemComposition.getShiftClickActionIndex();
|
||||
|
||||
if (shiftClickActionIndex >= 0 && shiftClickActionIndex < inventoryActions.length)
|
||||
if (shiftClickActionIndex >= 0)
|
||||
{
|
||||
option = inventoryActions[shiftClickActionIndex];
|
||||
shiftClickAction = MenuAction.of(MenuAction.ITEM_FIRST_OPTION.getId() + shiftClickActionIndex);
|
||||
}
|
||||
|
||||
MenuEntry[] entries = event.getMenuEntries();
|
||||
|
||||
for (MenuEntry entry : entries)
|
||||
{
|
||||
if (itemName.equals(Text.removeTags(entry.getTarget())))
|
||||
final MenuAction menuAction = MenuAction.of(entry.getType());
|
||||
|
||||
if (ITEM_MENU_TYPES.contains(menuAction) && entry.getIdentifier() == itemId)
|
||||
{
|
||||
entry.setType(MenuAction.RUNELITE.getId());
|
||||
|
||||
if (option.equals(entry.getOption()))
|
||||
if (shiftClickAction == menuAction)
|
||||
{
|
||||
entry.setOption("* " + option);
|
||||
entry.setOption("* " + entry.getOption());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -597,7 +607,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
|
||||
String option = event.getMenuOption();
|
||||
String target = event.getMenuTarget();
|
||||
ItemComposition itemComposition = client.getItemDefinition(itemId);
|
||||
ItemComposition itemComposition = itemManager.getItemComposition(itemId);
|
||||
|
||||
if (option.equals(RESET) && target.equals(MENU_TARGET))
|
||||
{
|
||||
|
||||
@@ -61,7 +61,6 @@ class MouseHighlightOverlay extends Overlay
|
||||
MenuAction.ITEM_FOURTH_OPTION,
|
||||
MenuAction.ITEM_FIFTH_OPTION,
|
||||
MenuAction.ITEM_USE,
|
||||
MenuAction.ITEM_DROP,
|
||||
MenuAction.WIDGET_FIRST_OPTION,
|
||||
MenuAction.WIDGET_SECOND_OPTION,
|
||||
MenuAction.WIDGET_THIRD_OPTION,
|
||||
|
||||
@@ -95,13 +95,13 @@ public interface NpcIndicatorsConfig extends Config
|
||||
)
|
||||
void setNpcToHighlight(String npcsToHighlight);
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "npcColor",
|
||||
name = "Highlight Color",
|
||||
description = "Color of the NPC highlight"
|
||||
)
|
||||
@Alpha
|
||||
default Color getHighlightColor()
|
||||
{
|
||||
return Color.CYAN;
|
||||
|
||||
@@ -48,6 +48,7 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
public class NpcSceneOverlay extends Overlay
|
||||
@@ -199,7 +200,7 @@ public class NpcSceneOverlay extends Overlay
|
||||
graphics.setColor(color);
|
||||
graphics.setStroke(new BasicStroke(2));
|
||||
graphics.draw(polygon);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
||||
graphics.setColor(ColorUtil.colorWithAlpha(color, color.getAlpha() / 12));
|
||||
graphics.fill(polygon);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,25 +83,25 @@ public interface NpcAggroAreaConfig extends Config
|
||||
return false;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "npcAggroAreaColor",
|
||||
name = "Aggressive colour",
|
||||
description = "Choose colour to use for marking NPC unaggressive area when NPCs are aggressive",
|
||||
position = 5
|
||||
)
|
||||
@Alpha
|
||||
default Color aggroAreaColor()
|
||||
{
|
||||
return new Color(0x64FFFF00, true);
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "npcUnaggroAreaColor",
|
||||
name = "Unaggressive colour",
|
||||
description = "Choose colour to use for marking NPC unaggressive area after NPCs have lost aggression",
|
||||
position = 6
|
||||
)
|
||||
@Alpha
|
||||
default Color unaggroAreaColor()
|
||||
{
|
||||
return new Color(0xFFFF00);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.pyramidplunder;
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Alpha;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -64,6 +65,7 @@ public interface PyramidPlunderConfig extends Config
|
||||
return 30;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "highlightDoorsColor",
|
||||
@@ -86,6 +88,7 @@ public interface PyramidPlunderConfig extends Config
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "highlightSpeartrapColor",
|
||||
@@ -108,6 +111,7 @@ public interface PyramidPlunderConfig extends Config
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 7,
|
||||
keyName = "highlightContainersColor",
|
||||
|
||||
@@ -50,6 +50,7 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
class PyramidPlunderOverlay extends Overlay
|
||||
{
|
||||
@@ -157,8 +158,7 @@ class PyramidPlunderOverlay extends Overlay
|
||||
}
|
||||
|
||||
graphics.draw(objectClickbox);
|
||||
graphics.setColor(new Color(highlightColor.getRed(), highlightColor.getGreen(),
|
||||
highlightColor.getBlue(), 50));
|
||||
graphics.setColor(ColorUtil.colorWithAlpha(highlightColor, highlightColor.getAlpha() / 5));
|
||||
graphics.fill(objectClickbox);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.runelite.client.plugins.slayer;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Alpha;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -90,6 +91,7 @@ public interface SlayerConfig extends Config
|
||||
return false;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 6,
|
||||
keyName = "targetColor",
|
||||
|
||||
@@ -37,6 +37,7 @@ import net.runelite.api.NPC;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
public class TargetClickboxOverlay extends Overlay
|
||||
{
|
||||
@@ -77,7 +78,7 @@ public class TargetClickboxOverlay extends Overlay
|
||||
graphics.setColor(color);
|
||||
graphics.setStroke(new BasicStroke(2));
|
||||
graphics.draw(objectClickbox);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
||||
graphics.setColor(ColorUtil.colorWithAlpha(color, color.getAlpha() / 12));
|
||||
graphics.fill(objectClickbox);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ class StatusBarsOverlay extends Overlay
|
||||
private static final Color SPECIAL_ATTACK_COLOR = new Color(3, 153, 0, 195);
|
||||
private static final Color ENERGY_COLOR = new Color(199, 174, 0, 220);
|
||||
private static final Color DISEASE_COLOR = new Color(255, 193, 75, 181);
|
||||
private static final Color PARASITE_COLOR = new Color(196, 62, 109, 181);
|
||||
private static final int HEIGHT = 252;
|
||||
private static final int RESIZED_BOTTOM_HEIGHT = 272;
|
||||
private static final int IMAGE_SIZE = 17;
|
||||
@@ -132,6 +133,11 @@ class StatusBarsOverlay extends Overlay
|
||||
return DISEASE_COLOR;
|
||||
}
|
||||
|
||||
if (client.getVar(Varbits.PARASITE) >= 1)
|
||||
{
|
||||
return PARASITE_COLOR;
|
||||
}
|
||||
|
||||
return HEALTH_COLOR;
|
||||
},
|
||||
() -> HEAL_COLOR,
|
||||
|
||||
@@ -59,7 +59,6 @@ import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.GraphicChanged;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.api.events.NpcChanged;
|
||||
import net.runelite.api.events.NpcDespawned;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
@@ -84,6 +83,7 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||
@Slf4j
|
||||
public class TimersPlugin extends Plugin
|
||||
{
|
||||
private static final String ABYSSAL_SIRE_STUN_MESSAGE = "The Sire has been disorientated temporarily.";
|
||||
private static final String ANTIFIRE_DRINK_MESSAGE = "You drink some of your antifire potion.";
|
||||
private static final String ANTIFIRE_EXPIRED_MESSAGE = "<col=7f007f>Your antifire potion has expired.</col>";
|
||||
private static final String CANNON_FURNACE_MESSAGE = "You add the furnace.";
|
||||
@@ -450,6 +450,11 @@ public class TimersPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.equals(ABYSSAL_SIRE_STUN_MESSAGE) && config.showAbyssalSireStun())
|
||||
{
|
||||
createGameTimer(ABYSSAL_SIRE_STUN);
|
||||
}
|
||||
|
||||
if (message.equals(ENDURANCE_EFFECT_MESSAGE))
|
||||
{
|
||||
wasWearingEndurance = true;
|
||||
@@ -805,28 +810,6 @@ public class TimersPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onNpcChanged(NpcChanged npcChanged)
|
||||
{
|
||||
int id = npcChanged.getNpc().getId();
|
||||
int oldId = npcChanged.getOld().getId();
|
||||
|
||||
if (id == NpcID.ABYSSAL_SIRE_5888)
|
||||
{
|
||||
// stunned npc type
|
||||
log.debug("Sire is stunned");
|
||||
if (config.showAbyssalSireStun())
|
||||
{
|
||||
createGameTimer(ABYSSAL_SIRE_STUN);
|
||||
}
|
||||
}
|
||||
else if (oldId == NpcID.ABYSSAL_SIRE_5888)
|
||||
{
|
||||
// change from stunned sire to anything else
|
||||
log.debug("Sire is unstunned");
|
||||
removeGameTimer(ABYSSAL_SIRE_STUN);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onAnimationChanged(AnimationChanged event)
|
||||
|
||||
@@ -38,6 +38,7 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.components.ProgressPieComponent;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
public class TitheFarmPlantOverlay extends Overlay
|
||||
{
|
||||
@@ -66,17 +67,17 @@ public class TitheFarmPlantOverlay extends Overlay
|
||||
fills.clear();
|
||||
|
||||
final Color colorUnwateredBorder = config.getColorUnwatered();
|
||||
final Color colorUnwatered = new Color(colorUnwateredBorder.getRed(), colorUnwateredBorder.getGreen(), colorUnwateredBorder.getBlue(), 100);
|
||||
final Color colorUnwatered = ColorUtil.colorWithAlpha(colorUnwateredBorder, (int) (colorUnwateredBorder.getAlpha() / 2.5));
|
||||
borders.put(TitheFarmPlantState.UNWATERED, colorUnwateredBorder);
|
||||
fills.put(TitheFarmPlantState.UNWATERED, colorUnwatered);
|
||||
|
||||
final Color colorWateredBorder = config.getColorWatered();
|
||||
final Color colorWatered = new Color(colorWateredBorder.getRed(), colorWateredBorder.getGreen(), colorWateredBorder.getBlue(), 100);
|
||||
final Color colorWatered = ColorUtil.colorWithAlpha(colorWateredBorder, (int) (colorWateredBorder.getAlpha() / 2.5));
|
||||
borders.put(TitheFarmPlantState.WATERED, colorWateredBorder);
|
||||
fills.put(TitheFarmPlantState.WATERED, colorWatered);
|
||||
|
||||
final Color colorGrownBorder = config.getColorGrown();
|
||||
final Color colorGrown = new Color(colorGrownBorder.getRed(), colorGrownBorder.getGreen(), colorGrownBorder.getBlue(), 100);
|
||||
final Color colorGrown = ColorUtil.colorWithAlpha(colorGrownBorder, (int) (colorGrownBorder.getAlpha() / 2.5));
|
||||
borders.put(TitheFarmPlantState.GROWN, colorGrownBorder);
|
||||
fills.put(TitheFarmPlantState.GROWN, colorGrown);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.runelite.client.plugins.tithefarm;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Alpha;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -32,6 +33,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
@ConfigGroup("tithefarmplugin")
|
||||
public interface TitheFarmPluginConfig extends Config
|
||||
{
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "hexColorUnwatered",
|
||||
@@ -43,6 +45,7 @@ public interface TitheFarmPluginConfig extends Config
|
||||
return new Color(255, 187, 0);
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "hexColorWatered",
|
||||
@@ -54,6 +57,7 @@ public interface TitheFarmPluginConfig extends Config
|
||||
return new Color(0, 153, 255);
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "hexColorGrown",
|
||||
|
||||
@@ -66,26 +66,29 @@ public class Ping
|
||||
{
|
||||
IPHlpAPI ipHlpAPI = IPHlpAPI.INSTANCE;
|
||||
Pointer ptr = ipHlpAPI.IcmpCreateFile();
|
||||
InetAddress inetAddress = InetAddress.getByName(world.getAddress());
|
||||
byte[] address = inetAddress.getAddress();
|
||||
String dataStr = RUNELITE_PING;
|
||||
int dataLength = dataStr.length() + 1;
|
||||
Pointer data = new Memory(dataLength);
|
||||
data.setString(0L, dataStr);
|
||||
IcmpEchoReply icmpEchoReply = new IcmpEchoReply(new Memory(IcmpEchoReply.SIZE + dataLength));
|
||||
assert icmpEchoReply.size() == IcmpEchoReply.SIZE;
|
||||
int packed = (address[0] & 0xff) | ((address[1] & 0xff) << 8) | ((address[2] & 0xff) << 16) | ((address[3] & 0xff) << 24);
|
||||
int ret = ipHlpAPI.IcmpSendEcho(ptr, packed, data, (short) (dataLength), Pointer.NULL, icmpEchoReply, IcmpEchoReply.SIZE + dataLength, TIMEOUT);
|
||||
if (ret != 1)
|
||||
try
|
||||
{
|
||||
InetAddress inetAddress = InetAddress.getByName(world.getAddress());
|
||||
byte[] address = inetAddress.getAddress();
|
||||
String dataStr = RUNELITE_PING;
|
||||
int dataLength = dataStr.length() + 1;
|
||||
Pointer data = new Memory(dataLength);
|
||||
data.setString(0L, dataStr);
|
||||
IcmpEchoReply icmpEchoReply = new IcmpEchoReply(new Memory(IcmpEchoReply.SIZE + dataLength));
|
||||
assert icmpEchoReply.size() == IcmpEchoReply.SIZE;
|
||||
int packed = (address[0] & 0xff) | ((address[1] & 0xff) << 8) | ((address[2] & 0xff) << 16) | ((address[3] & 0xff) << 24);
|
||||
int ret = ipHlpAPI.IcmpSendEcho(ptr, packed, data, (short) (dataLength), Pointer.NULL, icmpEchoReply, IcmpEchoReply.SIZE + dataLength, TIMEOUT);
|
||||
if (ret != 1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return Math.toIntExact(icmpEchoReply.roundTripTime.longValue());
|
||||
}
|
||||
finally
|
||||
{
|
||||
ipHlpAPI.IcmpCloseHandle(ptr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int rtt = Math.toIntExact(icmpEchoReply.roundTripTime.longValue());
|
||||
ipHlpAPI.IcmpCloseHandle(ptr);
|
||||
|
||||
return rtt;
|
||||
}
|
||||
|
||||
private static int tcpPing(World world) throws IOException
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Martin H <pilino@posteo.de>
|
||||
* 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.ui.components;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import javax.swing.JButton;
|
||||
import lombok.Getter;
|
||||
|
||||
public class ColorJButton extends JButton
|
||||
{
|
||||
private static final int ALPHA_TEXT_CUTOFF = 120;
|
||||
private static final int CHECKER_SIZE = 10;
|
||||
|
||||
@Getter
|
||||
private Color color;
|
||||
|
||||
public ColorJButton(String text, Color color)
|
||||
{
|
||||
super(text);
|
||||
|
||||
// Tell ButtonUI to not paint the background, we do it ourselves.
|
||||
this.setContentAreaFilled(false);
|
||||
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
public void setColor(Color color)
|
||||
{
|
||||
this.color = color;
|
||||
|
||||
// Use perceptive luminance to choose a readable font color
|
||||
// Based on https://stackoverflow.com/a/1855903
|
||||
double lum = (0.299 * color.getRed() + 0.587 * color.getGreen() + 0.114 * color.getBlue()) / 255;
|
||||
|
||||
final Color textColor;
|
||||
|
||||
if (lum > 0.5 || color.getAlpha() < ALPHA_TEXT_CUTOFF)
|
||||
{
|
||||
textColor = Color.BLACK;
|
||||
}
|
||||
else
|
||||
{
|
||||
textColor = Color.WHITE;
|
||||
}
|
||||
|
||||
this.setForeground(textColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
if (this.color.getAlpha() != 255)
|
||||
{
|
||||
for (int x = 0; x < this.getWidth(); x += CHECKER_SIZE)
|
||||
{
|
||||
for (int y = 0; y < this.getHeight(); y += CHECKER_SIZE)
|
||||
{
|
||||
int val = (x / CHECKER_SIZE + y / CHECKER_SIZE) % 2;
|
||||
g.setColor(val == 0 ? Color.LIGHT_GRAY : Color.WHITE);
|
||||
g.fillRect(x, y, CHECKER_SIZE, CHECKER_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g.setColor(this.color);
|
||||
g.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||
|
||||
super.paint(g);
|
||||
}
|
||||
}
|
||||
@@ -49,13 +49,16 @@ class PreviewPanel extends JPanel
|
||||
{
|
||||
super.paint(g);
|
||||
|
||||
for (int x = 0; x < getWidth(); x += CHECKER_SIZE)
|
||||
if (this.color.getAlpha() != 255)
|
||||
{
|
||||
for (int y = 0; y < getHeight(); y += CHECKER_SIZE)
|
||||
for (int x = 0; x < getWidth(); x += CHECKER_SIZE)
|
||||
{
|
||||
int val = (x / CHECKER_SIZE + y / CHECKER_SIZE) % 2;
|
||||
g.setColor(val == 0 ? Color.LIGHT_GRAY : Color.WHITE);
|
||||
g.fillRect(x, y, CHECKER_SIZE, CHECKER_SIZE);
|
||||
for (int y = 0; y < getHeight(); y += CHECKER_SIZE)
|
||||
{
|
||||
int val = (x / CHECKER_SIZE + y / CHECKER_SIZE) % 2;
|
||||
g.setColor(val == 0 ? Color.LIGHT_GRAY : Color.WHITE);
|
||||
g.fillRect(x, y, CHECKER_SIZE, CHECKER_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.TileObject;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
|
||||
/**
|
||||
@@ -65,7 +66,7 @@ public class OverlayUtil
|
||||
{
|
||||
graphics.setColor(Color.BLACK);
|
||||
graphics.fillOval(mini.getX() - MINIMAP_DOT_RADIUS / 2, mini.getY() - MINIMAP_DOT_RADIUS / 2 + 1, MINIMAP_DOT_RADIUS, MINIMAP_DOT_RADIUS);
|
||||
graphics.setColor(color);
|
||||
graphics.setColor(ColorUtil.colorWithAlpha(color, 0xFF));
|
||||
graphics.fillOval(mini.getX() - MINIMAP_DOT_RADIUS / 2, mini.getY() - MINIMAP_DOT_RADIUS / 2, MINIMAP_DOT_RADIUS, MINIMAP_DOT_RADIUS);
|
||||
}
|
||||
|
||||
@@ -92,7 +93,7 @@ public class OverlayUtil
|
||||
graphics.setColor(Color.BLACK);
|
||||
graphics.drawString(text, x + 1, y + 1);
|
||||
|
||||
graphics.setColor(color);
|
||||
graphics.setColor(ColorUtil.colorWithAlpha(color, 0xFF));
|
||||
graphics.drawString(text, x, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.awt.Point;
|
||||
import java.util.regex.Pattern;
|
||||
import lombok.Setter;
|
||||
import net.runelite.client.ui.overlay.RenderableEntity;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
@Setter
|
||||
@@ -100,7 +101,7 @@ public class TextComponent implements RenderableEntity
|
||||
}
|
||||
|
||||
// actual text
|
||||
graphics.setColor(color);
|
||||
graphics.setColor(ColorUtil.colorWithAlpha(color, 0xFF));
|
||||
graphics.drawString(text, position.x, position.y);
|
||||
}
|
||||
|
||||
|
||||
@@ -131,6 +131,24 @@ public class ColorUtil
|
||||
return String.format("%08x", color.getRGB());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the same RGB color with the specified alpha value.
|
||||
*
|
||||
* @param color The RGB color to use.
|
||||
* @param alpha The alpha value to use (0-255).
|
||||
* @return A Color with the given RGB and alpha.
|
||||
*/
|
||||
public static Color colorWithAlpha(final Color color, int alpha)
|
||||
{
|
||||
if (color.getAlpha() == alpha)
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
alpha = constrainValue(alpha);
|
||||
return new Color((color.getRGB() & 0x00ffffff) | (alpha << 24), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the passed hex string is an alpha hex color.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user