The Slayer plugin highlights target monsters based on their name rather
than NPC ID, as many common monsters (skeletons, zombies, etc.) have
nearly endless variations for different models and combat levels.
Previously, this name matching was done via a simple
`String#contains()`, which led to some incorrect matches such as pirates
being highlighted while on rat tasks and Jonny the beard being
highlighted while on bear tasks.
This commit changes matching to use regex to match string boundaries or
whitespace at either end of the task string, ensuring these substring
matches can only happen when word breaks occur. The only known existing
case where this would apply is for baby dragons and brutal dragons,
which are valid alternatives for their respective chromatic dragon
tasks.
This commit works around a bug with loading natives when the user's home
folder contains special characters such as `&`, `^` or `!`.
When Gluegen loads native libraries on Windows, it uses a temporary
directory located in `%appdata%` under the user's home directory, and
Gluegen checks whether files can be executed from this temporary
directory. To perform this check, it writes an executable to the
directory, executes it, and ensures that the return code is zero. The
executable file it writes is by default a `.bat` file, but it can be
told to write an `.exe` file instead by supplying this VM argument:
`-Djogamp.gluegen.UseNativeExeFile=true`.
The default behaviour of writing and executing a `.bat` file is broken
when the path to the temp folder contains a special character, due to a
convoluted trail of calls that leads to undefined behaviour:
- Gluegen attempts to execute the `.bat` file by calling `Runtime.exec()`:
`Runtime.exec(new String[] { "...absolute path...bat" }, null, null)`
- OpenJDK 11.0.8 passes the command to `ProcessBuilder`, which calls
`ProcessImpl.start(...)`, which creates a new `ProcessImpl` instance.
- In the `ProcessImpl` constructor, there are two different character
escape modes:
- **Legacy mode**, which allows ambiguous commands.
- **Non-legacy mode**, which does more rigorous escaping.
- Legacy is the default mode as long as `System.getSecurityManager()`
returns `null`, which is the case for RuneLite currently.
This mode can be changed by supplying the following VM argument:
`-Djdk.lang.Process.allowAmbiguousCommands=false`.
- Incidentally this also fixes the issue of loading natives with
special characters in the path, however it applies to *all*
`Runtime.exec()` calls.
- In legacy mode, the command is wrapped in quotes if it contains either
a space or tab character. The command is then passed along to the
native function `Java_java_lang_ProcessImpl_create`, which eventually
passes it along untouched to Microsoft's `CreateProcessW` function as
the `lpCommandLine` argument.
- In the documentation for this function, it is mentioned that an
interpreter (i.e. `cmd.exe`) is required in order to run a `.bat`
file. It is not specified what will happen if you instead pass the
path to a `.bat` file directly to the function, which is what Gluegen
ends up doing. However, `CreateProcessW` *does* support supplying the
path to an `.exe`, which Gluegen will do when
`jogamp.gluegen.UseNativeExeFile` is set to `true`.
It is unclear why supplying a `.bat` file normally works, yet breaks
when special characters are in the path. It seems like it should not
work in the first place.
This might help with #6509 and #14180.
Some other special characters, like Cyrillic letters, are more
fundamentally broken in RuneLite. This patch only slightly helps with
that.
This predates the alpha colorpicker, so it sort of made sense at the time, but currently the same effect can be achieved by just changing the fill color alpha. Additionally the toggle doesn't really toggle it but instead changes the alpha between 0 and 75 - and not the alpha that is chosen by the picker.
The Wilderness and PVP kill-death information box is created while in
these areas regardless of whether the setting (configured via the notice
board at the Edgeville bank) is enabled to show the text, meaning the
widget contains only empty text widgets when the setting is disabled
rather than being null, causing a bounding box to still be drawn and
affecting other snapped widget layout. This commit adds a child class of
WidgetOverlay specific to this widget and prevents it from being drawn
when the setting to show this information is disabled.