Skip to content

Commit

Permalink
Gazivodag master (open-osrs#10)
Browse files Browse the repository at this point in the history
* Transform objects now use an interface

* Plugins can now accept colors (not my code)

* mixins: renderWidgetLayer: skip hidden widgets

* World Map: Identify Both Shield of Arrav Quest Start Points (#8442)

Closes #8437

* widgetitem: associate Widget with WidgetItem

* widgetitem overlay: allow configuring which interfaces to overlay

Update overlays to behave consistent with how they behaved before
removal of query api, with the exception of adding the rune pouch
overlay to the bank.

* Update .gitignore

* Revert "Adding external plugin support (open-osrs#4)"

This reverts commit bfe1482

* Update QuestStartLocation.java

* Revert "Plugins update (open-osrs#7)"

This reverts commit 216f7d9

* Adding external plugin support (open-osrs#4)

* Adding archetype

* Update RuneLiteConfig.java

* Update Plugin.java

* Update PluginManager.java

* Adding pluginwatcher & classloader

* Update RuneLite.java

* Update pom.xml

* Update settings.xml

* Update pom.xml

* Update pom.xml

* Removing old example plugin

* Fixing the fix of the fix for plugin archetype.

(cherry picked from commit bfe1482)

* Plugins can now accept colors (not my code)

(cherry picked from commit 8e094f7)

* Update MenuEntrySwapperConfig.java
  • Loading branch information
zeruth committed Apr 19, 2019
1 parent 7a49aa1 commit c946897
Show file tree
Hide file tree
Showing 13 changed files with 415 additions and 365 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ project.properties
.idea/
.project
.settings/
.classpath
.classpath
runelite-client/src/main/resources/META-INF/MANIFEST.MF
git
classes/artifacts/client_jar/run.bat
classes/artifacts/client_jar/client.jar
48 changes: 14 additions & 34 deletions runelite-api/src/main/java/net/runelite/api/widgets/WidgetItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import java.awt.Rectangle;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
import net.runelite.api.Point;

Expand All @@ -34,55 +35,34 @@
*/
@AllArgsConstructor
@ToString
@Getter
public class WidgetItem
{
private final int id;
private final int quantity;
private final int index;
private final Rectangle canvasBounds;

/**
* Gets the ID of the item represented.
* The ID of the item represented.
*
* @return the items ID
* @see net.runelite.api.ItemID
*/
public int getId()
{
return id;
}

private final int id;
/**
* Gets the quantity of the represented item.
*
* @return the items quantity
* The quantity of the represented item.
*/
public int getQuantity()
{
return quantity;
}

private final int quantity;
/**
* Gets the index position of this WidgetItem inside its parents
* The index position of this WidgetItem inside its parents
* WidgetItem array.
*
* @return the index in the parent widget
* @see Widget#getWidgetItems()
*/
public int getIndex()
{
return index;
}

private final int index;
/**
* Gets the area where the widget is drawn on the canvas.
*
* @return the occupied area of the widget
* The area where the widget is drawn on the canvas.
*/
public Rectangle getCanvasBounds()
{
return canvasBounds;
}
private final Rectangle canvasBounds;
/**
* The widget which contains this item.
*/
private final Widget widget;

/**
* Gets the upper-left coordinate of where the widget is being drawn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public class ConfigPanel extends PluginPanel
}

ConfigPanel(PluginManager pluginManager, ConfigManager configManager, ScheduledExecutorService executorService,
RuneLiteConfig runeLiteConfig, ChatColorConfig chatColorConfig)
RuneLiteConfig runeLiteConfig, ChatColorConfig chatColorConfig)
{
super(false);
this.pluginManager = pluginManager;
Expand Down Expand Up @@ -195,28 +195,28 @@ private void initializePluginList()

// populate pluginList with all non-hidden plugins
pluginManager.getPlugins().stream()
.filter(plugin -> !plugin.getClass().getAnnotation(PluginDescriptor.class).hidden())
.forEach(plugin ->
{
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
final Config config = pluginManager.getPluginConfigProxy(plugin);
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
.filter(plugin -> !plugin.getClass().getAnnotation(PluginDescriptor.class).hidden())
.forEach(plugin ->
{
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
final Config config = pluginManager.getPluginConfigProxy(plugin);
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);

final PluginListItem listItem = new PluginListItem(this, plugin, descriptor, config, configDescriptor);
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
pluginList.add(listItem);
});
final PluginListItem listItem = new PluginListItem(this, plugin, descriptor, config, configDescriptor);
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
pluginList.add(listItem);
});

// add special entries for core client configurations
final PluginListItem runeLite = new PluginListItem(this, runeLiteConfig,
configManager.getConfigDescriptor(runeLiteConfig),
RUNELITE_PLUGIN, "RuneLite client settings", "client");
configManager.getConfigDescriptor(runeLiteConfig),
RUNELITE_PLUGIN, "RuneLite client settings", "client");
runeLite.setPinned(pinnedPlugins.contains(RUNELITE_PLUGIN));
pluginList.add(runeLite);

final PluginListItem chatColor = new PluginListItem(this, chatColorConfig,
configManager.getConfigDescriptor(chatColorConfig),
CHAT_COLOR_PLUGIN, "Recolor chat text", "colour", "messages");
configManager.getConfigDescriptor(chatColorConfig),
CHAT_COLOR_PLUGIN, "Recolor chat text", "colour", "messages");
chatColor.setPinned(pinnedPlugins.contains(CHAT_COLOR_PLUGIN));
pluginList.add(chatColor);

Expand Down Expand Up @@ -421,7 +421,7 @@ public void focusLost(FocusEvent e)
public void mouseClicked(MouseEvent e)
{
RuneliteColorPicker colorPicker = new RuneliteColorPicker(SwingUtilities.windowForComponent(ConfigPanel.this),
colorPickerBtn.getBackground(), cid.getItem().name(), cid.getAlpha() == null);
colorPickerBtn.getBackground(), cid.getItem().name(), cid.getAlpha() == null);
colorPicker.setLocation(getLocationOnScreen());
colorPicker.setOnColorChange(c ->
{
Expand Down Expand Up @@ -467,7 +467,7 @@ public void windowClosing(WindowEvent e)
heightSpinnerTextField.setColumns(4);

ChangeListener listener = e ->
configManager.setConfiguration(cd.getGroup().value(), cid.getItem().keyName(), widthSpinner.getValue() + "x" + heightSpinner.getValue());
configManager.setConfiguration(cd.getGroup().value(), cid.getItem().keyName(), widthSpinner.getValue() + "x" + heightSpinner.getValue());

widthSpinner.addChangeListener(listener);
heightSpinner.addChangeListener(listener);
Expand Down Expand Up @@ -512,8 +512,8 @@ public void windowClosing(WindowEvent e)
if (cid.getType() == Keybind.class || cid.getType() == ModifierlessKeybind.class)
{
Keybind startingValue = configManager.getConfiguration(cd.getGroup().value(),
cid.getItem().keyName(),
(Class<? extends Keybind>) cid.getType());
cid.getItem().keyName(),
(Class<? extends Keybind>) cid.getType());

HotkeyButton button = new HotkeyButton(startingValue, cid.getType() == ModifierlessKeybind.class);

Expand All @@ -536,8 +536,8 @@ public void focusLost(FocusEvent e)
resetButton.addActionListener((e) ->
{
final int result = JOptionPane.showOptionDialog(resetButton, "Are you sure you want to reset this plugin's configuration?",
"Are you sure?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE,
null, new String[]{"Yes", "No"}, "No");
"Are you sure?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE,
null, new String[]{"Yes", "No"}, "No");

if (result == JOptionPane.YES_OPTION)
{
Expand All @@ -564,8 +564,8 @@ private void changeConfiguration(PluginListItem listItem, Config config, Compone
if (!Strings.isNullOrEmpty(configItem.warning()))
{
final int result = JOptionPane.showOptionDialog(component, configItem.warning(),
"Are you sure?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE,
null, new String[]{"Yes", "No"}, "No");
"Are you sure?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE,
null, new String[]{"Yes", "No"}, "No");

if (result != JOptionPane.YES_OPTION)
{
Expand Down Expand Up @@ -659,9 +659,9 @@ private List<String> getPinnedPluginNames()
void savePinnedPlugins()
{
final String value = pluginList.stream()
.filter(PluginListItem::isPinned)
.map(PluginListItem::getName)
.collect(Collectors.joining(","));
.filter(PluginListItem::isPinned)
.map(PluginListItem::getName)
.collect(Collectors.joining(","));

configManager.setConfiguration(RUNELITE_GROUP_NAME, PINNED_PLUGINS_CONFIG_KEY, value);
}
Expand Down Expand Up @@ -704,4 +704,4 @@ public Dimension getPreferredSize()
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@ class PluginListItem extends JPanel
ON_STAR = new ImageIcon(onStar);
CONFIG_ICON_HOVER = new ImageIcon(ImageUtil.grayscaleOffset(configIcon, -100));
BufferedImage offSwitcherImage = ImageUtil.flipImage(
ImageUtil.grayscaleOffset(
ImageUtil.grayscaleImage(onSwitcher),
0.61f
),
true,
false
ImageUtil.grayscaleOffset(
ImageUtil.grayscaleImage(onSwitcher),
0.61f
),
true,
false
);
OFF_SWITCHER = new ImageIcon(offSwitcherImage);
BufferedImage offStar = ImageUtil.grayscaleOffset(
ImageUtil.grayscaleImage(onStar),
0.77f
ImageUtil.grayscaleImage(onStar),
0.77f
);
OFF_STAR = new ImageIcon(offStar);
}
Expand All @@ -121,23 +121,23 @@ class PluginListItem extends JPanel
* if there is no configuration associated with the plugin.
*/
PluginListItem(ConfigPanel configPanel, Plugin plugin, PluginDescriptor descriptor,
@Nullable Config config, @Nullable ConfigDescriptor configDescriptor)
@Nullable Config config, @Nullable ConfigDescriptor configDescriptor)
{
this(configPanel, plugin, config, configDescriptor,
descriptor.name(), descriptor.description(), descriptor.tags());
descriptor.name(), descriptor.description(), descriptor.tags());
}

/**
* Creates a new {@code PluginListItem} for a core configuration.
*/
PluginListItem(ConfigPanel configPanel, Config config, ConfigDescriptor configDescriptor,
String name, String description, String... tags)
String name, String description, String... tags)
{
this(configPanel, null, config, configDescriptor, name, description, tags);
}

private PluginListItem(ConfigPanel configPanel, @Nullable Plugin plugin, @Nullable Config config,
@Nullable ConfigDescriptor configDescriptor, String name, String description, String... tags)
@Nullable ConfigDescriptor configDescriptor, String name, String description, String... tags)
{
this.configPanel = configPanel;
this.plugin = plugin;
Expand Down Expand Up @@ -260,7 +260,7 @@ boolean matchesSearchTerms(String[] searchTerms)
for (String term : searchTerms)
{
if (keywords.stream().noneMatch((t) -> t.contains(term) ||
DISTANCE.apply(t, term) > 0.9))
DISTANCE.apply(t, term) > 0.9))
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ private InventoryTagsOverlay(ItemManager itemManager, InventoryTagsPlugin plugin
{
this.itemManager = itemManager;
this.plugin = plugin;
showOnEquipment();
showOnInventory();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class ItemChargeOverlay extends WidgetItemOverlay
{
this.itemChargePlugin = itemChargePlugin;
this.config = config;
showOnInventory();
showOnEquipment();
}

@Override
Expand Down

0 comments on commit c946897

Please sign in to comment.