Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Owain van Brakel
2020-02-06 16:51:15 +01:00
30 changed files with 957 additions and 164 deletions

View File

@@ -27,7 +27,7 @@ object ProjectVersions {
const val launcherVersion = "2.0.4"
const val rlVersion = "1.6.6-SNAPSHOT"
const val openosrsVersion = "2.1.25-SNAPSHOT"
const val openosrsVersion = "2.1.26-SNAPSHOT"
const val rsversion = 188
const val cacheversion = 165

View File

@@ -31,17 +31,17 @@ public class SequenceDefinition
{
private final int id;
public int[] frameIDs; // top 16 bits are FrameDefinition ids
public int[] field3048;
public int[] chatFrameIds;
public int[] frameLenghts;
public int rightHandItem = -1;
public int[] frameSounds;
public int frameStep = -1;
public int[] interleaveLeave;
public boolean stretches = false;
public int forcedPriority = 5;
public int maxLoops = 99;
public int[] field3056;
public int precedenceAnimating = -1;
public int leftHandItem = -1;
public int replyMode = 2;
public int frameStep = -1;
public int rightHandItem = -1;
public int maxLoops = 99;
public int precedenceAnimating = -1;
public int priority = -1;
public int replyMode = 2;
}

View File

@@ -26,13 +26,9 @@ package net.runelite.cache.definitions.loaders;
import net.runelite.cache.definitions.SequenceDefinition;
import net.runelite.cache.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SequenceLoader
{
private static final Logger logger = LoggerFactory.getLogger(SequenceLoader.class);
public SequenceDefinition load(int id, byte[] b)
{
SequenceDefinition def = new SequenceDefinition(id);
@@ -129,26 +125,26 @@ public class SequenceLoader
else if (opcode == 12)
{
var3 = stream.readUnsignedByte();
def.field3048 = new int[var3];
def.chatFrameIds = new int[var3];
for (var4 = 0; var4 < var3; ++var4)
{
def.field3048[var4] = stream.readUnsignedShort();
def.chatFrameIds[var4] = stream.readUnsignedShort();
}
for (var4 = 0; var4 < var3; ++var4)
{
def.field3048[var4] += stream.readUnsignedShort() << 16;
def.chatFrameIds[var4] += stream.readUnsignedShort() << 16;
}
}
else if (opcode == 13)
{
var3 = stream.readUnsignedByte();
def.field3056 = new int[var3];
def.frameSounds = new int[var3];
for (var4 = 0; var4 < var3; ++var4)
{
def.field3056[var4] = stream.read24BitInt();
def.frameSounds[var4] = stream.read24BitInt();
}
}

View File

@@ -31,6 +31,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import javax.inject.Inject;
import net.runelite.http.api.RuneLiteAPI;
import okhttp3.CacheControl;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
@@ -60,6 +61,7 @@ public class WorldClient
Request request = new Request.Builder()
.url(url)
.cacheControl(CacheControl.FORCE_NETWORK)
.build();
try (Response response = client.newCall(request).execute())
@@ -78,4 +80,4 @@ public class WorldClient
throw new IOException(ex);
}
}
}
}

View File

@@ -1180,8 +1180,9 @@ public class WidgetID
static class Lms
{
static final int INFO = 2;
static final int INFO = 3;
}
static class LmsKDA
{
static final int INFO = 4;
@@ -1213,4 +1214,4 @@ public class WidgetID
{
static final int CONTAINER = 0;
}
}
}

View File

@@ -46,6 +46,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();
@@ -145,4 +146,9 @@ public class RuneLiteProperties
String pluginPath = properties.getProperty(PLUGIN_PATH);
return pluginPath.equals("") ? null : pluginPath;
}
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

