Merge pull request #2813 from ThatGamerBlue/aaaaaaaaaaaaaaaaaaaaaaaaaaa

project: merge upstream uwu
This commit is contained in:
ThatGamerBlue
2020-09-19 16:53:02 +01:00
committed by GitHub
11 changed files with 192 additions and 6 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ object ProjectVersions {
const val launcherVersion = "2.2.0"
const val rlVersion = "1.6.26"
const val openosrsVersion = "3.4.4"
const val openosrsVersion = "3.4.5"
const val rsversion = 191
const val cacheversion = 165
@@ -6118,7 +6118,7 @@ public final class ItemID
public static final int MAGICAL_CAPE_RACK = 9822;
public static final int OAK_COSTUME_BOX = 9823;
public static final int TEAK_COSTUME_BOX = 9824;
public static final int MAHOGANY_COS_BOX = 9825;
public static final int MAHOGANY_COSTUME_BOX = 9825;
public static final int OAK_ARMOUR_CASE = 9826;
public static final int TEAK_ARMOUR_CASE = 9827;
public static final int MAHOGANY_ARMOUR_CASE = 9828;
@@ -11471,5 +11471,8 @@ public final class ItemID
public static final int WAXWOOD_LOG = 24938;
public static final int WAXWOOD_PLANK = 24939;
public static final int MARLOS_CRATE = 24940;
public static final int BP_OBJ = 24941;
public static final int REINFORCED_GOGGLES = 24942;
public static final int SOURHOG_FOOT = 24944;
/* This file is automatically generated. Do not edit. */
}
@@ -3026,7 +3026,6 @@ public final class NpcID
public static final int WIZARD_3232 = 3232;
public static final int LEECH = 3233;
public static final int FERAL_VAMPYRE_3234 = 3234;
public static final int SPIDER_3235 = 3235;
public static final int MIST = 3236;
public static final int FERAL_VAMPYRE_3237 = 3237;
public static final int VAMPYRIC_HOUND = 3238;
@@ -8817,5 +8816,15 @@ public final class NpcID
public static final int OLD_MAN_YARLO = 10425;
public static final int OLD_MAN_YARLO_10426 = 10426;
public static final int OLD_MAN_YARLO_10427 = 10427;
public static final int SPRIA = 10432;
public static final int SPRIA_10433 = 10433;
public static final int SPRIA_10434 = 10434;
public static final int SOURHOG = 10435;
public static final int SOURHOG_10436 = 10436;
public static final int PIG_THING = 10437;
public static final int ROSIE_10438 = 10438;
public static final int SHEEPDOG_10439 = 10439;
public static final int SPIDER_10442 = 10442;
public static final int SPIDER_10443 = 10443;
/* This file is automatically generated. Do not edit. */
}
@@ -13261,5 +13261,7 @@ public final class NullItemID
public static final int NULL_24879 = 24879;
public static final int NULL_24881 = 24881;
public static final int NULL_24883 = 24883;
public static final int NULL_24943 = 24943;
public static final int NULL_24945 = 24945;
/* This file is automatically generated. Do not edit. */
}
@@ -1597,5 +1597,7 @@ public final class NullNpcID
public static final int NULL_10429 = 10429;
public static final int NULL_10430 = 10430;
public static final int NULL_10431 = 10431;
public static final int NULL_10440 = 10440;
public static final int NULL_10441 = 10441;
/* This file is automatically generated. Do not edit. */
}
@@ -19691,5 +19691,33 @@ public final class NullObjectID
public static final int NULL_40304 = 40304;
public static final int NULL_40305 = 40305;
public static final int NULL_40306 = 40306;
public static final int NULL_40322 = 40322;
public static final int NULL_40326 = 40326;
public static final int NULL_40327 = 40327;
public static final int NULL_40328 = 40328;
public static final int NULL_40329 = 40329;
public static final int NULL_40332 = 40332;
public static final int NULL_40333 = 40333;
public static final int NULL_40334 = 40334;
public static final int NULL_40335 = 40335;
public static final int NULL_40336 = 40336;
public static final int NULL_40337 = 40337;
public static final int NULL_40338 = 40338;
public static final int NULL_40339 = 40339;
public static final int NULL_40340 = 40340;
public static final int NULL_40341 = 40341;
public static final int NULL_40342 = 40342;
public static final int NULL_40343 = 40343;
public static final int NULL_40344 = 40344;
public static final int NULL_40345 = 40345;
public static final int NULL_40346 = 40346;
public static final int NULL_40347 = 40347;
public static final int NULL_40348 = 40348;
public static final int NULL_40349 = 40349;
public static final int NULL_40350 = 40350;
public static final int NULL_40351 = 40351;
public static final int NULL_40352 = 40352;
public static final int NULL_40353 = 40353;
public static final int NULL_40354 = 40354;
/* This file is automatically generated. Do not edit. */
}
@@ -20602,5 +20602,27 @@ public final class ObjectID
public static final int DRAWERS_40282 = 40282;
public static final int DRAWERS_40283 = 40283;
public static final int BOXES_40284 = 40284;
public static final int NOTICE_BOARD_40307 = 40307;
public static final int STRANGE_HOLE_40308 = 40308;
public static final int STRANGE_HOLE_40309 = 40309;
public static final int CABBAGE_40310 = 40310;
public static final int POTATOES_40311 = 40311;
public static final int CARROT = 40312;
public static final int BROKEN_DEAD_TREE = 40313;
public static final int DAMAGED_CART = 40314;
public static final int FALLEN_TREE_40315 = 40315;
public static final int DEAD_SOURHOG = 40316;
public static final int DEAD_SOURHOG_40317 = 40317;
public static final int DEAD_SOURHOG_40318 = 40318;
public static final int DEAD_SOURHOG_40319 = 40319;
public static final int SKELETON_40320 = 40320;
public static final int SKELETON_40321 = 40321;
public static final int SCRAWLED_NOTE = 40323;
public static final int PILE_OF_ROPE_40324 = 40324;
public static final int DOOR_40325 = 40325;
public static final int ROPE_40330 = 40330;
public static final int BLOCKAGE_40331 = 40331;
public static final int CRUMBLING_WALL_40355 = 40355;
public static final int ROCKS_40356 = 40356;
/* This file is automatically generated. Do not edit. */
}
@@ -178,6 +178,7 @@ public enum Quest
SONG_OF_THE_ELVES(603, "Song of the Elves"),
THE_FREMENNIK_EXILES(718, "The Fremennik Exiles"),
SINS_OF_THE_FATHER(1276, "Sins of the Father"),
A_PORCINE_OF_INTEREST(1690, "A Porcine of Interest"),
//Miniquests
ENTER_THE_ABYSS(319, "Enter the Abyss"),
@@ -192,7 +193,8 @@ public enum Quest
LAIR_OF_TARN_RAZORLOR(328, "Lair of Tarn Razorlor"),
FAMILY_PEST(329, "Family Pest"),
THE_MAGE_ARENA_II(330, "The Mage Arena II"),
IN_SEARCH_OF_KNOWLEDGE(602, "In Search of Knowledge");
IN_SEARCH_OF_KNOWLEDGE(602, "In Search of Knowledge"),
DADDYS_HOME(1688, "Daddy's Home");
@Getter
private final int id;
@@ -1356,7 +1356,7 @@ public class WidgetID
static class GenericScroll
{
static final int TEXT = 6;
static final int TEXT = 7;
}
static class GauntletTimer
@@ -519,7 +519,7 @@ public class ItemManager
*/
private BufferedImage loadItemOutline(final int itemId, final int itemQuantity, final Color outlineColor)
{
final Sprite itemSprite = client.createItemSprite(itemId, itemQuantity, 1, 0, 0, true, 710);
final Sprite itemSprite = client.createItemSprite(itemId, itemQuantity, 1, 0, 0, false, Constants.CLIENT_DEFAULT_ZOOM);
return itemSprite.toBufferedOutline(outlineColor);
}
@@ -25,11 +25,21 @@
package net.runelite.client.ui;
import java.awt.Frame;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.util.Arrays;
import java.util.Comparator;
import javax.swing.JFrame;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.config.ExpandResizeType;
import net.runelite.client.util.OSType;
@Slf4j
public class ContainableFrame extends JFrame
{
public enum Mode
@@ -39,6 +49,23 @@ public class ContainableFrame extends JFrame
NEVER
}
private static boolean jdk8231564;
static
{
try
{
String javaVersion = System.getProperty("java.version");
String[] s = javaVersion.split("\\.");
int major = Integer.parseInt(s[0]), minor = Integer.parseInt(s[1]), patch = Integer.parseInt(s[2]);
jdk8231564 = major > 11 || (major == 11 && minor > 0) || (major == 11 && minor == 0 && patch >= 8);
}
catch (Exception ex)
{
log.error("error checking java version", ex);
}
}
private static final int SCREEN_EDGE_CLOSE_DISTANCE = 40;
@Setter
@@ -200,6 +227,97 @@ public class ContainableFrame extends JFrame
expandedClientOppositeDirection = false;
}
/**
* Due to Java bug JDK-4737788, maximizing an undecorated frame causes it to cover the taskbar.
* As a workaround, Substance calls this method when the window is maximized to manually set the
* bounds, but its calculation ignores high-DPI scaling. We're overriding it to correctly calculate
* the maximized bounds.
*/
@Override
public void setMaximizedBounds(Rectangle bounds)
{
if (OSType.getOSType() == OSType.MacOS)
{
// OSX seems to correctly handle DPI scaling already
super.setMaximizedBounds(bounds);
}
else
{
super.setMaximizedBounds(getWindowAreaBounds());
}
}
/**
* Finds the {@link GraphicsConfiguration} of the display the window is currently on. If it's on more than
* one screen, returns the one it's most on (largest area of intersection)
*/
private GraphicsConfiguration getCurrentDisplayConfiguration()
{
return Arrays.stream(GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices())
.map(GraphicsDevice::getDefaultConfiguration)
.max(Comparator.comparing(config ->
{
Rectangle intersection = config.getBounds().intersection(getBounds());
return intersection.width * intersection.height;
}))
.orElseGet(this::getGraphicsConfiguration);
}
/**
* Calculates the bounds of the window area of the screen.
* <p>
* The bounds returned by {@link GraphicsEnvironment#getMaximumWindowBounds} are incorrectly calculated on
* high-DPI screens.
*/
private Rectangle getWindowAreaBounds()
{
log.trace("Current bounds: {}", getBounds());
for (GraphicsDevice device : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices())
{
log.trace("Device: {} bounds {}", device, device.getDefaultConfiguration().getBounds());
}
GraphicsConfiguration config = getCurrentDisplayConfiguration();
// get screen bounds
Rectangle bounds = config.getBounds();
log.trace("Chosen device: {} bounds {}", config, bounds);
// transform bounds to dpi-independent coordinates
if (!jdk8231564)
{
// JDK-8231564 fixed setMaximizedBounds to scale the bounds, so this must only be done on <11.0.8
bounds = config.getDefaultTransform().createTransformedShape(bounds).getBounds();
log.trace("Transformed bounds {}", bounds);
}
// subtract insets (taskbar, etc.)
Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(config);
if (!jdk8231564)
{
// Prior to JDK-8231564, WFramePeer expects the bounds to be relative to the current monitor instead of the
// primary display.
bounds.x = bounds.y = 0;
}
else
{
// The insets from getScreenInsets are not scaled, we must convert them to DPI scaled pixels on 11.0.8 due
// to JDK-8231564 which expects the bounds to be in DPI-aware pixels.
double scaleX = config.getDefaultTransform().getScaleX();
double scaleY = config.getDefaultTransform().getScaleY();
insets.top /= scaleY;
insets.bottom /= scaleY;
insets.left /= scaleX;
insets.right /= scaleX;
}
bounds.x += insets.left;
bounds.y += insets.top;
bounds.height -= (insets.bottom + insets.top);
bounds.width -= (insets.right + insets.left);
log.trace("Final bounds: {}", bounds);
return bounds;
}
/**
* Force minimum size of frame to be it's layout manager's minimum size
*/