upstream
This commit is contained in:
@@ -41,6 +41,7 @@ public final class AnimationID
|
||||
public static final int WOODCUTTING_MITHRIL = 871;
|
||||
public static final int WOODCUTTING_ADAMANT = 869;
|
||||
public static final int WOODCUTTING_RUNE = 867;
|
||||
public static final int WOODCUTTING_GILDED = 8303;
|
||||
public static final int WOODCUTTING_DRAGON = 2846;
|
||||
public static final int WOODCUTTING_INFERNAL = 2117;
|
||||
public static final int WOODCUTTING_3A_AXE = 7264;
|
||||
@@ -112,6 +113,14 @@ public final class AnimationID
|
||||
public static final int FISHING_CRUSHING_INFERNAL_EELS = 7553;
|
||||
public static final int FISHING_CUTTING_SACRED_EELS = 7151;
|
||||
public static final int FISHING_BAREHAND = 6709;
|
||||
public static final int FISHING_BAREHAND_WINDUP_1 = 6703;
|
||||
public static final int FISHING_BAREHAND_WINDUP_2 = 6704;
|
||||
public static final int FISHING_BAREHAND_CAUGHT_SHARK_1 = 6705;
|
||||
public static final int FISHING_BAREHAND_CAUGHT_SHARK_2 = 6706;
|
||||
public static final int FISHING_BAREHAND_CAUGHT_SWORDFISH_1 = 6707;
|
||||
public static final int FISHING_BAREHAND_CAUGHT_SWORDFISH_2 = 6708;
|
||||
public static final int FISHING_BAREHAND_CAUGHT_TUNA_1 = 6710;
|
||||
public static final int FISHING_BAREHAND_CAUGHT_TUNA_2 = 6711;
|
||||
public static final int MINING_BRONZE_PICKAXE = 625;
|
||||
public static final int MINING_IRON_PICKAXE = 626;
|
||||
public static final int MINING_STEEL_PICKAXE = 627;
|
||||
@@ -119,6 +128,7 @@ public final class AnimationID
|
||||
public static final int MINING_MITHRIL_PICKAXE = 629;
|
||||
public static final int MINING_ADAMANT_PICKAXE = 628;
|
||||
public static final int MINING_RUNE_PICKAXE = 624;
|
||||
public static final int MINING_GILDED_PICKAXE = 8313;
|
||||
public static final int MINING_DRAGON_PICKAXE = 7139;
|
||||
public static final int MINING_DRAGON_PICKAXE_UPGRADED = 642;
|
||||
public static final int MINING_DRAGON_PICKAXE_OR = 8346;
|
||||
@@ -132,6 +142,7 @@ public final class AnimationID
|
||||
public static final int MINING_MOTHERLODE_MITHRIL = 6757;
|
||||
public static final int MINING_MOTHERLODE_ADAMANT = 6756;
|
||||
public static final int MINING_MOTHERLODE_RUNE = 6752;
|
||||
public static final int MINING_MOTHERLODE_GILDED = 8312;
|
||||
public static final int MINING_MOTHERLODE_DRAGON = 6758;
|
||||
public static final int MINING_MOTHERLODE_DRAGON_UPGRADED = 335;
|
||||
public static final int MINING_MOTHERLODE_DRAGON_OR = 8344;
|
||||
|
||||
@@ -259,6 +259,12 @@ public final class ScriptID
|
||||
@ScriptArguments(integer = 15)
|
||||
public static final int GE_OFFERS_SETUP_BUILD = 779;
|
||||
|
||||
/**
|
||||
* Builds the grand exchange item search widget
|
||||
*/
|
||||
@ScriptArguments(integer = 2)
|
||||
public static final int GE_ITEM_SEARCH = 752;
|
||||
|
||||
/**
|
||||
* Builds the quest list inside the quest tab that shows each quest's progress
|
||||
*/
|
||||
|
||||
@@ -62,7 +62,33 @@ public final class SoundEffectID
|
||||
public final static int ZERO_DAMAGE_SPLAT = 511;
|
||||
public final static int TAKE_DAMAGE_SPLAT = 510;
|
||||
public final static int ATTACK_HIT = 2498;
|
||||
public final static int PRAYER_ACTIVATE_VROOM = 2690;
|
||||
|
||||
public final static int PRAYER_ACTIVATE_THICK_SKIN = 2690;
|
||||
public final static int PRAYER_ACTIVATE_BURST_OF_STRENGTH = 2688;
|
||||
public final static int PRAYER_ACTIVATE_CLARITY_OF_THOUGHT = 2664;
|
||||
public final static int PRAYER_ACTIVATE_SHARP_EYE_RIGOUR = 2685;
|
||||
public final static int PRAYER_ACTIVATE_MYSTIC_WILL_AUGURY = 2670;
|
||||
public final static int PRAYER_ACTIVATE_ROCK_SKIN = 2684;
|
||||
public final static int PRAYER_ACTIVATE_SUPERHUMAN_STRENGTH = 2689;
|
||||
public final static int PRAYER_ACTIVATE_IMPROVED_REFLEXES = 2662;
|
||||
public final static int PRAYER_ACTIVATE_RAPID_RESTORE_PRESERVE = 2679;
|
||||
public final static int PRAYER_ACTIVATE_RAPID_HEAL = 2678;
|
||||
public final static int PRAYER_ACTIVATE_PROTECT_ITEM = 1982;
|
||||
public final static int PRAYER_ACTIVATE_HAWK_EYE = 2666;
|
||||
public final static int PRAYER_ACTIVATE_MYSTIC_LORE = 2668;
|
||||
public final static int PRAYER_ACTIVATE_STEEL_SKIN = 2687;
|
||||
public final static int PRAYER_ACTIVATE_ULTIMATE_STRENGTH = 2691;
|
||||
public final static int PRAYER_ACTIVATE_INCREDIBLE_REFLEXES = 2667;
|
||||
public final static int PRAYER_ACTIVATE_PROTECT_FROM_MAGIC = 2675;
|
||||
public final static int PRAYER_ACTIVATE_PROTECT_FROM_MISSILES = 2677;
|
||||
public final static int PRAYER_ACTIVATE_PROTECT_FROM_MELEE = 2676;
|
||||
public final static int PRAYER_ACTIVATE_EAGLE_EYE = 2665;
|
||||
public final static int PRAYER_ACTIVATE_MYSTIC_MIGHT = 2669;
|
||||
public final static int PRAYER_ACTIVATE_RETRIBUTION = 2682;
|
||||
public final static int PRAYER_ACTIVATE_REDEMPTION = 2680;
|
||||
public final static int PRAYER_ACTIVATE_SMITE = 2686;
|
||||
public final static int PRAYER_ACTIVATE_CHIVALRY = 3826;
|
||||
public final static int PRAYER_ACTIVATE_PIETY = 3825;
|
||||
public final static int PRAYER_DEACTIVE_VWOOP = 2663;
|
||||
public final static int PRAYER_DEPLETE_TWINKLE = 2672;
|
||||
|
||||
|
||||
@@ -435,6 +435,7 @@ public class WidgetID
|
||||
static final int HEALTH_ORB = 2;
|
||||
static final int PRAYER_ORB = 12;
|
||||
static final int QUICK_PRAYER_ORB = 14; // Has the "Quick-prayers" name
|
||||
static final int PRAYER_ORB_TEXT = 15;
|
||||
static final int RUN_ORB = 20;
|
||||
static final int TOGGLE_RUN_ORB = 22; // Has the "Toggle run" name
|
||||
static final int RUN_ORB_TEXT = 23;
|
||||
@@ -582,6 +583,7 @@ public class WidgetID
|
||||
static final int CONTAINER = 40;
|
||||
static final int TITLE = 44;
|
||||
static final int FULL_INPUT = 45;
|
||||
static final int GE_SEARCH_RESULTS = 53;
|
||||
static final int MESSAGES = 55;
|
||||
static final int TRANSPARENT_BACKGROUND_LINES = 56;
|
||||
static final int INPUT = 57;
|
||||
|
||||
@@ -216,6 +216,7 @@ public enum WidgetInfo
|
||||
MINIMAP_XP_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.XP_ORB),
|
||||
MINIMAP_PRAYER_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.PRAYER_ORB),
|
||||
MINIMAP_QUICK_PRAYER_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.QUICK_PRAYER_ORB),
|
||||
MINIMAP_PRAYER_ORB_TEXT(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.PRAYER_ORB_TEXT),
|
||||
MINIMAP_RUN_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.RUN_ORB),
|
||||
MINIMAP_TOGGLE_RUN_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.TOGGLE_RUN_ORB),
|
||||
MINIMAP_RUN_ORB_TEXT(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.RUN_ORB_TEXT),
|
||||
@@ -428,6 +429,7 @@ public enum WidgetInfo
|
||||
CHATBOX_BUTTONS(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.BUTTONS),
|
||||
CHATBOX_TITLE(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.TITLE),
|
||||
CHATBOX_FULL_INPUT(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.FULL_INPUT),
|
||||
CHATBOX_GE_SEARCH_RESULTS(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.GE_SEARCH_RESULTS),
|
||||
CHATBOX_CONTAINER(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.CONTAINER),
|
||||
CHATBOX_REPORT_TEXT(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.REPORT_TEXT),
|
||||
CHATBOX_INPUT(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.INPUT),
|
||||
|
||||
@@ -103,6 +103,10 @@ public class Notifier
|
||||
|
||||
private static final String appName = RuneLiteProperties.getTitle();
|
||||
|
||||
private static final File NOTIFICATION_FILE = new File(RuneLite.RUNELITE_DIR, "notification.wav");
|
||||
private static final long CLIP_MTIME_UNLOADED = -2;
|
||||
private static final long CLIP_MTIME_BUILTIN = -1;
|
||||
|
||||
private final Client client;
|
||||
private final RuneLiteConfig runeLiteConfig;
|
||||
private final ClientUI clientUI;
|
||||
@@ -113,6 +117,8 @@ public class Notifier
|
||||
private final boolean terminalNotifierAvailable;
|
||||
private Instant flashStart;
|
||||
private long mouseLastPressedMillis;
|
||||
private long lastClipMTime = CLIP_MTIME_UNLOADED;
|
||||
private Clip clip = null;
|
||||
|
||||
@Inject
|
||||
private Notifier(
|
||||
@@ -405,47 +411,73 @@ public class Notifier
|
||||
}
|
||||
}
|
||||
|
||||
private void playCustomSound()
|
||||
private synchronized void playCustomSound()
|
||||
{
|
||||
Clip clip = null;
|
||||
|
||||
// Try to load the user sound from ~/.runelite/notification.wav
|
||||
File file = new File(RuneLite.RUNELITE_DIR, "notification.wav");
|
||||
if (file.exists())
|
||||
long currentMTime = NOTIFICATION_FILE.exists() ? NOTIFICATION_FILE.lastModified() : CLIP_MTIME_BUILTIN;
|
||||
if (clip == null || currentMTime != lastClipMTime || !clip.isOpen())
|
||||
{
|
||||
if (clip != null)
|
||||
{
|
||||
clip.close();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
InputStream fileStream = new BufferedInputStream(new FileInputStream(file));
|
||||
try (AudioInputStream sound = AudioSystem.getAudioInputStream(fileStream))
|
||||
{
|
||||
clip = AudioSystem.getClip();
|
||||
clip.open(sound);
|
||||
}
|
||||
}
|
||||
catch (UnsupportedAudioFileException | IOException | LineUnavailableException e)
|
||||
{
|
||||
clip = null;
|
||||
log.warn("Unable to play notification sound", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (clip == null)
|
||||
{
|
||||
// Otherwise load from the classpath
|
||||
InputStream fileStream = new BufferedInputStream(Notifier.class.getResourceAsStream("notification.wav"));
|
||||
try (AudioInputStream sound = AudioSystem.getAudioInputStream(fileStream))
|
||||
{
|
||||
clip = AudioSystem.getClip();
|
||||
clip.open(sound);
|
||||
}
|
||||
catch (UnsupportedAudioFileException | IOException | LineUnavailableException e)
|
||||
catch (LineUnavailableException e)
|
||||
{
|
||||
log.warn("Unable to play builtin notification sound", e);
|
||||
lastClipMTime = CLIP_MTIME_UNLOADED;
|
||||
log.warn("Unable to play notification", e);
|
||||
Toolkit.getDefaultToolkit().beep();
|
||||
return;
|
||||
}
|
||||
|
||||
lastClipMTime = currentMTime;
|
||||
|
||||
if (!tryLoadNotification())
|
||||
{
|
||||
Toolkit.getDefaultToolkit().beep();
|
||||
return;
|
||||
}
|
||||
}
|
||||
clip.start();
|
||||
|
||||
// Using loop instead of start + setFramePosition prevents a the clip
|
||||
// from not being played sometimes, presumably a race condition in the
|
||||
// underlying line driver
|
||||
clip.loop(1);
|
||||
}
|
||||
|
||||
private boolean tryLoadNotification()
|
||||
{
|
||||
if (NOTIFICATION_FILE.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
InputStream fileStream = new BufferedInputStream(new FileInputStream(NOTIFICATION_FILE));
|
||||
try (AudioInputStream sound = AudioSystem.getAudioInputStream(fileStream))
|
||||
{
|
||||
clip.open(sound);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (UnsupportedAudioFileException | IOException | LineUnavailableException e)
|
||||
{
|
||||
log.warn("Unable to load notification sound", e);
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise load from the classpath
|
||||
InputStream fileStream = new BufferedInputStream(Notifier.class.getResourceAsStream("notification.wav"));
|
||||
try (AudioInputStream sound = AudioSystem.getAudioInputStream(fileStream))
|
||||
{
|
||||
clip.open(sound);
|
||||
return true;
|
||||
}
|
||||
catch (UnsupportedAudioFileException | IOException | LineUnavailableException e)
|
||||
{
|
||||
log.warn("Unable to load builtin notification sound", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,7 +593,11 @@ public class ChatMessageManager
|
||||
|
||||
// Update the message with RuneLite additions
|
||||
line.setRuneLiteFormatMessage(message.getRuneLiteFormattedMessage());
|
||||
line.setTimestamp(message.getTimestamp());
|
||||
|
||||
if (message.getTimestamp() != 0)
|
||||
{
|
||||
line.setTimestamp(message.getTimestamp());
|
||||
}
|
||||
|
||||
update(line);
|
||||
}
|
||||
|
||||
@@ -225,29 +225,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
|
||||
for (Overlay overlay : overlays)
|
||||
{
|
||||
OverlayPosition overlayPosition = overlay.getPosition();
|
||||
|
||||
if (overlay.getPreferredPosition() != null)
|
||||
{
|
||||
overlayPosition = overlay.getPreferredPosition();
|
||||
}
|
||||
|
||||
if (!isResizeable)
|
||||
{
|
||||
// On fixed mode, ABOVE_CHATBOX_RIGHT is in the same location as
|
||||
// BOTTOM_RIGHT and CANVAS_TOP_RIGHT is same as TOP_RIGHT.
|
||||
// Just use BOTTOM_RIGHT and TOP_RIGHT to prevent overlays from
|
||||
// drawing over each other.
|
||||
switch (overlayPosition)
|
||||
{
|
||||
case CANVAS_TOP_RIGHT:
|
||||
overlayPosition = OverlayPosition.TOP_RIGHT;
|
||||
break;
|
||||
case ABOVE_CHATBOX_RIGHT:
|
||||
overlayPosition = OverlayPosition.BOTTOM_RIGHT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
final OverlayPosition overlayPosition = getCorrectedOverlayPosition(overlay);
|
||||
|
||||
if (overlayPosition == OverlayPosition.DYNAMIC || overlayPosition == OverlayPosition.TOOLTIP)
|
||||
{
|
||||
@@ -345,6 +323,13 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
{
|
||||
for (Overlay overlay : overlayManager.getOverlays())
|
||||
{
|
||||
final OverlayPosition overlayPosition = getCorrectedOverlayPosition(overlay);
|
||||
|
||||
if (overlayPosition == OverlayPosition.DYNAMIC || overlayPosition == OverlayPosition.TOOLTIP)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (overlay.getBounds().contains(mousePoint))
|
||||
{
|
||||
if (SwingUtilities.isRightMouseButton(mouseEvent))
|
||||
@@ -524,6 +509,35 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
overlay.getBounds().setSize(dimension);
|
||||
}
|
||||
|
||||
private OverlayPosition getCorrectedOverlayPosition(final Overlay overlay)
|
||||
{
|
||||
OverlayPosition overlayPosition = overlay.getPosition();
|
||||
|
||||
if (overlay.getPreferredPosition() != null)
|
||||
{
|
||||
overlayPosition = overlay.getPreferredPosition();
|
||||
}
|
||||
|
||||
if (!isResizeable)
|
||||
{
|
||||
// On fixed mode, ABOVE_CHATBOX_RIGHT is in the same location as
|
||||
// BOTTOM_RIGHT and CANVAS_TOP_RIGHT is same as TOP_RIGHT.
|
||||
// Just use BOTTOM_RIGHT and TOP_RIGHT to prevent overlays from
|
||||
// drawing over each other.
|
||||
switch (overlayPosition)
|
||||
{
|
||||
case CANVAS_TOP_RIGHT:
|
||||
overlayPosition = OverlayPosition.TOP_RIGHT;
|
||||
break;
|
||||
case ABOVE_CHATBOX_RIGHT:
|
||||
overlayPosition = OverlayPosition.BOTTOM_RIGHT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return overlayPosition;
|
||||
}
|
||||
|
||||
private boolean shouldInvalidateBounds()
|
||||
{
|
||||
final Widget chatbox = client.getWidget(WidgetInfo.CHATBOX);
|
||||
|
||||
@@ -476,6 +476,7 @@ public class SwingUtil
|
||||
|
||||
public static void addModalTooltip(AbstractButton button, String on, String off)
|
||||
{
|
||||
button.setToolTipText(button.isSelected() ? on : off);
|
||||
button.addItemListener(l -> button.setToolTipText(button.isSelected() ? on : off));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user