@@ -0,0 +1,44 @@
/*
* Copyright (c) 2020, Crypthead <https://github.com/Crypthead>
* 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 lombok.RequiredArgsConstructor;
import lombok.Getter;
@Getter
@RequiredArgsConstructor
public enum TooltipPositionType
{
ABOVE_CURSOR("Above cursor"),
UNDER_CURSOR("Under cursor");
private final String type;
@Override
public String toString()
{
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

@@ -154,8 +154,10 @@ class ExternalPluginManager
{
for (String keyval : openOSRSConfig.getExternalRepositories().split(";"))
{
String[] repository = keyval.split(":", 2);
repositories.add(new DefaultUpdateRepository(repository[0], new URL(repository[1])));
String id = keyval.substring(0, keyval.lastIndexOf(":https"));
String url = keyval.substring(keyval.lastIndexOf("https"));
repositories.add(new DefaultUpdateRepository(id, new URL(url)));
}
}
catch (MalformedURLException e)
@@ -170,7 +172,7 @@ class ExternalPluginManager
{
try
{
DefaultUpdateRepository respository = new DefaultUpdateRepository(owner, toRepositoryUrl(owner, name));
DefaultUpdateRepository respository = new DefaultUpdateRepository(owner + toRepositoryUrl(owner, name), toRepositoryUrl(owner, name));
updateManager.addRepository(respository);
saveConfig();
}

View File

@@ -110,4 +110,8 @@ public abstract class Plugin implements Module, ExtensionPoint
private final EventScheduler subscribe;
private final EventScheduler observe;
}
public void resetConfiguration()
{
}
}

View File

@@ -48,8 +48,6 @@ public @interface PluginDescriptor
*/
String[] tags() default {};
boolean enabledByDefault() default true;
/**
* Whether or not plugin is hidden from configuration panel
*/

View File

@@ -466,8 +466,7 @@ public class PluginManager
return Boolean.parseBoolean(value);
}
final PluginDescriptor pluginDescriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
return pluginDescriptor == null || pluginDescriptor.enabledByDefault();
return true;
}
@SuppressWarnings("unchecked")

View File

@@ -0,0 +1,81 @@
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* 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.plugins.animations;
import java.io.IOException;
import java.util.HashMap;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.NPC;
import net.runelite.api.events.AnimationChanged;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.http.api.animation.AnimationsClient;
import org.apache.commons.lang3.ArrayUtils;
@PluginDescriptor(
name = "Animations",
hidden = true
)
@Slf4j
public class AnimationsPlugin extends Plugin
{
private final AnimationsClient animationsClient = new AnimationsClient();
private HashMap<Integer, int[]> animations;
@Inject
private Client client;
{
try
{
animations = animationsClient.get();
}
catch (IOException e)
{
e.printStackTrace();
}
}
@Subscribe
private void onAnimationChanged(AnimationChanged event)
{
if (event.getActor() instanceof NPC)
{
if (event.getActor().getAnimation() != -1)
{
if (ArrayUtils.contains(animations.get(((NPC) event.getActor()).getId()), event.getActor().getAnimation()))
{
return;
}
int[] newAnimations = ArrayUtils.add(animations.get(((NPC) event.getActor()).getId()), event.getActor().getAnimation());
animations.put(((NPC) event.getActor()).getId(), newAnimations);
animationsClient.submit(((NPC) event.getActor()).getId(), event.getActor().getAnimation());
}
}
}
}

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

