Search in sources :

Example 56 with Widget

use of net.runelite.api.widgets.Widget in project runelite by runelite.

the class XpDropPlugin method onWidgetHidden.

@Subscribe
public void onWidgetHidden(WidgetHiddenChanged event) {
    Widget widget = event.getWidget();
    int group = WidgetInfo.TO_GROUP(widget.getId());
    if (group != WidgetID.EXPERIENCE_DROP_GROUP_ID) {
        return;
    }
    if (widget.isHidden()) {
        return;
    }
    if (config.hideSkillIcons() && widget.getSpriteId() > 0) {
        widget.setHidden(true);
        return;
    }
    PrayerType prayer = getActivePrayerType();
    if (prayer == null) {
        resetTextColor(widget);
        return;
    }
    String text = widget.getText();
    if (text != null) {
        switch(prayer) {
            case MELEE:
                widget.setTextColor(config.getMeleePrayerColor().getRGB());
                break;
            case RANGE:
                widget.setTextColor(config.getRangePrayerColor().getRGB());
                break;
            case MAGIC:
                widget.setTextColor(config.getMagePrayerColor().getRGB());
                break;
        }
    }
}
Also used : Widget(net.runelite.api.widgets.Widget) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

Widget (net.runelite.api.widgets.Widget)56 Rectangle (java.awt.Rectangle)10 WidgetItem (net.runelite.api.widgets.WidgetItem)10 ArrayList (java.util.ArrayList)9 Subscribe (com.google.common.eventbus.Subscribe)7 Inject (net.runelite.api.mixins.Inject)6 RSWidget (net.runelite.rs.api.RSWidget)6 Point (net.runelite.api.Point)5 WidgetHiddenChanged (net.runelite.api.events.WidgetHiddenChanged)5 PanelComponent (net.runelite.client.ui.overlay.components.PanelComponent)5 Test (org.junit.Test)5 FontMetrics (java.awt.FontMetrics)4 Rectangle2D (java.awt.geom.Rectangle2D)4 Consumer (java.util.function.Consumer)4 LocalPoint (net.runelite.api.coords.LocalPoint)4 ItemComposition (net.runelite.api.ItemComposition)3 WidgetInfo (net.runelite.api.widgets.WidgetInfo)3 Color (java.awt.Color)2 BufferedImage (java.awt.image.BufferedImage)2 Matcher (java.util.regex.Matcher)2