Merge pull request #2313 from Owain94/merge-0602

project: Merge upstream
This commit is contained in:
Owain van Brakel
2020-02-06 16:25:31 +01:00
committed by GitHub
72 changed files with 844 additions and 362 deletions

View File

@@ -45,6 +45,7 @@ public class RuneLiteProperties
private static final String TROUBLESHOOTING_LINK = "runelite.wiki.troubleshooting.link";
private static final String BUILDING_LINK = "runelite.wiki.building.link";
private static final String DNS_CHANGE_LINK = "runelite.dnschange.link";
private static final String IMGUR_CLIENT_ID = "runelite.imgur.client.id";
private static final Properties properties = new Properties();
@@ -137,4 +138,9 @@ public class RuneLiteProperties
String launcherVersion = properties.getProperty(LAUNCHER_VERSION_PROPERTY);
return launcherVersion.equals("-1") ? null : launcherVersion;
}
public static String getImgurClientId()
{
return properties.getProperty(IMGUR_CLIENT_ID);
}
}

View File

@@ -33,4 +33,5 @@ public class ConfigItemDescriptor
private final Class<?> type;
private final Range range;
private final Alpha alpha;
private final Units units;
}

View File

@@ -350,7 +350,8 @@ public class ConfigManager
m.getDeclaredAnnotation(ConfigItem.class),
m.getReturnType(),
m.getDeclaredAnnotation(Range.class),
m.getDeclaredAnnotation(Alpha.class)
m.getDeclaredAnnotation(Alpha.class),
m.getDeclaredAnnotation(Units.class)
))
.sorted((a, b) -> ComparisonChain.start()
.compare(a.getItem().position(), b.getItem().position())

View File

@@ -325,6 +325,7 @@ public interface OpenOSRSConfig extends Config
position = 19,
titleSection = "opacityTitle"
)
@Units(Units.PERCENT)
default int opacityPercentage()
{
return 100;

View File

@@ -52,6 +52,7 @@ public interface RuneLiteConfig extends Config
position = 2,
titleSection = "uiTitle"
)
@Units(Units.PIXELS)
default Dimension gameSize()
{
return Constants.GAME_FIXED_SIZE;
@@ -174,6 +175,7 @@ public interface RuneLiteConfig extends Config
position = 12,
titleSection = "miscTitle"
)
@Units(Units.PERCENT)
default int volume()
{
return 100;
@@ -332,6 +334,17 @@ public interface RuneLiteConfig extends Config
return true;
}
@ConfigItem(
keyName = "tooltipPosition",
name = "Tooltip Position",
description = "Configures whether to show the tooltip above or under the cursor",
position = 35
)
default TooltipPositionType tooltipPosition()
{
return TooltipPositionType.UNDER_CURSOR;
}
@ConfigItem(
keyName = "infoBoxVertical",
name = "Display infoboxes vertically",
@@ -358,11 +371,12 @@ public interface RuneLiteConfig extends Config
@ConfigItem(
keyName = "infoBoxSize",
name = "Infobox size (px)",
name = "Infobox size",
description = "Configures the size of each infobox in pixels",
position = 28,
titleSection = "infoboxTitle"
)
@Units(Units.PIXELS)
default int infoBoxSize()
{
return 35;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Alexsuperfly <https://github.com/Alexsuperfly>
* Copyright (c) 2020, Crypthead <https://github.com/Crypthead>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -22,23 +22,23 @@
* (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.plugins.screenshot;
package net.runelite.client.config;
import lombok.RequiredArgsConstructor;
import lombok.Getter;
@Getter
@RequiredArgsConstructor
public enum UploadStyle
public enum TooltipPositionType
{
NEITHER("Neither"),
IMGUR("Imgur"),
CLIPBOARD("Clipboard");
ABOVE_CURSOR("Above cursor"),
UNDER_CURSOR("Under cursor");
private final String name;
private final String type;
@Override
public String toString()
{
return name;
return type;
}
}
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright (c) 2020, Hydrox6 <ikada@protonmail.ch>
* 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.config;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used with ConfigItem, defines what units are shown to the side of the box.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Documented
public @interface Units
{
String MILLISECONDS = "ms";
String MINUTES = " mins";
String PERCENT = "%";
String PIXELS = "px";
String POINTS = "pt";
String SECONDS = "s";
String TICKS = " ticks";
String LEVELS = " lvls";
String FPS = " fps";
String GP = " GP";
String value();
}

View File

@@ -87,4 +87,8 @@ public abstract class Plugin implements Module
{
subs.forEach(s -> s.subscribe(eventBus, this));
}
public void resetConfiguration()
{
}
}

View File

@@ -30,6 +30,7 @@ import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigTitleSection;
import net.runelite.client.config.Title;
import net.runelite.client.config.Units;
@ConfigGroup("agility")
public interface AgilityConfig extends Config
@@ -91,6 +92,7 @@ public interface AgilityConfig extends Config
hidden = true,
unhide = "showLapCount"
)
@Units(Units.MINUTES)
default int lapTimeout()
{
return 5;

View File

@@ -37,6 +37,7 @@ import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigTitleSection;
import net.runelite.client.config.Range;
import net.runelite.client.config.Title;
import net.runelite.client.config.Units;
@ConfigGroup("aoe")
public interface AoeWarningConfig extends Config
@@ -124,6 +125,7 @@ public interface AoeWarningConfig extends Config
titleSection = "overlayTitle",
position = 4
)
@Units(Units.MILLISECONDS)
default int delay()
{
return 300;

View File

@@ -30,6 +30,7 @@ package net.runelite.client.plugins.banktags;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.HashMultiset;
import com.google.common.collect.Multiset;
import com.google.common.collect.Lists;
import com.google.inject.Provides;
import java.awt.event.KeyEvent;
import java.awt.event.MouseWheelEvent;
@@ -100,6 +101,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
public static final String CONFIG_GROUP = "banktags";
public static final String TAG_SEARCH = "tag:";
public static final String ICON_SEARCH = "icon_";
public static final String TAG_TABS_CONFIG = "tagtabs";
public static final String VAR_TAG_SUFFIX = "*";
private static final String EDIT_TAGS_MENU_OPTION = "Edit-tags";
private static final String NUMBER_REGEX = "[0-9]+(\\.[0-9]+)?[kmb]?";
@@ -162,6 +164,36 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
return configManager.getConfig(BankTagsConfig.class);
}
@Override
public void resetConfiguration()
{
List<String> extraKeys = Lists.newArrayList(
CONFIG_GROUP + "." + TagManager.ITEM_KEY_PREFIX,
CONFIG_GROUP + "." + ICON_SEARCH,
CONFIG_GROUP + "." + TAG_TABS_CONFIG
);
for (String prefix : extraKeys)
{
List<String> keys = configManager.getConfigurationKeys(prefix);
for (String key : keys)
{
String[] str = key.split("\\.", 2);
if (str.length == 2)
{
configManager.unsetConfiguration(str[0], str[1]);
}
}
}
clientThread.invokeLater(() ->
{
tabInterface.destroy();
tabInterface.init();
});
}
@Override
public void startUp()
{
@@ -481,7 +513,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
@Subscribe
private void onConfigChanged(ConfigChanged configChanged)
{
if (configChanged.getGroup().equals("banktags") && configChanged.getKey().equals("useTabs"))
if (configChanged.getGroup().equals(CONFIG_GROUP) && configChanged.getKey().equals("useTabs"))
{
if (config.tabs())
{

View File

@@ -50,7 +50,7 @@ import net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirement;
@Singleton
public class TagManager
{
private static final String ITEM_KEY_PREFIX = "item_";
static final String ITEM_KEY_PREFIX = "item_";
private final ConfigManager configManager;
private final ItemManager itemManager;
private final ClueScrollService clueScrollService;

View File

@@ -40,13 +40,12 @@ import net.runelite.api.util.Text;
import net.runelite.client.config.ConfigManager;
import static net.runelite.client.plugins.banktags.BankTagsPlugin.CONFIG_GROUP;
import static net.runelite.client.plugins.banktags.BankTagsPlugin.ICON_SEARCH;
import static net.runelite.client.plugins.banktags.BankTagsPlugin.TAG_TABS_CONFIG;
import org.apache.commons.lang3.math.NumberUtils;
@Singleton
class TabManager
{
private static final String TAG_TABS_CONFIG = "tagtabs";
@Getter(AccessLevel.PACKAGE)
private final List<TagTab> tabs = new ArrayList<>();
private final ConfigManager configManager;

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.boosts;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("boosts")
public interface BoostsConfig extends Config
@@ -129,6 +130,7 @@ public interface BoostsConfig extends Config
description = "The amount of levels boosted to send a notification at. A value of 0 will disable notification.",
position = 8
)
@Units(Units.LEVELS)
default int boostThreshold()
{
return 0;

View File

@@ -4,6 +4,7 @@ import java.awt.Color;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("clanmanmode")
public interface ClanManModeConfig extends Config
@@ -135,6 +136,7 @@ public interface ClanManModeConfig extends Config
name = "Ticks to hide",
description = "How many ticks after you are logged in that attackbles are hidden (1 tick = 0.6 seconds)"
)
@Units(Units.TICKS)
default int hideTime()
{
return 5;

View File

@@ -41,6 +41,7 @@ import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
@@ -88,6 +89,7 @@ import net.runelite.client.config.ConfigTitleSection;
import net.runelite.client.config.Keybind;
import net.runelite.client.config.ModifierlessKeybind;
import net.runelite.client.config.Range;
import net.runelite.client.config.Units;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.PluginChanged;
import net.runelite.client.plugins.PluginManager;
@@ -543,6 +545,7 @@ class ConfigPanel extends PluginPanel
{
int value = Integer.parseInt(configManager.getConfiguration(cd.getGroup().value(), cid.getItem().keyName()));
Units units = cid.getUnits();
Range range = cid.getRange();
int min = 0, max = Integer.MAX_VALUE;
if (range != null)
@@ -558,12 +561,27 @@ class ConfigPanel extends PluginPanel
{
JLabel sliderValueLabel = new JLabel();
JSlider slider = new JSlider(min, max, value);
sliderValueLabel.setText(String.valueOf(slider.getValue()));
if (units != null)
{
sliderValueLabel.setText(slider.getValue() + " " + units.value());
}
else
{
sliderValueLabel.setText(String.valueOf(slider.getValue()));
}
slider.setPreferredSize(new Dimension(80, 25));
slider.setBackground(Color.WHITE);
slider.addChangeListener((l) ->
{
sliderValueLabel.setText(String.valueOf(slider.getValue()));
if (units != null)
{
sliderValueLabel.setText(slider.getValue() + " " + units.value());
}
else
{
sliderValueLabel.setText(String.valueOf(slider.getValue()));
}
if (!slider.getValueIsAdjusting())
{
changeConfiguration(slider, cd, cid);
@@ -597,7 +615,14 @@ class ConfigPanel extends PluginPanel
{
changeConfiguration(spinner, cd, cid);
sliderValueLabel.setText(String.valueOf(spinner.getValue()));
if (units != null)
{
sliderValueLabel.setText(spinner.getValue() + " " + units.value());
}
else
{
sliderValueLabel.setText(String.valueOf(spinner.getValue()));
}
slider.setValue((Integer) spinner.getValue());
subPanel.add(sliderValueLabel, BorderLayout.WEST);
@@ -641,6 +666,15 @@ class ConfigPanel extends PluginPanel
spinnerTextField.setColumns(SPINNER_FIELD_WIDTH);
spinner.addChangeListener(ce -> changeConfiguration(spinner, cd, cid));
if (units != null)
{
DecimalFormat df = ((JSpinner.NumberEditor) spinner.getEditor()).getFormat();
df.setPositiveSuffix(units.value());
df.setNegativeSuffix(units.value());
// Force update the spinner to have it add the units initially
spinnerTextField.setValue(value);
}
item.add(spinner, BorderLayout.EAST);
}
}
@@ -760,6 +794,7 @@ class ConfigPanel extends PluginPanel
JPanel dimensionPanel = new JPanel();
dimensionPanel.setLayout(new BorderLayout());
Units units = cid.getUnits();
String str = configManager.getConfiguration(cd.getGroup().value(), cid.getItem().keyName());
String[] splitStr = str.split("x");
int width = Integer.parseInt(splitStr[0]);
@@ -771,12 +806,30 @@ class ConfigPanel extends PluginPanel
JFormattedTextField widthSpinnerTextField = ((JSpinner.DefaultEditor) widthEditor).getTextField();
widthSpinnerTextField.setColumns(4);
if (units != null)
{
DecimalFormat df = ((JSpinner.NumberEditor) widthSpinner.getEditor()).getFormat();
df.setPositiveSuffix(units.value());
df.setNegativeSuffix(units.value());
// Force update the spinner to have it add the units initially
widthSpinnerTextField.setValue(width);
}
SpinnerModel heightModel = new SpinnerNumberModel(height, 0, Integer.MAX_VALUE, 1);
JSpinner heightSpinner = new JSpinner(heightModel);
Component heightEditor = heightSpinner.getEditor();
JFormattedTextField heightSpinnerTextField = ((JSpinner.DefaultEditor) heightEditor).getTextField();
heightSpinnerTextField.setColumns(4);
if (units != null)
{
DecimalFormat df = ((JSpinner.NumberEditor) heightSpinner.getEditor()).getFormat();
df.setPositiveSuffix(units.value());
df.setNegativeSuffix(units.value());
// Force update the spinner to have it add the units initially
heightSpinnerTextField.setValue(height);
}
ChangeListener listener = e ->
configManager.setConfiguration(cd.getGroup().value(), cid.getItem().keyName(), widthSpinner.getValue() + "x" + heightSpinner.getValue());

View File

@@ -28,6 +28,7 @@ package net.runelite.client.plugins.cooking;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("cooking")
public interface CookingConfig extends Config
@@ -35,9 +36,10 @@ public interface CookingConfig extends Config
@ConfigItem(
position = 1,
keyName = "statTimeout",
name = "Reset stats (minutes)",
name = "Reset stats",
description = "Configures the time until the session resets and the overlay is hidden (0 = Disable feature)"
)
@Units(Units.MINUTES)
default int statTimeout()
{
return 5;

View File

@@ -35,6 +35,7 @@ import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigTitleSection;
import net.runelite.client.config.Range;
import net.runelite.client.config.Title;
import net.runelite.client.config.Units;
@ConfigGroup("Cox")
@@ -220,6 +221,7 @@ public interface CoxConfig extends Config
description = "Change the Size of the Olm Infobox.",
titleSection = "olmTitle"
)
@Units(Units.PIXELS)
default int prayAgainstOlmSize()
{
return 40;
@@ -390,6 +392,7 @@ public interface CoxConfig extends Config
description = "Text Size for Timers.",
titleSection = "text"
)
@Units(Units.POINTS)
default int textSize()
{
return 14;

View File

@@ -27,16 +27,18 @@ package net.runelite.client.plugins.discord;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("discord")
public interface DiscordConfig extends Config
{
@ConfigItem(
keyName = "actionTimeout",
name = "Action timeout (minutes)",
name = "Action timeout",
description = "Configures after how long of not updating status will be reset (in minutes)",
position = 0
)
@Units(Units.MINUTES)
default int actionTimeout()
{
return 5;

View File

@@ -8,6 +8,7 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Range;
import net.runelite.client.config.Units;
@ConfigGroup("drop")
public interface DropPartyConfig extends Config
@@ -70,6 +71,7 @@ public interface DropPartyConfig extends Config
name = "Text Size",
description = "Text Size for Timers."
)
@Units(Units.POINTS)
default int textSize()
{
return 18;

View File

@@ -28,6 +28,7 @@ import java.awt.Color;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("xpdrop")
public interface XpDropConfig extends Config
@@ -89,6 +90,7 @@ public interface XpDropConfig extends Config
description = "Configures how many ticks should pass between fake XP drops, 0 to disable",
position = 4
)
@Units(Units.TICKS)
default int fakeXpDropDelay()
{
return 0;

View File

@@ -33,6 +33,7 @@ import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigTitleSection;
import net.runelite.client.config.Range;
import net.runelite.client.config.Title;
import net.runelite.client.config.Units;
@ConfigGroup("fightcave")
public interface FightCaveConfig extends Config
@@ -106,6 +107,7 @@ public interface FightCaveConfig extends Config
description = "Text Size for Timers.",
titleSection = "text"
)
@Units(Units.POINTS)
default int textSize()
{
return 32;

View File

@@ -28,6 +28,7 @@ import java.awt.Color;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("fishing")
public interface FishingConfig extends Config
@@ -112,9 +113,10 @@ public interface FishingConfig extends Config
@ConfigItem(
position = 7,
keyName = "statTimeout",
name = "Reset stats (minutes)",
name = "Reset stats",
description = "The time until fishing session data is reset in minutes."
)
@Units(Units.MINUTES)
default int statTimeout()
{
return 5;

View File

@@ -28,6 +28,7 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Range;
import net.runelite.client.config.Units;
@ConfigGroup(FpsPlugin.CONFIG_GROUP_KEY)
public interface FpsConfig extends Config
@@ -54,6 +55,7 @@ public interface FpsConfig extends Config
description = "Desired max global frames per second",
position = 2
)
@Units(Units.FPS)
default int maxFps()
{
return 50;
@@ -80,6 +82,7 @@ public interface FpsConfig extends Config
description = "Desired max frames per second for unfocused",
position = 4
)
@Units(Units.FPS)
default int maxFpsUnfocused()
{
return 50;

View File

@@ -30,6 +30,7 @@ import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigTitleSection;
import net.runelite.client.config.Range;
import net.runelite.client.config.Title;
import net.runelite.client.config.Units;
@ConfigGroup("freezetimers")
public interface FreezeTimersConfig extends Config
@@ -123,6 +124,7 @@ public interface FreezeTimersConfig extends Config
position = 8,
titleSection = "overlayTitle"
)
@Units(Units.PIXELS)
default int offset()
{
return 20;
@@ -163,6 +165,7 @@ public interface FreezeTimersConfig extends Config
position = 11,
titleSection = "overlayTitle"
)
@Units(Units.POINTS)
default int textSize()
{
return 11;

View File

@@ -35,6 +35,7 @@ import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigTitleSection;
import net.runelite.client.config.Range;
import net.runelite.client.config.Title;
import net.runelite.client.config.Units;
@ConfigGroup("Gauntlet")
@@ -282,6 +283,7 @@ public interface GauntletConfig extends Config
description = " change the size of Projectile icons.",
titleSection = "boss"
)
@Units(Units.PIXELS)
default int projectileIconSize()
{
return 20;

View File

@@ -32,6 +32,7 @@ import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigTitleSection;
import net.runelite.client.config.Title;
import net.runelite.client.config.Units;
import net.runelite.client.plugins.grounditems.config.ItemHighlightMode;
import net.runelite.client.plugins.grounditems.config.MenuHighlightMode;
import net.runelite.client.plugins.grounditems.config.PriceDisplayMode;
@@ -152,6 +153,7 @@ public interface GroundItemsConfig extends Config
position = 9,
titleSection = "highlightedTitle"
)
@Units(Units.GP)
default int getHighlightOverValue()
{
return 0;
@@ -231,6 +233,7 @@ public interface GroundItemsConfig extends Config
position = 15,
titleSection = "hiddenTitle"
)
@Units(Units.GP)
default int getHideUnderValue()
{
return 0;
@@ -338,6 +341,7 @@ public interface GroundItemsConfig extends Config
position = 24,
titleSection = "lowValueTitle"
)
@Units(Units.GP)
default int lowValuePrice()
{
return 20000;
@@ -386,6 +390,7 @@ public interface GroundItemsConfig extends Config
position = 28,
titleSection = "mediumValueTitle"
)
@Units(Units.GP)
default int mediumValuePrice()
{
return 100000;
@@ -434,6 +439,7 @@ public interface GroundItemsConfig extends Config
position = 32,
titleSection = "highValueTitle"
)
@Units(Units.GP)
default int highValuePrice()
{
return 1000000;
@@ -482,6 +488,7 @@ public interface GroundItemsConfig extends Config
position = 36,
titleSection = "insaneValueTitle"
)
@Units(Units.GP)
default int insaneValuePrice()
{
return 10000000;
@@ -600,6 +607,7 @@ public interface GroundItemsConfig extends Config
position = 46,
titleSection = "miscTitle"
)
@Units(Units.MILLISECONDS)
default int doubleTapDelay()
{
return 250;

View File

@@ -33,6 +33,7 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Range;
import net.runelite.client.config.Units;
@ConfigGroup("groundMarker")
public interface GroundMarkerConfig extends Config
@@ -279,6 +280,7 @@ public interface GroundMarkerConfig extends Config
name = "Minimap opacity",
description = "The opacity of the minimap markers"
)
@Units(Units.PERCENT)
default int minimapOverlayOpacity()
{
return 100;

View File

@@ -28,6 +28,7 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigSection;
import net.runelite.client.config.Units;
@ConfigGroup("idlenotifier")
public interface IdleNotifierConfig extends Config
@@ -144,10 +145,11 @@ public interface IdleNotifierConfig extends Config
@ConfigItem(
keyName = "timeout",
name = "Idle Notification Delay (ms)",
name = "Idle Notification Delay",
description = "The notification delay after the player is idle",
position = 11
)
@Units(Units.MILLISECONDS)
default int getIdleNotificationDelay()
{
return 5000;
@@ -203,6 +205,7 @@ public interface IdleNotifierConfig extends Config
description = "The amount of remaining oxygen to send a notification at. A value of 0 will disable notification.",
position = 16
)
@Units(Units.PERCENT)
default int getOxygenThreshold()
{
return 0;
@@ -214,6 +217,7 @@ public interface IdleNotifierConfig extends Config
description = "The amount of spec energy reached to send a notification at. A value of 0 will disable notification.",
position = 17
)
@Units(Units.PERCENT)
default int getSpecEnergyThreshold()
{
return 0;

View File

@@ -782,6 +782,11 @@ public class IdleNotifierPlugin extends Plugin
{
lastInteract = null;
lastInteracting = null;
// prevent animation notifications from firing too
lastAnimation = IDLE;
lastAnimating = null;
return true;
}
}
@@ -869,6 +874,11 @@ public class IdleNotifierPlugin extends Plugin
{
lastAnimation = IDLE;
lastAnimating = null;
// prevent interaction notifications from firing too
lastInteract = null;
lastInteracting = null;
return true;
}
}

View File

@@ -30,6 +30,7 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Range;
import net.runelite.client.config.Units;
@ConfigGroup("inventorygrid")
public interface InventoryGridConfig extends Config
@@ -74,6 +75,7 @@ public interface InventoryGridConfig extends Config
position = 4
)
@Range(min = 100)
@Units(Units.MILLISECONDS)
default int dragDelay()
{
return 100;

View File

@@ -26,6 +26,7 @@ package net.runelite.client.plugins.kingdomofmiscellania;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("kingdomofmiscellania")
public interface KingdomConfig extends Config
@@ -59,6 +60,7 @@ public interface KingdomConfig extends Config
description = "Sends a message to your chatbox when your kingdom's coffer is below the threshold. Leave at 0 to disable.",
position = 2
)
@Units(Units.GP)
default int notifyCofferThreshold()
{
return 0;

View File

@@ -29,6 +29,7 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Range;
import net.runelite.client.config.Units;
@ConfigGroup("metronome")
public interface MetronomePluginConfiguration extends Config
@@ -38,6 +39,7 @@ public interface MetronomePluginConfiguration extends Config
name = "Tick count",
description = "Configures the number of game ticks between metronome sounds"
)
@Units(Units.TICKS)
default int tickCount()
{
return 1;
@@ -58,6 +60,7 @@ public interface MetronomePluginConfiguration extends Config
name = "Tock every nth \"tick\"",
description = "Configures how many \"ticks\" between each \"tock\""
)
@Units(Units.TICKS)
default int tockNumber()
{
return 2;
@@ -102,6 +105,7 @@ public interface MetronomePluginConfiguration extends Config
name = "Volume modification",
description = "Configures tick/tock volume; only effects custom sounds."
)
@Units(Units.PERCENT)
default int volume()
{
return 35;

View File

@@ -30,6 +30,7 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Range;
import net.runelite.client.config.Units;
@ConfigGroup("mining")
public interface MiningConfig extends Config
@@ -104,6 +105,7 @@ public interface MiningConfig extends Config
name = "Progress pie diameter",
description = "Configures how big the progress pie is"
)
@Units(Units.PIXELS)
default int progressPieDiameter()
{
return 30;

View File

@@ -28,6 +28,7 @@ package net.runelite.client.plugins.motherlode;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("motherlode")
public interface MotherlodeConfig extends Config
@@ -54,9 +55,10 @@ public interface MotherlodeConfig extends Config
@ConfigItem(
keyName = "statTimeout",
name = "Reset stats (minutes)",
name = "Reset stats",
description = "Configures the time until statistics are reset"
)
@Units(Units.MINUTES)
default int statTimeout()
{
return 5;

View File

@@ -28,6 +28,7 @@ import java.awt.Color;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("npcindicators")
public interface NpcIndicatorsConfig extends Config
@@ -124,7 +125,8 @@ public interface NpcIndicatorsConfig extends Config
position = 7,
keyName = "showRespawnTimer",
name = "Show respawn timer",
description = "Show respawn timer of tagged NPCs")
description = "Show respawn timer of tagged NPCs"
)
default boolean showRespawnTimer()
{
return false;
@@ -134,7 +136,8 @@ public interface NpcIndicatorsConfig extends Config
position = 7,
keyName = "notifyOnRespawn",
name = "Notify on Respawn",
description = "Enable notification on respawn")
description = "Enable notification on respawn"
)
default boolean getNotifyOnRespawn()
{
return false;
@@ -144,7 +147,9 @@ public interface NpcIndicatorsConfig extends Config
position = 8,
keyName = "notifyOnRespawnDelay",
name = "Notification Delay",
description = "Notify when NPC is x ms from respawning")
description = "Notify when NPC is x ms from respawning"
)
@Units(Units.MILLISECONDS)
default int getNotifyOnRespawnDelay()
{
return -1;

View File

@@ -33,6 +33,7 @@ import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigTitleSection;
import net.runelite.client.config.Range;
import net.runelite.client.config.Title;
import net.runelite.client.config.Units;
@ConfigGroup("objectindicators")
public interface ObjectIndicatorsConfig extends Config
@@ -109,6 +110,7 @@ public interface ObjectIndicatorsConfig extends Config
description = "Configures the opacity/alpha of object marker",
titleSection = "colorTitle"
)
@Units(Units.PERCENT)
default int objectMarkerAlpha()
{
return 100;

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.performancestats;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("performancestats")
public interface PerformanceStatsConfig extends Config
@@ -34,9 +35,10 @@ public interface PerformanceStatsConfig extends Config
@ConfigItem(
position = 0,
keyName = "submitTimeout",
name = "Submit Timeout (seconds)",
name = "Submit Timeout",
description = "Submits after this many seconds of inactivity"
)
@Units(Units.SECONDS)
default int submitTimeout()
{
return 30;

View File

@@ -27,6 +27,7 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Range;
import net.runelite.client.config.Units;
@ConfigGroup("playerscouter")
public interface PlayerScouterConfig extends Config
@@ -116,6 +117,7 @@ public interface PlayerScouterConfig extends Config
description = "Minimum value for the item to be posted on discord.",
position = 6
)
@Units(Units.GP)
default int minimumValue()
{
return 1000;
@@ -157,6 +159,7 @@ public interface PlayerScouterConfig extends Config
description = "Minimum amount of ticks before the player can be scouted again. (1 tick = 600ms)",
position = 9
)
@Units(Units.TICKS)
default int timeout()
{
return 500;

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.poison;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup(PoisonConfig.GROUP)
public interface PoisonConfig extends Config
@@ -81,6 +82,7 @@ public interface PoisonConfig extends Config
description = "The size the time left text for other players/npc's will be",
position = 3
)
@Units(Units.POINTS)
default int fontSize()
{
return 8;

View File

@@ -29,6 +29,7 @@ import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigTitleSection;
import net.runelite.client.config.Title;
import net.runelite.client.config.Units;
@ConfigGroup("pyramidplunder")
public interface PyramidPlunderConfig extends Config
@@ -133,6 +134,7 @@ public interface PyramidPlunderConfig extends Config
description = "Recolor time left(s)",
titleSection = "warningsTitle"
)
@Units(Units.SECONDS)
default int firstWarningTime()
{
return 90;
@@ -145,6 +147,7 @@ public interface PyramidPlunderConfig extends Config
description = "Recolor time left(s)",
titleSection = "warningsTitle"
)
@Units(Units.SECONDS)
default int secondWarningTime()
{
return 30;

View File

@@ -31,6 +31,7 @@ import java.awt.Graphics2D;
import javax.inject.Singleton;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NonNull;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
@@ -43,7 +44,7 @@ public class ScreenMarkerOverlay extends Overlay
private final ScreenMarker marker;
private final ScreenMarkerRenderable screenMarkerRenderable;
ScreenMarkerOverlay(final ScreenMarker marker)
ScreenMarkerOverlay(@NonNull ScreenMarker marker)
{
this.marker = marker;
this.screenMarkerRenderable = new ScreenMarkerRenderable();

View File

@@ -36,6 +36,7 @@ import java.awt.image.BufferedImage;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.inject.Inject;
@@ -188,9 +189,10 @@ public class ScreenMarkerPlugin extends Plugin
public void finishCreation(boolean aborted)
{
if (!aborted && currentMarker != null)
ScreenMarker marker = currentMarker;
if (!aborted && marker != null)
{
final ScreenMarkerOverlay screenMarkerOverlay = new ScreenMarkerOverlay(currentMarker);
final ScreenMarkerOverlay screenMarkerOverlay = new ScreenMarkerOverlay(marker);
screenMarkerOverlay.setPreferredLocation(overlay.getBounds().getLocation());
screenMarkerOverlay.setPreferredSize(overlay.getBounds().getSize());
@@ -258,6 +260,6 @@ public class ScreenMarkerPlugin extends Plugin
{
}.getType());
return screenMarkerData.stream().map(ScreenMarkerOverlay::new);
return screenMarkerData.stream().filter(Objects::nonNull).map(ScreenMarkerOverlay::new);
}
}

View File

@@ -28,6 +28,7 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Keybind;
import net.runelite.client.util.ImageUploadStyle;
@ConfigGroup("screenshot")
public interface ScreenshotConfig extends Config
@@ -115,9 +116,9 @@ public interface ScreenshotConfig extends Config
description = "Configures whether or not screenshots are uploaded to Imgur, or placed on your clipboard",
position = 7
)
default UploadStyle uploadScreenshot()
default ImageUploadStyle uploadScreenshot()
{
return UploadStyle.NEITHER;
return ImageUploadStyle.NEITHER;
}
@ConfigItem(

View File

@@ -32,26 +32,17 @@ import com.google.inject.Provides;
import java.awt.Desktop;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Date;
import java.util.EnumSet;
import java.util.concurrent.ScheduledExecutorService;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.imageio.ImageIO;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.swing.SwingUtilities;
@@ -66,7 +57,6 @@ import net.runelite.api.Player;
import net.runelite.api.Point;
import net.runelite.api.SpriteID;
import net.runelite.api.Varbits;
import net.runelite.api.WorldType;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
@@ -96,24 +86,14 @@ import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.plugins.screenshot.imgur.ImageUploadRequest;
import net.runelite.client.plugins.screenshot.imgur.ImageUploadResponse;
import net.runelite.client.ui.ClientToolbar;
import net.runelite.client.ui.ClientUI;
import net.runelite.client.ui.DrawManager;
import net.runelite.client.ui.NavigationButton;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.HotkeyListener;
import net.runelite.client.util.ImageCapture;
import net.runelite.client.util.ImageUtil;
import net.runelite.http.api.RuneLiteAPI;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@PluginDescriptor(
@@ -126,10 +106,6 @@ import org.jetbrains.annotations.Nullable;
@Singleton
public class ScreenshotPlugin extends Plugin
{
private static final String IMGUR_CLIENT_ID = "30d71e5f6860809";
private static final HttpUrl IMGUR_IMAGE_UPLOAD_URL = HttpUrl.parse("https://api.imgur.com/3/image");
private static final MediaType JSON = MediaType.parse("application/json");
private static final DateFormat TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
private static final Pattern NUMBER_PATTERN = Pattern.compile("([0-9]+)");
@@ -196,6 +172,9 @@ public class ScreenshotPlugin extends Plugin
@Inject
private SpriteManager spriteManager;
@Inject
private ImageCapture imageCapture;
@Getter(AccessLevel.PACKAGE)
private BufferedImage reportButton;
@@ -206,7 +185,7 @@ public class ScreenshotPlugin extends Plugin
@Override
public void hotkeyPressed()
{
takeScreenshot(format(new Date()));
takeScreenshot("");
}
};
@@ -220,7 +199,6 @@ public class ScreenshotPlugin extends Plugin
private boolean screenshotLevels;
private boolean screenshotKingdom;
private boolean screenshotPet;
private UploadStyle uploadScreenshot;
private boolean screenshotKills;
private boolean screenshotBossKills;
private boolean screenshotFriendDeath;
@@ -253,7 +231,7 @@ public class ScreenshotPlugin extends Plugin
.tab(false)
.tooltip("Take screenshot")
.icon(iconImage)
.onClick(() -> takeScreenshot(format(new Date())))
.onClick(() -> takeScreenshot(""))
.popup(ImmutableMap
.<String, Runnable>builder()
.put("Open screenshot folder...", () ->
@@ -353,7 +331,7 @@ public class ScreenshotPlugin extends Plugin
{
final Player player = playerLootReceived.getPlayer();
final String name = player.getName();
String fileName = "Kill " + name + " " + format(new Date());
String fileName = "Kill " + name;
takeScreenshot(fileName);
}
}
@@ -421,7 +399,7 @@ public class ScreenshotPlugin extends Plugin
if (this.screenshotPet && PET_MESSAGES.stream().anyMatch(chatMessage::contains))
{
String fileName = "Pet " + format(new Date());
String fileName = "Pet";
takeScreenshot(fileName);
}
@@ -443,7 +421,7 @@ public class ScreenshotPlugin extends Plugin
if (m.matches())
{
String valuableDropName = m.group(1);
String fileName = "Valuable drop " + valuableDropName + " " + format(new Date());
String fileName = "Valuable drop " + valuableDropName;
takeScreenshot(fileName);
}
}
@@ -454,7 +432,7 @@ public class ScreenshotPlugin extends Plugin
if (m.matches())
{
String untradeableDropName = m.group(1);
String fileName = "Untradeable drop " + untradeableDropName + " " + format(new Date());
String fileName = "Untradeable drop " + untradeableDropName;
takeScreenshot(fileName);
}
}
@@ -703,135 +681,7 @@ public class ScreenshotPlugin extends Plugin
// Draw the game onto the screenshot
graphics.drawImage(image, gameOffsetX, gameOffsetY, null);
File playerFolder;
if (client.getLocalPlayer() != null && client.getLocalPlayer().getName() != null)
{
final EnumSet<WorldType> worldTypes = client.getWorldType();
String playerDir = client.getLocalPlayer().getName();
if (worldTypes.contains(WorldType.DEADMAN))
{
playerDir += "-Deadman";
}
else if (worldTypes.contains(WorldType.LEAGUE))
{
playerDir += "-League";
}
playerFolder = new File(SCREENSHOT_DIR, playerDir);
}
else
{
playerFolder = SCREENSHOT_DIR;
}
playerFolder.mkdirs();
if (subdirectory != null)
{
//uhh just tried to do this as workaround, not sure if it's the best idea tho
File actualplayerFolder = new File(playerFolder, subdirectory);
actualplayerFolder.mkdir();
playerFolder = actualplayerFolder;
}
try
{
File screenshotFile = new File(playerFolder, fileName + ".png");
// To make sure that screenshots don't get overwritten, check if file exists,
// and if it does create file with same name and suffix.
int i = 1;
while (screenshotFile.exists())
{
screenshotFile = new File(playerFolder, fileName + String.format("(%d)", i++) + ".png");
}
ImageIO.write(screenshot, "PNG", screenshotFile);
UploadStyle uploadStyle = this.uploadScreenshot;
if (uploadStyle == UploadStyle.IMGUR)
{
uploadScreenshot(screenshotFile);
}
else if (uploadStyle == UploadStyle.CLIPBOARD)
{
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
TransferableBufferedImage transferableBufferedImage = new TransferableBufferedImage(screenshot);
clipboard.setContents(transferableBufferedImage, null);
if (this.notifyWhenTaken)
{
notifier.notify("A screenshot was saved and inserted into your clipboard!", TrayIcon.MessageType.INFO);
}
}
else if (this.notifyWhenTaken)
{
notifier.notify("A screenshot was saved to " + screenshotFile, TrayIcon.MessageType.INFO);
}
}
catch (IOException ex)
{
log.warn("error writing screenshot", ex);
}
}
/**
* Uploads a screenshot to the Imgur image-hosting service,
* and copies the image link to the clipboard.
*
* @param screenshotFile Image file to upload.
* @throws IOException Thrown if the file cannot be read.
*/
/**
* Uploads a screenshot to the Imgur image-hosting service,
* and copies the image link to the clipboard.
*
* @param screenshotFile Image file to upload.
* @throws IOException Thrown if the file cannot be read.
*/
private void uploadScreenshot(File screenshotFile) throws IOException
{
String json = RuneLiteAPI.GSON.toJson(new ImageUploadRequest(screenshotFile));
Request request = new Request.Builder()
.url(IMGUR_IMAGE_UPLOAD_URL)
.addHeader("Authorization", "Client-ID " + IMGUR_CLIENT_ID)
.post(RequestBody.create(JSON, json))
.build();
RuneLiteAPI.CLIENT.newCall(request).enqueue(new Callback()
{
@Override
public void onFailure(@NotNull Call call, @NotNull IOException ex)
{
log.warn("error uploading screenshot", ex);
}
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException
{
try (InputStream in = response.body().byteStream())
{
ImageUploadResponse imageUploadResponse = RuneLiteAPI.GSON
.fromJson(new InputStreamReader(in), ImageUploadResponse.class);
if (imageUploadResponse.isSuccess())
{
String link = imageUploadResponse.getData().getLink();
StringSelection selection = new StringSelection(link);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(selection, selection);
if (notifyWhenTaken)
{
notifier.notify("A screenshot was uploaded and inserted into your clipboard!", TrayIcon.MessageType.INFO);
}
}
}
}
});
imageCapture.takeScreenshot(screenshot, fileName, config.notifyWhenTaken(), config.uploadScreenshot());
}
@VisibleForTesting
@@ -890,7 +740,6 @@ public class ScreenshotPlugin extends Plugin
this.screenshotLevels = config.screenshotLevels();
this.screenshotKingdom = config.screenshotKingdom();
this.screenshotPet = config.screenshotPet();
this.uploadScreenshot = config.uploadScreenshot();
this.screenshotKills = config.screenshotKills();
this.screenshotBossKills = config.screenshotBossKills();
this.screenshotFriendDeath = config.screenshotFriendDeath();

View File

@@ -29,6 +29,7 @@ import java.awt.Color;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("slayer")
public interface SlayerConfig extends Config
@@ -70,9 +71,10 @@ public interface SlayerConfig extends Config
@ConfigItem(
position = 4,
keyName = "statTimeout",
name = "InfoBox Expiry (minutes)",
name = "InfoBox Expiry",
description = "Set the time until the InfoBox expires"
)
@Units(Units.MINUTES)
default int statTimeout()
{
return 5;

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.smelting;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("smelting")
public interface SmeltingConfig extends Config
@@ -34,9 +35,10 @@ public interface SmeltingConfig extends Config
@ConfigItem(
position = 1,
keyName = "statTimeout",
name = "Reset stats (minutes)",
name = "Reset stats",
description = "The time it takes for the current smelting session to be reset"
)
@Units(Units.MINUTES)
default int statTimeout()
{
return 5;

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.spellbook;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("spellbook")
public interface SpellbookConfig extends Config
@@ -70,6 +71,7 @@ public interface SpellbookConfig extends Config
description = "Size (in px) of spells. Normal mobile size is 40px, use common sense for this setting",
position = 4
)
@Units(Units.PIXELS)
default int size()
{
return 40;

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.statusbars;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
import net.runelite.client.plugins.statusbars.config.BarMode;
@ConfigGroup("statusbars")
@@ -101,9 +102,10 @@ public interface StatusBarsConfig extends Config
@ConfigItem(
position = 7,
keyName = "hideStatusBarDelay",
name = "Delay (seconds)",
name = "Delay",
description = "Number of seconds after combat to hide the status bars."
)
@Units(Units.SECONDS)
default int hideStatusBarDelay()
{
return 3;

View File

@@ -30,6 +30,7 @@ import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigTitleSection;
import net.runelite.client.config.Title;
import net.runelite.client.config.Units;
@ConfigGroup("statusorbs")
public interface StatusOrbsConfig extends Config
@@ -83,11 +84,12 @@ public interface StatusOrbsConfig extends Config
@ConfigItem(
keyName = "notifyBeforeHpRegenDuration",
name = "Hitpoint Regen Notification (seconds)",
name = "Hitpoint Regen Notification",
description = "Notify approximately when your next hitpoint is about to regen. A value of 0 will disable notification.",
titleSection = "hp",
position = 4
)
@Units(Units.SECONDS)
default int getNotifyBeforeHpRegenSeconds()
{
return 0;

View File

@@ -28,6 +28,7 @@ package net.runelite.client.plugins.stretchedmode;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("stretchedmode")
public interface StretchedModeConfig extends Config
@@ -64,9 +65,10 @@ public interface StretchedModeConfig extends Config
@ConfigItem(
keyName = "scalingFactor",
name = "Resizable Scaling (%)",
name = "Resizable Scaling",
description = "In resizable mode, the game is reduced in size this much before it's stretched."
)
@Units(Units.PERCENT)
default int scalingFactor()
{
return 50;

View File

@@ -33,6 +33,7 @@ import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigSection;
import net.runelite.client.config.Range;
import net.runelite.client.config.Units;
@ConfigGroup("thieving")
public interface ThievingConfig extends Config
@@ -40,9 +41,10 @@ public interface ThievingConfig extends Config
@ConfigItem(
position = 1,
keyName = "statTimeout",
name = "Reset stats (minutes)",
name = "Reset stats",
description = "Change the time until the thieving session is reset and the overlay is hidden"
)
@Units(Units.MINUTES)
default int statTimeout()
{
return 5;

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.timetracking;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("timetracking")
public interface TimeTrackingConfig extends Config
@@ -72,10 +73,11 @@ public interface TimeTrackingConfig extends Config
@ConfigItem(
keyName = "defaultTimerMinutes",
name = "Default Time (Minutes)",
name = "Default Time",
description = "The default time for the timer in minutes",
position = 4
)
@Units(Units.MINUTES)
default int defaultTimerMinutes()
{
return 5;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Lotto <https://github.com/devLotto>
* Copyright (c) 2020, Henry Darnell <hjdarnel@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -22,23 +22,23 @@
* (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.plugins.screenshot.imgur;
package net.runelite.client.plugins.wiki;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Base64;
import lombok.Data;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@Data
public class ImageUploadRequest
@ConfigGroup(WikiPlugin.CONFIG_GROUP_KEY)
public interface WikiConfig extends Config
{
private final String image;
private final String type;
public ImageUploadRequest(File imageFile) throws IOException
@ConfigItem(
keyName = "leftClickSearch",
name = "Left Click Search",
description = "Swap left-click on the Wiki button to Search",
position = 1
)
default boolean leftClickSearch()
{
this.image = Base64.getEncoder().encodeToString(Files.readAllBytes(imageFile.toPath()));
this.type = "base64";
return false;
}
}

View File

@@ -24,6 +24,7 @@
*/
package net.runelite.client.plugins.wiki;
import com.google.inject.Provides;
import javax.inject.Inject;
import javax.inject.Provider;
import lombok.extern.slf4j.Slf4j;
@@ -48,7 +49,9 @@ import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetPositionMode;
import net.runelite.api.widgets.WidgetType;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.SpriteManager;
import net.runelite.client.plugins.Plugin;
@@ -86,6 +89,9 @@ public class WikiPlugin extends Plugin
@Inject
private SpriteManager spriteManager;
@Inject
private WikiConfig config;
@Inject
private ClientThread clientThread;
@@ -102,6 +108,14 @@ public class WikiPlugin extends Plugin
private boolean wikiSelected = false;
static final String CONFIG_GROUP_KEY = "wiki";
@Provides
WikiConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(WikiConfig.class);
}
@Override
public void startUp()
{
@@ -111,29 +125,32 @@ public class WikiPlugin extends Plugin
@Override
public void shutDown()
{
clientThread.invokeLater(() ->
clientThread.invokeLater(this::removeWidgets);
}
private void removeWidgets()
{
Widget minimapOrbs = client.getWidget(WidgetInfo.MINIMAP_ORBS);
if (minimapOrbs == null)
{
Widget minimapOrbs = client.getWidget(WidgetInfo.MINIMAP_ORBS);
if (minimapOrbs == null)
{
return;
}
Widget[] children = minimapOrbs.getChildren();
if (children == null || children.length < 1)
{
return;
}
children[0] = null;
return;
}
Widget[] children = minimapOrbs.getChildren();
if (children == null || children.length < 1)
{
return;
}
children[0] = null;
Widget vanilla = client.getWidget(WidgetInfo.MINIMAP_WIKI_BANNER);
if (vanilla != null)
{
vanilla.setHidden(false);
}
Widget vanilla = client.getWidget(WidgetInfo.MINIMAP_WIKI_BANNER);
if (vanilla != null)
{
vanilla.setHidden(false);
}
onDeselect();
client.setSpellSelected(false);
});
onDeselect();
client.setSpellSelected(false);
}
@Subscribe
@@ -178,14 +195,17 @@ public class WikiPlugin extends Plugin
icon.setSpriteId(SpriteID.WIKI_SELECTED);
client.setAllWidgetsAreOpTargetable(true);
});
icon.setAction(5, "Search"); // Start at option 5 so the target op is ontop
final int searchIndex = config.leftClickSearch() ? 4 : 5;
icon.setAction(searchIndex, "Search");
icon.setOnOpListener((JavaScriptCallback) ev ->
{
if (ev.getOp() == 6)
if (ev.getOp() == searchIndex + 1)
{
openSearchInput();
}
});
// This doesn't always run because we cancel the menuop
icon.setOnTargetLeaveListener((JavaScriptCallback) ev -> onDeselect());
icon.revalidate();
@@ -200,6 +220,19 @@ public class WikiPlugin extends Plugin
}
}
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals(CONFIG_GROUP_KEY))
{
clientThread.invokeLater(() ->
{
removeWidgets();
addWidgets();
});
}
}
private void onDeselect()
{
client.setAllWidgetsAreOpTargetable(false);

View File

@@ -30,6 +30,7 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Range;
import net.runelite.client.config.Units;
import net.runelite.client.plugins.wintertodt.config.WintertodtNotifyMode;
@ConfigGroup("wintertodt")
@@ -66,6 +67,7 @@ public interface WintertodtConfig extends Config
@Range(
max = 60
)
@Units(Units.SECONDS)
default int roundNotification()
{
return 5;

View File

@@ -311,8 +311,8 @@ public class WintertodtPlugin extends Plugin
chatMessageManager.update(messageNode);
client.refreshChat();
// all actions except woodcutting are interrupted from damage
if (currentActivity != WintertodtActivity.WOODCUTTING)
// all actions except woodcutting and idle are interrupted from damage
if (currentActivity != WintertodtActivity.WOODCUTTING && currentActivity != WintertodtActivity.IDLE)
{
wasInterrupted = true;
}

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.woodcutting;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("woodcutting")
public interface WoodcuttingConfig extends Config
@@ -34,9 +35,10 @@ public interface WoodcuttingConfig extends Config
@ConfigItem(
position = 1,
keyName = "statTimeout",
name = "Reset stats (minutes)",
name = "Reset stats",
description = "Configures the time until statistic is reset. Also configures when tree indicator is hidden"
)
@Units(Units.MINUTES)
default int statTimeout()
{
return 5;

View File

@@ -29,6 +29,7 @@ import net.runelite.client.config.Alpha;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("xpglobes")
public interface XpGlobesConfig extends Config
@@ -152,6 +153,7 @@ public interface XpGlobesConfig extends Config
description = "Change the stroke width of the progress arc",
position = 10
)
@Units(Units.PIXELS)
default int progressArcStrokeWidth()
{
return 2;
@@ -163,6 +165,7 @@ public interface XpGlobesConfig extends Config
description = "Change the size of the xp orbs",
position = 11
)
@Units(Units.PIXELS)
default int xpOrbSize()
{
return 40;
@@ -174,6 +177,7 @@ public interface XpGlobesConfig extends Config
description = "Change the duration the xp orbs are visible",
position = 12
)
@Units(Units.SECONDS)
default int xpOrbDuration()
{
return 10;

View File

@@ -28,6 +28,7 @@ import lombok.AllArgsConstructor;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
@ConfigGroup("xpTracker")
public interface XpTrackerConfig extends Config
@@ -87,6 +88,7 @@ public interface XpTrackerConfig extends Config
name = "Auto pause after",
description = "Configures how many minutes passes before pausing a skill while in game and there's no XP, 0 means disabled"
)
@Units(Units.MINUTES)
default int pauseSkillAfter()
{
return 0;

View File

@@ -26,6 +26,7 @@ package net.runelite.client.ui.overlay;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
@@ -61,6 +62,8 @@ public abstract class WidgetItemOverlay extends Overlay
public Dimension render(Graphics2D graphics)
{
final List<WidgetItem> itemWidgets = overlayManager.getItemWidgets();
final Rectangle originalClipBounds = graphics.getClipBounds();
Widget curClipParent = null;
for (WidgetItem widgetItem : itemWidgets)
{
Widget widget = widgetItem.getWidget();
@@ -74,6 +77,29 @@ public abstract class WidgetItemOverlay extends Overlay
continue;
}
Widget parent = widget.getParent();
Rectangle parentBounds = parent.getBounds();
Rectangle itemCanvasBounds = widgetItem.getCanvasBounds();
boolean shouldClip;
shouldClip = itemCanvasBounds.y < parentBounds.y && itemCanvasBounds.y + itemCanvasBounds.height >= parentBounds.y;
shouldClip |= itemCanvasBounds.y < parentBounds.y + parentBounds.height && itemCanvasBounds.y + itemCanvasBounds.height >= parentBounds.y + parentBounds.height;
shouldClip |= itemCanvasBounds.x < parentBounds.x && (itemCanvasBounds.x + itemCanvasBounds.width) >= parentBounds.x;
shouldClip |= itemCanvasBounds.x < parentBounds.x + parentBounds.width && itemCanvasBounds.x + itemCanvasBounds.width >= parentBounds.x + parentBounds.width;
if (shouldClip)
{
if (curClipParent != parent)
{
graphics.setClip(parentBounds);
curClipParent = parent;
}
}
else if (curClipParent != null && curClipParent != parent)
{
graphics.setClip(originalClipBounds);
curClipParent = null;
}
renderItemOverlay(graphics, widgetItem.getId(), widgetItem);
}
return null;

View File

@@ -32,6 +32,8 @@ import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Client;
import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.config.TooltipPositionType;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
@@ -41,16 +43,19 @@ import net.runelite.client.ui.overlay.components.TooltipComponent;
@Singleton
public class TooltipOverlay extends Overlay
{
private static final int OFFSET = 24;
private static final int UNDER_OFFSET = 24;
private static final int ABOVE_OFFSET = -20;
private static final int PADDING = 2;
private final TooltipManager tooltipManager;
private final Client client;
private final RuneLiteConfig runeLiteConfig;
@Inject
private TooltipOverlay(Client client, TooltipManager tooltipManager)
private TooltipOverlay(Client client, TooltipManager tooltipManager, final RuneLiteConfig runeLiteConfig)
{
this.client = client;
this.tooltipManager = tooltipManager;
this.runeLiteConfig = runeLiteConfig;
setPosition(OverlayPosition.TOOLTIP);
setPriority(OverlayPriority.HIGHEST);
setLayer(OverlayLayer.ALWAYS_ON_TOP);
@@ -81,7 +86,8 @@ public class TooltipOverlay extends Overlay
{
final Rectangle clientCanvasBounds = new Rectangle(client.getRealDimensions());
final net.runelite.api.Point mouseCanvasPosition = client.getMouseCanvasPosition();
final Point mousePosition = new Point(mouseCanvasPosition.getX(), mouseCanvasPosition.getY() + OFFSET);
final int offset = runeLiteConfig.tooltipPosition() == TooltipPositionType.UNDER_CURSOR ? UNDER_OFFSET : ABOVE_OFFSET;
final Point mousePosition = new Point(mouseCanvasPosition.getX(), mouseCanvasPosition.getY() + offset);
final Rectangle bounds = new Rectangle(getBounds());
bounds.setLocation(mousePosition);
@@ -94,7 +100,7 @@ public class TooltipOverlay extends Overlay
if (boundsY > clientY)
{
graphics.translate(0, -bounds.height - OFFSET);
graphics.translate(0, -bounds.height - offset);
}
if (boundsX > clientX)
@@ -113,7 +119,7 @@ public class TooltipOverlay extends Overlay
if (newBounds.contains(mousePosition))
{
mousePosition.move(mouseCanvasPosition.getX(), mouseCanvasPosition.getY() + OFFSET + newBounds.height);
mousePosition.move(mouseCanvasPosition.getX(), mouseCanvasPosition.getY() + offset + newBounds.height);
}
tooltipComponent.setPosition(mousePosition);

View File

@@ -0,0 +1,244 @@
/*
* Copyright (c) 2018, Lotto <https://github.com/devLotto>
* Copyright (c) 2019, Alexsuperfly <https://github.com/Alexsuperfly>
* 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.util;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Base64;
import java.util.Date;
import java.util.EnumSet;
import javax.imageio.ImageIO;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.WorldType;
import net.runelite.client.Notifier;
import static net.runelite.client.RuneLite.SCREENSHOT_DIR;
import net.runelite.client.RuneLiteProperties;
import net.runelite.http.api.RuneLiteAPI;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
@Slf4j
@Singleton
public class ImageCapture
{
private static final DateFormat TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
private static final HttpUrl IMGUR_IMAGE_UPLOAD_URL = HttpUrl.parse("https://api.imgur.com/3/image");
private static final MediaType JSON = MediaType.parse("application/json");
@Inject
private Client client;
@Inject
private Notifier notifier;
/**
* Saves a screenshot of the client window to the screenshot folder as a PNG,
* and optionally uploads it to an image-hosting service.
*
* @param screenshot BufferedImage to capture.
* @param fileName Filename to use, without file extension.
* @param notify Send a notification to the system tray when the image is captured.
* @param imageUploadStyle which method to use to upload the screenshot (Imgur or directly to clipboard).
*/
public void takeScreenshot(BufferedImage screenshot, String fileName, boolean notify, ImageUploadStyle imageUploadStyle)
{
if (client.getGameState() == GameState.LOGIN_SCREEN)
{
// Prevent the screenshot from being captured
log.info("Login screenshot prevented");
return;
}
File playerFolder;
if (client.getLocalPlayer() != null && client.getLocalPlayer().getName() != null)
{
final EnumSet<WorldType> worldTypes = client.getWorldType();
String playerDir = client.getLocalPlayer().getName();
if (worldTypes.contains(WorldType.DEADMAN))
{
playerDir += "-Deadman";
}
else if (worldTypes.contains(WorldType.LEAGUE))
{
playerDir += "-League";
}
playerFolder = new File(SCREENSHOT_DIR, playerDir);
}
else
{
playerFolder = SCREENSHOT_DIR;
}
playerFolder.mkdirs();
fileName += " " + format(new Date());
try
{
File screenshotFile = new File(playerFolder, fileName + ".png");
// To make sure that screenshots don't get overwritten, check if file exists,
// and if it does create file with same name and suffix.
int i = 1;
while (screenshotFile.exists())
{
screenshotFile = new File(playerFolder, fileName + String.format("(%d)", i++) + ".png");
}
ImageIO.write(screenshot, "PNG", screenshotFile);
if (imageUploadStyle == ImageUploadStyle.IMGUR)
{
uploadScreenshot(screenshotFile, notify);
}
else if (imageUploadStyle == ImageUploadStyle.CLIPBOARD)
{
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
TransferableBufferedImage transferableBufferedImage = new TransferableBufferedImage(screenshot);
clipboard.setContents(transferableBufferedImage, null);
if (notify)
{
notifier.notify("A screenshot was saved and inserted into your clipboard!", TrayIcon.MessageType.INFO);
}
}
else if (notify)
{
notifier.notify("A screenshot was saved to " + screenshotFile, TrayIcon.MessageType.INFO);
}
}
catch (IOException ex)
{
log.warn("error writing screenshot", ex);
}
}
/**
* Uploads a screenshot to the Imgur image-hosting service,
* and copies the image link to the clipboard.
*
* @param screenshotFile Image file to upload.
* @throws IOException Thrown if the file cannot be read.
*/
private void uploadScreenshot(File screenshotFile, boolean notify) throws IOException
{
String json = RuneLiteAPI.GSON.toJson(new ImageUploadRequest(screenshotFile));
Request request = new Request.Builder()
.url(IMGUR_IMAGE_UPLOAD_URL)
.addHeader("Authorization", "Client-ID " + RuneLiteProperties.getImgurClientId())
.post(RequestBody.create(JSON, json))
.build();
RuneLiteAPI.CLIENT.newCall(request).enqueue(new Callback()
{
@Override
public void onFailure(Call call, IOException ex)
{
log.warn("error uploading screenshot", ex);
}
@Override
public void onResponse(Call call, Response response) throws IOException
{
try (InputStream in = response.body().byteStream())
{
ImageUploadResponse imageUploadResponse = RuneLiteAPI.GSON
.fromJson(new InputStreamReader(in), ImageUploadResponse.class);
if (imageUploadResponse.isSuccess())
{
String link = imageUploadResponse.getData().getLink();
StringSelection selection = new StringSelection(link);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(selection, selection);
if (notify)
{
notifier.notify("A screenshot was uploaded and inserted into your clipboard!", TrayIcon.MessageType.INFO);
}
}
}
}
});
}
private static String format(Date date)
{
synchronized (TIME_FORMAT)
{
return TIME_FORMAT.format(date);
}
}
@Data
private static class ImageUploadResponse
{
private Data data;
private boolean success;
@lombok.Data
private static class Data
{
private String link;
}
}
@Data
private static class ImageUploadRequest
{
private final String image;
private final String type;
ImageUploadRequest(File imageFile) throws IOException
{
this.image = Base64.getEncoder().encodeToString(Files.readAllBytes(imageFile.toPath()));
this.type = "base64";
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Lotto <https://github.com/devLotto>
* Copyright (c) 2019, Alexsuperfly <https://github.com/Alexsuperfly>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -22,19 +22,12 @@
* (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.plugins.screenshot.imgur;
import lombok.Data;
package net.runelite.client.util;
@Data
public class ImageUploadResponse
public enum ImageUploadStyle
{
private Data data;
private boolean success;
@lombok.Data
public static class Data
{
private String link;
}
}
NEITHER,
IMGUR,
CLIPBOARD
}

View File

@@ -24,7 +24,7 @@
* 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.plugins.screenshot;
package net.runelite.client.util;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;

View File

@@ -12,3 +12,4 @@ runelite.wiki.troubleshooting.link=https://github.com/open-osrs/runelite/wiki/Tr
runelite.wiki.building.link=https://github.com/open-osrs/runelite/wiki/Building-with-IntelliJ-IDEA
runelite.dnschange.link=https://1.1.1.1/dns/
launcher.version=@launcher.version@
runelite.imgur.client.id=30d71e5f6860809

View File

@@ -1 +1 @@
14DBDBF6FB86760F32965613C7393403F142073AA388332F9A5C97B69FE65D19
3444503072AEE70EEB53938C1FDC826A7530B62BB5FAB65402A22BAB08D7B76D

View File

@@ -25,65 +25,83 @@ LABEL17:
iload 1
iconst 0
if_icmple LABEL21
jump LABEL25
jump LABEL31
LABEL21:
iconst 1 ; What we compare the boolean with
iconst 0 ; Boolean
sconst "drawSpecbarAnyway"
runelite_callback
if_icmpeq LABEL25
if_icmpeq LABEL41
iconst 1
iconst 38862883
if_sethide
iconst 190
iconst 28
iconst 0
iconst 0
iconst 38862850
if_setsize
return
LABEL25:
LABEL31:
invoke 1972
iconst 1
if_icmpeq LABEL35
jump LABEL41
LABEL35:
iconst 190
iconst 16
iconst 0
iconst 0
iconst 38862850
if_setsize
LABEL41:
iconst 0
istore 2
iconst 38862883
if_gethide
if_gethide
iconst 1
if_icmpeq LABEL32
jump LABEL34
LABEL32:
if_icmpeq LABEL48
jump LABEL50
LABEL48:
iconst 1
istore 2
LABEL34:
LABEL50:
iconst 0
iconst 38862883
if_sethide
if_sethide
get_varp 301
iconst 0
if_icmpgt LABEL41
jump LABEL45
LABEL41:
if_icmpgt LABEL57
jump LABEL61
LABEL57:
iconst 16776960
iconst 38862888
if_setcolour
jump LABEL48
LABEL45:
if_setcolour
jump LABEL64
LABEL61:
iconst 16
iconst 38862888
if_setcolour
LABEL48:
if_setcolour
LABEL64:
get_varp 300
istore 3
iload 3
iconst 0
if_icmplt LABEL54
jump LABEL56
LABEL54:
if_icmplt LABEL70
jump LABEL72
LABEL70:
iconst 0
istore 3
LABEL56:
LABEL72:
sconst "Special Attack: "
iload 3
iconst 10
div
tostring
div
tostring
sconst "%"
join_string 3
iconst 38862888
if_settext
if_settext
iload 0
iload 3
iload 2
@@ -96,119 +114,119 @@ LABEL56:
iconst 0
if_icmple RETURN ; Return if the weapon isn't supposed to have a spec
jump CONTINUE ; Idk why I'm doing it like this but it's the jagex way
RETURN:
return
CONTINUE:
RETURN:
return
CONTINUE:
iload 3
iload 1
if_icmpge LABEL73
jump LABEL77
LABEL73:
if_icmpge LABEL89
jump LABEL93
LABEL89:
iconst 3767611
iconst 38862887
if_setcolour
jump LABEL80
LABEL77:
if_setcolour
jump LABEL96
LABEL93:
iconst 12907
iconst 38862887
if_setcolour
LABEL80:
if_setcolour
LABEL96:
iconst 94
iconst 3
inv_getobj
inv_getobj
istore 4
iconst 111
iconst 115
iconst 1739
iload 4
enum
enum
sconst " ("
iconst 111
iconst 105
iconst 906
iload 4
enum
enum
iconst 10
div
tostring
div
tostring
sconst "%)"
join_string 4
sstore 0
iload 4
switch
22737: LABEL108
22740: LABEL108
22743: LABEL108
22731: LABEL108
22734: LABEL108
jump LABEL116
LABEL108:
switch
22737: LABEL124
22740: LABEL124
22743: LABEL124
22731: LABEL124
22734: LABEL124
jump LABEL132
LABEL124:
iconst 111
iconst 115
iconst 1739
iload 4
enum
enum
sconst " 5-100% "
join_string 2
sstore 0
LABEL116:
LABEL132:
get_varbit 5712
iconst 0
if_icmpeq LABEL120
jump LABEL185
LABEL120:
if_icmpeq LABEL136
jump LABEL201
LABEL136:
iload 4
iconst 11235
if_icmpeq LABEL136
if_icmpeq LABEL152
iload 4
iconst 20408
if_icmpeq LABEL136
if_icmpeq LABEL152
iload 4
iconst 12765
if_icmpeq LABEL136
if_icmpeq LABEL152
iload 4
iconst 12768
if_icmpeq LABEL136
if_icmpeq LABEL152
iload 4
iconst 12767
if_icmpeq LABEL136
jump LABEL169
LABEL136:
if_icmpeq LABEL152
jump LABEL185
LABEL152:
iconst 94
iconst 13
inv_getobj
inv_getobj
iconst 11212
if_icmpeq LABEL157
if_icmpeq LABEL173
iconst 94
iconst 13
inv_getobj
inv_getobj
iconst 11227
if_icmpeq LABEL157
if_icmpeq LABEL173
iconst 94
iconst 13
inv_getobj
inv_getobj
iconst 11228
if_icmpeq LABEL157
if_icmpeq LABEL173
iconst 94
iconst 13
inv_getobj
inv_getobj
iconst 11229
if_icmpeq LABEL157
jump LABEL169
LABEL157:
if_icmpeq LABEL173
jump LABEL185
LABEL173:
sconst "Descent of Dragons: Deal a double attack with dragon arrows that inflicts up to 50% more damage (minimum damage of 8 per hit). ("
iconst 111
iconst 105
iconst 906
iload 4
enum
enum
iconst 10
div
tostring
div
tostring
sconst "%)"
join_string 3
sstore 0
LABEL169:
LABEL185:
iconst 526
iconst -2147483645
iconst -1
@@ -218,17 +236,17 @@ LABEL169:
iconst 160
sconst "IiIsii"
iconst 38862883
if_setonmouserepeat
if_setonmouserepeat
iconst 40
iconst 38862890
sconst "I"
iconst 38862883
if_setonmouseleave
jump LABEL189
LABEL185:
if_setonmouseleave
jump LABEL205
LABEL201:
iconst -1
sconst ""
iconst 38862883
if_setonmouserepeat
LABEL189:
if_setonmouserepeat
LABEL205:
return