@@ -111,7 +111,7 @@ public class PluginManagerPanel extends PluginPanel
private final JPanel repositoriesPanel = new JPanel();
private final JPanel installedPluginsPanel = new JPanel(new GridBagLayout());
private final JPanel availablePluginsPanel = new JPanel(new GridBagLayout());
private String filterMode = "Available plugins (All)";
private String filterMode = "Available plugins";
private int scrollBarPosition;
private JScrollBar scrollbar;
private Set<String> deps;
@@ -238,58 +238,31 @@ public class PluginManagerPanel extends PluginPanel
JRadioButton installed = new JRadioButton("Installed");
installed.setSelected(filterMode.contains("Installed"));
List<UpdateRepository> updateRepositories = externalPluginManager.getRepositories();
List<JRadioButton> authors = new ArrayList<>();
JRadioButton allPlugins = new JRadioButton("All");
allPlugins.setSelected(filterMode.contains("All"));
authors.add(allPlugins);
for (UpdateRepository repository : updateRepositories)
{
JRadioButton author = new JRadioButton(repository.getId());
author.setSelected(filterMode.contains(repository.getId()));
author.addActionListener(ev -> {
filterMode = filterMode.contains("Installed") ? "Installed plugins (" + repository.getId() + ")" : "Available plugins (" + repository.getId() + ")";
onSearchBarChanged();
buildPanel();
});
authors.add(author);
}
repositories.addActionListener(ev -> {
filterMode = "Repositories";
buildPanel();
});
plugins.addActionListener(ev -> {
filterMode = "Available plugins (All)";
filterMode = "Available plugins";
onSearchBarChanged();
buildPanel();
});
available.addActionListener(ev -> {
filterMode = "Available plugins (All)";
filterMode = "Available plugins";
onSearchBarChanged();
buildPanel();
});
installed.addActionListener(ev -> {
filterMode = "Installed plugins (All)";
onSearchBarChanged();
buildPanel();
});
allPlugins.addActionListener(ev -> {
filterMode = filterMode.contains("Installed") ? "Installed plugins (All)" : "Available plugins (All)";
filterMode = "Installed plugins";
onSearchBarChanged();
buildPanel();
});
RadioButtonPanel mainRadioPanel = new RadioButtonPanel("Show", repositories, plugins);
RadioButtonPanel pluginRadioPanel = new RadioButtonPanel("Plugins", available, installed);
RadioButtonPanel authorRadioPanel = new RadioButtonPanel("Author", authors.toArray(new JRadioButton[0]));
filterPanel.add(mainRadioPanel, BorderLayout.NORTH);
@@ -297,10 +270,6 @@ public class PluginManagerPanel extends PluginPanel
{
filterPanel.add(pluginRadioPanel, BorderLayout.CENTER);
}
if (!filterMode.equals("Repositories") && updateRepositories.size() > 1)
{
filterPanel.add(authorRadioPanel, BorderLayout.SOUTH);
}
return filterPanel;
}
@@ -351,8 +320,8 @@ public class PluginManagerPanel extends PluginPanel
JTextField owner = new JTextField();
JTextField name = new JTextField();
Object[] message = {
"Repository owner:", owner,
"Repository name:", name
"Github Repository owner:", owner,
"Github Repository name:", name
};
int option = JOptionPane.showConfirmDialog(null, message, "Add repository", JOptionPane.OK_CANCEL_OPTION);
@@ -560,7 +529,7 @@ public class PluginManagerPanel extends PluginPanel
JPanel installedPluginsContainer = new JPanel();
installedPluginsContainer.setLayout(new BorderLayout(0, 5));
installedPluginsContainer.setBorder(new EmptyBorder(0, 10, 10, 10));
installedPluginsContainer.add(titleLabel(filterMode.replace(" (All)", "")), BorderLayout.NORTH);
installedPluginsContainer.add(titleLabel(filterMode), BorderLayout.NORTH);
installedPluginsContainer.add(searchBar, BorderLayout.CENTER);
installedPluginsContainer.add(installedPluginsPanel, BorderLayout.SOUTH);
@@ -572,7 +541,7 @@ public class PluginManagerPanel extends PluginPanel
JPanel availablePluginsContainer = new JPanel();
availablePluginsContainer.setLayout(new BorderLayout(0, 5));
availablePluginsContainer.setBorder(new EmptyBorder(0, 10, 10, 10));
availablePluginsContainer.add(titleLabel(filterMode.replace(" (All)", "")), BorderLayout.NORTH);
availablePluginsContainer.add(titleLabel(filterMode), BorderLayout.NORTH);
availablePluginsContainer.add(searchBar, BorderLayout.CENTER);
availablePluginsContainer.add(availablePluginsPanel, BorderLayout.SOUTH);
@@ -587,7 +556,7 @@ public class PluginManagerPanel extends PluginPanel
for (UpdateRepository repository : externalPluginManager.getRepositories())
{
String name = repository.getId();
String name = repository.getId().replace(repository.getUrl().toString(), "");
ExternalBox repositoryBox = new ExternalBox(name, repository.getUrl());
c.fill = GridBagConstraints.HORIZONTAL;
@@ -610,7 +579,7 @@ public class PluginManagerPanel extends PluginPanel
@Override
public void mousePressed(MouseEvent e)
{
externalPluginManager.removeRepository(name);
externalPluginManager.removeRepository(repository.getId());
repositories();
reloadPlugins();
@@ -682,8 +651,7 @@ public class PluginManagerPanel extends PluginPanel
for (PluginInfo pluginInfo : installedPluginsList)
{
if ((!search.equals("") && mismatchesSearchTerms(search, pluginInfo)) ||
(!filterMode.contains("All") && !filterMode.contains(pluginInfo.getRepositoryId())))
if (!search.equals("") && mismatchesSearchTerms(search, pluginInfo))
{
continue;
}
@@ -717,8 +685,7 @@ public class PluginManagerPanel extends PluginPanel
for (PluginInfo pluginInfo : availablePluginsList)
{
if ((!search.equals("") && mismatchesSearchTerms(search, pluginInfo)) ||
(!filterMode.contains("All") && !filterMode.contains(pluginInfo.getRepositoryId())))
if (!search.equals("") && mismatchesSearchTerms(search, pluginInfo))
{
continue;
}

View File

@@ -0,0 +1,77 @@
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* 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.plugins.sounds;
import java.io.IOException;
import java.util.HashMap;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.events.SoundEffectPlayed;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.http.api.sounds.SoundsClient;
import org.apache.commons.lang3.ArrayUtils;
@PluginDescriptor(
name = "Sounds",
hidden = true
)
@Slf4j
public class SoundsPlugin extends Plugin
{
private final SoundsClient soundsClient = new SoundsClient();
private HashMap<Integer, int[]> sounds;
@Inject
private Client client;
{
try
{
sounds = soundsClient.get();
}
catch (IOException e)
{
e.printStackTrace();
}
}
@Subscribe
private void onSoundEffectPlayed(SoundEffectPlayed event)
{
if (event.getNpcid() != -1)
{
if (ArrayUtils.contains(sounds.get(event.getNpcid()), event.getSoundId()))
{
return;
}
int[] newSounds = ArrayUtils.add(sounds.get(event.getNpcid()), event.getSoundId());
sounds.put(event.getNpcid(), newSounds);
soundsClient.submit(event.getNpcid(), event.getSoundId());
}
}
}

View File

@@ -0,0 +1,97 @@
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* 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.plugins.xtea;
import java.io.IOException;
import java.util.HashMap;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.events.GameStateChanged;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.http.api.xtea.XteaClient;
@PluginDescriptor(
name = "Xtea",
hidden = true
)
@Slf4j
public class XteaPlugin extends Plugin
{
private final XteaClient xteaClient = new XteaClient();
private HashMap<Integer, int[]> xteas;
{
try
{
xteas = xteaClient.get();
}
catch (IOException e)
{
e.printStackTrace();
}
}
@Inject
private Client client;
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged)
{
if (gameStateChanged.getGameState() != GameState.LOGGED_IN)
{
return;
}
int[] regions = client.getMapRegions();
int[][] xteaKeys = client.getXteaKeys();
for (int idx = 0; idx < regions.length; ++idx)
{
int region = regions[idx];
int[] keys = xteaKeys[idx];
if (xteas.get(region) != null)
{
continue;
}
xteas.put(region, keys);
log.debug("Region {} keys {}, {}, {}, {}", region, keys[0], keys[1], keys[2], keys[3]);
//Don't post non encrypted regions
if (keys[0] == 0 && keys[1] == 0 && keys[2] == 0 && keys[3] == 0)
{
continue;
}
xteaClient.submit(region, keys);
}
}
}

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

@@ -0,0 +1,33 @@
/*
* 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;
public enum ImageUploadStyle
{
NEITHER,
IMGUR,
CLIPBOARD
}

View File

@@ -0,0 +1,68 @@
/*
* Copyright (c) 2019, Alexsuperfly <https://github.com/Alexsuperfly>
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* 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 HOLDER 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.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.image.BufferedImage;
import lombok.AllArgsConstructor;
import lombok.NonNull;
import org.jetbrains.annotations.NotNull;
@AllArgsConstructor
class TransferableBufferedImage implements Transferable
{
@NonNull
private final BufferedImage image;
@NotNull
@Override
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException
{
if (flavor.equals(DataFlavor.imageFlavor))
{
return image;
}
else
{
throw new UnsupportedFlavorException(flavor);
}
}
@Override
public DataFlavor[] getTransferDataFlavors()
{
return new DataFlavor[]{DataFlavor.imageFlavor};
}
@Override
public boolean isDataFlavorSupported(DataFlavor flavor)
{
return flavor.equals(DataFlavor.imageFlavor);
}
}

File diff suppressed because one or more lines are too long

View File

@@ -13,3 +13,4 @@ runelite.wiki.building.link=https://github.com/open-osrs/runelite/wiki/Building-
runelite.dnschange.link=https://1.1.1.1/dns/
launcher.version=@launcher.version@
plugin.path=@plugin.path@
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