diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridConfig.java deleted file mode 100644 index eda6b7cbb8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridConfig.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2018, Jeremy Plsek - * 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.inventorygrid; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("inventorygrid") -public interface InventoryGridConfig extends Config -{ - @ConfigItem( - keyName = "showItem", - name = "Show item", - description = "Show a preview of the item in the new slot" - ) - default boolean showItem() - { - return true; - } - - @ConfigItem( - keyName = "showGrid", - name = "Show grid", - description = "Show a grid on the inventory while dragging" - ) - default boolean showGrid() - { - return true; - } - - @ConfigItem( - keyName = "showHighlight", - name = "Highlight background", - description = "Show a green background highlight on the new slot" - ) - default boolean showHighlight() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridPlugin.java deleted file mode 100644 index dc6b0ae372..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridPlugin.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2018, Jeremy Plsek - * Copyright (c) 2019, Adam - * 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.inventorygrid; - -import com.google.inject.Inject; -import com.google.inject.Provides; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.ui.overlay.OverlayManager; - -@PluginDescriptor( - name = "Inventory Grid", - description = "Shows a grid over the inventory and a preview of where items will be dragged", - tags = {"items", "overlay"}, - enabledByDefault = false -) -public class InventoryGridPlugin extends Plugin -{ - @Inject - private InventoryGridOverlay overlay; - - @Inject - private OverlayManager overlayManager; - - @Override - public void startUp() - { - overlayManager.add(overlay); - } - - @Override - public void shutDown() - { - overlayManager.remove(overlay); - } - - @Provides - InventoryGridConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(InventoryGridConfig.class); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenConfig.java deleted file mode 100644 index 34b4b89aab..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenConfig.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * 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.loginscreen; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("loginscreen") -public interface LoginScreenConfig extends Config -{ - @ConfigItem( - keyName = "syncusername", - name = "Sync username", - description = "Syncs the username that is currently remembered between computers" - ) - default boolean syncUsername() - { - return true; - } - - @ConfigItem( - keyName = "pasteenabled", - name = "Ctrl-V paste", - description = "Enables Ctrl+V pasting on the login screen" - ) - default boolean pasteEnabled() - { - return false; - } - - @ConfigItem( - keyName = "username", - name = "", - description = "", - hidden = true - ) - default String username() - { - return ""; - } - - @ConfigItem( - keyName = "username", - name = "", - description = "" - ) - void username(String key); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenPlugin.java deleted file mode 100644 index b99efb6e62..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenPlugin.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * 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.loginscreen; - -import com.google.common.base.Strings; -import com.google.inject.Provides; -import java.awt.Toolkit; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.UnsupportedFlavorException; -import java.awt.event.KeyEvent; -import java.io.IOException; -import javax.inject.Inject; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.events.GameStateChanged; -import net.runelite.client.events.SessionOpen; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.input.KeyListener; -import net.runelite.client.input.KeyManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.util.OSType; - -@PluginDescriptor( - name = "Login Screen", - description = "Provides various enhancements for login screen" -) -@Slf4j -public class LoginScreenPlugin extends Plugin implements KeyListener -{ - private static final int MAX_USERNAME_LENGTH = 254; - private static final int MAX_PASSWORD_LENGTH = 20; - private static final int MAX_PIN_LENGTH = 6; - - @Inject - private Client client; - - @Inject - private LoginScreenConfig config; - - @Inject - private KeyManager keyManager; - - private String usernameCache; - - @Override - protected void startUp() throws Exception - { - applyUsername(); - keyManager.registerKeyListener(this); - } - - @Override - protected void shutDown() throws Exception - { - if (config.syncUsername()) - { - client.getPreferences().setRememberedUsername(usernameCache); - } - - keyManager.unregisterKeyListener(this); - } - - @Provides - LoginScreenConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(LoginScreenConfig.class); - } - - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - if (!config.syncUsername()) - { - return; - } - - if (event.getGameState() == GameState.LOGIN_SCREEN) - { - applyUsername(); - } - else if (event.getGameState() == GameState.LOGGED_IN) - { - String username = ""; - - if (client.getPreferences().getRememberedUsername() != null) - { - username = client.getUsername(); - } - - if (config.username().equals(username)) - { - return; - } - - log.debug("Saving username: {}", username); - config.username(username); - } - } - - @Subscribe - public void onSessionOpen(SessionOpen event) - { - // configuation for the account is available now, so update the username - applyUsername(); - } - - private void applyUsername() - { - if (!config.syncUsername()) - { - return; - } - - GameState gameState = client.getGameState(); - if (gameState == GameState.LOGIN_SCREEN) - { - String username = config.username(); - - if (Strings.isNullOrEmpty(username)) - { - return; - } - - // Save it only once - if (usernameCache == null) - { - usernameCache = client.getPreferences().getRememberedUsername(); - } - - client.getPreferences().setRememberedUsername(username); - } - } - - @Override - public void keyTyped(KeyEvent e) - { - } - - @Override - public void keyPressed(KeyEvent e) - { - if (!config.pasteEnabled() || ( - client.getGameState() != GameState.LOGIN_SCREEN && - client.getGameState() != GameState.LOGIN_SCREEN_AUTHENTICATOR)) - { - return; - } - - // enable pasting on macOS with the Command (meta) key - boolean isModifierDown = OSType.getOSType() == OSType.MacOS ? e.isMetaDown() : e.isControlDown(); - - if (e.getKeyCode() == KeyEvent.VK_V && isModifierDown) - { - try - { - final String data = Toolkit - .getDefaultToolkit() - .getSystemClipboard() - .getData(DataFlavor.stringFlavor) - .toString() - .trim(); - - switch (client.getLoginIndex()) - { - // Username/password form - case 2: - if (client.getCurrentLoginField() == 0) - { - // Truncate data to maximum username length if necessary - client.setUsername(data.substring(0, Math.min(data.length(), MAX_USERNAME_LENGTH))); - } - else - { - // Truncate data to maximum password length if necessary - client.setPassword(data.substring(0, Math.min(data.length(), MAX_PASSWORD_LENGTH))); - } - - break; - // Authenticator form - case 4: - // Truncate data to maximum OTP code length if necessary - client.setOtp(data.substring(0, Math.min(data.length(), MAX_PIN_LENGTH))); - break; - } - } - catch (UnsupportedFlavorException | IOException ex) - { - log.warn("failed to fetch clipboard data", ex); - } - } - } - - @Override - public void keyReleased(KeyEvent e) - { - - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/GraphicsObjectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/GraphicsObjectMixin.java deleted file mode 100644 index 7bfa3c1bd9..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/GraphicsObjectMixin.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * 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.mixins; - -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.events.GraphicsObjectCreated; -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.Mixin; -import net.runelite.api.mixins.Shadow; -import net.runelite.rs.api.RSClient; -import net.runelite.rs.api.RSGraphicsObject; - -@Mixin(RSGraphicsObject.class) -public abstract class GraphicsObjectMixin implements RSGraphicsObject -{ - @Shadow("clientInstance") - private static RSClient client; - - @Inject - GraphicsObjectMixin() - { - final GraphicsObjectCreated event = new GraphicsObjectCreated(this); - client.getCallbacks().post(event); - } - - @Override - @Inject - public LocalPoint getLocation() - { - return new LocalPoint(this.getX(), this.getY()); - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClanMemberManagerMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClanMemberManagerMixin.java deleted file mode 100644 index aca7addbb5..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClanMemberManagerMixin.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2018, trimbe - * 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.mixins; - -import net.runelite.api.ClanMember; -import net.runelite.api.events.ClanMemberJoined; -import net.runelite.api.events.ClanMemberLeft; -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.Mixin; -import net.runelite.api.mixins.Shadow; -import net.runelite.rs.api.RSClanMemberManager; -import net.runelite.rs.api.RSClient; -import net.runelite.rs.api.RSName; -import net.runelite.rs.api.RSNameable; - -@Mixin(RSClanMemberManager.class) -public abstract class RSClanMemberManagerMixin implements RSClanMemberManager -{ - @Shadow("clientInstance") - private static RSClient client; - private RSNameable nameable; - private RSName name; - private RSName prevName; - - @Inject - @Override - public void rl$add(RSName name, RSName prevName) - { - this.name = name; - this.prevName = prevName; - ClanMember member = findByName(name); - if (member == null) - { - return; - } - - ClanMemberJoined event = new ClanMemberJoined(member); - client.getCallbacks().postDeferred(event); - } - - @Inject - @Override - public void rl$remove(RSNameable nameable) - { - this.nameable = nameable; - ClanMember member = findByName(nameable.getRsName()); - if (member == null) - { - return; - } - - ClanMemberLeft event = new ClanMemberLeft(member); - client.getCallbacks().postDeferred(event); - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClanMemberMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClanMemberMixin.java deleted file mode 100644 index a35a267bce..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClanMemberMixin.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2016-2017, Adam - * 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.mixins; - -import net.runelite.api.ClanMemberRank; -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.Mixin; -import net.runelite.rs.api.RSClanMember; - -@Mixin(RSClanMember.class) -public abstract class RSClanMemberMixin implements RSClanMember -{ - @Override - @Inject - public String getUsername() - { - return getRsName().getName(); - } - - @Override - @Inject - public ClanMemberRank getRank() - { - return ClanMemberRank.valueOf(getRSRank()); - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSEnumMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSEnumMixin.java deleted file mode 100644 index 06dd3ab2e8..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSEnumMixin.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2019, Adam - * 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.mixins; - -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.Mixin; -import net.runelite.rs.api.RSEnum; - -@Mixin(RSEnum.class) -public abstract class RSEnumMixin implements RSEnum -{ - @Inject - @Override - public int getIntValue(int key) - { - final int[] keys = getKeys(); - if (keys == null) - { - return getDefaultInt(); - } - - for (int i = 0; i < keys.length; ++i) - { - if (keys[i] == key) - { - final int[] values = getIntVals(); - return values[i]; - } - } - return getDefaultInt(); - } - - @Inject - @Override - public String getStringValue(int key) - { - final int[] keys = getKeys(); - if (keys == null) - { - return getDefaultString(); - } - - for (int i = 0; i < keys.length; ++i) - { - if (keys[i] == key) - { - final String[] values = getStringVals(); - return values[i]; - } - } - return getDefaultString(); - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSFriendManagerMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSFriendManagerMixin.java deleted file mode 100644 index 91d5077dd0..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSFriendManagerMixin.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * 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.mixins; - -import net.runelite.api.events.RemovedFriend; -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.MethodHook; -import net.runelite.api.mixins.Mixin; -import net.runelite.api.mixins.Shadow; -import net.runelite.rs.api.RSClient; -import net.runelite.rs.api.RSFriendManager; - -@Mixin(RSFriendManager.class) -public abstract class RSFriendManagerMixin implements RSFriendManager -{ - @Shadow("clientInstance") - private static RSClient client; - - @MethodHook("removeFriend") - @Inject - public void rl$removeFriend(String friendName) - { - RemovedFriend removedFriend = new RemovedFriend(friendName); - client.getCallbacks().post(removedFriend); - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSGroundObjectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSGroundObjectMixin.java deleted file mode 100644 index d0d00d8e9b..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSGroundObjectMixin.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2018, SomeoneWithAnInternetConnection - * 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.mixins; - -import java.awt.geom.Area; -import net.runelite.api.Model; -import net.runelite.api.Perspective; -import net.runelite.api.Renderable; -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.Mixin; -import net.runelite.api.mixins.Shadow; -import net.runelite.rs.api.RSClient; -import net.runelite.rs.api.RSGroundObject; - -@Mixin(RSGroundObject.class) -public abstract class RSGroundObjectMixin implements RSGroundObject -{ - @Shadow("clientInstance") - private static RSClient client; - - @Inject - private int groundObjectPlane; - - @Inject - @Override - public int getPlane() - { - return groundObjectPlane; - } - - @Inject - @Override - public void setPlane(int plane) - { - this.groundObjectPlane = plane; - } - - @Inject - private Model getModel() - { - Renderable renderable = getRenderable(); - if (renderable == null) - { - return null; - } - - if (renderable instanceof Model) - { - return (Model) renderable; - } - else - { - return renderable.getModel(); - } - } - - @Inject - @Override - public Area getClickbox() - { - return Perspective.getClickbox(client, getModel(), 0, getLocalLocation()); - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSIgnoreMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSIgnoreMixin.java deleted file mode 100644 index 98bcd7b3b2..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSIgnoreMixin.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * 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.mixins; - -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.Mixin; -import net.runelite.rs.api.RSIgnore; -import net.runelite.rs.api.RSName; - -@Mixin(RSIgnore.class) -public abstract class RSIgnoreMixin implements RSIgnore -{ - @Override - @Inject - public String getName() - { - return getRsName().getName(); - } - - @Override - @Inject - public String getPrevName() - { - RSName prevName = getRsPrevName(); - return prevName == null ? null : prevName.getName(); - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSItemLayerMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSItemLayerMixin.java deleted file mode 100644 index 8b67d4d314..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSItemLayerMixin.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2018, SomeoneWithAnInternetConnection - * 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.mixins; - -import java.awt.geom.Area; -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.Mixin; -import net.runelite.rs.api.RSItemLayer; - -@Mixin(RSItemLayer.class) -public abstract class RSItemLayerMixin implements RSItemLayer -{ - @Inject - private int itemLayerPlane; - - @Inject - @Override - public int getPlane() - { - return itemLayerPlane; - } - - @Inject - @Override - public void setPlane(int plane) - { - this.itemLayerPlane = plane; - } - - @Inject - @Override - public Area getClickbox() - { - throw new UnsupportedOperationException(); - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSKeyFocusListenerMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSKeyFocusListenerMixin.java deleted file mode 100644 index 73ddd9fd99..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSKeyFocusListenerMixin.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * 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.mixins; - -import java.awt.event.FocusEvent; -import java.awt.event.KeyEvent; -import net.runelite.api.events.FocusChanged; -import net.runelite.api.mixins.Copy; -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.MethodHook; -import net.runelite.api.mixins.Mixin; -import net.runelite.api.mixins.Replace; -import net.runelite.api.mixins.Shadow; -import net.runelite.rs.api.RSClient; -import net.runelite.rs.api.RSKeyFocusListener; - -@Mixin(RSKeyFocusListener.class) -public abstract class RSKeyFocusListenerMixin implements RSKeyFocusListener -{ - @Shadow("clientInstance") - private static RSClient client; - - @Copy("keyPressed") - abstract void rs$keyPressed(KeyEvent keyEvent); - - @Copy("keyReleased") - abstract void rs$keyReleased(KeyEvent keyEvent); - - @Copy("keyTyped") - abstract void rs$keyTyped(KeyEvent keyEvent); - - @Override - @Replace("keyPressed") - public final synchronized void keyPressed(KeyEvent keyEvent) - { - client.getCallbacks().keyPressed(keyEvent); - if (!keyEvent.isConsumed()) - { - rs$keyPressed(keyEvent); - } - } - - @Override - @Replace("keyReleased") - public final synchronized void keyReleased(KeyEvent keyEvent) - { - client.getCallbacks().keyReleased(keyEvent); - if (!keyEvent.isConsumed()) - { - rs$keyReleased(keyEvent); - } - } - - @Override - @Replace("keyTyped") - public final void keyTyped(KeyEvent keyEvent) - { - client.getCallbacks().keyTyped(keyEvent); - if (!keyEvent.isConsumed()) - { - rs$keyTyped(keyEvent); - } - } - - @Inject - @MethodHook("focusLost") - public void onFocusLost(FocusEvent focusEvent) - { - final FocusChanged focusChanged = new FocusChanged(); - focusChanged.setFocused(false); - client.getCallbacks().post(focusChanged); - } -} \ No newline at end of file diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSMessageNodeMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSMessageNodeMixin.java deleted file mode 100644 index da716252e7..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSMessageNodeMixin.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2016-2017, Adam - * 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.mixins; - -import net.runelite.api.ChatMessageType; -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.MethodHook; -import net.runelite.api.mixins.Mixin; -import net.runelite.api.mixins.Shadow; -import net.runelite.rs.api.RSClient; -import net.runelite.rs.api.RSMessageNode; - -@Mixin(RSMessageNode.class) -public abstract class RSMessageNodeMixin implements RSMessageNode -{ - @Shadow("clientInstance") - private static RSClient client; - - @Inject - private String runeLiteFormatMessage; - - @Inject - private int rl$timestamp; - - @Inject - RSMessageNodeMixin() - { - rl$timestamp = (int) (System.currentTimeMillis() / 1000L); - } - - @Inject - @Override - public ChatMessageType getType() - { - return ChatMessageType.of(getRSType()); - } - - @Inject - @Override - public String getRuneLiteFormatMessage() - { - return runeLiteFormatMessage; - } - - @Inject - @Override - public void setRuneLiteFormatMessage(String runeLiteFormatMessage) - { - this.runeLiteFormatMessage = runeLiteFormatMessage; - } - - @Inject - @Override - public int getTimestamp() - { - return rl$timestamp; - } - - @Inject - @Override - public void setTimestamp(int timestamp) - { - this.rl$timestamp = timestamp; - } - - @Inject - @MethodHook(value = "setMessage", end = true) - public void setMessage(int type, String name, String sender, String value) - { - // Message nodes get reused after a time by calling setMessage. - // Clear the runelite formatted message then. - runeLiteFormatMessage = null; - rl$timestamp = (int) (System.currentTimeMillis() / 1000L); - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSNameableContainerMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSNameableContainerMixin.java deleted file mode 100644 index 8a3a1492e0..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSNameableContainerMixin.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2018, trimbe - * Copyright (c) 2019, Adam - * 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.mixins; - -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.MethodHook; -import net.runelite.api.mixins.Mixin; -import net.runelite.rs.api.RSName; -import net.runelite.rs.api.RSNameable; -import net.runelite.rs.api.RSNameableContainer; - -@Mixin(RSNameableContainer.class) -public abstract class RSNameableContainerMixin implements RSNameableContainer -{ - /** - * Default implementation of rl$add - * @param name - * @param prevName - */ - @Inject - @Override - public void rl$add(RSName name, RSName prevName) - { - } - - /** - * Default implementation of rl$del - * @param nameable - */ - @Inject - @Override - public void rl$remove(RSNameable nameable) - { - } - - @Inject - @MethodHook(value = "add", end = true) - public void add(RSName name, RSName prevName) - { - rl$add(name, prevName); - } - - @Inject - @MethodHook("remove") - public void remove(RSNameable nameable) - { - rl$remove(nameable); - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSNameableMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSNameableMixin.java deleted file mode 100644 index 2d64135330..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSNameableMixin.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * 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.mixins; - -import net.runelite.api.events.NameableNameChanged; -import net.runelite.api.mixins.FieldHook; -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.Mixin; -import net.runelite.api.mixins.Shadow; -import net.runelite.rs.api.RSClient; -import net.runelite.rs.api.RSNameable; - -@Mixin(RSNameable.class) -public abstract class RSNameableMixin implements RSNameable -{ - @Shadow("clientInstance") - private static RSClient client; - - @FieldHook("prevName") - @Inject - public void onPrevNameChanged(int idx) - { - NameableNameChanged nameableNameChanged = new NameableNameChanged(this); - client.getCallbacks().post(nameableNameChanged); - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSNpcCompositionMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSNpcCompositionMixin.java deleted file mode 100644 index b12477525c..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSNpcCompositionMixin.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * 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.mixins; - -import net.runelite.api.HeadIcon; -import static net.runelite.api.HeadIcon.MAGIC; -import static net.runelite.api.HeadIcon.MELEE; -import static net.runelite.api.HeadIcon.RANGED; -import static net.runelite.api.HeadIcon.RANGE_MAGE; -import net.runelite.api.events.NpcActionChanged; -import net.runelite.api.mixins.FieldHook; -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.Mixin; -import net.runelite.api.mixins.Shadow; -import net.runelite.rs.api.RSClient; -import net.runelite.rs.api.RSNPCComposition; - -@Mixin(RSNPCComposition.class) -public abstract class RSNpcCompositionMixin implements RSNPCComposition -{ - @Shadow("clientInstance") - private static RSClient client; - - @Inject - @Override - public HeadIcon getOverheadIcon() - { - switch (getRsOverheadIcon()) - { - case 0: - return MELEE; - case 1: - return RANGED; - case 2: - return MAGIC; - case 6: - return RANGE_MAGE; - default: - return null; - } - } - - @FieldHook("actions") - @Inject - public void actionsHook(int idx) - { - NpcActionChanged npcActionChanged = new NpcActionChanged(); - npcActionChanged.setNpcComposition(this); - npcActionChanged.setIdx(idx); - client.getCallbacks().post(npcActionChanged); - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSSceneTileModelMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSSceneTileModelMixin.java deleted file mode 100644 index a1ab51260e..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSSceneTileModelMixin.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * 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.mixins; - -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.Mixin; -import net.runelite.rs.api.RSSceneTileModel; - -@Mixin(RSSceneTileModel.class) -public abstract class RSSceneTileModelMixin implements RSSceneTileModel -{ - @Inject - private int rl$modelBufferOffset; - - @Inject - private int rl$modelUvBufferOffset; - - @Inject - private int rl$modelBufferLen; - - @Inject - @Override - public int getBufferOffset() - { - return rl$modelBufferOffset; - } - - @Inject - @Override - public void setBufferOffset(int bufferOffset) - { - rl$modelBufferOffset = bufferOffset; - } - - @Inject - @Override - public int getUvBufferOffset() - { - return rl$modelUvBufferOffset; - } - - @Inject - @Override - public void setUvBufferOffset(int bufferOffset) - { - rl$modelUvBufferOffset = bufferOffset; - } - - @Inject - @Override - public int getBufferLen() - { - return rl$modelBufferLen; - } - - @Inject - @Override - public void setBufferLen(int bufferLen) - { - rl$modelBufferLen = bufferLen; - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSSceneTilePaintMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSSceneTilePaintMixin.java deleted file mode 100644 index 27c719d58c..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSSceneTilePaintMixin.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * 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.mixins; - -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.Mixin; -import net.runelite.rs.api.RSSceneTilePaint; - -@Mixin(RSSceneTilePaint.class) -public abstract class RSSceneTilePaintMixin implements RSSceneTilePaint -{ - @Inject - private int rl$paintModelBufferOffset; - - @Inject - private int rl$paintModelUvBufferOffset; - - @Inject - private int rl$paintModelBufferLen; - - @Inject - @Override - public int getBufferOffset() - { - return rl$paintModelBufferOffset; - } - - @Inject - @Override - public void setBufferOffset(int bufferOffset) - { - rl$paintModelBufferOffset = bufferOffset; - } - - @Inject - @Override - public int getUvBufferOffset() - { - return rl$paintModelUvBufferOffset; - } - - @Inject - @Override - public void setUvBufferOffset(int bufferOffset) - { - rl$paintModelUvBufferOffset = bufferOffset; - } - - @Inject - @Override - public int getBufferLen() - { - return rl$paintModelBufferLen; - } - - @Inject - @Override - public void setBufferLen(int bufferLen) - { - rl$paintModelBufferLen = bufferLen; - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSSpritePixelsMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSSpritePixelsMixin.java deleted file mode 100644 index b351a3d768..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSSpritePixelsMixin.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2016-2017, Adam - * 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.mixins; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.Mixin; -import net.runelite.rs.api.RSSpritePixels; - -@Mixin(RSSpritePixels.class) -public abstract class RSSpritePixelsMixin implements RSSpritePixels -{ - @Inject - @Override - public BufferedImage toBufferedImage() - { - BufferedImage img = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); - - toBufferedImage(img); - - return img; - } - - @Inject - @Override - public void toBufferedImage(BufferedImage img) - { - int width = getWidth(); - int height = getHeight(); - - if (img.getWidth() != width || img.getHeight() != height) - { - throw new IllegalArgumentException("Image bounds do not match SpritePixels"); - } - - int[] pixels = getPixels(); - int[] transPixels = new int[pixels.length]; - - for (int i = 0; i < pixels.length; i++) - { - if (pixels[i] != 0) - { - transPixels[i] = pixels[i] | 0xff000000; - } - } - - img.setRGB(0, 0, width, height, transPixels, 0, width); - } - - @Inject - @Override - public BufferedImage toBufferedOutline(Color color) - { - BufferedImage img = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); - - toBufferedOutline(img, color.getRGB()); - - return img; - } - - @Inject - @Override - public void toBufferedOutline(BufferedImage img, int color) - { - int width = getWidth(); - int height = getHeight(); - - if (img.getWidth() != width || img.getHeight() != height) - { - throw new IllegalArgumentException("Image bounds do not match SpritePixels"); - } - - int[] pixels = getPixels(); - int[] newPixels = new int[width * height]; - int pixelIndex = 0; - - for (int y = 0; y < height; ++y) - { - for (int x = 0; x < width; ++x) - { - int pixel = pixels[pixelIndex]; - if (pixel == 16777215 || pixel == 0) - { - // W - if (x > 0 && pixels[pixelIndex - 1] != 0) - { - pixel = color; - } - // N - else if (y > 0 && pixels[pixelIndex - width] != 0) - { - pixel = color; - } - // E - else if (x < width - 1 && pixels[pixelIndex + 1] != 0) - { - pixel = color; - } - // S - else if (y < height - 1 && pixels[pixelIndex + width] != 0) - { - pixel = color; - } - newPixels[pixelIndex] = pixel; - } - - pixelIndex++; - } - } - - img.setRGB(0, 0, width, height, newPixels, 0, width); - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSWallObjectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSWallObjectMixin.java deleted file mode 100644 index e5db24d686..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSWallObjectMixin.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2018, SomeoneWithAnInternetConnection - * 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.mixins; - -import java.awt.geom.Area; -import net.runelite.api.Model; -import net.runelite.api.Perspective; -import net.runelite.api.Renderable; -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.Mixin; -import net.runelite.api.mixins.Shadow; -import net.runelite.rs.api.RSClient; -import net.runelite.rs.api.RSWallObject; - -@Mixin(RSWallObject.class) -public abstract class RSWallObjectMixin implements RSWallObject -{ - @Shadow("clientInstance") - private static RSClient client; - - @Inject - private int wallPlane; - - @Inject - @Override - public int getPlane() - { - return wallPlane; - } - - @Inject - @Override - public void setPlane(int plane) - { - this.wallPlane = plane; - } - - @Inject - private Model getModelA() - { - Renderable renderable = getRenderable1(); - if (renderable == null) - { - return null; - } - - if (renderable instanceof Model) - { - return (Model) renderable; - } - else - { - return renderable.getModel(); - } - } - - @Inject - private Model getModelB() - { - Renderable renderable = getRenderable2(); - if (renderable == null) - { - return null; - } - - if (renderable instanceof Model) - { - return (Model) renderable; - } - else - { - return renderable.getModel(); - } - } - - @Inject - @Override - public Area getClickbox() - { - Area clickbox = new Area(); - - Area clickboxA = Perspective.getClickbox(client, getModelA(), 0, getLocalLocation()); - Area clickboxB = Perspective.getClickbox(client, getModelB(), 0, getLocalLocation()); - - if (clickboxA == null && clickboxB == null) - { - return null; - } - - if (clickboxA != null) - { - clickbox.add(clickboxA); - } - - if (clickboxB != null) - { - clickbox.add(clickboxB); - } - - return clickbox; - } -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/WorldMapManagerMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/WorldMapManagerMixin.java deleted file mode 100644 index 3f51e31e48..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/WorldMapManagerMixin.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2018, Morgan Lewis - * 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.mixins; - -import net.runelite.api.mixins.Mixin; -import net.runelite.api.mixins.Replace; -import net.runelite.api.mixins.Shadow; -import net.runelite.rs.api.RSClient; -import net.runelite.rs.api.RSWorldMapManager; - -@Mixin(RSWorldMapManager.class) -public abstract class WorldMapManagerMixin implements RSWorldMapManager -{ - @Shadow("clientInstance") - static RSClient client; - - /* - The worldMapZoom is essentially pixels per tile. In most instances - getPixelsPerTile returns the same as worldMapZoom. - - At some map widths when 100% zoomed in the Jagex version of this function - returns 7.89 instead of 8.0 (the worldMapZoom at this level). - This would cause both the x and y positions of the map to shift - slightly when the map was certain widths. - - This mixin function replaces Jagex calculation with getWorldMapZoom. - This small change makes the world map tile sizing predictable. - */ - @Replace("getPixelsPerTile") - @Override - public float getPixelsPerTile(int graphicsDiff, int worldDiff) - { - return client.getRenderOverview().getWorldMapZoom(); - } - -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/WorldMapMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/WorldMapMixin.java deleted file mode 100644 index bdd291b354..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/WorldMapMixin.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2018, Morgan Lewis - * 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.mixins; - -import net.runelite.api.Point; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.Mixin; -import net.runelite.rs.api.RSRenderOverview; -import net.runelite.rs.api.RSWorldMapManager; - -@Mixin(RSRenderOverview.class) -public abstract class WorldMapMixin implements RSRenderOverview -{ - @Override - @Inject - public Point getWorldMapPosition() - { - RSWorldMapManager worldMapManager = getWorldMapManager(); - int worldX = getWorldMapX() + worldMapManager.getSurfaceOffsetX(); - int worldY = getWorldMapY() + worldMapManager.getSurfaceOffsetY(); - return new Point(worldX, worldY); - } - - @Inject - public void setWorldMapPositionTarget(WorldPoint worldPoint) - { - setWorldMapPositionTarget(worldPoint.getX(), worldPoint.getY()); - } - -}