diff --git a/runelite-api/src/main/java/net/runelite/api/Constants.java b/runelite-api/src/main/java/net/runelite/api/Constants.java index 48ff3fc4bf..5d3259ed5b 100644 --- a/runelite-api/src/main/java/net/runelite/api/Constants.java +++ b/runelite-api/src/main/java/net/runelite/api/Constants.java @@ -82,6 +82,11 @@ public class Constants public static final int TILE_FLAG_BRIDGE = 2; + /** + * The height of the overworld, in tiles. Coordinates above this are in caves and other such zones. + */ + public static final int OVERWORLD_MAX_Y = 4160; + /** * The number of milliseconds in a client tick. *

diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPlugin.java index 55b1a37017..468e23a201 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPlugin.java @@ -25,13 +25,17 @@ package net.runelite.client.plugins.skybox; import com.google.inject.Inject; +import com.google.inject.Provides; +import java.awt.Color; import java.io.IOException; import net.runelite.api.Client; +import net.runelite.api.Constants; import net.runelite.api.GameState; import net.runelite.api.Player; import net.runelite.api.coords.LocalPoint; import net.runelite.api.events.BeforeRender; import net.runelite.api.events.GameStateChanged; +import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; @@ -47,6 +51,9 @@ public class SkyboxPlugin extends Plugin @Inject private Client client; + @Inject + private SkyboxPluginConfig config; + private Skybox skybox; @Override @@ -62,6 +69,12 @@ public class SkyboxPlugin extends Plugin skybox = null; } + @Provides + SkyboxPluginConfig provideConfig(ConfigManager configManager) + { + return configManager.getConfig(SkyboxPluginConfig.class); + } + private int mapChunk(int cx, int cy, int plane) { cx -= client.getBaseX() / 8; @@ -91,6 +104,14 @@ public class SkyboxPlugin extends Plugin return; } + Color overrideColor = player.getWorldLocation().getY() < Constants.OVERWORLD_MAX_Y + ? config.customOverworldColor() : config.customOtherColor(); + if (overrideColor != null) + { + client.setSkyboxColor(overrideColor.getRGB()); + return; + } + int px, py; if (client.getOculusOrbState() == 1) { @@ -99,7 +120,7 @@ public class SkyboxPlugin extends Plugin } else { - LocalPoint p = client.getLocalPlayer().getLocalLocation(); + LocalPoint p = player.getLocalLocation(); px = p.getX(); py = p.getY(); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPluginConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPluginConfig.java new file mode 100644 index 0000000000..3968724b72 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPluginConfig.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2019 logarrhytmic + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.skybox; + +import java.awt.Color; +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("skybox") +public interface SkyboxPluginConfig extends Config +{ + @ConfigItem( + keyName = "customOverworldColor", + name = "Overworld sky color", + description = "Sets the color to use for the sky in overworld areas.", + position = 1 + ) + Color customOverworldColor(); + + @ConfigItem( + keyName = "customOtherColor", + name = "Cave sky color", + description = "Sets the color to use for the sky in non-overworld areas.", + position = 2 + ) + Color customOtherColor(); +}