├── .gitignore
├── resources
├── OSJR_tray.png
├── Runescape.ttf
├── gamepack.jar
├── clan_ranks
│ ├── Owner.png
│ ├── Captain.png
│ ├── Corporal.png
│ ├── Friend.png
│ ├── General.png
│ ├── Recruit.png
│ ├── Sergeant.png
│ └── Lieutenant.png
└── skill_icons
│ ├── Agility.png
│ ├── Attack.png
│ ├── Cooking.png
│ ├── Defence.png
│ ├── Farming.png
│ ├── Fishing.png
│ ├── Hunter.png
│ ├── Magic.png
│ ├── Mining.png
│ ├── Prayer.png
│ ├── Ranged.png
│ ├── Slayer.png
│ ├── Crafting.png
│ ├── Fletching.png
│ ├── Herblore.png
│ ├── Hitpoints.png
│ ├── Smithing.png
│ ├── Strength.png
│ ├── Thieving.png
│ ├── Construction.png
│ ├── Firemaking.png
│ ├── Runecrafting.png
│ └── Woodcutting.png
├── .travis.yml
├── .settings
├── org.eclipse.buildship.core.prefs
└── org.eclipse.jdt.core.prefs
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── src
├── main
│ └── java
│ │ ├── hooks
│ │ ├── model
│ │ │ ├── RSField.java
│ │ │ ├── ItemDefinition.java
│ │ │ └── RSClass.java
│ │ ├── accessors
│ │ │ ├── Area.java
│ │ │ ├── Ignore.java
│ │ │ ├── Varcs.java
│ │ │ ├── Class33.java
│ │ │ ├── Class38.java
│ │ │ ├── Class160.java
│ │ │ ├── Class237.java
│ │ │ ├── Class308.java
│ │ │ ├── Renderable.java
│ │ │ ├── Sequence.java
│ │ │ ├── ClientPacket.java
│ │ │ ├── PacketNode.java
│ │ │ ├── BaseVarType.java
│ │ │ ├── WorldMapData.java
│ │ │ ├── BoundingBox3D.java
│ │ │ ├── PlayerComposition.java
│ │ │ ├── WorldComparator.java
│ │ │ ├── Class23.java
│ │ │ ├── Class138.java
│ │ │ ├── ObjectComposition.java
│ │ │ ├── Class20.java
│ │ │ ├── Class28.java
│ │ │ ├── ChatPlayer.java
│ │ │ ├── Class255.java
│ │ │ ├── Coordinates.java
│ │ │ ├── ClanMember.java
│ │ │ ├── Nameable.java
│ │ │ ├── BoundingBox3DDrawMode.java
│ │ │ ├── GrandExchangeOffer.java
│ │ │ ├── SpritePixels.java
│ │ │ ├── Class95.java
│ │ │ ├── Item.java
│ │ │ ├── Name.java
│ │ │ ├── GameEngine.java
│ │ │ ├── ClanMemberManager.java
│ │ │ ├── NpcComposition.java
│ │ │ ├── SoundTaskDataProvider.java
│ │ │ ├── Class62.java
│ │ │ ├── Node.java
│ │ │ ├── ChatLineBuffer.java
│ │ │ ├── NameableContainer.java
│ │ │ ├── ItemLayer.java
│ │ │ ├── Npc.java
│ │ │ ├── Actor.java
│ │ │ ├── MessageNode.java
│ │ │ ├── WallObject.java
│ │ │ ├── Tile.java
│ │ │ ├── GroundObject.java
│ │ │ ├── Player.java
│ │ │ ├── DecorativeObject.java
│ │ │ ├── Region.java
│ │ │ ├── GameObject.java
│ │ │ ├── Model.java
│ │ │ └── Client.java
│ │ └── helpers
│ │ │ ├── Constants.java
│ │ │ ├── Cache.java
│ │ │ ├── Triangle.java
│ │ │ ├── Vertex.java
│ │ │ ├── Point.java
│ │ │ ├── Jarvis.java
│ │ │ ├── LocalPoint.java
│ │ │ ├── WorldPoint.java
│ │ │ ├── Skill.java
│ │ │ └── SkillGlobe.java
│ │ ├── discord
│ │ ├── ErrorCode.java
│ │ ├── DiscordReply.java
│ │ ├── Backoff.java
│ │ ├── DiscordJoinRequest.java
│ │ ├── DiscordEventHandler.java
│ │ ├── BaseConnection.java
│ │ ├── UpdateStatus.java
│ │ ├── BaseConnectionOsx.java
│ │ ├── DiscordManager.java
│ │ ├── BaseConnectionWindows.java
│ │ ├── BaseConnectionUnix.java
│ │ └── WinRegistry.java
│ │ ├── paint
│ │ ├── TextPaintListener.java
│ │ ├── PaintListener.java
│ │ ├── misc
│ │ │ ├── XpGlobe.java
│ │ │ ├── FpsPaintListener.java
│ │ │ ├── DecorativeObjects.java
│ │ │ ├── WallObjects.java
│ │ │ ├── GroundObjects.java
│ │ │ ├── GameObjects.java
│ │ │ ├── GroundItems.java
│ │ │ └── ActorNames.java
│ │ ├── GameCanvas.java
│ │ ├── CanvasInjector.java
│ │ ├── skills
│ │ │ ├── AgilityOverlay.java
│ │ │ └── FishingOverlay.java
│ │ ├── InputListeners.java
│ │ └── ColorChooserApplet.java
│ │ ├── cache
│ │ ├── ActorListener.java
│ │ ├── ItemDefinitionManager.java
│ │ ├── ObjectManager.java
│ │ ├── TileListener.java
│ │ └── MessageManager.java
│ │ ├── game
│ │ ├── Settings.java
│ │ ├── OSRSLauncher.java
│ │ ├── LoaderWindow.java
│ │ └── RSAppletStub.java
│ │ └── reflection
│ │ ├── JarInjector.java
│ │ ├── Util.java
│ │ └── JarLoader.java
└── test
│ └── java
│ └── LibraryTest.java
├── .classpath
├── settings.gradle
├── .project
├── README.md
├── gradlew.bat
└── gradlew
/.gitignore:
--------------------------------------------------------------------------------
1 | /.gradle/
2 | /build/
3 | /bin/
4 | resources/gamepack_injected.jar
5 |
--------------------------------------------------------------------------------
/resources/OSJR_tray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/OSJR_tray.png
--------------------------------------------------------------------------------
/resources/Runescape.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/Runescape.ttf
--------------------------------------------------------------------------------
/resources/gamepack.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/gamepack.jar
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 | jdk:
3 | - oraclejdk8
4 |
5 | before_install:
6 | - chmod +x gradlew
--------------------------------------------------------------------------------
/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | connection.project.dir=
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/resources/clan_ranks/Owner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/clan_ranks/Owner.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/resources/clan_ranks/Captain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/clan_ranks/Captain.png
--------------------------------------------------------------------------------
/resources/clan_ranks/Corporal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/clan_ranks/Corporal.png
--------------------------------------------------------------------------------
/resources/clan_ranks/Friend.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/clan_ranks/Friend.png
--------------------------------------------------------------------------------
/resources/clan_ranks/General.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/clan_ranks/General.png
--------------------------------------------------------------------------------
/resources/clan_ranks/Recruit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/clan_ranks/Recruit.png
--------------------------------------------------------------------------------
/resources/clan_ranks/Sergeant.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/clan_ranks/Sergeant.png
--------------------------------------------------------------------------------
/resources/skill_icons/Agility.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Agility.png
--------------------------------------------------------------------------------
/resources/skill_icons/Attack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Attack.png
--------------------------------------------------------------------------------
/resources/skill_icons/Cooking.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Cooking.png
--------------------------------------------------------------------------------
/resources/skill_icons/Defence.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Defence.png
--------------------------------------------------------------------------------
/resources/skill_icons/Farming.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Farming.png
--------------------------------------------------------------------------------
/resources/skill_icons/Fishing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Fishing.png
--------------------------------------------------------------------------------
/resources/skill_icons/Hunter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Hunter.png
--------------------------------------------------------------------------------
/resources/skill_icons/Magic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Magic.png
--------------------------------------------------------------------------------
/resources/skill_icons/Mining.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Mining.png
--------------------------------------------------------------------------------
/resources/skill_icons/Prayer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Prayer.png
--------------------------------------------------------------------------------
/resources/skill_icons/Ranged.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Ranged.png
--------------------------------------------------------------------------------
/resources/skill_icons/Slayer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Slayer.png
--------------------------------------------------------------------------------
/resources/clan_ranks/Lieutenant.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/clan_ranks/Lieutenant.png
--------------------------------------------------------------------------------
/resources/skill_icons/Crafting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Crafting.png
--------------------------------------------------------------------------------
/resources/skill_icons/Fletching.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Fletching.png
--------------------------------------------------------------------------------
/resources/skill_icons/Herblore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Herblore.png
--------------------------------------------------------------------------------
/resources/skill_icons/Hitpoints.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Hitpoints.png
--------------------------------------------------------------------------------
/resources/skill_icons/Smithing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Smithing.png
--------------------------------------------------------------------------------
/resources/skill_icons/Strength.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Strength.png
--------------------------------------------------------------------------------
/resources/skill_icons/Thieving.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Thieving.png
--------------------------------------------------------------------------------
/resources/skill_icons/Construction.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Construction.png
--------------------------------------------------------------------------------
/resources/skill_icons/Firemaking.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Firemaking.png
--------------------------------------------------------------------------------
/resources/skill_icons/Runecrafting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Runecrafting.png
--------------------------------------------------------------------------------
/resources/skill_icons/Woodcutting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeruth/OSJR/HEAD/resources/skill_icons/Woodcutting.png
--------------------------------------------------------------------------------
/src/main/java/hooks/model/RSField.java:
--------------------------------------------------------------------------------
1 | package hooks.model;
2 |
3 | public class RSField {
4 |
5 | public Number multiplier;
6 | public String name;
7 | public String obfuscatedName;
8 |
9 | public RSField() {
10 |
11 | }
12 |
13 | }
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-bin.zip
6 |
--------------------------------------------------------------------------------
/src/main/java/discord/ErrorCode.java:
--------------------------------------------------------------------------------
1 | package discord;
2 |
3 | /**
4 | * Discord error codes
5 | */
6 | public enum ErrorCode {
7 | PIPE_CLOSED, READ_CORRUPT, SUCCESS, UNKNOWN
8 |
9 | // TODO Implement more error codes, and use an id field instead of ordinal
10 | }
--------------------------------------------------------------------------------
/src/main/java/hooks/model/ItemDefinition.java:
--------------------------------------------------------------------------------
1 | package hooks.model;
2 |
3 | public class ItemDefinition {
4 |
5 | int id = -1;
6 | String name = "";
7 |
8 | public ItemDefinition() {
9 |
10 | }
11 |
12 | public String getName() {
13 | return this.name;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/discord/DiscordReply.java:
--------------------------------------------------------------------------------
1 | package discord;
2 |
3 | /**
4 | * Discord reply to join requests
5 | */
6 | public enum DiscordReply {
7 | /**
8 | * Ignore the request
9 | */
10 | IGNORE,
11 |
12 | /**
13 | * Deny the request
14 | */
15 | NO,
16 |
17 | /**
18 | * Accept the request
19 | */
20 | YES
21 | }
22 |
--------------------------------------------------------------------------------
/src/test/java/LibraryTest.java:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * This Java source file was generated by the Gradle 'init' task.
4 | */
5 | import org.junit.Test;
6 |
7 | public class LibraryTest {
8 | @Test
9 | public void testSomeLibraryMethod() {
10 | // Library classUnderTest = new Library();
11 | // assertTrue("someLibraryMethod should return 'true'",
12 | // classUnderTest.someLibraryMethod());
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Area.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Area extends RSClass {
7 |
8 | public Area(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.sequence != null) {
11 | this.fields = Hooks.sequence.fields;
12 | this.name = Hooks.sequence.name;
13 | this.obfuscatedName = Hooks.sequence.obfuscatedName;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Ignore.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Ignore extends RSClass {
7 |
8 | public Ignore(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.ignore != null) {
11 | this.fields = Hooks.ignore.fields;
12 | this.name = Hooks.ignore.name;
13 | this.obfuscatedName = Hooks.ignore.obfuscatedName;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Varcs.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Varcs extends RSClass {
7 |
8 | public Varcs(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.varcs != null) {
11 | this.fields = Hooks.ignore.fields;
12 | this.name = Hooks.ignore.name;
13 | this.obfuscatedName = Hooks.ignore.obfuscatedName;
14 | }
15 |
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Class33.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Class33 extends RSClass {
7 |
8 | public Class33(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.class33 != null) {
11 | this.fields = Hooks.class33.fields;
12 | this.name = Hooks.class33.name;
13 | this.obfuscatedName = Hooks.class33.obfuscatedName;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Class38.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Class38 extends RSClass {
7 |
8 | public Class38(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.class38 != null) {
11 | this.fields = Hooks.class38.fields;
12 | this.name = Hooks.class38.name;
13 | this.obfuscatedName = Hooks.class38.obfuscatedName;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/paint/TextPaintListener.java:
--------------------------------------------------------------------------------
1 | package paint;
2 |
3 | import java.util.EventListener;
4 |
5 | /**
6 | * Created by IntelliJ IDEA. User: Jan Ove / Kosaki Date: 23.apr.2009 Time:
7 | * 20:09:07
8 | */
9 | public interface TextPaintListener extends EventListener {
10 | /**
11 | * Gets called on each repaint.
12 | *
13 | * @return array of strings to paint. 1 per line.
14 | */
15 | public abstract String[] onTextRepaint();
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Class160.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Class160 extends RSClass {
7 |
8 | public Class160(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.class160 != null) {
11 | this.fields = Hooks.class160.fields;
12 | this.name = Hooks.class160.name;
13 | this.obfuscatedName = Hooks.class160.obfuscatedName;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Class237.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Class237 extends RSClass {
7 |
8 | public Class237(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.class237 != null) {
11 | this.fields = Hooks.class237.fields;
12 | this.name = Hooks.class237.name;
13 | this.obfuscatedName = Hooks.class237.obfuscatedName;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Class308.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Class308 extends RSClass {
7 |
8 | public Class308(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.class308 != null) {
11 | this.fields = Hooks.class308.fields;
12 | this.name = Hooks.class308.name;
13 | this.obfuscatedName = Hooks.class308.obfuscatedName;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Renderable.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Renderable extends RSClass {
7 |
8 | public Renderable(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.actor != null) {
11 | this.fields = Hooks.actor.fields;
12 | this.name = Hooks.actor.name;
13 | this.obfuscatedName = Hooks.actor.obfuscatedName;
14 | }
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Sequence.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Sequence extends RSClass {
7 |
8 | public Sequence(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.sequence != null) {
11 | this.fields = Hooks.sequence.fields;
12 | this.name = Hooks.sequence.name;
13 | this.obfuscatedName = Hooks.sequence.obfuscatedName;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/ClientPacket.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class ClientPacket extends RSClass {
7 |
8 | public ClientPacket(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.sequence != null) {
11 | this.fields = Hooks.sequence.fields;
12 | this.name = Hooks.sequence.name;
13 | this.obfuscatedName = Hooks.sequence.obfuscatedName;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/PacketNode.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class PacketNode extends RSClass {
7 |
8 | public PacketNode(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.packetNode != null) {
11 | this.fields = Hooks.packetNode.fields;
12 | this.name = Hooks.packetNode.name;
13 | this.obfuscatedName = Hooks.packetNode.obfuscatedName;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/BaseVarType.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class BaseVarType extends RSClass {
7 |
8 | public BaseVarType(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.baseVarType != null) {
11 | this.fields = Hooks.baseVarType.fields;
12 | this.name = Hooks.baseVarType.name;
13 | this.obfuscatedName = Hooks.baseVarType.obfuscatedName;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/WorldMapData.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class WorldMapData extends RSClass {
7 |
8 | public WorldMapData(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.worldMapData != null) {
11 | this.fields = Hooks.worldMapData.fields;
12 | this.name = Hooks.worldMapData.name;
13 | this.obfuscatedName = Hooks.worldMapData.obfuscatedName;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/BoundingBox3D.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class BoundingBox3D extends RSClass {
7 |
8 | public BoundingBox3D(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.boundingBox3D != null) {
11 | this.fields = Hooks.boundingBox3D.fields;
12 | this.name = Hooks.boundingBox3D.name;
13 | this.obfuscatedName = Hooks.boundingBox3D.obfuscatedName;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/PlayerComposition.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 |
5 | public class PlayerComposition extends Actor {
6 |
7 | public PlayerComposition(Object reference) {
8 | super(reference);
9 | this.reference = reference;
10 | if (Hooks.playerComposition != null) {
11 | this.fields = Hooks.playerComposition.fields;
12 | this.name = Hooks.playerComposition.name;
13 | this.obfuscatedName = Hooks.playerComposition.obfuscatedName;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/WorldComparator.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class WorldComparator extends RSClass {
7 |
8 | public WorldComparator(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.worldComparator != null) {
11 | this.fields = Hooks.worldComparator.fields;
12 | this.name = Hooks.worldComparator.name;
13 | this.obfuscatedName = Hooks.worldComparator.obfuscatedName;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/hooks/helpers/Constants.java:
--------------------------------------------------------------------------------
1 | package hooks.helpers;
2 |
3 | import java.awt.Dimension;
4 |
5 | public class Constants {
6 | public static final int CLIENT_DEFAULT_ZOOM = 512;
7 | public static final int GAME_FIXED_WIDTH = 765;
8 | public static final int GAME_FIXED_HEIGHT = 503;
9 | public static final double GAME_FIXED_ASPECT_RATIO = (double) GAME_FIXED_WIDTH / (double) GAME_FIXED_HEIGHT;
10 | public static final Dimension GAME_FIXED_SIZE = new Dimension(GAME_FIXED_WIDTH, GAME_FIXED_HEIGHT);
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/paint/PaintListener.java:
--------------------------------------------------------------------------------
1 | package paint;
2 |
3 | import java.awt.Graphics;
4 | import java.util.EventListener;
5 |
6 | /**
7 | * Created by IntelliJ IDEA. User: Jan Ove / Kosaki Date: 19.mar.2009 Time:
8 | * 17:04:48
9 | */
10 | public interface PaintListener extends EventListener {
11 | /**
12 | * Gets called on each repaint. This at default 50 times a second so try not to
13 | * do anything resource intensive.
14 | *
15 | * @param g
16 | * instance of the graphics object to paint on
17 | */
18 | public abstract void onRepaint(Graphics g);
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Class23.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Class23 extends RSClass {
7 |
8 | int baseY;
9 |
10 | public Class23(Object reference) {
11 | this.reference = reference;
12 | if (Hooks.class23 != null) {
13 | this.fields = Hooks.class23.fields;
14 | this.name = Hooks.class23.name;
15 | this.obfuscatedName = Hooks.class23.obfuscatedName;
16 | }
17 | }
18 |
19 | public int getBaseY() {
20 | this.baseY = (int) getValue(getField("baseY"));
21 | return this.baseY;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Class138.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Class138 extends RSClass {
7 |
8 | int baseX;
9 |
10 | public Class138(Object reference) {
11 | this.reference = reference;
12 | if (Hooks.class138 != null) {
13 | this.fields = Hooks.class138.fields;
14 | this.name = Hooks.class138.name;
15 | this.obfuscatedName = Hooks.class138.obfuscatedName;
16 | }
17 | }
18 |
19 | public int getBaseX() {
20 | this.baseX = (int) getValue(getField("baseX"));
21 | return this.baseX;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/ObjectComposition.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class ObjectComposition extends RSClass {
7 |
8 | public ObjectComposition(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.npcComposition != null) {
11 | this.fields = Hooks.npcComposition.fields;
12 | this.name = Hooks.npcComposition.name;
13 | this.obfuscatedName = Hooks.npcComposition.obfuscatedName;
14 | }
15 | }
16 |
17 | public int getID() {
18 | return (int) getValue(getField("id"));
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Class20.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Class20 extends RSClass {
7 |
8 | int cameraY;
9 |
10 | public Class20(Object reference) {
11 | this.reference = reference;
12 | if (Hooks.class20 != null) {
13 | this.fields = Hooks.class20.fields;
14 | this.name = Hooks.class20.name;
15 | this.obfuscatedName = Hooks.class20.obfuscatedName;
16 | }
17 | }
18 |
19 | public int getCameraY() {
20 | this.cameraY = (int) getValue(getField("cameraY"));
21 | return this.cameraY;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Class28.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Class28 extends RSClass {
7 |
8 | int cameraYaw;
9 |
10 | public Class28(Object reference) {
11 | this.reference = reference;
12 | if (Hooks.class28 != null) {
13 | this.fields = Hooks.class28.fields;
14 | this.name = Hooks.class28.name;
15 | this.obfuscatedName = Hooks.class28.obfuscatedName;
16 | }
17 | }
18 |
19 | public int getCameraYaw() {
20 | this.cameraYaw = (int) getValue(getField("cameraYaw"));
21 | return this.cameraYaw;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/ChatPlayer.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class ChatPlayer extends RSClass {
7 |
8 | int rank;
9 |
10 | public ChatPlayer(Object reference) {
11 | this.reference = reference;
12 | if (Hooks.chatPlayer != null) {
13 | this.fields = Hooks.chatPlayer.fields;
14 | this.name = Hooks.chatPlayer.name;
15 | this.obfuscatedName = Hooks.chatPlayer.obfuscatedName;
16 | }
17 | }
18 |
19 | public int getRank() {
20 | this.rank = (int) getValue(getField("rank"));
21 | ;
22 | return this.rank;
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Class255.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Class255 extends RSClass {
7 |
8 | Region region;
9 |
10 | public Class255(Object reference) {
11 | this.reference = reference;
12 | if (Hooks.class255 != null) {
13 | this.fields = Hooks.class255.fields;
14 | this.name = Hooks.class255.name;
15 | this.obfuscatedName = Hooks.class255.obfuscatedName;
16 | }
17 | }
18 |
19 | public Region getRegion() {
20 | this.region = new Region(getValue(getField("region")));
21 | return this.region;
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Coordinates.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Coordinates extends RSClass {
7 |
8 | int plane;
9 |
10 | public Coordinates(Object reference) {
11 | this.reference = reference;
12 | if (Hooks.coordinates != null) {
13 | this.fields = Hooks.coordinates.fields;
14 | this.name = Hooks.coordinates.name;
15 | this.obfuscatedName = Hooks.coordinates.obfuscatedName;
16 | }
17 | }
18 |
19 | public int getPlane() {
20 | this.plane = (int) getValue(getField("plane"));
21 | return this.plane;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/hooks/helpers/Cache.java:
--------------------------------------------------------------------------------
1 | package hooks.helpers;
2 |
3 | import java.util.Hashtable;
4 |
5 | public class Cache {
6 | private Hashtable cache;
7 |
8 | public Cache() {
9 | this.cache = new Hashtable<>();
10 | }
11 |
12 | // http://stackoverflow.com/questions/442747/getting-the-name-of-the-current-executing-method/8592871#8592871
13 |
14 | public void clear() {
15 | this.cache.clear();
16 | }
17 |
18 | public Object get(String signature) {
19 | return this.cache.get(signature);
20 | }
21 |
22 | public void put(String signature, Object o) {
23 | this.cache.put(signature, o);
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/ClanMember.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class ClanMember extends RSClass {
7 |
8 | ChatPlayer chatPLayer;
9 |
10 | public ClanMember(Object reference) {
11 | this.reference = reference;
12 | if (Hooks.clanMember != null) {
13 | this.fields = Hooks.clanMember.fields;
14 | this.name = Hooks.clanMember.name;
15 | this.obfuscatedName = Hooks.clanMember.obfuscatedName;
16 | }
17 | }
18 |
19 | public ChatPlayer asChatPlayer() {
20 | this.chatPLayer = new ChatPlayer(this.reference);
21 | return this.chatPLayer;
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Nameable.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Nameable extends RSClass {
7 |
8 | public Nameable(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.nameable != null) {
11 | this.fields = Hooks.nameable.fields;
12 | this.name = Hooks.nameable.name;
13 | this.obfuscatedName = Hooks.nameable.obfuscatedName;
14 | }
15 | }
16 |
17 | public Name getName() {
18 | return new Name(getValue(getField("name")));
19 | }
20 |
21 | public ClanMember asClanMember() {
22 | return new ClanMember(this.reference);
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * This settings file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * In a single project build this file can be empty or even removed.
6 | *
7 | * Detailed information about configuring a multi-project build in Gradle can be found
8 | * in the user guide at https://docs.gradle.org/4.3/userguide/multi_project_builds.html
9 | */
10 |
11 | /*
12 | // To declare projects as part of a multi-project build use the 'include' method
13 | include 'shared'
14 | include 'api'
15 | include 'services:webservice'
16 | */
17 |
18 | rootProject.name = 'OS-JR'
19 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/BoundingBox3DDrawMode.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class BoundingBox3DDrawMode extends RSClass {
7 |
8 | int plane;
9 |
10 | public BoundingBox3DDrawMode(Object reference) {
11 | this.reference = reference;
12 | if (Hooks.boundingBox3D != null) {
13 | this.fields = Hooks.boundingBox3D.fields;
14 | this.name = Hooks.boundingBox3D.name;
15 | this.obfuscatedName = Hooks.boundingBox3D.obfuscatedName;
16 | }
17 | }
18 |
19 | public int getPlane() {
20 | this.plane = (int) getValue(getField("plane"));
21 | return this.plane;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/GrandExchangeOffer.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class GrandExchangeOffer extends RSClass {
7 |
8 | public int plane = 0;
9 |
10 | public GrandExchangeOffer(Object reference) {
11 | this.reference = reference;
12 | if (Hooks.grandExchangeOffer != null) {
13 | this.fields = Hooks.grandExchangeOffer.fields;
14 | this.name = Hooks.grandExchangeOffer.name;
15 | this.obfuscatedName = Hooks.grandExchangeOffer.obfuscatedName;
16 | }
17 | }
18 |
19 | public int getCameraPitch() {
20 | return (int) getValue(getField("cameraPitch"));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/SpritePixels.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class SpritePixels extends RSClass {
7 |
8 | public SpritePixels(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.spritePixels != null) {
11 | this.fields = Hooks.spritePixels.fields;
12 | this.name = Hooks.spritePixels.name;
13 | this.obfuscatedName = Hooks.spritePixels.obfuscatedName;
14 | }
15 | }
16 |
17 | public int getHeight() {
18 | return (int) getValue(getField("height"));
19 | }
20 |
21 | public int getWidth() {
22 | return (int) getValue(getField("width"));
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Class95.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import java.util.Map;
4 |
5 | import hooks.Hooks;
6 | import hooks.model.RSClass;
7 |
8 | public class Class95 extends RSClass {
9 |
10 | public Class95(Object reference) {
11 | this.reference = reference;
12 | if (Hooks.class95 != null) {
13 | this.fields = Hooks.class95.fields;
14 | this.name = Hooks.class95.name;
15 | this.obfuscatedName = Hooks.class95.obfuscatedName;
16 | }
17 | }
18 |
19 | public Map getChatLineMap() {
20 | @SuppressWarnings("unchecked")
21 | Map m = (Map) getValue(getField("chatLineMap"));
22 | return m;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/paint/misc/XpGlobe.java:
--------------------------------------------------------------------------------
1 | package paint.misc;
2 |
3 | import java.awt.Graphics;
4 | import java.awt.RenderingHints;
5 |
6 | import game.Game;
7 | import hooks.Hooks;
8 | import hooks.helpers.SkillGlobe;
9 | import paint.PaintListener;
10 |
11 | public class XpGlobe implements PaintListener {
12 |
13 | RenderingHints rh = new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING,
14 | RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
15 |
16 | @Override
17 | public void onRepaint(Graphics g) {
18 | if (Hooks.client.isLoggedIn() && Game.ctrlPressed==false)
19 | if (SkillGlobe.activeSkillGlobe != null) {
20 | SkillGlobe.activeSkillGlobe.paint(g);
21 | }
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | OS-JR
4 | Project OS-JR created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.buildship.core.gradleprojectbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.buildship.core.gradleprojectnature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Item.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Item extends RSClass {
7 |
8 | public Item(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.item != null) {
11 | this.fields = Hooks.item.fields;
12 | this.name = Hooks.item.name;
13 | this.obfuscatedName = Hooks.item.obfuscatedName;
14 | }
15 | }
16 |
17 | public int getId() {
18 | return (int) getValue(getField("id"));
19 | }
20 |
21 | public int getX() {
22 | return (int) getValue(getField("quantity"));
23 | }
24 |
25 | public Node asNode() {
26 | return new Node(this.reference);
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Name.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Name extends RSClass {
7 |
8 | public Name(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.name != null) {
11 | this.fields = Hooks.name.fields;
12 | this.name = Hooks.name.name;
13 | this.obfuscatedName = Hooks.name.obfuscatedName;
14 | }
15 | }
16 |
17 | public String getCleanName() {
18 | return (String) getValue(getField("cleanName"));
19 | }
20 |
21 | public String getOriginalName() {
22 | if (this.reference == null)
23 | return "null";
24 | return (String) getValue(getField("name"));
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/GameEngine.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class GameEngine extends RSClass {
7 |
8 | public GameEngine(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.gameEngine != null) {
11 | this.fields = Hooks.gameEngine.fields;
12 | this.name = Hooks.gameEngine.name;
13 | this.obfuscatedName = Hooks.gameEngine.obfuscatedName;
14 | }
15 | }
16 |
17 | public int getFps() {
18 | return (int) getValue(getField("FPS"));
19 | }
20 |
21 | public ClanMemberManager getClanMemberManager() {
22 | return new ClanMemberManager(getValue(getField("clanMemberManager")));
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/ClanMemberManager.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class ClanMemberManager extends RSClass {
7 |
8 | NameableContainer nameableContainer;
9 |
10 | public ClanMemberManager(Object reference) {
11 | this.reference = reference;
12 | if (Hooks.clanMemberManager != null) {
13 | this.fields = Hooks.clanMemberManager.fields;
14 | this.name = Hooks.clanMemberManager.name;
15 | this.obfuscatedName = Hooks.clanMemberManager.obfuscatedName;
16 | }
17 | }
18 |
19 | public NameableContainer asNameableContainer() {
20 | this.nameableContainer = new NameableContainer(this.reference);
21 | return this.nameableContainer;
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/NpcComposition.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class NpcComposition extends RSClass {
7 |
8 | public NpcComposition(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.npcComposition != null) {
11 | this.fields = Hooks.npcComposition.fields;
12 | this.name = Hooks.npcComposition.name;
13 | this.obfuscatedName = Hooks.npcComposition.obfuscatedName;
14 | }
15 | }
16 |
17 | public String[] getActions() {
18 | return (String[]) getValue(getField("actions"));
19 | }
20 |
21 | public String getName() {
22 | if (this.reference == null)
23 | return "null";
24 | return (String) getValue(getField("name"));
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/SoundTaskDataProvider.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class SoundTaskDataProvider extends RSClass {
7 | Player localPlayer;
8 |
9 | public SoundTaskDataProvider(Object reference) {
10 | this.reference = reference;
11 | if (Hooks.soundTaskDataProvider != null) {
12 | this.fields = Hooks.soundTaskDataProvider.fields;
13 | this.name = Hooks.soundTaskDataProvider.name;
14 | this.obfuscatedName = Hooks.soundTaskDataProvider.obfuscatedName;
15 | }
16 | }
17 |
18 | public Player getLocalPlayer() {
19 | this.reference = null;
20 | this.localPlayer = new Player(getValue(getField("localPlayer")));
21 | return this.localPlayer;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/cache/ActorListener.java:
--------------------------------------------------------------------------------
1 | package cache;
2 |
3 | import java.awt.Graphics;
4 |
5 | import hooks.Hooks;
6 | import hooks.accessors.Npc;
7 | import hooks.accessors.Player;
8 | import paint.PaintListener;
9 |
10 | public class ActorListener implements PaintListener {
11 |
12 | public static Player[] players;
13 | public static Npc[] npcs;
14 | int tick = 0;
15 |
16 | @Override
17 | public void onRepaint(Graphics g) {
18 | if (this.tick > 40) {
19 | if (Hooks.client != null)
20 | if (Hooks.client.isLoggedIn()) {
21 | Player[] ps = Hooks.client.getCachedPlayers();
22 | Npc[] ns = Hooks.client.getCachedNpcs();
23 | ActorListener.players = ps;
24 | ActorListener.npcs = ns;
25 | }
26 | this.tick = 0;
27 | } else {
28 | this.tick++;
29 | }
30 |
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/paint/GameCanvas.java:
--------------------------------------------------------------------------------
1 | package paint;
2 |
3 | import java.awt.Canvas;
4 | import java.awt.Graphics;
5 | import java.awt.Image;
6 | import java.awt.image.BufferedImage;
7 |
8 | import game.Game;
9 |
10 | public class GameCanvas extends Canvas {
11 | Graphics botGraphics;
12 |
13 | private static final long serialVersionUID = 1L;
14 |
15 | @Override
16 | public Image createImage(int width, int height) {
17 | return new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
18 | }
19 |
20 | @Override
21 | public Graphics getGraphics() {
22 | if (Game.vanilla) {
23 | return super.getGraphics();
24 | }
25 |
26 | this.botGraphics = Game.gamePaint();
27 |
28 | if (this.botGraphics != null) {
29 | return this.botGraphics;
30 | } else {
31 | return super.getGraphics();
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Class62.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Class62 extends RSClass {
7 |
8 | int[][][] tileHeights;
9 | byte[][][] tileSettings;
10 |
11 | public Class62(Object reference) {
12 | this.reference = reference;
13 | if (Hooks.class62 != null) {
14 | this.fields = Hooks.class62.fields;
15 | this.name = Hooks.class62.name;
16 | this.obfuscatedName = Hooks.class62.obfuscatedName;
17 | }
18 | }
19 |
20 | public int[][][] getTileHeights() {
21 | this.tileHeights = (int[][][]) getValue(getField("tileHeights"));
22 | return this.tileHeights;
23 | }
24 |
25 | public byte[][][] getTileSettings() {
26 | this.tileSettings = (byte[][][]) getValue(getField("tileSettings"));
27 | return this.tileSettings;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Node.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Node extends RSClass {
7 |
8 | public Node(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.node != null) {
11 | this.fields = Hooks.node.fields;
12 | this.name = Hooks.node.name;
13 | this.obfuscatedName = Hooks.node.obfuscatedName;
14 | }
15 | }
16 |
17 | public boolean hasNext() {
18 | Object ref = getValue(getField("next"));
19 | if (ref != null)
20 | return true;
21 | return false;
22 | }
23 |
24 | public Node getNext() {
25 | Object ref = getValue(getField("next"));
26 | return new Node(ref);
27 | }
28 |
29 | public Node getPrevious() {
30 | Object ref = getValue(getField("previous"));
31 | return new Node(ref);
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/ChatLineBuffer.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class ChatLineBuffer extends RSClass {
7 |
8 | public ChatLineBuffer(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.chatLineBuffer != null) {
11 | this.fields = Hooks.chatLineBuffer.fields;
12 | this.name = Hooks.chatLineBuffer.name;
13 | this.obfuscatedName = Hooks.chatLineBuffer.obfuscatedName;
14 | }
15 | }
16 |
17 | public MessageNode[] getLines() {
18 | Object[] os = (Object[]) getValue(getField("lines"));
19 | if (os != null) {
20 | MessageNode[] mns = new MessageNode[os.length];
21 | int i = 0;
22 | for (Object o : os) {
23 | mns[i] = new MessageNode(o);
24 | i++;
25 | }
26 | return mns;
27 | }
28 | return null;
29 | }
30 |
31 | public static int length() {
32 | return -1;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/NameableContainer.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class NameableContainer extends RSClass {
7 |
8 | public NameableContainer(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.nameableContainer != null) {
11 | this.fields = Hooks.nameableContainer.fields;
12 | this.name = Hooks.nameableContainer.name;
13 | this.obfuscatedName = Hooks.nameableContainer.obfuscatedName;
14 | }
15 | }
16 |
17 | public Nameable[] getNameables() {
18 | Object[] os = (Object[]) getValue(getField("nameables"));
19 | int i = 0;
20 | for (Object o : os) {
21 | if (o != null)
22 | i++;
23 | }
24 | Nameable[] nameables = new Nameable[i];
25 | int k = 0;
26 | for (Object o : os) {
27 | if (o != null) {
28 | nameables[k] = new Nameable(o);
29 | k++;
30 | }
31 | }
32 | return nameables;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/ItemLayer.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class ItemLayer extends RSClass {
7 |
8 | public ItemLayer(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.itemLayer != null) {
11 | this.fields = Hooks.itemLayer.fields;
12 | this.name = Hooks.itemLayer.name;
13 | this.obfuscatedName = Hooks.itemLayer.obfuscatedName;
14 | }
15 | }
16 |
17 | public int getHash() {
18 | return (int) getValue(getField("hash"));
19 | }
20 |
21 | public int getX() {
22 | return (int) getValue(getField("x"));
23 | }
24 |
25 | public int getY() {
26 | return (int) getValue(getField("y"));
27 | }
28 |
29 | public Item getBottom() {
30 | return new Item(getValue(getField("bottom")));
31 | }
32 |
33 | public Item getMiddle() {
34 | return new Item(getValue(getField("middle")));
35 | }
36 |
37 | public Item getTop() {
38 | return new Item(getValue(getField("top")));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Npc.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.helpers.Perspective;
5 | import hooks.model.RSClass;
6 |
7 | public class Npc extends RSClass {
8 |
9 | public Model paintModel;
10 |
11 | public Npc(Object reference) {
12 | this.reference = reference;
13 | if (Hooks.npc != null) {
14 | this.fields = Hooks.npc.fields;
15 | this.name = Hooks.npc.name;
16 | this.obfuscatedName = Hooks.npc.obfuscatedName;
17 | }
18 | }
19 |
20 | public Actor asActor() {
21 | return new Actor(this.reference);
22 | }
23 |
24 | public int getCombatLevel() {
25 | return (int) getValue(getField("combatLevel"));
26 | }
27 |
28 | public NpcComposition getNpcComposition() {
29 | return new NpcComposition(getValue(getField("composition")));
30 | }
31 |
32 | public java.awt.geom.Area getClickbox() {
33 | if (this.paintModel != null)
34 | return Perspective.getClickbox(Hooks.client, this.paintModel, 0, asActor().getX(), asActor().getY());
35 | return null;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/cache/ItemDefinitionManager.java:
--------------------------------------------------------------------------------
1 | package cache;
2 |
3 | import java.io.File;
4 | import java.io.FileNotFoundException;
5 | import java.io.FileReader;
6 | import com.google.gson.Gson;
7 | import com.google.gson.JsonIOException;
8 | import com.google.gson.JsonSyntaxException;
9 |
10 | import hooks.model.ItemDefinition;
11 |
12 | public class ItemDefinitionManager {
13 |
14 | public static ItemDefinition[] itemDefinitions;
15 |
16 | @SuppressWarnings("resource")
17 | public static void init() {
18 | Gson gson = new Gson();
19 | try {
20 | ItemDefinitionManager.itemDefinitions = gson.fromJson(new FileReader(new File("./resources/ItemDef.json")),
21 | ItemDefinition[].class);
22 | } catch (JsonSyntaxException e) {
23 | // TODO Auto-generated catch block
24 | e.printStackTrace();
25 | } catch (JsonIOException e) {
26 | // TODO Auto-generated catch block
27 | e.printStackTrace();
28 | } catch (FileNotFoundException e) {
29 | // TODO Auto-generated catch block
30 | e.printStackTrace();
31 | }
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/game/Settings.java:
--------------------------------------------------------------------------------
1 | package game;
2 |
3 | public class Settings {
4 | public static final boolean DOWNLOAD_GAMEPACK = false;
5 |
6 | public static boolean DRAW_NPCS = false;
7 |
8 | public static boolean NEW_FKEYS = true;
9 |
10 | public static boolean RESET_EXPH = true;
11 |
12 | public static boolean SHOW_AGILITY_OVERLAY = false;
13 |
14 | public static boolean SHOW_FISHING_NET_BAIT = false;
15 |
16 | public static boolean SHOW_FISHING_NET_HARPOON = false;
17 |
18 | public static boolean SHOW_FISHING_CAGE_HARPOON = false;
19 |
20 | public static boolean SHOW_FISHING_BARBARIAN = false;
21 |
22 | public static boolean SHOW_DEBUG = false;
23 |
24 | public static boolean SHOW_DECORATIVEOBJECT_IDS = false;
25 |
26 | public static boolean SHOW_FPS = true;
27 |
28 | public static boolean SHOW_GAMEOBJECT_IDS = false;
29 |
30 | public static boolean SHOW_GROUNDOBJECT_IDS = false;
31 |
32 | public static boolean SHOW_PLAYER_NAMES = true;
33 |
34 | public static boolean SHOW_WALLOBJECT_IDS = false;
35 |
36 | public static boolean SHOW_FISHING_OVERLAY = false;
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Actor.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import java.awt.Polygon;
4 |
5 | import hooks.Hooks;
6 | import hooks.helpers.LocalPoint;
7 | import hooks.helpers.Perspective;
8 |
9 | public class Actor extends Renderable {
10 |
11 | LocalPoint localLocation;
12 | int x;
13 | int y;
14 | Polygon tileAreaonScreen;
15 |
16 | public Actor(Object reference) {
17 | super(reference);
18 | if (Hooks.actor != null) {
19 | this.fields = Hooks.actor.fields;
20 | this.name = Hooks.actor.name;
21 | this.obfuscatedName = Hooks.actor.obfuscatedName;
22 | }
23 | }
24 |
25 | public LocalPoint getLocalLocation() {
26 | this.localLocation = new LocalPoint(getX(), getY());
27 | return this.localLocation;
28 | }
29 |
30 | public int getX() {
31 | this.x = (int) getValue(getField("x"));
32 | return this.x;
33 | }
34 |
35 | public int getY() {
36 | this.y = (int) getValue(getField("y"));
37 | return this.y;
38 | }
39 |
40 | public Polygon getTileAreaOnScreen() {
41 | this.tileAreaonScreen = Perspective.getCanvasTilePoly(Hooks.client, getLocalLocation());
42 | return this.tileAreaonScreen;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/discord/Backoff.java:
--------------------------------------------------------------------------------
1 | package discord;
2 |
3 | import java.security.SecureRandom;
4 | import java.util.Random;
5 |
6 | /**
7 | * Backoff implementation
8 | */
9 | public class Backoff {
10 | private long current;
11 | private final long maxAmount;
12 |
13 | private final long minAmount;
14 |
15 | private final Random random;
16 |
17 | /**
18 | * Backoff constructor
19 | *
20 | * @param minAmount
21 | * Minimum amount of time
22 | * @param maxAmount
23 | * Maximum amount of time
24 | */
25 | public Backoff(long minAmount, long maxAmount) {
26 | this.minAmount = minAmount;
27 | this.maxAmount = maxAmount;
28 |
29 | this.random = new SecureRandom();
30 |
31 | this.current = minAmount;
32 | }
33 |
34 | /**
35 | * Calculate the next delay based on previous results
36 | *
37 | * @return Next Delay
38 | */
39 | public long nextDelay() {
40 | long delay = (long) (this.current * 2.0D * this.random.nextDouble());
41 |
42 | this.current = Math.min(this.current + delay, this.maxAmount);
43 |
44 | return this.current;
45 | }
46 |
47 | /**
48 | * Reset the backoff
49 | */
50 | public void reset() {
51 | this.current = this.minAmount;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/game/OSRSLauncher.java:
--------------------------------------------------------------------------------
1 | package game;
2 |
3 | import java.awt.AWTException;
4 | import java.awt.Image;
5 | import java.awt.SystemTray;
6 | import java.awt.TrayIcon;
7 | import java.io.File;
8 | import java.io.IOException;
9 |
10 | import javax.imageio.ImageIO;
11 |
12 | public class OSRSLauncher {
13 |
14 | public static SystemTray systemTray;
15 | public static TrayIcon trayIcon;
16 | static Image icon;
17 |
18 | public static LoaderWindow loaderWindow;
19 |
20 | public static void main(String[] args) {
21 | try {
22 | icon = ImageIO.read(new File("./resources/OSJR_tray.png"));
23 | if (SystemTray.isSupported()) {
24 | systemTray = SystemTray.getSystemTray();
25 | try {
26 | trayIcon = new TrayIcon(icon, "OSJR");
27 | trayIcon.setImageAutoSize(true);
28 | systemTray.add(trayIcon);
29 | } catch (AWTException e) {
30 | // TODO Auto-generated catch block
31 | e.printStackTrace();
32 | }
33 | }
34 | } catch (IOException e1) {
35 | // TODO Auto-generated catch block
36 | e1.printStackTrace();
37 | }
38 |
39 | loaderWindow = new LoaderWindow(args);
40 | loaderWindow.setIconImage(icon);
41 | loaderWindow.setVisible(true);
42 | loaderWindow.pack();
43 |
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/discord/DiscordJoinRequest.java:
--------------------------------------------------------------------------------
1 | package discord;
2 |
3 | /**
4 | * Discord join request
5 | */
6 | public class DiscordJoinRequest {
7 | private final String avatar;
8 | private final String discriminator;
9 | private final String userId;
10 | private final String username;
11 |
12 | DiscordJoinRequest(String userId, String username, String discriminator, String avatar) {
13 | this.userId = userId;
14 | this.username = username;
15 | this.discriminator = discriminator;
16 | this.avatar = avatar;
17 | }
18 |
19 | /**
20 | * Get the avatar of the user requesting to join
21 | *
22 | * @return Avatar
23 | */
24 | public String getAvatar() {
25 | return this.avatar;
26 | }
27 |
28 | /**
29 | * Get the discriminator of the request
30 | *
31 | * @return Discriminator
32 | */
33 | public String getDiscriminator() {
34 | return this.discriminator;
35 | }
36 |
37 | /**
38 | * Get the id of the user requesting to join
39 | *
40 | * @return User id
41 | */
42 | public String getUserId() {
43 | return this.userId;
44 | }
45 |
46 | /**
47 | * Get the name of the user requesting to join
48 | *
49 | * @return Username
50 | */
51 | public String getUsername() {
52 | return this.username;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/paint/misc/FpsPaintListener.java:
--------------------------------------------------------------------------------
1 | package paint.misc;
2 |
3 | import java.awt.Color;
4 | import java.awt.FontMetrics;
5 | import java.awt.Graphics;
6 |
7 | import game.OSRSLauncher;
8 | import game.Settings;
9 | import hooks.Hooks;
10 | import hooks.accessors.Client;
11 | import paint.PaintListener;
12 |
13 | public class FpsPaintListener implements PaintListener {
14 |
15 | FontMetrics fm;
16 | String stringFps;
17 | int x;
18 | int fps;
19 |
20 | public FpsPaintListener(Client game) {
21 | }
22 |
23 | @Override
24 | public void onRepaint(Graphics g) {
25 | if (Settings.SHOW_FPS) {
26 | if (Client.isLoaded()) {
27 | this.fm = g.getFontMetrics();
28 | this.stringFps = "" + Hooks.gameEngine.getFps();
29 | this.x = OSRSLauncher.loaderWindow.getWidth() - this.fm.stringWidth(this.stringFps) - 17;
30 |
31 | this.fps = Hooks.gameEngine.getFps();
32 | if (this.fps >= 50) {
33 | g.setColor(Color.cyan);
34 | } else if (this.fps >= 40 && this.fps < 50) {
35 | g.setColor(Color.green);
36 | } else if (this.fps >= 30 && this.fps < 40) {
37 | g.setColor(Color.yellow);
38 | } else {
39 | g.setColor(Color.red);
40 | }
41 | g.drawString(this.stringFps, this.x, 15);
42 | }
43 | }
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/MessageNode.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class MessageNode extends RSClass {
7 |
8 | public MessageNode(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.messageNode != null) {
11 | this.fields = Hooks.messageNode.fields;
12 | this.name = Hooks.messageNode.name;
13 | this.obfuscatedName = Hooks.messageNode.obfuscatedName;
14 | }
15 | }
16 |
17 | public int getID() {
18 | return (int) getValue(getField("id"));
19 | }
20 |
21 | public int getTick() {
22 | return (int) getValue(getField("tick"));
23 | }
24 |
25 | public int getType() {
26 | return (int) getValue(getField("type"));
27 | }
28 |
29 | public String getName() {
30 | String s = (String) getValue(getField("name"));
31 | s = s.replace("
", "(Ironman)");
32 | return s;
33 | }
34 |
35 | public String getSender() {
36 | String s = (String) getValue(getField("sender"));
37 | return s;
38 | }
39 |
40 | public String getMessage() {
41 | String s = (String) getValue(getField("value"));
42 | s = s.replace("
", "\n");
43 | s = s.replace("", "");
44 | s = s.replace("", "[Urgent] ");
45 | s = s.replace("", "[Info] ");
46 | return s;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/discord/DiscordEventHandler.java:
--------------------------------------------------------------------------------
1 | package discord;
2 |
3 | /**
4 | * Discord Event Handler class
5 | */
6 | public interface DiscordEventHandler {
7 | /**
8 | * Called when the connection is being disconnected
9 | *
10 | * @param errorCode
11 | * Error code
12 | * @param message
13 | * Error message
14 | */
15 | void disconnected(ErrorCode errorCode, String message);
16 |
17 | /**
18 | * Called when an error occurs on the connection
19 | *
20 | * @param errorCode
21 | * Error code
22 | * @param message
23 | * Error message
24 | */
25 | void errored(ErrorCode errorCode, String message);
26 |
27 | /**
28 | * Called when joining a game
29 | *
30 | * @param joinSecret
31 | * Join secret
32 | */
33 | void joinGame(String joinSecret);
34 |
35 | /**
36 | * Called when requesting to join a game
37 | *
38 | * @param joinRequest
39 | * Join secret
40 | */
41 | void joinRequest(DiscordJoinRequest joinRequest);
42 |
43 | /**
44 | * Called when the connection is ready
45 | */
46 | void ready();
47 |
48 | /**
49 | * Called when spectating a game
50 | *
51 | * @param spectateSecret
52 | * Spectate secret
53 | */
54 | void spectateGame(String spectateSecret);
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/cache/ObjectManager.java:
--------------------------------------------------------------------------------
1 | package cache;
2 |
3 | import java.awt.Color;
4 | import java.util.HashMap;
5 |
6 | import hooks.Hooks;
7 | import hooks.accessors.Client;
8 |
9 | public class ObjectManager {
10 |
11 | public static Color fillColor = new Color(Color.YELLOW.getBlue(), Color.YELLOW.getGreen(), Color.YELLOW.getRed(),
12 | 50);
13 | public static Color outlineColor = Color.YELLOW;
14 | public int basex = 0, basey = 0;
15 |
16 | public Thread t = new Thread(new Runnable() {
17 |
18 | @Override
19 | public void run() {
20 | while (true != false) {
21 | try {
22 | Thread.sleep(100);
23 | } catch (Exception e) {
24 | e.printStackTrace();
25 | }
26 | if (Hooks.client != null) {
27 | if (Client.isLoaded())
28 | if (Hooks.client.isLoggedIn()) {
29 | if (ObjectManager.this.basex != Client.getBaseX()
30 | || ObjectManager.this.basey != Client.getBaseY()) {
31 | } else {
32 | resetObjects();
33 | }
34 | }
35 | }
36 | }
37 | }
38 | });
39 |
40 | public static void resetObjects() {
41 | TileListener.decorativeObjects = new HashMap<>();
42 | TileListener.wallObjects = new HashMap<>();
43 | TileListener.groundObjects = new HashMap<>();
44 | TileListener.gameObjects = new HashMap<>();
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/paint/misc/DecorativeObjects.java:
--------------------------------------------------------------------------------
1 | package paint.misc;
2 |
3 | import java.awt.Color;
4 | import java.awt.Graphics;
5 | import java.awt.Graphics2D;
6 |
7 | import cache.TileListener;
8 | import game.Game;
9 | import game.Settings;
10 | import hooks.Hooks;
11 | import hooks.accessors.Client;
12 | import hooks.accessors.DecorativeObject;
13 | import hooks.helpers.LocalPoint;
14 | import hooks.helpers.Perspective;
15 | import hooks.helpers.Point;
16 | import paint.PaintListener;
17 |
18 | public class DecorativeObjects implements PaintListener {
19 |
20 | public DecorativeObjects(Client game) {
21 | }
22 |
23 | @Override
24 | public void onRepaint(Graphics g) {
25 | g.setColor(Color.yellow);
26 | if (Settings.SHOW_DECORATIVEOBJECT_IDS && Game.ctrlPressed==false)
27 | if (Hooks.client != null)
28 | if (Hooks.client.isLoggedIn()) {
29 | for (DecorativeObject o : TileListener.decorativeObjects.values()) {
30 | String name = "" + o.getID() + "p: " + 0 + " x:" + o.getX() + " y:" + o.getY();
31 | Point p = Perspective.getCanvasTextLocation(Hooks.client, (Graphics2D) g,
32 | new LocalPoint(o.getX(), o.getY()), name, 0);
33 | if (p != null && name != null && name.compareTo("null") != 0)
34 | g.drawString(name, p.getX(), p.getY());
35 | }
36 | }
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/paint/misc/WallObjects.java:
--------------------------------------------------------------------------------
1 | package paint.misc;
2 |
3 | import java.awt.Color;
4 | import java.awt.Graphics;
5 | import java.awt.Graphics2D;
6 |
7 | import cache.TileListener;
8 | import game.Game;
9 | import game.Settings;
10 | import hooks.Hooks;
11 | import hooks.accessors.Client;
12 | import hooks.accessors.WallObject;
13 | import hooks.helpers.LocalPoint;
14 | import hooks.helpers.Perspective;
15 | import hooks.helpers.Point;
16 | import paint.PaintListener;
17 |
18 | public class WallObjects implements PaintListener {
19 |
20 | public WallObjects(Client game) {
21 | }
22 |
23 | @Override
24 | public void onRepaint(Graphics g) {
25 | g.setColor(Color.yellow);
26 | if (Settings.SHOW_WALLOBJECT_IDS && Game.ctrlPressed==false)
27 | if (Hooks.client != null)
28 | if (Hooks.client.isLoggedIn()) {
29 | for (WallObject wo : TileListener.wallObjects.values()) {
30 | if (wo != null) {
31 | String name = "" + wo.getID() + "p: " + 0 + " x:" + wo.getX() + " y:" + wo.getY();
32 | Point p = Perspective.getCanvasTextLocation(Hooks.client, (Graphics2D) g,
33 | new LocalPoint(wo.getX(), wo.getY()), name, 0);
34 | if (p != null && name != null && name.compareTo("null") != 0)
35 | g.drawString(name, p.getX(), p.getY());
36 | }
37 | }
38 | }
39 |
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/paint/misc/GroundObjects.java:
--------------------------------------------------------------------------------
1 | package paint.misc;
2 |
3 | import java.awt.Color;
4 | import java.awt.Graphics;
5 | import java.awt.Graphics2D;
6 |
7 | import cache.TileListener;
8 | import game.Game;
9 | import game.Settings;
10 | import hooks.Hooks;
11 | import hooks.accessors.Client;
12 | import hooks.accessors.GroundObject;
13 | import hooks.helpers.LocalPoint;
14 | import hooks.helpers.Perspective;
15 | import hooks.helpers.Point;
16 | import paint.PaintListener;
17 |
18 | public class GroundObjects implements PaintListener {
19 |
20 | public GroundObjects(Client game) {
21 | }
22 |
23 | @Override
24 | public void onRepaint(Graphics g) {
25 | g.setColor(Color.yellow);
26 | if (Settings.SHOW_GROUNDOBJECT_IDS && Game.ctrlPressed==false)
27 | if (Hooks.client != null)
28 | if (Hooks.client.isLoggedIn()) {
29 | for (GroundObject go : TileListener.groundObjects.values()) {
30 | if (go != null) {
31 | String name = "" + go.getID() + "p: " + go.getPlane() + " x:" + go.getX() + " y:"
32 | + go.getY();
33 | Point p = Perspective.getCanvasTextLocation(Hooks.client, (Graphics2D) g,
34 | new LocalPoint(go.getX(), go.getY()), name, 0);
35 | if (p != null && name != null && name.compareTo("null") != 0)
36 | g.drawString(name, p.getX(), p.getY());
37 | }
38 | }
39 | }
40 |
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/WallObject.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.helpers.Perspective;
5 | import hooks.model.RSClass;
6 |
7 | public class WallObject extends RSClass {
8 |
9 | public WallObject(Object reference) {
10 | this.reference = reference;
11 | if (Hooks.wallObject != null) {
12 | this.fields = Hooks.wallObject.fields;
13 | this.name = Hooks.wallObject.name;
14 | this.obfuscatedName = Hooks.wallObject.obfuscatedName;
15 | }
16 | }
17 |
18 | public java.awt.geom.Area getClickbox() {
19 | return Perspective.getClickbox(Hooks.client, getModel(), 0, getX(), getY());
20 | }
21 |
22 | public int getHash() {
23 | return (int) getValue(getField("hash"));
24 | }
25 |
26 | public int getID() {
27 | int hash = getHash();
28 | return hash >> 14 & 32767;
29 | }
30 |
31 | public Model getModel() {
32 | if (getRenderable1().reference != null) {
33 | return new Model(getValue(getField("renderable1")));
34 | }
35 | return null;
36 |
37 | }
38 |
39 | public int getPlane() {
40 | return (int) getValue(getField("plane"));
41 | }
42 |
43 | public Renderable getRenderable1() {
44 | return new Renderable(getValue(getField("renderable1")));
45 | }
46 |
47 | public int getX() {
48 | return (int) getValue(getField("x"));
49 | }
50 |
51 | public int getY() {
52 | return (int) getValue(getField("y"));
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/paint/misc/GameObjects.java:
--------------------------------------------------------------------------------
1 | package paint.misc;
2 |
3 | import java.awt.Color;
4 | import java.awt.Graphics;
5 | import java.awt.Graphics2D;
6 | import java.util.ArrayList;
7 |
8 | import cache.TileListener;
9 | import game.Game;
10 | import game.Settings;
11 | import hooks.Hooks;
12 | import hooks.accessors.Client;
13 | import hooks.accessors.GameObject;
14 | import hooks.helpers.LocalPoint;
15 | import hooks.helpers.Perspective;
16 | import hooks.helpers.Point;
17 | import paint.PaintListener;
18 |
19 | public class GameObjects implements PaintListener {
20 |
21 | @Override
22 | public void onRepaint(Graphics g) {
23 | g.setColor(Color.yellow);
24 | if (Settings.SHOW_GAMEOBJECT_IDS && Game.ctrlPressed==false)
25 | if (Hooks.client != null)
26 | if (Hooks.client.isLoggedIn()) {
27 | for (ArrayList gos : TileListener.gameObjects.values()) {
28 | GameObject go = gos.get(0);
29 | if (go.getPlane() == Client.getPlane()) {
30 | String name = "" + go.getID() + "p: " + go.getPlane() + " x:" + go.getX() + " y:"
31 | + go.getY();
32 | Point p = Perspective.getCanvasTextLocation(Hooks.client, (Graphics2D) g,
33 | new LocalPoint(go.getX(), go.getY()), name, 0);
34 | if (p != null && name != null && name.compareTo("null") != 0)
35 | g.drawString(name, p.getX(), p.getY());
36 | }
37 | }
38 | }
39 |
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/reflection/JarInjector.java:
--------------------------------------------------------------------------------
1 | package reflection;
2 |
3 | import java.io.File;
4 | import java.io.FileOutputStream;
5 | import java.util.Hashtable;
6 | import java.util.jar.JarEntry;
7 | import java.util.jar.JarOutputStream;
8 |
9 | import org.objectweb.asm.ClassWriter;
10 | import org.objectweb.asm.tree.ClassNode;
11 |
12 | import paint.CanvasInjector;
13 |
14 | public class JarInjector {
15 | private Hashtable classnodes;
16 | private File injectedJar;
17 |
18 | public JarInjector(Hashtable classnodes) {
19 | this.classnodes = classnodes;
20 | }
21 |
22 | public Hashtable getClassnodes() {
23 | return this.classnodes;
24 | }
25 |
26 | public File getInjectedJar() {
27 | return this.injectedJar;
28 | }
29 |
30 | public void run() {
31 | this.classnodes = new CanvasInjector(this.classnodes).run();
32 |
33 | try {
34 | this.injectedJar = new File("./resources/gamepack_injected.jar");
35 | try (JarOutputStream jos = new JarOutputStream(new FileOutputStream(this.injectedJar))) {
36 | for (ClassNode cn : this.classnodes.values()) {
37 | ClassWriter cw = new ClassWriter(1);
38 | cn.accept(cw);
39 | JarEntry entry = new JarEntry(cn.name + ".class");
40 | jos.putNextEntry(entry);
41 | jos.write(cw.toByteArray());
42 | jos.closeEntry();
43 | }
44 | jos.close();
45 | }
46 |
47 | } catch (Exception e) {
48 | e.printStackTrace();
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/hooks/model/RSClass.java:
--------------------------------------------------------------------------------
1 | package hooks.model;
2 |
3 | import java.lang.reflect.Field;
4 |
5 | import game.Game;
6 |
7 | public class RSClass {
8 |
9 | public RSField[] fields;
10 | public String name;
11 | public String obfuscatedName;
12 | public Object reference;
13 |
14 | public RSClass() {
15 |
16 | }
17 |
18 | public RSField getField(String fieldName) {
19 | for (RSField f : this.fields) {
20 | if (f != null)
21 | if (f.name.compareTo(fieldName) == 0) {
22 | return f;
23 | }
24 | }
25 | System.out.println("Shouldnt happen");
26 | return null;
27 | }
28 |
29 | public Object getValue(RSField f) {
30 | try {
31 | if (this.reference == null)
32 | this.reference = Game.applet;
33 | if (f.multiplier != null) {
34 | Field field = Game.jarLoader.loadClass(this.obfuscatedName).getDeclaredField(f.obfuscatedName);
35 | field.setAccessible(true);
36 | if (field.get(this.reference) == null) {
37 | return null;
38 | }
39 | return (int) (field.get(this.reference)) * f.multiplier.intValue();
40 | }
41 |
42 | Field field = Game.jarLoader.loadClass(this.obfuscatedName).getDeclaredField(f.obfuscatedName);
43 | field.setAccessible(true);
44 | return field.get(this.reference);
45 | } catch (NullPointerException | IllegalArgumentException | IllegalAccessException | NoSuchFieldException
46 | | SecurityException | ClassNotFoundException e) {
47 | if (Game.debug)
48 | e.printStackTrace();
49 | }
50 | return null;
51 | }
52 | }
--------------------------------------------------------------------------------
/src/main/java/reflection/Util.java:
--------------------------------------------------------------------------------
1 | package reflection;
2 |
3 | import java.lang.reflect.Array;
4 | import java.lang.reflect.Field;
5 |
6 | public class Util {
7 |
8 | public static Object[][][] get3DArray(Object reference, Field field) {
9 |
10 | Object[] arr1D = getArray(reference, field);
11 | if (arr1D == null)
12 | return null;
13 |
14 | Object[][][] arr3D = new Object[arr1D.length][0][0];
15 |
16 | for (int i = 0; i < arr1D.length; i++) {
17 | if (arr1D[i] != null) {
18 | int length = Array.getLength(arr1D[i]);
19 | Object[] temp = new Object[length];
20 | arr3D[i] = new Object[length][0];
21 | for (int j = 0; j < length; j++) {
22 | temp[j] = Array.get(arr1D[i], j);
23 | int length2 = Array.getLength(temp[j]);
24 | arr3D[i][j] = new Object[length2];
25 |
26 | for (int k = 0; k < length; k++) {
27 | arr3D[i][j][k] = Array.get(temp[j], k);
28 | }
29 |
30 | }
31 |
32 | }
33 |
34 | }
35 | return arr3D;
36 | }
37 |
38 | public static Object[] getArray(Object obj, Field field) {
39 | try {
40 | Object array = field.get(obj);
41 |
42 | if (array == null)
43 | return null;
44 |
45 | int length = Array.getLength(array);
46 | Object[] arr = new Object[length];
47 | for (int i = 0; i < length; i++) {
48 | arr[i] = Array.get(array, i);
49 |
50 | }
51 | return arr;
52 | } catch (IllegalArgumentException | IllegalAccessException e) {
53 | e.printStackTrace();
54 | }
55 |
56 | return null;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # OSJR [](https://travis-ci.org/zeruth/OSJR)
2 | A High-speed Old School Runescape client
3 | - Discord: https://discord.gg/hYJdgFj
4 |
5 | # What's New! 4/4/18
6 |
7 | -Added Seers Village course to Agility overlay.
8 | -Finished ColorPicker - now supports all colorable entities in OSJR under Settings > Change Colors.
9 | -Finished XpGlobe - now has a solid background, with much better skill icon. background color can still be changes.
10 |
11 | Note: For XpGlobe,
12 | Text color is tied to Outline color.
13 | Background color is tied to Fill color.
14 |
15 |
16 | ### Color Picker / Xp Globe
17 |
18 | 
19 |
20 | Included is some very basic paint Listeners:
21 | - Agility Overlay (Al Kharid/Varrock/Canifis/Falador/Seers)
22 | - Actor Names Overlay (Players/NPC's/Clan members)
23 | - Fishing Overlay (built into ActorNames for now)
24 | - Various Object ID overlays under Settings
25 | - Color Picker for anything OSJR colors under Settings.
26 |
27 | ### Discord Rich Presence
28 | - Users can set a custom status under Discord > Update status.
29 | - Will inform how long a user has been logged in or out.
30 |
31 | 
32 |
33 | ### Hooks are once again included.
34 |
35 | - If you are really interested in knowing how I get them, take a look at my Runelite fork commits.
36 |
37 | ### No release is supported at this time.
38 | - if you want to use this. Build it and run it using Eclipse. It is not ready for a runnable Jar release.
39 |
--------------------------------------------------------------------------------
/src/main/java/discord/BaseConnection.java:
--------------------------------------------------------------------------------
1 | package discord;
2 |
3 | import org.apache.commons.lang3.SystemUtils;
4 |
5 | /**
6 | * Base connection class
7 | *
8 | * Implementation is OS dependent
9 | */
10 | public abstract class BaseConnection {
11 | static BaseConnection create() {
12 | if (SystemUtils.IS_OS_MAC_OSX)
13 | return new BaseConnectionOsx();
14 |
15 | if (SystemUtils.IS_OS_UNIX)
16 | return new BaseConnectionUnix();
17 |
18 | if (SystemUtils.IS_OS_WINDOWS)
19 | return new BaseConnectionWindows();
20 |
21 | throw new IllegalStateException("This OS is not supported"); //$NON-NLS-1$
22 | }
23 |
24 | static void destroy(BaseConnection baseConnection) {
25 | baseConnection.close();
26 | }
27 |
28 | BaseConnection() {
29 | }
30 |
31 | abstract boolean close();
32 |
33 | abstract boolean isOpen();
34 |
35 | abstract boolean open();
36 |
37 | abstract boolean read(byte[] bytes, int length, boolean wait);
38 |
39 | /**
40 | * Register an application
41 | *
42 | * @param applicationId
43 | * Application ID
44 | * @param command
45 | * Command to run the application
46 | */
47 | public abstract void register(String applicationId, String command);
48 |
49 | /**
50 | * Register a Steam application
51 | *
52 | * @param applicationId
53 | * Application ID
54 | * @param steamId
55 | * Application Steam ID
56 | */
57 | public abstract void registerSteamGame(String applicationId, String steamId);
58 |
59 | abstract boolean write(byte[] bytes, int length); // FIXME Lock over calls of that methods to unsure 2 threads are
60 | // not writing at the same time
61 | }
62 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Tile.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Tile extends RSClass {
7 |
8 | public Tile(Object reference) {
9 | this.reference = reference;
10 | if (Hooks.tile != null) {
11 | this.fields = Hooks.tile.fields;
12 | this.name = Hooks.tile.name;
13 | this.obfuscatedName = Hooks.tile.obfuscatedName;
14 | }
15 | }
16 |
17 | public DecorativeObject getDecorativeObject() {
18 | Object o = getValue(getField("decorativeObject"));
19 | if (o != null)
20 | return new DecorativeObject(o);
21 | return null;
22 | }
23 |
24 | public GroundObject getGroundObject() {
25 | Object o = getValue(getField("groundObject"));
26 | if (o != null)
27 | return new GroundObject(o);
28 | return null;
29 | }
30 |
31 | public ItemLayer getItemLayer() {
32 | return new ItemLayer(getValue(getField("itemLayer")));
33 | }
34 |
35 | public GameObject[] getObjects() {
36 | Object[] os = (Object[]) getValue(getField("objects"));
37 | int i = 0;
38 | GameObject[] gos = new GameObject[os.length];
39 | for (Object o : os) {
40 | if (o != null) {
41 | gos[i] = new GameObject(o);
42 | i++;
43 | }
44 | }
45 | return gos;
46 | }
47 |
48 | public int getPlane() {
49 | return (int) getValue(getField("plane"));
50 | }
51 |
52 | public WallObject getWallObject() {
53 | Object o = getValue(getField("wallObject"));
54 | if (o != null)
55 | return new WallObject(o);
56 | return null;
57 | }
58 |
59 | public int getX() {
60 | return (int) getValue(getField("x"));
61 | }
62 |
63 | public int getY() {
64 | return (int) getValue(getField("y"));
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/GroundObject.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.helpers.Perspective;
5 | import hooks.model.RSClass;
6 |
7 | public class GroundObject extends RSClass {
8 |
9 | public int plane = 0;
10 |
11 | public GroundObject(Object reference) {
12 | this.reference = reference;
13 | if (Hooks.groundObject != null) {
14 | this.fields = Hooks.groundObject.fields;
15 | this.name = Hooks.groundObject.name;
16 | this.obfuscatedName = Hooks.groundObject.obfuscatedName;
17 | }
18 | }
19 |
20 | public GroundObject() {
21 | this.reference = null;
22 | if (Hooks.groundObject != null) {
23 | this.fields = Hooks.groundObject.fields;
24 | this.name = Hooks.groundObject.name;
25 | this.obfuscatedName = Hooks.groundObject.obfuscatedName;
26 | }
27 | }
28 |
29 | public java.awt.geom.Area getClickbox() {
30 | return Perspective.getClickbox(Hooks.client, getModel(), 0, getX(), getY());
31 | }
32 |
33 | public int getHash() {
34 | return (int) getValue(getField("hash"));
35 | }
36 |
37 | public int getID() {
38 | int hash = getHash();
39 | return hash >> 14 & 32767;
40 | }
41 |
42 | public Model getModel() {
43 | if (getRenderable1().reference != null) {
44 | return new Model(getValue(getField("renderable")));
45 | }
46 | return null;
47 |
48 | }
49 |
50 | public int getPlane() {
51 | return this.plane;
52 | }
53 |
54 | public Renderable getRenderable1() {
55 | return new Renderable(getValue(getField("renderable")));
56 | }
57 |
58 | public int getX() {
59 | return (int) getValue(getField("x"));
60 | }
61 |
62 | public int getY() {
63 | return (int) getValue(getField("y"));
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/src/main/java/paint/CanvasInjector.java:
--------------------------------------------------------------------------------
1 | package paint;
2 |
3 | import java.util.Hashtable;
4 | import java.util.ListIterator;
5 |
6 | import org.objectweb.asm.Opcodes;
7 | import org.objectweb.asm.tree.AbstractInsnNode;
8 | import org.objectweb.asm.tree.ClassNode;
9 | import org.objectweb.asm.tree.MethodInsnNode;
10 | import org.objectweb.asm.tree.MethodNode;
11 |
12 | public class CanvasInjector {
13 | public static void setSuper(ClassNode node, String superClass) {
14 | String replaced = "";
15 | if (!node.superName.equals(""))
16 | replaced = node.superName;
17 | if (!replaced.equals("")) {
18 | for (Object o : node.methods) {
19 | final MethodNode mn = (MethodNode) o;
20 | final ListIterator> listIt = mn.instructions.iterator();
21 | while (listIt.hasNext()) {
22 | final AbstractInsnNode ain = (AbstractInsnNode) listIt.next();
23 | if (ain.getOpcode() == Opcodes.INVOKESPECIAL) {
24 | final MethodInsnNode call = (MethodInsnNode) ain;
25 | if (call.owner.equals(replaced))
26 | call.owner = superClass;
27 | }
28 | }
29 | }
30 | }
31 | node.superName = superClass;
32 | }
33 |
34 | private Hashtable classnodes;
35 |
36 | public CanvasInjector(Hashtable classnodes) {
37 | super();
38 | this.classnodes = classnodes;
39 | }
40 |
41 | public Hashtable getClassnodes() {
42 | return this.classnodes;
43 | }
44 |
45 | public Hashtable run() {
46 | for (ClassNode cn : this.classnodes.values()) {
47 | if (cn.superName.toLowerCase().contains("canvas")) {
48 | setSuper(cn, "paint/GameCanvas");
49 | }
50 | }
51 | return this.classnodes;
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Player.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.model.RSClass;
5 |
6 | public class Player extends RSClass {
7 |
8 | int cameraX;
9 |
10 | public Player(Object reference) {
11 | this.reference = reference;
12 | if (Hooks.player != null) {
13 | this.fields = Hooks.player.fields;
14 | this.name = Hooks.player.name;
15 | this.obfuscatedName = Hooks.player.obfuscatedName;
16 | }
17 | }
18 |
19 | public Actor asActor() {
20 | return new Actor(this.reference);
21 | }
22 |
23 | public int getCombatLevel() {
24 | return (int) getValue(getField("combatLevel"));
25 | }
26 |
27 | public Name getNames() {
28 | return new Name(getValue(getField("name")));
29 | }
30 |
31 | public boolean isInClanChat() {
32 | try {
33 | if (Client.getClanMemberManager().reference != null) {
34 | for (Nameable n : Client.getClanMemberManager().asNameableContainer().getNameables()) {
35 | if (n != null) {
36 | if (n.getName().getOriginalName().compareTo(getNames().getOriginalName()) == 0)
37 | return true;
38 | }
39 | }
40 |
41 | }
42 | } catch (Exception e) {
43 | e.printStackTrace();
44 | }
45 | return false;
46 | }
47 |
48 | public int getClanRank() {
49 | if (isInClanChat()) {
50 | for (Nameable n : Client.getClanMemberManager().asNameableContainer().getNameables()) {
51 | if (n != null) {
52 | if (n.getName().getOriginalName().compareTo(getNames().getOriginalName()) == 0)
53 | return n.asClanMember().asChatPlayer().getRank();
54 | }
55 | }
56 | }
57 | return 0;
58 | }
59 |
60 | public int getCameraX() {
61 | this.cameraX = (int) getValue(getField("cameraX"));
62 | return this.cameraX;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/DecorativeObject.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.helpers.Perspective;
5 | import hooks.model.RSClass;
6 |
7 | public class DecorativeObject extends RSClass {
8 |
9 | public int plane = 0;
10 |
11 | public DecorativeObject(Object reference) {
12 | this.reference = reference;
13 | if (Hooks.decorativeObject != null) {
14 | this.fields = Hooks.decorativeObject.fields;
15 | this.name = Hooks.decorativeObject.name;
16 | this.obfuscatedName = Hooks.decorativeObject.obfuscatedName;
17 | }
18 | }
19 |
20 | public DecorativeObject() {
21 | this.reference = null;
22 | if (Hooks.decorativeObject != null) {
23 | this.fields = Hooks.decorativeObject.fields;
24 | this.name = Hooks.decorativeObject.name;
25 | this.obfuscatedName = Hooks.decorativeObject.obfuscatedName;
26 | }
27 | }
28 |
29 | public java.awt.geom.Area getClickbox() {
30 | return Perspective.getClickbox(Hooks.client, getModel(), getOrientation(), getX(), getY());
31 | }
32 |
33 | public int getHash() {
34 | return (int) getValue(getField("hash"));
35 | }
36 |
37 | public int getID() {
38 | return getHash() >> 14 & 32767;
39 | }
40 |
41 | public Model getModel() {
42 | if (getRenderable1().reference != null) {
43 | return new Model(getValue(getField("renderable1")));
44 | }
45 | return null;
46 |
47 | }
48 |
49 | public int getOrientation() {
50 | return (int) getValue(getField("rotation"));
51 | }
52 |
53 | public int getPlane() {
54 | return this.plane;
55 | }
56 |
57 | public Renderable getRenderable1() {
58 | return new Renderable(getValue(getField("renderable1")));
59 | }
60 |
61 | public int getX() {
62 | return (int) getValue(getField("x"));
63 | }
64 |
65 | public int getY() {
66 | return (int) getValue(getField("y"));
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/src/main/java/discord/UpdateStatus.java:
--------------------------------------------------------------------------------
1 | package discord;
2 |
3 | import java.awt.event.MouseAdapter;
4 | import java.awt.event.MouseEvent;
5 |
6 | import javax.swing.JButton;
7 | import javax.swing.JFrame;
8 | import javax.swing.JLabel;
9 | import javax.swing.JPanel;
10 | import javax.swing.JTextField;
11 | import javax.swing.SwingConstants;
12 | import javax.swing.border.EmptyBorder;
13 |
14 | public class UpdateStatus extends JFrame {
15 |
16 | /**
17 | *
18 | */
19 | private static final long serialVersionUID = 1L;
20 |
21 | public static void run() {
22 | UpdateStatus frame = new UpdateStatus();
23 | frame.setVisible(true);
24 | frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
25 | }
26 |
27 | private JPanel contentPane;
28 |
29 | JTextField textField;
30 |
31 | /**
32 | * Create the frame.
33 | */
34 | public UpdateStatus() {
35 | setBounds(100, 100, 150, 128);
36 | this.contentPane = new JPanel();
37 | this.contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
38 | setContentPane(this.contentPane);
39 | this.contentPane.setLayout(null);
40 |
41 | JLabel lblUpdateStatus = new JLabel("Update Status");
42 | lblUpdateStatus.setBounds(5, 5, 124, 20);
43 | lblUpdateStatus.setHorizontalAlignment(SwingConstants.CENTER);
44 | this.contentPane.add(lblUpdateStatus);
45 |
46 | this.textField = new JTextField();
47 | this.textField.setBounds(5, 30, 124, 20);
48 | this.contentPane.add(this.textField);
49 | this.textField.setColumns(10);
50 |
51 | JButton btnNewButton = new JButton("Confirm");
52 | btnNewButton.addMouseListener(new MouseAdapter() {
53 | @Override
54 | public void mouseClicked(MouseEvent arg0) {
55 | DiscordManager.discordStatus = UpdateStatus.this.textField.getText();
56 | setVisible(false);
57 | }
58 | });
59 | btnNewButton.setBounds(5, 56, 124, 23);
60 | this.contentPane.add(btnNewButton);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/game/LoaderWindow.java:
--------------------------------------------------------------------------------
1 | package game;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.Container;
5 | import java.awt.Graphics;
6 |
7 | import javax.swing.JFrame;
8 | import javax.swing.JPanel;
9 | import javax.swing.JPopupMenu;
10 | import javax.swing.ToolTipManager;
11 |
12 | import paint.MenuHandler;
13 |
14 | public class LoaderWindow extends JFrame {
15 |
16 | public static Game game;
17 | private static final long serialVersionUID = 1L;
18 | private JPanel gamePanel;
19 | private MenuHandler menuHandler;
20 | private Container contentPanel;
21 |
22 | public LoaderWindow(String[] args) {
23 | boolean vanilla = false;
24 | for (String s : args) {
25 | if (s.compareTo("vanilla") == 0) {
26 | vanilla = true;
27 | }
28 | }
29 | if (vanilla) {
30 | game = new Game(args);
31 | } else {
32 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
33 | setResizable(true);
34 | setSize(780, 563);
35 | setTitle("OSJR");
36 | setLayout(new BorderLayout());
37 |
38 | JPopupMenu.setDefaultLightWeightPopupEnabled(false);
39 | ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
40 |
41 | this.contentPanel = getContentPane();
42 | this.contentPanel.setLayout(new BorderLayout());
43 | this.gamePanel = new JPanel();
44 | this.contentPanel.add(this.gamePanel);
45 |
46 | try {
47 | this.contentPanel.repaint();
48 | this.contentPanel.revalidate();
49 | game = new Game(args);
50 | this.contentPanel.add(game);
51 | this.contentPanel.setVisible(true);
52 | this.contentPanel.setSize(765, 503);
53 | this.contentPanel.repaint();
54 | this.contentPanel.revalidate();
55 | setResizable(true);
56 | } catch (Exception e) {
57 | }
58 |
59 | this.menuHandler = new MenuHandler(this, game);
60 | this.setJMenuBar(this.menuHandler.makeJMenuBar());
61 |
62 | }
63 |
64 | }
65 |
66 | @Override
67 | public void paint(Graphics g) {
68 | super.paint(g);
69 | }
70 |
71 | }
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Region.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import java.util.ArrayList;
4 |
5 | import hooks.Hooks;
6 | import hooks.model.RSClass;
7 |
8 | public class Region extends RSClass {
9 |
10 | GameObject[] objects;
11 | Tile[] tiles;
12 | Object[][][] rsTiles;
13 |
14 | Object[] tempObjects;
15 | Tile tempTile;
16 |
17 | public Region(Object reference) {
18 | this.reference = reference;
19 | if (Hooks.region != null) {
20 | this.fields = Hooks.region.fields;
21 | this.name = Hooks.region.name;
22 | this.obfuscatedName = Hooks.region.obfuscatedName;
23 | }
24 | }
25 |
26 | public GameObject[] getObjects() {
27 | this.tempObjects = (Object[]) getValue(getField("objects"));
28 | int i = 0;
29 | this.objects = new GameObject[this.tempObjects.length];
30 | for (Object o : this.tempObjects) {
31 | if (o != null) {
32 | this.objects[i] = new GameObject(o);
33 | i++;
34 | }
35 | }
36 | return this.objects;
37 | }
38 |
39 | public Tile getTile(int x, int y) {
40 | if (Hooks.client != null) {
41 | int bx = Client.getBaseX();
42 | int by = Client.getBaseY();
43 |
44 | int ax = x - bx;
45 | int ay = y - by;
46 |
47 | System.out.println(bx + " " + by);
48 | this.rsTiles = (Object[][][]) getValue(getField("tiles"));
49 |
50 | if (this.rsTiles[Client.getPlane()][ax][ay] != null) {
51 | this.tempTile = new Tile(this.rsTiles[Client.getPlane()][ax][ay]);
52 | }
53 | return this.tempTile;
54 | }
55 |
56 | return null;
57 |
58 | }
59 |
60 | public ArrayList getTiles() {
61 | ArrayList tiles = new ArrayList<>();
62 | int REGION_SIZE = 104;
63 | this.rsTiles = (Object[][][]) getValue(getField("tiles"));
64 | int z = Client.getPlane();
65 | for (int x = 0; x < REGION_SIZE; ++x) {
66 | for (int y = 0; y < REGION_SIZE; ++y) {
67 | Object tile = this.rsTiles[z][x][y];
68 | if (tile == null) {
69 | continue;
70 | }
71 | tiles.add(new Tile(tile));
72 | }
73 | }
74 | return tiles;
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/src/main/java/hooks/helpers/Triangle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017, Adam
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are met:
7 | *
8 | * 1. Redistributions of source code must retain the above copyright notice, this
9 | * list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation
12 | * and/or other materials provided with the distribution.
13 | *
14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 | */
25 | package hooks.helpers;
26 |
27 | public class Triangle {
28 | private final Vertex a;
29 | private final Vertex b;
30 | private final Vertex c;
31 |
32 | public Triangle(Vertex a, Vertex b, Vertex c) {
33 | this.a = a;
34 | this.b = b;
35 | this.c = c;
36 | }
37 |
38 | public Vertex getA() {
39 | // TODO Auto-generated method stub
40 | return this.a;
41 | }
42 |
43 | public Vertex getB() {
44 | // TODO Auto-generated method stub
45 | return this.b;
46 | }
47 |
48 | public Vertex getC() {
49 | // TODO Auto-generated method stub
50 | return this.c;
51 | }
52 |
53 | public Triangle rotate(int orientation) {
54 | return new Triangle(this.a.rotate(orientation), this.b.rotate(orientation), this.c.rotate(orientation));
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/GameObject.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import hooks.Hooks;
4 | import hooks.helpers.LocalPoint;
5 | import hooks.helpers.Perspective;
6 | import hooks.model.RSClass;
7 |
8 | public class GameObject extends RSClass {
9 |
10 | int cameraZ;
11 | int x;
12 | int y;
13 | int id;
14 | int plane;
15 | Renderable renderable1;
16 | Model model;
17 | java.awt.geom.Area clickbox;
18 |
19 | public GameObject(Object reference) {
20 | this.reference = reference;
21 | if (Hooks.gameObject != null) {
22 | this.fields = Hooks.gameObject.fields;
23 | this.name = Hooks.gameObject.name;
24 | this.obfuscatedName = Hooks.gameObject.obfuscatedName;
25 | }
26 | }
27 |
28 | public GameObject() {
29 | this.reference = null;
30 | if (Hooks.gameObject != null) {
31 | this.fields = Hooks.gameObject.fields;
32 | this.name = Hooks.gameObject.name;
33 | this.obfuscatedName = Hooks.gameObject.obfuscatedName;
34 | }
35 | }
36 |
37 | public java.awt.geom.Area getClickbox() {
38 | this.clickbox = Perspective.getClickbox(Hooks.client, getModel(), 0, getX(), getY());
39 | return this.clickbox;
40 | }
41 |
42 | public int getHash() {
43 | this.id = (int) getValue(getField("hash"));
44 | return this.id;
45 | }
46 |
47 | public int getID() {
48 | this.id = getHash();
49 | return this.id >> 14 & 32767;
50 | }
51 |
52 | public Model getModel() {
53 | if (getRenderable1().reference != null) {
54 | this.model = new Model(getValue(getField("renderable")));
55 | return this.model;
56 | }
57 | return null;
58 |
59 | }
60 |
61 | public LocalPoint getLocalPoint() {
62 | LocalPoint lp = new LocalPoint(getX(), getY());
63 | return lp;
64 | }
65 |
66 | public int getPlane() {
67 | this.plane = (int) getValue(getField("plane"));
68 | return this.plane;
69 | }
70 |
71 | public Renderable getRenderable1() {
72 | this.renderable1 = new Renderable(getValue(getField("renderable")));
73 | return this.renderable1;
74 | }
75 |
76 | public int getX() {
77 | this.x = (int) getValue(getField("x"));
78 | return this.x;
79 | }
80 |
81 | public int getY() {
82 | this.y = (int) getValue(getField("y"));
83 | return this.y;
84 | }
85 |
86 | public int getCameraZ() {
87 | this.cameraZ = (int) getValue(getField("cameraZ"));
88 | return this.cameraZ;
89 | }
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/src/main/java/paint/misc/GroundItems.java:
--------------------------------------------------------------------------------
1 | package paint.misc;
2 |
3 | import java.awt.Color;
4 | import java.awt.Graphics;
5 | import java.awt.Graphics2D;
6 | import java.awt.RenderingHints;
7 |
8 | import cache.ItemDefinitionManager;
9 | import cache.TileListener;
10 | import game.Game;
11 | import game.Settings;
12 | import hooks.Hooks;
13 | import hooks.accessors.Item;
14 | import hooks.accessors.ItemLayer;
15 | import hooks.helpers.LocalPoint;
16 | import hooks.helpers.Perspective;
17 | import hooks.helpers.Point;
18 | import paint.PaintListener;
19 |
20 | public class GroundItems implements PaintListener {
21 | Graphics2D g2d;
22 |
23 | RenderingHints rh = new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING,
24 | RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
25 |
26 | public GroundItems() {
27 |
28 | }
29 |
30 | @Override
31 | public void onRepaint(Graphics g) {
32 | if (Settings.SHOW_PLAYER_NAMES && Game.ctrlPressed==false) {
33 | if (this.g2d == null)
34 | this.g2d = (Graphics2D) g;
35 | if (Hooks.client != null)
36 | if (Hooks.client.isLoggedIn()) {
37 | for (ItemLayer il : TileListener.groundItems) {
38 | int i = 0;
39 | g.setColor(Color.white);
40 | Item item = il.getTop();
41 | if (item.reference != null) {
42 | String name = ItemDefinitionManager.itemDefinitions[item.getId()].getName();
43 | Point p = Perspective.getCanvasTextLocation(Hooks.client, (Graphics2D) g,
44 | new LocalPoint(il.getX(), il.getY()), name, i);
45 | if (p != null) {
46 | g.drawString(name, p.getX(), p.getY() - i);
47 | }
48 | i += 10;
49 | }
50 | item = il.getMiddle();
51 | if (item.reference != null) {
52 | String name = ItemDefinitionManager.itemDefinitions[item.getId()].getName();
53 | Point p = Perspective.getCanvasTextLocation(Hooks.client, (Graphics2D) g,
54 | new LocalPoint(il.getX(), il.getY()), name, i);
55 | if (p != null) {
56 | g.drawString(name, p.getX(), p.getY() - i);
57 | }
58 | i += 10;
59 | }
60 | item = il.getBottom();
61 | if (item.reference != null) {
62 | String name = ItemDefinitionManager.itemDefinitions[item.getId()].getName();
63 | Point p = Perspective.getCanvasTextLocation(Hooks.client, (Graphics2D) g,
64 | new LocalPoint(il.getX(), il.getY()), name, i);
65 | if (p != null) {
66 | g.drawString(name, p.getX(), p.getY() - i);
67 | }
68 | i += 10;
69 | }
70 | }
71 | }
72 | }
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/src/main/java/hooks/helpers/Vertex.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017, Adam
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are met:
7 | *
8 | * 1. Redistributions of source code must retain the above copyright notice, this
9 | * list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation
12 | * and/or other materials provided with the distribution.
13 | *
14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 | */
25 | package hooks.helpers;
26 |
27 | public class Vertex {
28 | private final int x;
29 | private final int y;
30 | private final int z;
31 |
32 | public Vertex(int x, int y, int z) {
33 | this.x = x;
34 | this.y = y;
35 | this.z = z;
36 | }
37 |
38 | public int getX() {
39 | // TODO Auto-generated method stub
40 | return this.x;
41 | }
42 |
43 | public int getY() {
44 | // TODO Auto-generated method stub
45 | return this.y;
46 | }
47 |
48 | public int getZ() {
49 | // TODO Auto-generated method stub
50 | return this.z;
51 | }
52 |
53 | /**
54 | * Rotate the vertex by the given orientation
55 | *
56 | * @param orientation
57 | * @return the newly rotated vertex
58 | */
59 | public Vertex rotate(int orientation) {
60 | // models are orientated north (1024) and there are 2048 angles total
61 | orientation = (orientation + 1024) % 2048;
62 |
63 | if (orientation == 0) {
64 | return this;
65 | }
66 |
67 | int sin = Perspective.SINE[orientation];
68 | int cos = Perspective.COSINE[orientation];
69 |
70 | return new Vertex(this.x * cos + this.z * sin >> 16, this.y, this.z * cos - this.x * sin >> 16);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/main/java/game/RSAppletStub.java:
--------------------------------------------------------------------------------
1 | package game;
2 |
3 | import java.applet.AppletContext;
4 | import java.applet.AppletStub;
5 | import java.io.BufferedReader;
6 | import java.io.IOException;
7 | import java.io.InputStreamReader;
8 | import java.net.MalformedURLException;
9 | import java.net.URL;
10 | import java.net.URLConnection;
11 | import java.util.HashMap;
12 |
13 | public class RSAppletStub implements AppletStub {
14 |
15 | private String link = "http://oldschool21.runescape.com/";
16 | private HashMap parameters = new HashMap<>();
17 |
18 | public RSAppletStub() {
19 | parse();
20 | }
21 |
22 | @Override
23 | public void appletResize(int width, int height) {
24 |
25 | }
26 |
27 | @Override
28 | public AppletContext getAppletContext() {
29 | return null;
30 | }
31 |
32 | @Override
33 | public URL getCodeBase() {
34 | try {
35 | return new URL(this.link);
36 | } catch (MalformedURLException e) {
37 | e.printStackTrace();
38 | }
39 | return null;
40 | }
41 |
42 | @Override
43 | public URL getDocumentBase() {
44 | return getCodeBase();
45 | }
46 |
47 | public String getLink() {
48 | return this.link;
49 | }
50 |
51 | @Override
52 | public String getParameter(String name) {
53 | return this.parameters.get(name);
54 | }
55 |
56 | @Override
57 | public boolean isActive() {
58 | return true;
59 | }
60 |
61 | private void parse() {
62 | try {
63 | final URLConnection urlConnection = new URL(this.link + "l=0/jav_config.ws").openConnection();
64 | urlConnection.addRequestProperty("User-Agent",
65 | "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36");
66 | final BufferedReader reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
67 | String line;
68 | while ((line = reader.readLine()) != null) {
69 | line = line.replaceAll("\">'", "\"").replaceAll("'", "").replaceAll("\\(", "").replaceAll("\\)", "")
70 | .replaceAll("\"", "").replaceAll(" ", "").replaceAll("param=", "").replaceAll(";", "")
71 | .replaceAll("value", "");
72 | final String[] splitted = line.split("=");
73 | if (splitted.length == 1) {
74 | this.parameters.put(splitted[0], "");
75 | } else if (splitted.length == 2) {
76 | this.parameters.put(splitted[0], splitted[1]);
77 | } else if (splitted.length == 3) {
78 | this.parameters.put(splitted[0], splitted[1] + "=" + splitted[2]);
79 | } else if (splitted.length == 4) {
80 | this.parameters.put(splitted[0], splitted[1] + "=" + splitted[2] + "=" + splitted[3]);
81 | }
82 | }
83 | } catch (IOException e) {
84 | e.printStackTrace();
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/src/main/java/discord/BaseConnectionOsx.java:
--------------------------------------------------------------------------------
1 | package discord;
2 |
3 | import java.io.FileWriter;
4 |
5 | class BaseConnectionOsx extends BaseConnectionUnix {
6 | @Override
7 | public void register(String applicationId, String command) {
8 | try {
9 | if (command != null)
10 | BaseConnectionOsx.registerCommand(applicationId, command);
11 | else
12 | BaseConnectionOsx.registerUrl(applicationId);
13 | } catch (Exception ex) {
14 | throw new RuntimeException("Failed to register " + (command == null ? "url" : "command"), ex);
15 | }
16 | }
17 |
18 | private static void registerCommand(String applicationId, String command) {
19 | String home = System.getenv("HOME");
20 | if (home == null)
21 | throw new RuntimeException("Unable to find user HOME directory");
22 |
23 | String path = home + "/Library/Application Support/discord";
24 |
25 | if (!BaseConnectionUnix.mkdir(path))
26 | throw new RuntimeException("Failed to create directory '" + path + "'");
27 |
28 | path += "/games";
29 |
30 | if (!BaseConnectionUnix.mkdir(path))
31 | throw new RuntimeException("Failed to create directory '" + path + "'");
32 |
33 | path += "/" + applicationId + ".json";
34 |
35 | try (FileWriter fileWriter = new FileWriter(path)) {
36 | fileWriter.write("{\"command\": \"" + command + "\"}");
37 | } catch (Exception ex) {
38 | throw new RuntimeException("Failed to write fame info into '" + path + "'");
39 | }
40 | }
41 |
42 | @Override
43 | public void registerSteamGame(String applicationId, String steamId) {
44 | this.register(applicationId, "steam://rungameid/" + steamId);
45 | }
46 |
47 | private static void registerUrl(String applicationId) {
48 | throw new UnsupportedOperationException("OSX URL registration is not handled yet");
49 | /*
50 | * TODO char url[256]; snprintf(url, sizeof(url), "discord-%s", applicationId);
51 | * CFStringRef cfURL = CFStringCreateWithCString(NULL, url,
52 | * kCFStringEncodingUTF8);
53 | *
54 | * NSString* myBundleId = [[NSBundle mainBundle] bundleIdentifier]; if
55 | * (!myBundleId) { fprintf(stderr, "No bundle id found\n"); return; }
56 | *
57 | * NSURL* myURL = [[NSBundle mainBundle] bundleURL]; if (!myURL) {
58 | * fprintf(stderr, "No bundle url found\n"); return; }
59 | *
60 | * OSStatus status = LSSetDefaultHandlerForURLScheme(cfURL, (__bridge
61 | * CFStringRef)myBundleId); if (status != noErr) { fprintf(stderr,
62 | * "Error in LSSetDefaultHandlerForURLScheme: %d\n", (int)status); return; }
63 | *
64 | * status = LSRegisterURL((__bridge CFURLRef)myURL, true); if (status != noErr)
65 | * { fprintf(stderr, "Error in LSRegisterURL: %d\n", (int)status); }
66 | */
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/hooks/helpers/Point.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017, Adam
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are met:
7 | *
8 | * 1. Redistributions of source code must retain the above copyright notice, this
9 | * list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation
12 | * and/or other materials provided with the distribution.
13 | *
14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 | */
25 | package hooks.helpers;
26 |
27 | public class Point {
28 | private final int x;
29 | private final int y;
30 |
31 | public Point(int x, int y) {
32 | this.x = x;
33 | this.y = y;
34 | }
35 |
36 | /**
37 | * Find the distance from this point to another point
38 | *
39 | * @param other
40 | * @return
41 | */
42 | public int distanceTo(Point other) {
43 | return (int) Math.hypot(getX() - other.getX(), getY() - other.getY());
44 | }
45 |
46 | @Override
47 | public boolean equals(Object obj) {
48 | if (this == obj) {
49 | return true;
50 | }
51 | if (obj == null) {
52 | return false;
53 | }
54 | if (getClass() != obj.getClass()) {
55 | return false;
56 | }
57 | final Point other = (Point) obj;
58 | if (this.x != other.x) {
59 | return false;
60 | }
61 | if (this.y != other.y) {
62 | return false;
63 | }
64 | return true;
65 | }
66 |
67 | public int getX() {
68 | return this.x;
69 | }
70 |
71 | public int getY() {
72 | return this.y;
73 | }
74 |
75 | @Override
76 | public int hashCode() {
77 | int hash = 3;
78 | hash = 23 * hash + this.x;
79 | hash = 23 * hash + this.y;
80 | return hash;
81 | }
82 |
83 | @Override
84 | public String toString() {
85 | return "Point{" + "x=" + this.x + ", y=" + this.y + '}';
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/src/main/java/reflection/JarLoader.java:
--------------------------------------------------------------------------------
1 | package reflection;
2 |
3 | import java.io.File;
4 | import java.io.FileOutputStream;
5 | import java.net.URL;
6 | import java.net.URLClassLoader;
7 | import java.nio.channels.Channels;
8 | import java.nio.channels.ReadableByteChannel;
9 | import java.util.Enumeration;
10 | import java.util.Hashtable;
11 | import java.util.jar.JarEntry;
12 | import java.util.jar.JarFile;
13 |
14 | import org.objectweb.asm.ClassReader;
15 | import org.objectweb.asm.tree.ClassNode;
16 |
17 | import game.RSAppletStub;
18 | import game.Settings;
19 |
20 | public class JarLoader extends ClassLoader {
21 |
22 | private RSAppletStub appleStub;
23 | private ClassLoader classLoader;
24 | private Hashtable classnodes;
25 |
26 | private String gamepackUrl;
27 |
28 | public JarLoader() {
29 | this.appleStub = new RSAppletStub();
30 | this.classnodes = new Hashtable<>();
31 | this.gamepackUrl = this.appleStub.getLink() + this.appleStub.getParameter("initial_jar");
32 | loadJar();
33 |
34 | JarInjector injector = new JarInjector(this.classnodes);
35 | injector.run();
36 | this.classnodes = injector.getClassnodes();
37 |
38 | try {
39 | this.classLoader = URLClassLoader.newInstance(new URL[] { injector.getInjectedJar().toURI().toURL() });
40 | } catch (Exception e) {
41 | e.printStackTrace();
42 | }
43 |
44 | }
45 |
46 | public RSAppletStub getAppletStub() {
47 | return this.appleStub;
48 | }
49 |
50 | public Hashtable getClassnodes() {
51 | return this.classnodes;
52 | }
53 |
54 | @Override
55 | public Class> loadClass(String name) throws ClassNotFoundException {
56 | return this.classLoader.loadClass(name);
57 | }
58 |
59 | private void loadJar() {
60 | try {
61 | if (Settings.DOWNLOAD_GAMEPACK) {
62 | long start = System.currentTimeMillis();
63 | ReadableByteChannel rbc = Channels.newChannel(new URL(this.gamepackUrl).openStream());
64 | FileOutputStream fos = new FileOutputStream("gamepack.jar");
65 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
66 |
67 | System.out.println("Gamepack download took " + (System.currentTimeMillis() - start) + "ms");
68 |
69 | } else {
70 | }
71 | try (JarFile jar = new JarFile(new File("./resources/gamepack.jar"))) {
72 | Enumeration en = jar.entries();
73 | while (en.hasMoreElements()) {
74 | JarEntry entry = en.nextElement();
75 | if (entry.getName().endsWith(".class")) {
76 | ClassReader cr = new ClassReader(jar.getInputStream(entry));
77 | ClassNode cn = new ClassNode();
78 | cr.accept(cn, ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
79 | this.classnodes.put(cn.name, cn);
80 | }
81 | }
82 | jar.close();
83 | }
84 |
85 | } catch (Exception e) {
86 | e.printStackTrace();
87 | }
88 | }
89 | }
--------------------------------------------------------------------------------
/src/main/java/cache/TileListener.java:
--------------------------------------------------------------------------------
1 | package cache;
2 |
3 | import java.awt.Graphics;
4 | import java.util.ArrayList;
5 | import java.util.HashMap;
6 |
7 | import hooks.Hooks;
8 | import hooks.accessors.Client;
9 | import hooks.accessors.DecorativeObject;
10 | import hooks.accessors.GameObject;
11 | import hooks.accessors.GroundObject;
12 | import hooks.accessors.ItemLayer;
13 | import hooks.accessors.Tile;
14 | import hooks.accessors.WallObject;
15 | import paint.PaintListener;
16 |
17 | public class TileListener implements PaintListener {
18 | private int tick;
19 | public static HashMap decorativeObjects = new HashMap<>();
20 | public static HashMap> gameObjects = new HashMap<>();
21 | public static HashMap groundObjects = new HashMap<>();
22 | public static HashMap wallObjects = new HashMap<>();
23 | public static ArrayList groundItems = new ArrayList<>();
24 |
25 | @Override
26 | public void onRepaint(Graphics g) {
27 | if (this.tick > 40) {
28 | if (Hooks.client != null)
29 | if (Hooks.client.isLoggedIn()) {
30 | decorativeObjects = new HashMap<>();
31 | gameObjects = new HashMap<>();
32 | groundObjects = new HashMap<>();
33 | wallObjects = new HashMap<>();
34 | groundItems = new ArrayList<>();
35 |
36 | for (Tile t : Client.getRegion().getTiles()) {
37 |
38 | if (t.getItemLayer().reference != null) {
39 | groundItems.add(t.getItemLayer());
40 | }
41 |
42 | if (t.getDecorativeObject() != null) {
43 | DecorativeObject decObj = t.getDecorativeObject();
44 | if (decObj != null) {
45 | decorativeObjects.put(decObj.getID(), decObj);
46 | }
47 | }
48 |
49 | if (t.getGroundObject() != null) {
50 | GroundObject groundObj = t.getGroundObject();
51 | if (groundObj != null) {
52 | groundObjects.put(groundObj.getID(), groundObj);
53 | }
54 | }
55 |
56 | if (t.getDecorativeObject() != null) {
57 | WallObject wallObj = t.getWallObject();
58 | if (wallObj != null) {
59 | wallObjects.put(wallObj.getID(), wallObj);
60 | }
61 | }
62 |
63 | for (GameObject go : t.getObjects()) {
64 | if (go != null) {
65 | if (gameObjects.get(go.getID()) == null) {
66 | ArrayList gos = new ArrayList<>();
67 | gos.add(go);
68 | gameObjects.put(go.getID(), gos);
69 | } else {
70 | ArrayList gos = gameObjects.get(go.getID());
71 | if (gos != null && go != null) {
72 | gos.add(go);
73 | gameObjects.put(go.getID(), gos);
74 | }
75 | }
76 | }
77 | }
78 | }
79 | }
80 | this.tick = 0;
81 | } else {
82 | this.tick++;
83 | }
84 |
85 | }
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Model.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import hooks.Hooks;
7 | import hooks.helpers.Triangle;
8 | import hooks.helpers.Vertex;
9 | import hooks.model.RSClass;
10 |
11 | public class Model extends RSClass {
12 |
13 | public Model(Object reference) {
14 | this.reference = reference;
15 | if (Hooks.model != null) {
16 | this.fields = Hooks.model.fields;
17 | this.name = Hooks.model.name;
18 | this.obfuscatedName = Hooks.model.obfuscatedName;
19 | }
20 | }
21 |
22 | public List getTriangles() {
23 | if (getVertices() != null) {
24 | int[] trianglesX = getTrianglesX();
25 | int[] trianglesY = getTrianglesY();
26 | int[] trianglesZ = getTrianglesZ();
27 |
28 | List vertices = getVertices();
29 | List triangles = new ArrayList<>(getTrianglesCount());
30 |
31 | for (int i = 0; i < getTrianglesCount(); ++i) {
32 | int triangleX = trianglesX[i];
33 | int triangleY = trianglesY[i];
34 | int triangleZ = trianglesZ[i];
35 |
36 | Triangle triangle = new Triangle(vertices.get(triangleX), vertices.get(triangleY),
37 | vertices.get(triangleZ));
38 | triangles.add(triangle);
39 | }
40 |
41 | return triangles;
42 | }
43 | return null;
44 | }
45 |
46 | private int getTrianglesCount() {
47 | // TODO Auto-generated method stub
48 | return (int) getValue(getField("indicesCount"));
49 | }
50 |
51 | private int[] getTrianglesX() {
52 | // TODO Auto-generated method stub
53 | return (int[]) getValue(getField("indices1"));
54 | }
55 |
56 | private int[] getTrianglesY() {
57 | // TODO Auto-generated method stub
58 | return (int[]) getValue(getField("indices2"));
59 | }
60 |
61 | private int[] getTrianglesZ() {
62 | // TODO Auto-generated method stub
63 | return (int[]) getValue(getField("indices3"));
64 | }
65 |
66 | public List getVertices() {
67 | if (getValue(getField("verticesCount")) != null) {
68 | int[] verticesX = getVerticesX();
69 | int[] verticesY = getVerticesY();
70 | int[] verticesZ = getVerticesZ();
71 |
72 | List vertices = new ArrayList<>();
73 |
74 | for (int i = 0; i < getVerticesCount(); ++i) {
75 | Vertex v = new Vertex(verticesX[i], verticesY[i], verticesZ[i]);
76 | vertices.add(v);
77 | }
78 | return vertices;
79 | }
80 | return null;
81 | }
82 |
83 | private int getVerticesCount() {
84 | return (int) getValue(getField("verticesCount"));
85 | }
86 |
87 | private int[] getVerticesX() {
88 | return (int[]) getValue(getField("verticesX"));
89 | }
90 |
91 | private int[] getVerticesY() {
92 | return (int[]) getValue(getField("verticesY"));
93 | }
94 |
95 | private int[] getVerticesZ() {
96 | return (int[]) getValue(getField("verticesZ"));
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/src/main/java/discord/DiscordManager.java:
--------------------------------------------------------------------------------
1 | package discord;
2 |
3 | import hooks.Hooks;
4 |
5 | public class DiscordManager {
6 |
7 | public static String discordStatus = "Main Menu";
8 |
9 | public static boolean loggedIn = false;
10 |
11 | public static long start = System.currentTimeMillis() / 1000L;
12 |
13 | public static Thread t = new Thread(new Runnable() {
14 |
15 | @Override
16 | public void run() {
17 | while (true != false) {
18 | // TODO Auto-generated method stub
19 | String applicationId = "" + 429263064676958218L;
20 | DiscordRpc discordRpc = new DiscordRpc();
21 |
22 | DiscordEventHandler discordEventHandler = new DiscordEventHandler() {
23 | @Override
24 | public void disconnected(ErrorCode errorCode, String message) {
25 | // System.err.println("CLASS DISCONNECTED : " + errorCode + " " + message);
26 | }
27 |
28 | @Override
29 | public void errored(ErrorCode errorCode, String message) {
30 | System.err.println("CLASS ERRORED : " + errorCode + " " + message);
31 | }
32 |
33 | @Override
34 | public void joinGame(String joinSecret) {
35 | System.err.println("CLASS JOIN GAME : " + joinSecret);
36 | }
37 |
38 | @Override
39 | public void joinRequest(DiscordJoinRequest joinRequest) {
40 | System.err.println("CLASS JOIN REQUEST : " + joinRequest);
41 | }
42 |
43 | @Override
44 | public void ready() {
45 | // System.err.println("CLASS READY");
46 | }
47 |
48 | @Override
49 | public void spectateGame(String spectateSecret) {
50 | System.err.println("CLASS SPECTATE GAME : " + spectateSecret);
51 | }
52 | };
53 |
54 | try {
55 | discordRpc.init(applicationId, discordEventHandler, true, null);
56 |
57 | Thread.sleep(5000L);
58 | discordRpc.runCallbacks();
59 |
60 | DiscordRichPresence discordRichPresence = new DiscordRichPresence();
61 | if (Hooks.client.isLoggedIn()) {
62 | if (!loggedIn) {
63 | start = System.currentTimeMillis() / 1000L;
64 | loggedIn = true;
65 | }
66 | discordRichPresence.setState("Logged In");
67 | } else {
68 | if (loggedIn) {
69 | start = System.currentTimeMillis() / 1000L;
70 | loggedIn = false;
71 | }
72 | discordRichPresence.setState("Logged Out");
73 | }
74 |
75 | discordRichPresence.setDetails(discordStatus);
76 | discordRichPresence.setStartTimestamp(start);
77 | // discordRichPresence.setEndTimestamp(end);
78 | // discordRichPresence.sett
79 | discordRichPresence.setLargeImageKey("defaultlarge");
80 | // discordRichPresence.setSmallImageKey("icon-small");
81 | // discordRichPresence.setPartyId("ALONE");
82 | // discordRichPresence.setPartySize(40);
83 | // discordRichPresence.setPartyMax(70);
84 | // discordRichPresence.setMatchSecret("hello");
85 | // discordRichPresence.setJoinSecret("join");
86 | // discordRichPresence.setSpectateSecret("look");
87 | discordRichPresence.setInstance(false);
88 |
89 | discordRpc.updatePresence(discordRichPresence);
90 |
91 | Thread.sleep(5000L);
92 |
93 | discordRpc.runCallbacks();
94 | discordRpc.shutdown();
95 | // Thread.sleep(5000L);
96 |
97 | } catch (InterruptedException ignored) {
98 | } finally {
99 | discordRpc.shutdown();
100 | }
101 | }
102 |
103 | }
104 | });
105 |
106 | public static void run() {
107 | t.start();
108 | }
109 | }
--------------------------------------------------------------------------------
/src/main/java/hooks/helpers/Jarvis.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017, Adam
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are met:
7 | *
8 | * 1. Redistributions of source code must retain the above copyright notice, this
9 | * list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation
12 | * and/or other materials provided with the distribution.
13 | *
14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 | */
25 | package hooks.helpers;
26 |
27 | import java.util.ArrayList;
28 | import java.util.List;
29 |
30 | /**
31 | * Implementation of the Jarvis march algorithm
32 | * https://en.wikipedia.org/wiki/Gift_wrapping_algorithm
33 | *
34 | * @author adam
35 | */
36 | public class Jarvis {
37 | /**
38 | * compute the convex hull of a given set of points
39 | *
40 | * @param points
41 | * @return
42 | */
43 | public static List convexHull(List points) {
44 | if (points.size() < 3) {
45 | return null;
46 | }
47 |
48 | List ch = new ArrayList<>();
49 |
50 | // find the left most point
51 | Point left = findLeftMost(points);
52 |
53 | // current point we are on
54 | Point current = left;
55 |
56 | do {
57 | ch.add(current);
58 |
59 | // the next point - all points are to the right of the
60 | // line between current and next
61 | Point next = null;
62 |
63 | for (Point p : points) {
64 | if (next == null) {
65 | next = p;
66 | continue;
67 | }
68 |
69 | int cp = crossProduct(current, p, next);
70 | if (cp > 0 || (cp == 0 && current.distanceTo(p) > current.distanceTo(next))) {
71 | next = p;
72 | }
73 | }
74 |
75 | // Points can be null if they are behind or very close to the camera.
76 | if (next == null) {
77 | return null;
78 | }
79 |
80 | assert ch.size() <= points.size() : "hull has more points than graph";
81 | current = next;
82 | } while (current != left);
83 |
84 | return ch;
85 | }
86 |
87 | private static int crossProduct(Point p, Point q, Point r) {
88 | int val = (q.getY() - p.getY()) * (r.getX() - q.getX()) - (q.getX() - p.getX()) * (r.getY() - q.getY());
89 | return val;
90 | }
91 |
92 | private static Point findLeftMost(List points) {
93 | Point left = null;
94 |
95 | for (Point p : points) {
96 | if (left == null || p.getX() < left.getX()) {
97 | left = p;
98 | } else if (p.getX() == left.getX() && p.getY() < left.getY()) {
99 | left = p;
100 | }
101 | }
102 |
103 | return left;
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/src/main/java/hooks/helpers/LocalPoint.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 Abex
3 | * Copyright (c) 2017, Adam
4 | * All rights reserved.
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | * 2. Redistributions in binary form must reproduce the above copyright notice,
12 | * this list of conditions and the following disclaimer in the documentation
13 | * and/or other materials provided with the distribution.
14 | *
15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | */
26 | package hooks.helpers;
27 |
28 | import hooks.accessors.Client;
29 |
30 | /**
31 | * A LocolPoint is a Two-Dimensional point in the local coordinate space.
32 | * Because the local coordinate space moves, it is not safe to keep a LocalPoint
33 | * after a loading zone. The unit is 1/128th of a Tile
34 | */
35 | public class LocalPoint {
36 | /**
37 | * Returns a LocalPoint of the center of the passed tile
38 | */
39 | public static LocalPoint fromRegion(int x, int y) {
40 | return new LocalPoint((x << Perspective.LOCAL_COORD_BITS) + (1 << Perspective.LOCAL_COORD_BITS - 1) - 1,
41 | (y << Perspective.LOCAL_COORD_BITS) + (1 << Perspective.LOCAL_COORD_BITS - 1) - 1);
42 | }
43 |
44 | /**
45 | * Returns a LocalPoint of the center of the passed tile
46 | *
47 | * @return LocalPoint if in scene, otherwise null
48 | */
49 | public static LocalPoint fromWorld(Client client, int x, int y) {
50 | if (!WorldPoint.isInScene(client, x, y)) {
51 | return null;
52 | }
53 |
54 | int baseX = Client.getBaseX();
55 | int baseY = Client.getBaseY();
56 |
57 | return fromRegion(x - baseX, y - baseY);
58 | }
59 |
60 | /**
61 | * Returns a LocalPoint of the center of the passed tile
62 | *
63 | * @return LocalPoint if in scene, otherwise null
64 | */
65 |
66 | public static LocalPoint fromWorld(Client client, WorldPoint world) {
67 | if (Client.getPlane() != world.getPlane()) {
68 | return null;
69 | }
70 | return fromWorld(client, world.getX(), world.getY());
71 | }
72 |
73 | private final int x, y;
74 |
75 | public LocalPoint(int i, int j) {
76 | this.x = i;
77 | this.y = j;
78 | }
79 |
80 | /**
81 | * Find the distance from this point to another point
82 | *
83 | * @param other
84 | * @return
85 | */
86 | public int distanceTo(LocalPoint other) {
87 | return (int) Math.hypot(getX() - other.getX(), getY() - other.getY());
88 | }
89 |
90 | /**
91 | * Returns the X coordinate in Region space (tiles)
92 | */
93 | public int getRegionX() {
94 | return this.x >>> Perspective.LOCAL_COORD_BITS;
95 | }
96 |
97 | /**
98 | * Returns the Y coordinate in Region space (tiles)
99 | */
100 | public int getRegionY() {
101 | return this.y >>> Perspective.LOCAL_COORD_BITS;
102 | }
103 |
104 | public int getX() {
105 | return this.x;
106 | }
107 |
108 | public int getY() {
109 | return this.y;
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/src/main/java/paint/misc/ActorNames.java:
--------------------------------------------------------------------------------
1 | package paint.misc;
2 |
3 | import java.awt.Color;
4 | import java.awt.Graphics;
5 | import java.awt.Graphics2D;
6 | import java.awt.Image;
7 | import java.awt.RenderingHints;
8 | import java.io.FileInputStream;
9 | import java.io.InputStream;
10 |
11 | import javax.imageio.ImageIO;
12 |
13 | import cache.ActorListener;
14 | import game.Game;
15 | import game.LoaderWindow;
16 | import game.Settings;
17 | import hooks.Hooks;
18 | import hooks.accessors.Client;
19 | import hooks.accessors.Npc;
20 | import hooks.accessors.Player;
21 | import hooks.helpers.LocalPoint;
22 | import hooks.helpers.Perspective;
23 | import hooks.helpers.Point;
24 | import paint.PaintListener;
25 |
26 | public class ActorNames implements PaintListener {
27 |
28 | public static Color npcNameColor = Color.CYAN;
29 | public static Color playerNameColor = Color.green;
30 | public static Color clanMateNameColor = Color.ORANGE;
31 |
32 | Graphics2D g2d;
33 |
34 | RenderingHints rh = new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING,
35 | RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
36 |
37 | public ActorNames(Client game) {
38 |
39 | }
40 |
41 | @Override
42 | public void onRepaint(Graphics g) {
43 | if (Settings.SHOW_PLAYER_NAMES && Game.ctrlPressed==false) {
44 | if (this.g2d == null)
45 | this.g2d = (Graphics2D) g;
46 | if (Hooks.client != null)
47 | if (Hooks.client.isLoggedIn()) {
48 | g.setFont(Game.runescapeFont);
49 | g.setColor(playerNameColor);
50 |
51 | for (Player pl : ActorListener.players) {
52 | if (pl != null) {
53 | if (pl.isInClanChat()) {
54 | Image rank = getRankImage(pl.getClanRank());
55 | g.setColor(clanMateNameColor);
56 | String name = pl.getNames().getOriginalName();
57 | Point p = Perspective.getCanvasTextLocation(Hooks.client, (Graphics2D) g,
58 | new LocalPoint(pl.asActor().getX(), pl.asActor().getY()), name, 200);
59 | if (p != null) {
60 | g.drawString(name, p.getX(), p.getY());
61 | if (rank != null) {
62 | Graphics2D g2 = (Graphics2D) g;
63 | g2.setRenderingHints(this.rh);
64 | g2.drawImage(rank, p.getX() - 12, p.getY() - 9, LoaderWindow.game);
65 | }
66 | g.setColor(playerNameColor);
67 | }
68 | } else {
69 | String name = pl.getNames().getOriginalName();
70 | Point p = Perspective.getCanvasTextLocation(Hooks.client, (Graphics2D) g,
71 | new LocalPoint(pl.asActor().getX(), pl.asActor().getY()), name, 200);
72 | if (p != null) {
73 | g.drawString(name, p.getX(), p.getY());
74 | }
75 | }
76 |
77 | // g2.drawImage(rank, null, p.getX(), p.getY());
78 | }
79 | }
80 | g.setFont(Game.runescapeFont);
81 | g.setColor(npcNameColor);
82 | Npc[] ns = ActorListener.npcs;
83 | if (ns != null) {
84 | for (Npc pl : ns) {
85 | if (pl != null) {
86 | String name = pl.getNpcComposition().getName();
87 | if (name != null) {
88 | if (!name.contains("Fishing")) {
89 | Point p = Perspective.getCanvasTextLocation(Hooks.client, (Graphics2D) g,
90 | new LocalPoint(pl.asActor().getX(), pl.asActor().getY()), name, 190);
91 | if (p != null && name != null && name.compareTo("null") != 0) //$NON-NLS-1$
92 | g.drawString(name, p.getX(), p.getY());
93 | }
94 | }
95 | }
96 | }
97 | }
98 | }
99 | }
100 | }
101 |
102 | @SuppressWarnings("resource")
103 | public static Image getRankImage(int clanRank) {
104 | String imageName = "";
105 | switch (clanRank) {
106 | case -1:
107 | return null;
108 | case 0:
109 | imageName = "Friend";
110 | break;
111 | case 1:
112 | imageName = "Recruit";
113 | break;
114 | case 2:
115 | imageName = "Corporal";
116 | break;
117 | case 3:
118 | imageName = "Sergeant";
119 | break;
120 | case 4:
121 | imageName = "Lieutenant";
122 | break;
123 | case 5:
124 | imageName = "Captain";
125 | break;
126 | case 6:
127 | imageName = "General";
128 | break;
129 | case 7:
130 | imageName = "Owner";
131 | break;
132 | }
133 | InputStream is = null;
134 | try {
135 | is = new FileInputStream("./resources/clan_ranks/" + imageName + ".png");
136 | Image rank = ImageIO.read(is);
137 | is.close();
138 | if (rank != null)
139 | return rank;
140 | } catch (Exception e) {
141 | e.printStackTrace();
142 | }
143 | return null;
144 | }
145 |
146 | }
147 |
--------------------------------------------------------------------------------
/src/main/java/hooks/helpers/WorldPoint.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 Abex
3 | * Copyright (c) 2017, Adam
4 | * All rights reserved.
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice, this
10 | * list of conditions and the following disclaimer.
11 | * 2. Redistributions in binary form must reproduce the above copyright notice,
12 | * this list of conditions and the following disclaimer in the documentation
13 | * and/or other materials provided with the distribution.
14 | *
15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | */
26 | package hooks.helpers;
27 |
28 | import hooks.accessors.Client;
29 |
30 | /**
31 | * WorldPoint is a Three-Dimensional point representing the location of a Tile
32 | */
33 | public class WorldPoint {
34 | /**
35 | * Returns a WorldPoint containing the passed local coordinates
36 | */
37 | public static WorldPoint fromLocal(Client client, int x, int y, int plane) {
38 | return new WorldPoint((x >>> Perspective.LOCAL_COORD_BITS) + Client.getBaseX(),
39 | (y >>> Perspective.LOCAL_COORD_BITS) + Client.getBaseY(), plane);
40 | }
41 |
42 | /**
43 | * Returns a WorldPoint containing the passed LocalPoint
44 | */
45 | public static WorldPoint fromLocal(Client client, LocalPoint local) {
46 | return fromLocal(client, local.getX(), local.getY(), Client.getPlane());
47 | }
48 |
49 | /**
50 | * Returns a WorldPoint from the passed region coords
51 | */
52 | public static WorldPoint fromRegion(Client client, int x, int y, int plane) {
53 | return new WorldPoint(x + Client.getBaseX(), y + Client.getBaseY(), plane);
54 | }
55 |
56 | public static boolean isInScene(Client client, int x, int y) {
57 | int baseX = Client.getBaseX();
58 | int baseY = Client.getBaseY();
59 |
60 | int maxX = baseX + Perspective.SCENE_SIZE;
61 | int maxY = baseY + Perspective.SCENE_SIZE;
62 |
63 | return x >= baseX && x < maxX && y >= baseY && y < maxY;
64 | }
65 |
66 | /**
67 | * The plane coordinate of the Point.
68 | */
69 | private final int plane;
70 |
71 | /**
72 | * The X coordinate of the Point. Units are in tiles
73 | */
74 | private final int x;
75 |
76 | /**
77 | * The Y coordinate of the Point. Units are in tiles
78 | */
79 | private final int y;
80 |
81 | public WorldPoint(int x, int y, int plane) {
82 | this.x = x;
83 | this.y = y;
84 | this.plane = plane;
85 | }
86 |
87 | /**
88 | * Find the distance from this point to another point. Returns Integer.MAX_VALUE
89 | * if other is on a different plane.
90 | *
91 | * @param other
92 | * @return
93 | */
94 | public int distanceTo(WorldPoint other) {
95 | if (other.plane != this.plane) {
96 | return Integer.MAX_VALUE;
97 | }
98 |
99 | return (int) Math.hypot(getX() - other.getX(), getY() - other.getY());
100 | }
101 |
102 | /**
103 | * Find the distance from this point to another point.
104 | *
105 | * @param other
106 | * @return
107 | */
108 | public int distanceTo2D(WorldPoint other) {
109 | return (int) Math.hypot(getX() - other.getX(), getY() - other.getY());
110 | }
111 |
112 | public int getPlane() {
113 | // TODO Auto-generated method stub
114 | return this.plane;
115 | }
116 |
117 | int getX() {
118 | // TODO Auto-generated method stub
119 | return this.x;
120 | }
121 |
122 | int getY() {
123 | // TODO Auto-generated method stub
124 | return this.y;
125 | }
126 |
127 | public boolean isInScene(Client client) {
128 | return Client.getPlane() == this.plane && isInScene(client, this.x, this.y);
129 | }
130 |
131 | @Deprecated
132 | public Point toPoint() {
133 | return new Point(this.x, this.y);
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/src/main/java/discord/BaseConnectionWindows.java:
--------------------------------------------------------------------------------
1 | package discord;
2 |
3 | import java.io.File;
4 | import java.io.IOException;
5 | import java.io.RandomAccessFile;
6 |
7 | class BaseConnectionWindows extends BaseConnection {
8 | private boolean opened;
9 | private RandomAccessFile pipe;
10 |
11 | BaseConnectionWindows() {
12 | this.pipe = null;
13 | this.opened = false;
14 | }
15 |
16 | @Override
17 | boolean close() {
18 | if (!this.isOpen())
19 | return true;
20 |
21 | try {
22 | this.pipe.close();
23 | } catch (IOException ignored) {
24 | }
25 |
26 | this.pipe = null;
27 | this.opened = false;
28 |
29 | return true;
30 | }
31 |
32 | @Override
33 | boolean isOpen() {
34 | return this.opened;
35 | }
36 |
37 | @Override
38 | boolean open() {
39 | String pipeName = "\\\\?\\pipe\\discord-ipc-";
40 |
41 | if (this.isOpen())
42 | throw new IllegalStateException("Connection is already opened");
43 |
44 | int pipeDigit = 0;
45 | while (pipeDigit < 10) {
46 | try {
47 | this.pipe = new RandomAccessFile(pipeName + pipeDigit, "rw");
48 | this.opened = true;
49 | return true;
50 | } catch (Exception ex) {
51 | ++pipeDigit;
52 | }
53 | }
54 |
55 | return false;
56 | }
57 |
58 | @Override
59 | boolean read(byte[] bytes, int length, boolean wait) {
60 | if (bytes == null || bytes.length == 0)
61 | return bytes != null;
62 |
63 | if (!this.isOpen())
64 | return false;
65 |
66 | try {
67 | if (!wait) {
68 | long available = this.pipe.length() - this.pipe.getFilePointer();
69 |
70 | if (available < length)
71 | return false;
72 | }
73 |
74 | int read = this.pipe.read(bytes, 0, length);
75 |
76 | if (read != length)
77 | throw new IOException();
78 |
79 | return true;
80 | } catch (IOException ignored) {
81 | this.close();
82 | return false;
83 | }
84 | }
85 |
86 | @Override
87 | public void register(String applicationId, String command) {
88 | String javaLibraryPath = System.getProperty("java.home");
89 | File javaExeFile = new File(javaLibraryPath.split(";")[0] + "/bin/java.exe");
90 | File javawExeFile = new File(javaLibraryPath.split(";")[0] + "/bin/javaw.exe");
91 | String javaExePath = javaExeFile.exists() ? javaExeFile.getAbsolutePath()
92 | : javawExeFile.exists() ? javawExeFile.getAbsolutePath() : null;
93 |
94 | if (javaExePath == null)
95 | throw new RuntimeException("Unable to find java path");
96 |
97 | String openCommand;
98 |
99 | if (command != null)
100 | openCommand = command;
101 | else
102 | openCommand = javaExePath;
103 |
104 | String protocolName = "discord-" + applicationId;
105 | String protocolDescription = "URL:Run game " + applicationId + " protocol";
106 | String keyName = "Software\\Classes\\" + protocolName;
107 | String iconKeyName = keyName + "\\DefaultIcon";
108 | String commandKeyName = keyName + "\\DefaultIcon";
109 |
110 | try {
111 | WinRegistry.createKey(WinRegistry.HKEY_CURRENT_USER, keyName);
112 | WinRegistry.writeStringValue(WinRegistry.HKEY_CURRENT_USER, keyName, "", protocolDescription);
113 | WinRegistry.writeStringValue(WinRegistry.HKEY_CURRENT_USER, keyName, "URL Protocol", "\0");
114 |
115 | WinRegistry.createKey(WinRegistry.HKEY_CURRENT_USER, iconKeyName);
116 | WinRegistry.writeStringValue(WinRegistry.HKEY_CURRENT_USER, iconKeyName, "", javaExePath);
117 |
118 | WinRegistry.createKey(WinRegistry.HKEY_CURRENT_USER, commandKeyName);
119 | WinRegistry.writeStringValue(WinRegistry.HKEY_CURRENT_USER, commandKeyName, "", openCommand);
120 | } catch (Exception ex) {
121 | throw new RuntimeException("Unable to modify Discord registry keys", ex);
122 | }
123 | }
124 |
125 | @Override
126 | public void registerSteamGame(String applicationId, String steamId) {
127 | try {
128 | String steamPath = WinRegistry.readString(WinRegistry.HKEY_CURRENT_USER, "Software\\\\Valve\\\\Steam",
129 | "SteamExe");
130 | if (steamPath == null)
131 | throw new RuntimeException("Steam exe path not found");
132 |
133 | steamPath = steamPath.replaceAll("/", "\\");
134 |
135 | String command = "\"" + steamPath + "\" steam://rungameid/" + steamId;
136 |
137 | this.register(applicationId, command);
138 | } catch (Exception ex) {
139 | throw new RuntimeException("Unable to register Steam game", ex);
140 | }
141 | }
142 |
143 | @Override
144 | boolean write(byte[] bytes, int length) {
145 | if (bytes == null || length == 0)
146 | return bytes != null;
147 |
148 | if (!this.isOpen())
149 | return false;
150 |
151 | try {
152 | this.pipe.write(bytes, 0, length);
153 | return true;
154 | } catch (IOException ignored) {
155 | return false;
156 | }
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/src/main/java/paint/skills/AgilityOverlay.java:
--------------------------------------------------------------------------------
1 | package paint.skills;
2 |
3 | import java.awt.Color;
4 | import java.awt.Graphics;
5 | import java.awt.Graphics2D;
6 | import java.awt.geom.Area;
7 | import java.util.ArrayList;
8 |
9 | import cache.ObjectManager;
10 | import cache.TileListener;
11 | import game.Game;
12 | import game.Settings;
13 | import hooks.accessors.Client;
14 | import hooks.accessors.DecorativeObject;
15 | import hooks.accessors.GameObject;
16 | import hooks.accessors.GroundObject;
17 | import paint.PaintListener;
18 |
19 | public class AgilityOverlay implements PaintListener {
20 |
21 | Color outlineColor = ObjectManager.outlineColor;
22 | Color fillColor = ObjectManager.fillColor;
23 |
24 | Graphics2D g2;
25 | Area a;
26 |
27 | public AgilityOverlay() {
28 | }
29 |
30 | @Override
31 | public void onRepaint(Graphics g) {
32 | g.setFont(Game.runescapeFont);
33 |
34 | g.setColor(this.outlineColor);
35 | if (Settings.SHOW_AGILITY_OVERLAY == true && Game.ctrlPressed==false) {
36 | if (TileListener.gameObjects != null)
37 | try {
38 | for (ArrayList gos : TileListener.gameObjects.values()) {
39 |
40 | if (gos.get(0).getPlane() != Client.getPlane())
41 | continue;
42 | if (gos.get(0) != null) {
43 | switch (gos.get(0).getID()) {
44 |
45 | // Al Kharid course
46 | case 10355:
47 | case 10357:
48 | case 10352:
49 | // Varrock course
50 | case 10587:
51 | case 10642:
52 | case 10777:
53 | case 10778:
54 | case 10779:
55 | case 10780:
56 | case 10781:
57 | case 10817:
58 | // Canifis course;
59 | case 10819:
60 | case 10820:
61 | case 10821:
62 | case 10822:
63 | case 10823:
64 | case 10828:
65 | case 10831:
66 | case 10832:
67 | // Falador
68 | case 10836:
69 | case 11161:
70 | case 11360:
71 | case 11361:
72 | case 11365:
73 | case 11366:
74 | case 11367:
75 | case 11369:
76 | case 11370:
77 | case 11371:
78 | // Seers
79 | case 11374:
80 | case 11375:
81 | case 11376:
82 | case 11377:
83 | g.setColor(this.outlineColor);
84 | this.g2 = (Graphics2D) g;
85 | this.a = gos.get(0).getClickbox();
86 | if (this.a != null) {
87 | this.g2.draw(this.a);
88 | this.g2.setPaint(this.fillColor);
89 | this.g2.fill(this.a);
90 | }
91 | }
92 | }
93 | }
94 |
95 | for (DecorativeObject d : TileListener.decorativeObjects.values()) {
96 |
97 | if (d != null) {
98 | switch (d.getID()) {
99 |
100 | // Al Kharid course
101 | case 10093:
102 | case 10094:
103 | // Varrock course
104 | case 10586:
105 | // Falador course;
106 | case 10833:
107 | // Seers course
108 | case 11373:
109 | if (d.getPlane() != Client.getPlane()) {
110 | if (Game.debug)
111 | System.out.println("" + d.getPlane() + " " + Client.getPlane()); //$NON-NLS-1$ //$NON-NLS-2$
112 | } else {
113 | g.setColor(this.outlineColor);
114 | ;
115 | this.g2 = (Graphics2D) g;
116 | this.a = d.getClickbox();
117 | if (this.a != null) {
118 |
119 | this.g2.draw(this.a);
120 | this.g2.setPaint(this.fillColor);
121 | this.g2.fill(this.a);
122 | }
123 |
124 | }
125 | }
126 |
127 | }
128 |
129 | }
130 |
131 | for (GroundObject go : TileListener.groundObjects.values()) {
132 | if (go != null) {
133 | switch (go.getID()) {
134 |
135 | // Al Kharid Course
136 | case 10284:
137 | drawGroundObject(go, g);
138 | break;
139 | case 10527:
140 | drawGroundObject(go, g);
141 | break;
142 | case 10583:
143 | drawGroundObject(go, g);
144 | break;
145 | case 10584:
146 | drawGroundObject(go, g);
147 | break;
148 | // Falador course
149 | case 10834:
150 | drawGroundObject(go, g);
151 | break;
152 | case 11364:
153 | drawGroundObject(go, g);
154 | break;
155 | // Seers
156 | case 11378:
157 | go.plane = 2;
158 | drawGroundObject(go, g);
159 | break;
160 | }
161 | }
162 | }
163 | } catch (Exception e) {
164 | ObjectManager.resetObjects();
165 | }
166 | }
167 | }
168 |
169 | private void drawGroundObject(GroundObject go, Graphics g) {
170 | if (go.getPlane() != Client.getPlane()) {
171 | if (Game.debug)
172 | System.out.println("" + go.getPlane() + " " + Client.getPlane());
173 | return;
174 | }
175 | g.setColor(this.outlineColor);
176 | ;
177 | this.g2 = (Graphics2D) g;
178 | this.a = go.getClickbox();
179 | if (this.a != null) {
180 | this.g2.draw(this.a);
181 | this.g2.setPaint(this.fillColor);
182 | this.g2.fill(this.a);
183 | }
184 | }
185 |
186 | }
187 |
--------------------------------------------------------------------------------
/src/main/java/hooks/accessors/Client.java:
--------------------------------------------------------------------------------
1 | package hooks.accessors;
2 |
3 | import java.awt.Canvas;
4 | import java.util.Map;
5 |
6 | import game.LoaderWindow;
7 | import hooks.Hooks;
8 | import hooks.model.RSClass;
9 |
10 | public class Client extends RSClass {
11 |
12 | public static boolean loggedIn = false;
13 | int loginState;
14 | int gameState;
15 | int scale;
16 |
17 | Player[] cachedPlayers;
18 | Npc[] cachedNPCs;
19 |
20 | Object[] tempObjects;
21 | Player tempPlayer;
22 | Npc tempNPC;
23 |
24 | public static boolean isLoaded() {
25 | try {
26 | Hooks.client.getLoginState();
27 | return true;
28 | } catch (Exception e) {
29 | return false;
30 | }
31 | }
32 |
33 | public Client(Object reference) {
34 | this.reference = reference;
35 | if (Hooks.client != null) {
36 | this.fields = Hooks.client.fields;
37 | this.name = Hooks.client.name;
38 | this.obfuscatedName = Hooks.client.obfuscatedName;
39 | }
40 | }
41 |
42 | public static int getBaseX() {
43 | return Hooks.class138.getBaseX();
44 | }
45 |
46 | public static int getBaseY() {
47 | return Hooks.class23.getBaseY();
48 | }
49 |
50 | public Npc[] getCachedNpcs() {
51 | this.tempObjects = (Object[]) getValue(getField("cachedNPCs"));
52 | if (this.tempObjects != null) {
53 | int i = 0;
54 | this.cachedNPCs = new Npc[this.tempObjects.length];
55 | for (Object o : this.tempObjects) {
56 | if (o != null) {
57 | this.tempNPC = new Npc(o);
58 | this.cachedNPCs[i] = this.tempNPC;
59 | i++;
60 | }
61 | }
62 | return this.cachedNPCs;
63 | }
64 | return null;
65 | }
66 |
67 | public Player[] getCachedPlayers() {
68 | this.tempObjects = (Object[]) getValue(getField("cachedPlayers"));
69 | if (this.tempObjects != null) {
70 | int i = 0;
71 | this.cachedPlayers = new Player[this.tempObjects.length];
72 | for (Object o : this.tempObjects) {
73 | if (o != null) {
74 | this.tempPlayer = new Player(o);
75 | this.cachedPlayers[i] = this.tempPlayer;
76 | i++;
77 | }
78 | }
79 | return this.cachedPlayers;
80 | }
81 | return null;
82 |
83 | }
84 |
85 | public int[] getRealSkillLevels() {
86 | return (int[]) getValue(getField("realSkillLevels"));
87 | }
88 |
89 | public int[] getExperiences() {
90 | return (int[]) getValue(getField("skillExperiences"));
91 | }
92 |
93 | public static int getCameraPitch() {
94 | return Hooks.grandExchangeOffer.getCameraPitch();
95 | }
96 |
97 | public static int getCameraX() {
98 | return Hooks.player.getCameraX();
99 | }
100 |
101 | public static int getCameraY() {
102 | return Hooks.class20.getCameraY();
103 | }
104 |
105 | public static int getCameraYaw() {
106 | return Hooks.class28.getCameraYaw();
107 | }
108 |
109 | public static int getCameraZ() {
110 | return Hooks.gameObject.getCameraZ();
111 | }
112 |
113 | public static Canvas getCanvas() {
114 | return LoaderWindow.game;
115 | }
116 |
117 | public int getGameState() {
118 | this.gameState = (int) getValue(getField("gameState"));
119 | return this.gameState;
120 | }
121 |
122 | public static Player getLocalPlayer() {
123 | return Hooks.soundTaskDataProvider.getLocalPlayer();
124 | }
125 |
126 | public int getLoginState() {
127 | this.loginState = (int) getValue(getField("loginState"));
128 | return this.loginState;
129 | }
130 |
131 | public int getMapAngle() {
132 | return (int) getValue(getField("mapAngle"));
133 | }
134 |
135 | public static int getPlane() {
136 | return Hooks.boundingBox3DDrawMode.getPlane();
137 | }
138 |
139 | public int getWidgetRoot() {
140 | return (int) getValue(getField("widgetRoot"));
141 | }
142 |
143 | public static Region getRegion() {
144 | if (Hooks.class255 == null)
145 | return null;
146 | return Hooks.class255.getRegion();
147 | }
148 |
149 | public int getScale() {
150 | this.scale = (int) getValue(getField("scale"));
151 | return this.scale;
152 | }
153 |
154 | public static int getSetting(int i) {
155 | return 0;
156 | }
157 |
158 | public static int[] getSettingsArray() {
159 | return new int[100];
160 | }
161 |
162 | public static int[][][] getTileHeights() {
163 | return Hooks.class62.getTileHeights();
164 | }
165 |
166 | public static byte[][][] getTileSettings() {
167 | return Hooks.class62.getTileSettings();
168 | }
169 |
170 | public int getViewportHeight() {
171 | return (int) getValue(getField("viewportHeight"));
172 | }
173 |
174 | public int getViewportWidth() {
175 | return (int) getValue(getField("viewportWidth"));
176 | }
177 |
178 | public boolean isLoggedIn() {
179 | return (getLoginState() == 10 && getGameState() >= 11 && loggedIn == true);
180 | }
181 |
182 | public boolean isResized() {
183 | return (boolean) getValue(getField("isResized"));
184 | }
185 |
186 | public static Map getChatLineMap() {
187 | return Hooks.class95.getChatLineMap();
188 | }
189 |
190 | public static ClanMemberManager getClanMemberManager() {
191 | return Hooks.gameEngine.getClanMemberManager();
192 | }
193 |
194 | public int getCycle() {
195 | return (int) getValue(getField("cycleCntr"));
196 | }
197 | }
198 |
--------------------------------------------------------------------------------
/src/main/java/paint/InputListeners.java:
--------------------------------------------------------------------------------
1 | package paint;
2 |
3 | import java.applet.Applet;
4 | import java.awt.Canvas;
5 | import java.awt.event.FocusEvent;
6 | import java.awt.event.FocusListener;
7 | import java.awt.event.KeyEvent;
8 | import java.awt.event.KeyListener;
9 | import java.awt.event.MouseEvent;
10 | import java.awt.event.MouseListener;
11 | import java.awt.event.MouseMotionListener;
12 | import java.awt.event.MouseWheelEvent;
13 | import java.awt.event.MouseWheelListener;
14 |
15 | import game.Game;
16 | import game.LoaderWindow;
17 |
18 | public class InputListeners
19 | implements MouseListener, MouseMotionListener, MouseWheelListener, KeyListener, FocusListener {
20 |
21 | public Applet client;
22 | private boolean hasFocus;
23 | private boolean inputEnabled;
24 |
25 | public InputListeners(boolean inputEnabled, Applet client) {
26 | this.inputEnabled = inputEnabled;
27 | this.client = client;
28 | }
29 |
30 | @Override
31 | public void focusGained(FocusEvent e) {
32 | this.hasFocus = true;
33 | e.setSource(this.client);
34 | if (this.inputEnabled && this.client != null) {
35 | Canvas canvas = (Canvas) this.client.getComponent(0);
36 | if (canvas != null)
37 | canvas.dispatchEvent(e);
38 | }
39 | }
40 |
41 | @Override
42 | public void focusLost(FocusEvent e) {
43 | this.hasFocus = false;
44 | e.setSource(this.client);
45 | if (this.inputEnabled && this.client != null) {
46 | Canvas canvas = (Canvas) this.client.getComponent(0);
47 | if (canvas != null)
48 | canvas.dispatchEvent(e);
49 | }
50 | }
51 |
52 | public boolean isInputEnabled() {
53 | return this.inputEnabled;
54 | }
55 |
56 | @Override
57 | public void keyPressed(KeyEvent e) {
58 | if (e.getKeyCode()==17) {
59 | Game.ctrlPressed = true;
60 | }
61 | e.setSource(this.client);
62 | if (this.inputEnabled && this.client != null) {
63 | Canvas canvas = (Canvas) this.client.getComponent(0);
64 | if (canvas != null)
65 | canvas.dispatchEvent(e);
66 | }
67 | }
68 |
69 | @Override
70 | public void keyReleased(KeyEvent e) {
71 | if (e.getKeyCode()==17) {
72 | Game.ctrlPressed = false;
73 | }
74 | e.setSource(this.client);
75 | if (this.inputEnabled && this.client != null) {
76 | Canvas canvas = (Canvas) this.client.getComponent(0);
77 | if (canvas != null)
78 | canvas.dispatchEvent(e);
79 | }
80 | }
81 |
82 | @Override
83 | public void keyTyped(KeyEvent e) {
84 | e.setSource(this.client);
85 | if (this.inputEnabled && this.client != null) {
86 | Canvas canvas = (Canvas) this.client.getComponent(0);
87 | if (canvas != null)
88 | canvas.dispatchEvent(e);
89 | }
90 | }
91 |
92 | // Listeners
93 | @Override
94 | public void mouseClicked(MouseEvent e) {
95 | LoaderWindow.game.focus();
96 | if (this.inputEnabled && this.client != null) {
97 | e.setSource(this.client);
98 | Canvas canvas = (Canvas) this.client.getComponent(0);
99 | if (canvas != null)
100 | canvas.dispatchEvent(e);
101 | }
102 | }
103 |
104 | @Override
105 | public void mouseDragged(MouseEvent e) {
106 | e.setSource(this.client);
107 | if (this.inputEnabled && this.client != null) {
108 | Canvas canvas = (Canvas) this.client.getComponent(0);
109 | if (canvas != null)
110 | canvas.dispatchEvent(e);
111 | }
112 | }
113 |
114 | @Override
115 | public void mouseEntered(MouseEvent e) {
116 | e.setSource(this.client);
117 | if (this.inputEnabled && this.client != null) {
118 | Canvas canvas = (Canvas) this.client.getComponent(0);
119 | if (canvas != null)
120 | canvas.dispatchEvent(e);
121 | }
122 | }
123 |
124 | @Override
125 | public void mouseExited(MouseEvent e) {
126 | e.setSource(this.client);
127 | if (this.inputEnabled && this.client != null) {
128 | Canvas canvas = (Canvas) this.client.getComponent(0);
129 | if (canvas != null)
130 | canvas.dispatchEvent(e);
131 | }
132 | }
133 |
134 | @Override
135 | public void mouseMoved(MouseEvent e) {
136 | e.setSource(this.client);
137 | if (this.inputEnabled && this.client != null) {
138 | Canvas canvas = (Canvas) this.client.getComponent(0);
139 | if (canvas != null)
140 | canvas.dispatchEvent(e);
141 | }
142 | }
143 |
144 | @Override
145 | public void mousePressed(MouseEvent e) {
146 | if (this.inputEnabled && this.client != null) {
147 | e.setSource(this.client);
148 | Canvas canvas = (Canvas) this.client.getComponent(0);
149 | if (canvas != null) {
150 | if (!this.hasFocus)
151 | canvas.requestFocus();
152 |
153 | canvas.dispatchEvent(e);
154 | }
155 | }
156 | }
157 |
158 | @Override
159 | public void mouseReleased(MouseEvent e) {
160 | if (this.inputEnabled && this.client != null) {
161 | e.setSource(this.client);
162 | Canvas canvas = (Canvas) this.client.getComponent(0);
163 | if (canvas != null)
164 | canvas.dispatchEvent(e);
165 | }
166 | }
167 |
168 | // End listeners
169 |
170 | @Override
171 | public void mouseWheelMoved(MouseWheelEvent e) {
172 | e.setSource(this.client);
173 | if (this.inputEnabled && this.client != null) {
174 | Canvas canvas = (Canvas) this.client.getComponent(0);
175 | if (canvas != null)
176 | canvas.dispatchEvent(e);
177 | }
178 | }
179 |
180 | public void setInputeEnabled(boolean inputEnabled) {
181 | this.inputEnabled = inputEnabled;
182 | }
183 |
184 | }
185 |
--------------------------------------------------------------------------------
/src/main/java/discord/BaseConnectionUnix.java:
--------------------------------------------------------------------------------
1 | package discord;
2 |
3 | import java.io.File;
4 | import java.io.FileWriter;
5 | import java.io.IOException;
6 | import java.nio.ByteBuffer;
7 | import java.nio.file.Files;
8 | import java.nio.file.Paths;
9 |
10 | import jnr.unixsocket.UnixSocketAddress;
11 | import jnr.unixsocket.UnixSocketChannel;
12 |
13 | class BaseConnectionUnix extends BaseConnection {
14 | private boolean opened;
15 | private UnixSocketChannel unixSocket;
16 |
17 | BaseConnectionUnix() {
18 | this.unixSocket = null;
19 | this.opened = false;
20 | }
21 |
22 | @Override
23 | boolean close() {
24 | if (!this.isOpen())
25 | return true;
26 |
27 | try {
28 | this.unixSocket.close();
29 | } catch (IOException ignored) {
30 | }
31 |
32 | this.unixSocket = null;
33 | this.opened = false;
34 |
35 | return true;
36 | }
37 |
38 | private static String getTempPath() {
39 | String temp = System.getenv("XDG_RUNTIME_DIR");
40 | temp = temp != null ? temp : System.getenv("TMPDIR");
41 | temp = temp != null ? temp : System.getenv("TMP");
42 | temp = temp != null ? temp : System.getenv("TEMP");
43 | temp = temp != null ? temp : "/tmp";
44 | return temp;
45 | }
46 |
47 | @Override
48 | boolean isOpen() {
49 | return this.opened;
50 | }
51 |
52 | static boolean mkdir(String path) {
53 | File file = new File(path);
54 |
55 | return file.exists() && file.isDirectory() || file.mkdir();
56 | }
57 |
58 | @Override
59 | boolean open() {
60 | String pipeName = BaseConnectionUnix.getTempPath() + "/discord-ipc-";
61 |
62 | if (this.isOpen())
63 | throw new IllegalStateException("Connection is already opened");
64 |
65 | int pipeDigit = 0;
66 | while (pipeDigit < 10) {
67 | try {
68 | UnixSocketAddress address = new UnixSocketAddress(pipeName + pipeDigit);
69 | this.unixSocket = UnixSocketChannel.open(address);
70 | this.opened = true;
71 |
72 | return true;
73 | } catch (Exception ex) {
74 | ++pipeDigit;
75 | }
76 | }
77 |
78 | return false;
79 | }
80 |
81 | @Override
82 | boolean read(byte[] bytes, int length, boolean wait) {
83 | if (bytes == null || bytes.length == 0)
84 | return bytes != null;
85 |
86 | if (!this.isOpen())
87 | return false;
88 |
89 | try {
90 | if (!wait) {
91 | long available = this.unixSocket.socket().getInputStream().available();
92 |
93 | if (available < length)
94 | return false;
95 | }
96 |
97 | ByteBuffer byteBuffer = ByteBuffer.allocate(length);
98 |
99 | int read = this.unixSocket.read(byteBuffer);
100 |
101 | if (read != length)
102 | throw new IOException();
103 |
104 | byteBuffer.get(bytes, 0, length);
105 |
106 | return true;
107 | } catch (IOException ignored) {
108 | this.close();
109 | return false;
110 | }
111 | }
112 |
113 | @Override
114 | public void register(String applicationId, String command) {
115 | String home = System.getenv("HOME");
116 |
117 | if (home == null)
118 | throw new RuntimeException("Unable to find user HOME directory");
119 |
120 | if (command == null) {
121 | try {
122 | command = Files.readSymbolicLink(Paths.get("/proc/self/exe")).toString();
123 | } catch (Exception ex) {
124 | throw new RuntimeException("Unable to get current exe path from /proc/self/exe", ex);
125 | }
126 | }
127 |
128 | String desktopFile = "[Desktop Entry]\n" + "Name=Game " + applicationId + "\n" + "Exec=" + command + " %%u\n"
129 | + "Type=Application\n" + "NoDisplay=true\n" + "Categories=Discord;Games;\n"
130 | + "MimeType=x-scheme-handler/discord-" + applicationId + ";\n";
131 |
132 | String desktopFileName = "/discord-" + applicationId + ".desktop";
133 | String desktopFilePath = home + "/.local";
134 |
135 | if (BaseConnectionUnix.mkdir(desktopFilePath))
136 | throw new RuntimeException("Failed to create directory '" + desktopFilePath + "'");
137 |
138 | desktopFilePath += "/share";
139 |
140 | if (BaseConnectionUnix.mkdir(desktopFilePath))
141 | throw new RuntimeException("Failed to create directory '" + desktopFilePath + "'");
142 |
143 | desktopFilePath += "/applications";
144 |
145 | if (BaseConnectionUnix.mkdir(desktopFilePath))
146 | throw new RuntimeException("Failed to create directory '" + desktopFilePath + "'");
147 |
148 | desktopFilePath += desktopFileName;
149 |
150 | try (FileWriter fileWriter = new FileWriter(desktopFilePath)) {
151 | fileWriter.write(desktopFile);
152 | } catch (Exception ex) {
153 | throw new RuntimeException("Failed to write desktop info into '" + desktopFilePath + "'");
154 | }
155 |
156 | String xdgMimeCommand = "xdg-mime default discord-" + applicationId + ".desktop x-scheme-handler/discord-"
157 | + applicationId;
158 |
159 | try {
160 | ProcessBuilder processBuilder = new ProcessBuilder(xdgMimeCommand.split(" "));
161 | processBuilder.environment();
162 | int result = processBuilder.start().waitFor();
163 | if (result < 0)
164 | throw new Exception("xdg-mime returned " + result);
165 | } catch (Exception ex) {
166 | throw new RuntimeException("Failed to register mime handler", ex);
167 | }
168 | }
169 |
170 | @Override
171 | public void registerSteamGame(String applicationId, String steamId) {
172 | this.register(applicationId, "xdg-open steam://rungameid/" + steamId);
173 | }
174 |
175 | @Override
176 | boolean write(byte[] bytes, int length) {
177 | if (bytes == null || length == 0)
178 | return bytes != null;
179 |
180 | if (!this.isOpen())
181 | return false;
182 |
183 | try {
184 | ByteBuffer byteBuffer = ByteBuffer.allocate(length);
185 | byteBuffer.put(bytes, 0, length);
186 |
187 | this.unixSocket.write(byteBuffer);
188 | return true;
189 | } catch (IOException ignored) {
190 | return false;
191 | }
192 | }
193 | }
194 |
--------------------------------------------------------------------------------
/src/main/java/hooks/helpers/Skill.java:
--------------------------------------------------------------------------------
1 | package hooks.helpers;
2 |
3 | import hooks.Hooks;
4 |
5 | public class Skill {
6 |
7 | public static double getLevelUpPercentage(int skillID) {
8 | int xpForNextLevel = getXpForNextLevel(Hooks.client.getRealSkillLevels()[skillID]);
9 | int xpForCurrentLevel = getXpForNextLevel(Hooks.client.getRealSkillLevels()[skillID] - 1);
10 | int currentXp = Hooks.client.getExperiences()[skillID];
11 | float percentage = ((float) (currentXp - xpForCurrentLevel) / (float) (xpForNextLevel - xpForCurrentLevel))
12 | * 100;
13 | if (currentXp == 0) {
14 | return 0;
15 | }
16 | return roundDown5(percentage);
17 |
18 | }
19 |
20 | public static int getXpForNextLevel(int currentLevel) {
21 | switch (currentLevel) {
22 | case 1:
23 | return 83;
24 | case 2:
25 | return 174;
26 | case 3:
27 | return 276;
28 | case 4:
29 | return 388;
30 | case 5:
31 | return 512;
32 | case 6:
33 | return 650;
34 | case 7:
35 | return 801;
36 | case 8:
37 | return 969;
38 | case 9:
39 | return 1154;
40 | case 10:
41 | return 1358;
42 | case 11:
43 | return 1584;
44 | case 12:
45 | return 1833;
46 | case 13:
47 | return 2107;
48 | case 14:
49 | return 2411;
50 | case 15:
51 | return 2746;
52 | case 16:
53 | return 3115;
54 | case 17:
55 | return 3523;
56 | case 18:
57 | return 3973;
58 | case 19:
59 | return 4470;
60 | case 20:
61 | return 5018;
62 | case 21:
63 | return 5624;
64 | case 22:
65 | return 6291;
66 | case 23:
67 | return 7028;
68 | case 24:
69 | return 7842;
70 | case 25:
71 | return 8740;
72 | case 26:
73 | return 9730;
74 | case 27:
75 | return 10824;
76 | case 28:
77 | return 12031;
78 | case 29:
79 | return 13363;
80 | case 30:
81 | return 14833;
82 | case 31:
83 | return 16465;
84 | case 32:
85 | return 18247;
86 | case 33:
87 | return 20224;
88 | case 34:
89 | return 22406;
90 | case 35:
91 | return 24815;
92 | case 36:
93 | return 27473;
94 | case 37:
95 | return 30408;
96 | case 38:
97 | return 33648;
98 | case 39:
99 | return 37224;
100 | case 40:
101 | return 41171;
102 | case 41:
103 | return 45529;
104 | case 42:
105 | return 50339;
106 | case 43:
107 | return 55649;
108 | case 44:
109 | return 61512;
110 | case 45:
111 | return 67983;
112 | case 46:
113 | return 75127;
114 | case 47:
115 | return 83014;
116 | case 48:
117 | return 91721;
118 | case 49:
119 | return 101333;
120 | case 50:
121 | return 111945;
122 | case 51:
123 | return 123660;
124 | case 52:
125 | return 136594;
126 | case 53:
127 | return 150872;
128 | case 54:
129 | return 166636;
130 | case 55:
131 | return 184040;
132 | case 56:
133 | return 203254;
134 | case 57:
135 | return 224466;
136 | case 58:
137 | return 247886;
138 | case 59:
139 | return 273742;
140 | case 60:
141 | return 302288;
142 | case 61:
143 | return 333804;
144 | case 62:
145 | return 368599;
146 | case 63:
147 | return 407015;
148 | case 64:
149 | return 449428;
150 | case 65:
151 | return 496254;
152 | case 66:
153 | return 547953;
154 | case 67:
155 | return 605032;
156 | case 68:
157 | return 668051;
158 | case 69:
159 | return 737627;
160 | case 70:
161 | return 814445;
162 | case 71:
163 | return 899257;
164 | case 72:
165 | return 992885;
166 | case 73:
167 | return 1096278;
168 | case 74:
169 | return 1210421;
170 | case 75:
171 | return 1336443;
172 | case 76:
173 | return 1475581;
174 | case 77:
175 | return 1629200;
176 | case 78:
177 | return 1798808;
178 | case 79:
179 | return 1986808;
180 | case 80:
181 | return 2192818;
182 | case 81:
183 | return 2421087;
184 | case 82:
185 | return 2673114;
186 | case 83:
187 | return 2951373;
188 | case 84:
189 | return 3258594;
190 | case 85:
191 | return 3597792;
192 | case 86:
193 | return 3972294;
194 | case 87:
195 | return 4385776;
196 | case 88:
197 | return 4842295;
198 | case 89:
199 | return 5346332;
200 | case 90:
201 | return 5902831;
202 | case 91:
203 | return 6517253;
204 | case 92:
205 | return 7195629;
206 | case 93:
207 | return 7944614;
208 | case 94:
209 | return 8771558;
210 | case 95:
211 | return 9684577;
212 | case 96:
213 | return 10692629;
214 | case 97:
215 | return 11805606;
216 | case 98:
217 | return 13034431;
218 |
219 | }
220 | return -1;
221 | }
222 |
223 | public static String getNameForID(int skillID) {
224 | switch (skillID) {
225 | case 0:
226 | return "Attack";
227 | case 1:
228 | return "Defence";
229 | case 2:
230 | return "Strength";
231 | case 3:
232 | return "Hitpoints";
233 | case 4:
234 | return "Ranged";
235 | case 5:
236 | return "Prayer";
237 | case 6:
238 | return "Magic";
239 | case 7:
240 | return "Cooking";
241 | case 8:
242 | return "Woodcutting";
243 | case 9:
244 | return "Fletching";
245 | case 10:
246 | return "Fishing";
247 | case 11:
248 | return "Firemaking";
249 | case 12:
250 | return "Crafting";
251 | case 13:
252 | return "Smithing";
253 | case 14:
254 | return "Mining";
255 | case 15:
256 | return "Herblore";
257 | case 16:
258 | return "Agility";
259 | case 17:
260 | return "Thieving";
261 | case 18:
262 | return "Slayer";
263 | case 19:
264 | return "Farming";
265 | case 20:
266 | return "Runecrafting";
267 | case 21:
268 | return "Hunter";
269 | case 22:
270 | return "Construction";
271 | }
272 | return null;
273 | }
274 |
275 | public static double roundDown5(double d) {
276 | return (long) (d * 1e5) / 1e5;
277 | }
278 | }
279 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/src/main/java/cache/MessageManager.java:
--------------------------------------------------------------------------------
1 | package cache;
2 |
3 | import java.awt.Graphics;
4 | import java.util.ArrayList;
5 | import java.util.Map;
6 |
7 | import game.Game;
8 | import hooks.accessors.ChatLineBuffer;
9 | import hooks.accessors.Client;
10 | import hooks.accessors.MessageNode;
11 | import paint.PaintListener;
12 |
13 | public class MessageManager implements PaintListener {
14 |
15 | static int tick = 0;
16 |
17 | public static final int SERVER = 0;
18 | public static final int PUBLIC = 2;
19 | public static final int PM_RECEIVED = 3;
20 | public static final int TRADE_RECEIVED = 4;
21 | public static final int PM_INFO = 5;
22 | public static final int PM_SENT = 6;
23 | public static final int PM_RECEIVED_MOD = 7;
24 | public static final int CLAN = 9;
25 | public static final int CLAN_INFO = 11;
26 | public static final int TRADE_SENT = 12;
27 | public static final int ABUSE_REPORT = 26;
28 | public static final int EXAMINE_ITEM = 27;
29 | public static final int EXAMINE_NPC = 28;
30 | public static final int EXAMINE_OBJECT = 29;
31 | public static final int FRIENDS_ADD = 30;
32 | public static final int IGNORE_ADD = 31;
33 | public static final int AUTOCHAT = 90;
34 | public static final int GAME = 99;
35 | public static final int TRADE = 101;
36 | public static final int DUEL = 103;
37 | public static final int FILTERED = 105;
38 | public static final int ACTION = 109;
39 |
40 | public static ArrayList publicMessages = new ArrayList<>();
41 | public static ArrayList clanMessages = new ArrayList<>();
42 | public static ArrayList serverMessages = new ArrayList<>();
43 | public static ArrayList helpMessages = new ArrayList<>();
44 | public static ArrayList filteredMessages = new ArrayList<>();
45 | public static ArrayList unknownMessages = new ArrayList<>();
46 |
47 | public static void handleNewMessages() {
48 | if (tick > 40) {
49 | Map m = Client.getChatLineMap();
50 | if (m.get(SERVER) != null) {
51 | ChatLineBuffer buffer = new ChatLineBuffer(m.get(SERVER));
52 | for (MessageNode mn : buffer.getLines()) {
53 | if (mn.reference != null)
54 | if (!containsMessage(mn, serverMessages)) {
55 | handleNewServerMessage(mn);
56 | serverMessages.add(mn);
57 | }
58 | }
59 | }
60 | if (m.get(PUBLIC) != null) {
61 | ChatLineBuffer buffer = new ChatLineBuffer(m.get(PUBLIC));
62 | for (MessageNode mn : buffer.getLines()) {
63 | if (mn.reference != null)
64 | if (!containsMessage(mn, publicMessages)) {
65 | if (mn.getMessage().contains("lol42")) {
66 | Game.sendTrayMessage("test", "succeeded");
67 | }
68 | handleNewPublicMessage(mn);
69 | publicMessages.add(mn);
70 | }
71 | }
72 | }
73 | if (m.get(CLAN) != null) {
74 | ChatLineBuffer buffer = new ChatLineBuffer(m.get(CLAN));
75 | for (MessageNode mn : buffer.getLines()) {
76 | if (mn.reference != null)
77 | if (!containsMessage(mn, clanMessages)) {
78 | handleNewClanMessage(mn);
79 | clanMessages.add(mn);
80 | }
81 | }
82 | }
83 | if (m.get(CLAN_INFO) != null) {
84 | ChatLineBuffer buffer = new ChatLineBuffer(m.get(CLAN_INFO));
85 | for (MessageNode mn : buffer.getLines()) {
86 | if (mn.reference != null)
87 | if (!containsMessage(mn, helpMessages)) {
88 | handleNewClanInfoMessage(mn);
89 | helpMessages.add(mn);
90 | }
91 | }
92 | }
93 | if (m.get(FILTERED) != null) {
94 | ChatLineBuffer buffer = new ChatLineBuffer(m.get(FILTERED));
95 | for (MessageNode mn : buffer.getLines()) {
96 | if (mn.reference != null)
97 | if (!containsMessage(mn, filteredMessages)) {
98 | handleNewFilteredMessage(mn);
99 | filteredMessages.add(mn);
100 | }
101 | }
102 | }
103 | int i = 0;
104 | while (i < 110) {
105 | if (i != CLAN_INFO && i != SERVER && i != CLAN && i != PUBLIC && i != FILTERED) {
106 | if (m.get(i) != null) {
107 | ChatLineBuffer buffer = new ChatLineBuffer(m.get(i));
108 | for (MessageNode mn : buffer.getLines()) {
109 | if (mn.reference != null)
110 | if (!containsMessage(mn, unknownMessages)) {
111 | handleNewUnknownMessage(mn);
112 | unknownMessages.add(mn);
113 | }
114 | }
115 | }
116 | }
117 | i++;
118 | }
119 | tick = 0;
120 | } else {
121 | tick++;
122 | }
123 |
124 | }
125 |
126 | public static boolean containsMessage(MessageNode newMessage, ArrayList messages) {
127 | for (MessageNode m : messages) {
128 | if (newMessage != null)
129 | if (newMessage.getMessage().compareTo(m.getMessage()) == 0) {
130 | if (newMessage.getTick() == m.getTick())
131 | return true;
132 | }
133 | }
134 | return false;
135 | }
136 |
137 | public static void handleNewPublicMessage(MessageNode mn) {
138 | System.out.println("Public: (" + mn.getName() + ") " + mn.getMessage());
139 | }
140 |
141 | public static void handleNewServerMessage(MessageNode mn) {
142 | System.out.println("Server: " + mn.getMessage());
143 | if (mn.getMessage().contains("A bird's nest falls out of the tree."))
144 | Game.sendTrayMessage("OSJR", "A bird's nest falls out of the tree.");
145 | if (mn.getMessage().contains("Welcome to RuneScape."))
146 | Client.loggedIn = true;
147 | }
148 |
149 | public static void handleNewClanMessage(MessageNode mn) {
150 | System.out.println("Clan: (" + mn.getName() + ") " + mn.getMessage());
151 | }
152 |
153 | public static void handleNewClanInfoMessage(MessageNode mn) {
154 | System.out.println("Help: " + mn.getMessage());
155 | }
156 |
157 | public static void handleNewUnknownMessage(MessageNode mn) {
158 | System.out.println("Unknown:" + mn.getType() + " " + mn.getMessage());
159 | }
160 |
161 | public static void handleNewFilteredMessage(MessageNode mn) {
162 | if (Game.debug)
163 | System.out.println("Filtered: " + mn.getMessage());
164 | }
165 |
166 | public static void testMessage() {
167 | System.out.println("New Message!");
168 | }
169 |
170 | @Override
171 | public void onRepaint(Graphics g) {
172 | handleNewMessages();
173 | }
174 |
175 | }
176 |
--------------------------------------------------------------------------------
/src/main/java/discord/WinRegistry.java:
--------------------------------------------------------------------------------
1 | package discord;
2 |
3 | import java.lang.reflect.InvocationTargetException;
4 | import java.lang.reflect.Method;
5 | import java.util.prefs.Preferences;
6 |
7 | class WinRegistry {
8 | static final int HKEY_CURRENT_USER = 0x80000001;
9 | private static final int HKEY_LOCAL_MACHINE = 0x80000002;
10 | private static final int KEY_ALL_ACCESS = 0xf003f;
11 |
12 | private static final int KEY_READ = 0x20019;
13 | private static final int REG_SUCCESS = 0;
14 | private static final Method regCloseKey;
15 | private static final Method regCreateKeyEx;
16 | private static final Method regDeleteKey;
17 | private static final Method regDeleteValue;
18 | private static final Method regEnumKeyEx;
19 | private static final Method regEnumValue;
20 | private static final Method regOpenKey;
21 | private static final Method regQueryInfoKey;
22 | private static final Method regQueryValueEx;
23 | private static final Method regSetValueEx;
24 | private static final Preferences systemRoot = Preferences.systemRoot();
25 | private static final Preferences userRoot = Preferences.userRoot();
26 | private static final Class extends Preferences> userClass = WinRegistry.userRoot.getClass();
27 |
28 | static {
29 | try {
30 | regOpenKey = WinRegistry.userClass.getDeclaredMethod("WindowsRegOpenKey", int.class, byte[].class,
31 | int.class);
32 | regOpenKey.setAccessible(true);
33 | regCloseKey = WinRegistry.userClass.getDeclaredMethod("WindowsRegCloseKey", int.class);
34 | regCloseKey.setAccessible(true);
35 | regQueryValueEx = WinRegistry.userClass.getDeclaredMethod("WindowsRegQueryValueEx", int.class,
36 | byte[].class);
37 | regQueryValueEx.setAccessible(true);
38 | regEnumValue = WinRegistry.userClass.getDeclaredMethod("WindowsRegEnumValue", int.class, int.class,
39 | int.class);
40 | regEnumValue.setAccessible(true);
41 | regQueryInfoKey = WinRegistry.userClass.getDeclaredMethod("WindowsRegQueryInfoKey1", int.class);
42 | regQueryInfoKey.setAccessible(true);
43 | regEnumKeyEx = WinRegistry.userClass.getDeclaredMethod("WindowsRegEnumKeyEx", int.class, int.class,
44 | int.class);
45 | regEnumKeyEx.setAccessible(true);
46 | regCreateKeyEx = WinRegistry.userClass.getDeclaredMethod("WindowsRegCreateKeyEx", int.class, byte[].class);
47 | regCreateKeyEx.setAccessible(true);
48 | regSetValueEx = WinRegistry.userClass.getDeclaredMethod("WindowsRegSetValueEx", int.class, byte[].class,
49 | byte[].class);
50 | regSetValueEx.setAccessible(true);
51 | regDeleteValue = WinRegistry.userClass.getDeclaredMethod("WindowsRegDeleteValue", int.class, byte[].class);
52 | regDeleteValue.setAccessible(true);
53 | regDeleteKey = WinRegistry.userClass.getDeclaredMethod("WindowsRegDeleteKey", int.class, byte[].class);
54 | regDeleteKey.setAccessible(true);
55 | } catch (Exception e) {
56 | throw new RuntimeException(e);
57 | }
58 | }
59 |
60 | static void createKey(int hkey, String key)
61 | throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
62 | int[] ret;
63 |
64 | if (hkey == WinRegistry.HKEY_LOCAL_MACHINE) {
65 | ret = WinRegistry.createKey(WinRegistry.systemRoot, hkey, key);
66 | WinRegistry.regCloseKey.invoke(WinRegistry.systemRoot, ret[0]);
67 | } else if (hkey == WinRegistry.HKEY_CURRENT_USER) {
68 | ret = WinRegistry.createKey(WinRegistry.userRoot, hkey, key);
69 | WinRegistry.regCloseKey.invoke(WinRegistry.userRoot, ret[0]);
70 | } else
71 | throw new IllegalArgumentException("hkey=" + hkey);
72 |
73 | if (ret[1] != REG_SUCCESS)
74 | throw new IllegalArgumentException("rc=" + ret[1] + " key=" + key);
75 | }
76 |
77 | private static int[] createKey(Preferences root, int hkey, String key)
78 | throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
79 | return (int[]) WinRegistry.regCreateKeyEx.invoke(root, hkey, toCstr(key));
80 | }
81 |
82 | static String readString(int hkey, String key, String valueName)
83 | throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
84 | if (hkey == WinRegistry.HKEY_LOCAL_MACHINE)
85 | return WinRegistry.readString(WinRegistry.systemRoot, hkey, key, valueName);
86 | else if (hkey == WinRegistry.HKEY_CURRENT_USER)
87 | return WinRegistry.readString(WinRegistry.userRoot, hkey, key, valueName);
88 | else
89 | throw new IllegalArgumentException("hkey=" + hkey);
90 | }
91 |
92 | private static String readString(Preferences root, int hkey, String key, String value)
93 | throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
94 | int[] handles = (int[]) WinRegistry.regOpenKey.invoke(root, hkey, toCstr(key), WinRegistry.KEY_READ);
95 | if (handles[1] != WinRegistry.REG_SUCCESS)
96 | return null;
97 |
98 | byte[] valb = (byte[]) WinRegistry.regQueryValueEx.invoke(root, handles[0], toCstr(value));
99 | WinRegistry.regCloseKey.invoke(root, handles[0]);
100 | return valb != null ? new String(valb).trim() : null;
101 | }
102 |
103 | // =====================
104 |
105 | // utility
106 | private static byte[] toCstr(String str) {
107 | byte[] result = new byte[str.length() + 1];
108 |
109 | for (int i = 0; i < str.length(); i++)
110 | result[i] = (byte) str.charAt(i);
111 |
112 | result[str.length()] = 0;
113 | return result;
114 | }
115 |
116 | static void writeStringValue(int hkey, String key, String valueName, String value)
117 | throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
118 | if (hkey == WinRegistry.HKEY_LOCAL_MACHINE)
119 | WinRegistry.writeStringValue(WinRegistry.systemRoot, hkey, key, valueName, value);
120 | else if (hkey == WinRegistry.HKEY_CURRENT_USER)
121 | WinRegistry.writeStringValue(WinRegistry.userRoot, hkey, key, valueName, value);
122 | else
123 | throw new IllegalArgumentException("hkey=" + hkey);
124 | }
125 |
126 | private static void writeStringValue(Preferences root, int hkey, String key, String valueName, String value)
127 | throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
128 | int[] handles = (int[]) WinRegistry.regOpenKey.invoke(root, hkey, toCstr(key), WinRegistry.KEY_ALL_ACCESS);
129 |
130 | WinRegistry.regSetValueEx.invoke(root, handles[0], WinRegistry.toCstr(valueName), WinRegistry.toCstr(value));
131 | WinRegistry.regCloseKey.invoke(root, handles[0]);
132 | }
133 |
134 | private WinRegistry() {
135 | }
136 | }
--------------------------------------------------------------------------------
/src/main/java/hooks/helpers/SkillGlobe.java:
--------------------------------------------------------------------------------
1 | package hooks.helpers;
2 |
3 | import java.awt.BasicStroke;
4 | import java.awt.Color;
5 | import java.awt.Font;
6 | import java.awt.Graphics;
7 | import java.awt.Graphics2D;
8 | import java.awt.Image;
9 | import java.awt.RenderingHints;
10 | import java.awt.Shape;
11 | import java.awt.geom.Ellipse2D;
12 | import java.awt.geom.RoundRectangle2D;
13 | import java.io.FileInputStream;
14 | import java.io.InputStream;
15 | import java.text.DecimalFormat;
16 |
17 | import javax.imageio.ImageIO;
18 |
19 | import cache.ObjectManager;
20 | import game.Game;
21 | import game.LoaderWindow;
22 | import game.OSRSLauncher;
23 | import hooks.Hooks;
24 |
25 | public class SkillGlobe {
26 |
27 | public static SkillGlobe activeSkillGlobe;
28 |
29 | public int skillID;
30 | private Color fillColor;
31 | private Color outlineColor;
32 | private Graphics2D g2;
33 |
34 | public SkillGlobe(int skillID) {
35 | this.skillID = skillID;
36 | }
37 |
38 | public void paint(Graphics g) {
39 | this.g2 = (Graphics2D) g;
40 | this.fillColor = ObjectManager.fillColor;
41 | this.outlineColor = ObjectManager.outlineColor;
42 |
43 | if (OSRSLauncher.loaderWindow.getWidth() <= 850) {
44 | RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
45 | int radiusX = 50;
46 | int centerX = ((OSRSLauncher.loaderWindow.getWidth() - (radiusX)) / 2) - 50;
47 | int centerY = 5;
48 | int radiusYY = 50;
49 | int startAngle = 90;
50 | Shape circle = new Ellipse2D.Double(centerX, centerY, radiusYY, radiusX);
51 | Graphics2D g22 = (Graphics2D) g;
52 | g.setFont(Game.runescapeFont.deriveFont(Font.BOLD, 18));
53 | g.setColor(Color.DARK_GRAY.darker());
54 | g22.setRenderingHints(rh);
55 | g22.setStroke(new BasicStroke(3));
56 | g22.setColor(this.fillColor);
57 | RoundRectangle2D skillBackdrop = new RoundRectangle2D.Double(centerX - 32, centerY + 10, 40, 30, 10, 10);
58 | g22.setColor(Color.DARK_GRAY.darker());
59 | g22.draw(skillBackdrop);
60 | g22.fill(skillBackdrop);
61 | g22.draw(circle);
62 | g22.setColor(this.fillColor);
63 | g22.fill(skillBackdrop);
64 | g22.setColor(Color.DARK_GRAY.darker());
65 | g22.fill(circle);
66 | g22.setColor(this.fillColor);
67 |
68 | g22.fill(circle);
69 | String skillName = Skill.getNameForID(this.skillID);
70 | if (skillName != null)
71 | try (InputStream is = new FileInputStream("./resources/skill_icons/" + skillName + ".png")) {
72 | Image skillIcon = ImageIO.read(is);
73 | is.close();
74 | this.g2.drawImage(skillIcon, centerX - 29, centerY + 13, LoaderWindow.game);
75 | } catch (Exception e) {
76 | e.printStackTrace();
77 | }
78 | g.setColor(this.outlineColor);
79 | int lvl = Hooks.client.getRealSkillLevels()[this.skillID];
80 | double percentage = Skill.getLevelUpPercentage(this.skillID);
81 | DecimalFormat df = new DecimalFormat("##.##");
82 | int lvlX;
83 | if (Integer.toString(lvl).length() == 1) {
84 | lvlX = centerX + 20;
85 | } else {
86 | lvlX = centerX + 16;
87 | }
88 |
89 | g22.drawString(Integer.toString(lvl), lvlX, 20);
90 | String s = "-" + (int) ((percentage / 100) * 360);
91 | int length = Integer.valueOf(s);
92 | g22.drawArc(centerX, centerY, radiusX, radiusYY, startAngle, length);
93 | g22.setFont(new Font("TimesRoman", Font.PLAIN, 24));
94 | String i = String.valueOf((int) percentage);
95 | if ((int) percentage < 10) {
96 | i = "0" + i;
97 | }
98 | g22.drawString("" + i, centerX + 6, 40);
99 | g22.setFont(new Font("TimesRoman", Font.BOLD, 14));
100 | String percentage2 = "";
101 | if (df.format(percentage).split("\\.").length == 2) {
102 | percentage2 = df.format(percentage).split("\\.")[1];
103 | if (percentage2.length() == 1)
104 | percentage2 = percentage2 + 0;
105 | } else {
106 | percentage2 = "00";
107 | }
108 | g22.drawString("." + percentage2, centerX + 28, 40);
109 | g.setColor(this.fillColor);
110 | g22.setStroke(new BasicStroke());
111 | } else {
112 | RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
113 | int radiusX = 50;
114 | int centerX = ((OSRSLauncher.loaderWindow.getWidth() - (radiusX)) / 2);
115 | int centerY = 5;
116 | int radiusYY = 50;
117 | int startAngle = 90;
118 | Shape circle = new Ellipse2D.Double(centerX, centerY, radiusYY, radiusX);
119 | Graphics2D g22 = (Graphics2D) g;
120 | g.setFont(Game.runescapeFont.deriveFont(Font.BOLD, 18));
121 | g.setColor(Color.DARK_GRAY.darker());
122 | g22.setRenderingHints(rh);
123 | g22.setStroke(new BasicStroke(3));
124 | g22.setColor(this.fillColor);
125 | RoundRectangle2D skillBackdrop = new RoundRectangle2D.Double(centerX - 32, centerY + 10, 40, 30, 10, 10);
126 | g22.setColor(Color.DARK_GRAY.darker());
127 | g22.draw(skillBackdrop);
128 | g22.fill(skillBackdrop);
129 | g22.draw(circle);
130 | g22.setColor(this.fillColor);
131 | g22.fill(skillBackdrop);
132 | g22.setColor(Color.DARK_GRAY.darker());
133 | g22.fill(circle);
134 | g22.setColor(this.fillColor);
135 |
136 | g22.fill(circle);
137 | String skillName = Skill.getNameForID(this.skillID);
138 | if (skillName != null)
139 | try (InputStream is = new FileInputStream("./resources/skill_icons/" + skillName + ".png")) {
140 | Image skillIcon = ImageIO.read(is);
141 | is.close();
142 | this.g2.drawImage(skillIcon, centerX - 29, centerY + 13, LoaderWindow.game);
143 | } catch (Exception e) {
144 | e.printStackTrace();
145 | }
146 | g.setColor(this.outlineColor);
147 | int lvl = Hooks.client.getRealSkillLevels()[this.skillID];
148 | double percentage = Skill.getLevelUpPercentage(this.skillID);
149 | DecimalFormat df = new DecimalFormat("##.##");
150 | int lvlX;
151 | if (Integer.toString(lvl).length() == 1) {
152 | lvlX = centerX + 20;
153 | } else {
154 | lvlX = centerX + 16;
155 | }
156 |
157 | g22.drawString(Integer.toString(lvl), lvlX, 20);
158 | String s = "-" + (int) ((percentage / 100) * 360);
159 | int length = Integer.valueOf(s);
160 | g22.drawArc(centerX, centerY, radiusX, radiusYY, startAngle, length);
161 | g22.setFont(new Font("TimesRoman", Font.PLAIN, 24));
162 | String i = String.valueOf((int) percentage);
163 | if ((int) percentage < 10) {
164 | i = "0" + i;
165 | }
166 | g22.drawString("" + i, centerX + 6, 40);
167 | g22.setFont(new Font("TimesRoman", Font.BOLD, 14));
168 | String percentage2 = "";
169 | if (df.format(percentage).split("\\.").length == 2) {
170 | percentage2 = df.format(percentage).split("\\.")[1];
171 | if (percentage2.length() == 1)
172 | percentage2 = percentage2 + 0;
173 | } else {
174 | percentage2 = "00";
175 | }
176 | g22.drawString("." + percentage2, centerX + 28, 40);
177 | g.setColor(this.fillColor);
178 | g22.setStroke(new BasicStroke());
179 | }
180 | }
181 |
182 | }
183 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
3 | org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
4 | org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
5 | org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
6 | org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
7 | org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
8 | org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
9 | org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
10 | org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
11 | org.eclipse.jdt.core.compiler.problem.APILeak=warning
12 | org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
13 | org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
14 | org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
15 | org.eclipse.jdt.core.compiler.problem.deadCode=warning
16 | org.eclipse.jdt.core.compiler.problem.deprecation=warning
17 | org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
18 | org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
19 | org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
20 | org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
21 | org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
22 | org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
23 | org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
24 | org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
25 | org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
26 | org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
27 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
28 | org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
29 | org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
30 | org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
31 | org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
32 | org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
33 | org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
34 | org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
35 | org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
36 | org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
37 | org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
38 | org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
39 | org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
40 | org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
41 | org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
42 | org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
43 | org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
44 | org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
45 | org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
46 | org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
47 | org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
48 | org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
49 | org.eclipse.jdt.core.compiler.problem.nullReference=warning
50 | org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
51 | org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
52 | org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
53 | org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
54 | org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
55 | org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
56 | org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
57 | org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
58 | org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
59 | org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
60 | org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
61 | org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
62 | org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
63 | org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning
64 | org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
65 | org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
66 | org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
67 | org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
68 | org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
69 | org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
70 | org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
71 | org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
72 | org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
73 | org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
74 | org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
75 | org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
76 | org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
77 | org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
78 | org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
79 | org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
80 | org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
81 | org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
82 | org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
83 | org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=warning
84 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
85 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
86 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
87 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
88 | org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
89 | org.eclipse.jdt.core.compiler.problem.unusedImport=warning
90 | org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
91 | org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
92 | org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
93 | org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
94 | org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
95 | org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
96 | org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
97 | org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
98 | org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
99 | org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
100 | org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
101 |
--------------------------------------------------------------------------------
/src/main/java/paint/skills/FishingOverlay.java:
--------------------------------------------------------------------------------
1 | package paint.skills;
2 |
3 | import java.awt.Graphics;
4 | import java.awt.Graphics2D;
5 | import java.awt.Polygon;
6 |
7 | import cache.ObjectManager;
8 | import game.Game;
9 | import game.Settings;
10 | import hooks.Hooks;
11 | import hooks.accessors.Npc;
12 | import hooks.helpers.LocalPoint;
13 | import hooks.helpers.Perspective;
14 | import hooks.helpers.Point;
15 | import paint.PaintListener;
16 | import paint.misc.ActorNames;
17 |
18 | public class FishingOverlay implements PaintListener {
19 |
20 | Graphics2D g2d;
21 |
22 | public FishingOverlay() {
23 |
24 | }
25 |
26 | @Override
27 | public void onRepaint(Graphics g) {
28 | if (Settings.SHOW_FISHING_OVERLAY && Game.ctrlPressed==false) {
29 | g.setFont(Game.runescapeFont);
30 | if (this.g2d == null)
31 | this.g2d = (Graphics2D) g;
32 | if (Hooks.client != null)
33 | if (Hooks.client.isLoggedIn()) {
34 | g.setColor(ActorNames.playerNameColor);
35 | Npc[] ns = Hooks.client.getCachedNpcs();
36 | if (ns != null) {
37 | for (Npc pl : ns) {
38 | if (pl != null) {
39 | String name = pl.getNpcComposition().getName();
40 | if (name != null) {
41 | if (name.contains("Fishing")) {
42 | String[] actions = pl.getNpcComposition().getActions();
43 | if (actions.length > 1) {
44 | if (Settings.SHOW_FISHING_CAGE_HARPOON)
45 | if (actions[0].compareTo("Cage") == 0) {
46 | for (String s : actions) {
47 | if (s != null)
48 | if (s.compareTo("Harpoon") == 0) {
49 | Polygon p = pl.asActor().getTileAreaOnScreen();
50 | if (p != null) {
51 | g.setColor(ObjectManager.outlineColor);
52 | ((Graphics2D) g).draw(p);
53 | g.setColor(ObjectManager.fillColor);
54 | ((Graphics2D) g).fill(p);
55 | g.setColor(ActorNames.npcNameColor);
56 | }
57 | }
58 | }
59 | }
60 | if (Settings.SHOW_FISHING_NET_BAIT)
61 | if (actions[0].compareTo("Small Net") == 0) {
62 | for (String s : actions) {
63 | if (s != null)
64 | if (s.compareTo("Bait") == 0) {
65 | Polygon p = pl.asActor().getTileAreaOnScreen();
66 | if (p != null) {
67 | g.setColor(ObjectManager.outlineColor);
68 | ((Graphics2D) g).draw(p);
69 | g.setColor(ObjectManager.fillColor);
70 | ((Graphics2D) g).fill(p);
71 | g.setColor(ActorNames.npcNameColor);
72 | }
73 | }
74 | }
75 | }
76 | if (Settings.SHOW_FISHING_NET_HARPOON)
77 | if (actions[0].compareTo("Big Net") == 0) {
78 | for (String s : actions) {
79 | if (s != null)
80 | if (s.compareTo("Harpoon") == 0) {
81 | Polygon p = pl.asActor().getTileAreaOnScreen();
82 | if (p != null) {
83 | g.setColor(ObjectManager.outlineColor);
84 | ((Graphics2D) g).draw(p);
85 | g.setColor(ObjectManager.fillColor);
86 | ((Graphics2D) g).fill(p);
87 | g.setColor(ActorNames.npcNameColor);
88 | }
89 | }
90 | }
91 | }
92 | if (Settings.SHOW_FISHING_BARBARIAN)
93 | for (String s : actions)
94 | if (s != null)
95 | if (s.compareTo("Use-rod") == 0) {
96 | Polygon p = pl.asActor().getTileAreaOnScreen();
97 | if (p != null) {
98 | g.setColor(ObjectManager.outlineColor);
99 | ((Graphics2D) g).draw(p);
100 | g.setColor(ObjectManager.fillColor);
101 | ((Graphics2D) g).fill(p);
102 | g.setColor(ActorNames.npcNameColor);
103 | }
104 | }
105 | }
106 | }
107 | }
108 | }
109 | }
110 | for (Npc pl : ns) {
111 | if (pl != null) {
112 | String name = pl.getNpcComposition().getName();
113 | if (name != null) {
114 | if (name.contains("Fishing")) {
115 | String[] actions = pl.getNpcComposition().getActions();
116 | if (Settings.SHOW_FISHING_CAGE_HARPOON)
117 | if (actions[0].compareTo("Cage") == 0) {
118 | for (String ss : actions) {
119 | if (ss != null)
120 | if (ss.compareTo("Harpoon") == 0) {
121 | int i = 50;
122 | for (String s : actions) {
123 | if (s != null) {
124 | Point p1 = Perspective.getCanvasTextLocation(
125 | Hooks.client, (Graphics2D) g,
126 | new LocalPoint(pl.asActor().getX(),
127 | pl.asActor().getY()),
128 | s, i);
129 | if (p1 != null && name != null
130 | && name.compareTo("null") != 0) //$NON-NLS-1$
131 | g.drawString(s, p1.getX(), p1.getY());
132 | i -= 50;
133 | }
134 | }
135 | }
136 | }
137 | }
138 | if (Settings.SHOW_FISHING_NET_BAIT)
139 | if (actions[0].compareTo("Small Net") == 0) {
140 | for (String ss : actions) {
141 | if (ss != null)
142 | if (ss.compareTo("Bait") == 0) {
143 | int i = 50;
144 | for (String s : actions) {
145 | if (s != null) {
146 | Point p1 = Perspective.getCanvasTextLocation(
147 | Hooks.client, (Graphics2D) g,
148 | new LocalPoint(pl.asActor().getX(),
149 | pl.asActor().getY()),
150 | s, i);
151 | if (p1 != null && name != null
152 | && name.compareTo("null") != 0) //$NON-NLS-1$
153 | g.drawString(s, p1.getX(), p1.getY());
154 | i -= 50;
155 | }
156 | }
157 | }
158 | }
159 | }
160 | if (Settings.SHOW_FISHING_NET_HARPOON)
161 | if (actions[0].compareTo("Big Net") == 0) {
162 | for (String ss : actions) {
163 | if (ss != null)
164 | if (ss.compareTo("Harpoon") == 0) {
165 | int i = 50;
166 | for (String s : actions) {
167 | if (s != null) {
168 | Point p1 = Perspective.getCanvasTextLocation(
169 | Hooks.client, (Graphics2D) g,
170 | new LocalPoint(pl.asActor().getX(),
171 | pl.asActor().getY()),
172 | s, i);
173 | if (p1 != null && name != null
174 | && name.compareTo("null") != 0)
175 | g.drawString(s, p1.getX(), p1.getY());
176 | i -= 50;
177 | }
178 | }
179 | }
180 | }
181 | }
182 | if (Settings.SHOW_FISHING_BARBARIAN)
183 | for (String ss : actions) {
184 | if (ss != null)
185 | if (ss.compareTo("Use-rod") == 0) {
186 | int i = 50;
187 | for (String s : actions) {
188 | if (s != null) {
189 | Point p1 = Perspective.getCanvasTextLocation(
190 | Hooks.client, (Graphics2D) g,
191 | new LocalPoint(pl.asActor().getX(),
192 | pl.asActor().getY()),
193 | s, i);
194 | if (p1 != null && name != null
195 | && name.compareTo("null") != 0)
196 | g.drawString("Leaping", p1.getX(), p1.getY());
197 | i -= 50;
198 | }
199 | }
200 | }
201 | }
202 | }
203 | }
204 | }
205 | }
206 | }
207 | }
208 | }
209 | }
210 | }
211 |
--------------------------------------------------------------------------------
/src/main/java/paint/ColorChooserApplet.java:
--------------------------------------------------------------------------------
1 | package paint;
2 |
3 | import java.applet.Applet;
4 | import java.awt.Canvas;
5 | import java.awt.Color;
6 | import java.awt.GridLayout;
7 | import java.awt.Insets;
8 | import java.awt.Label;
9 | import java.awt.Panel;
10 | import java.awt.Scrollbar;
11 | import java.awt.event.ActionEvent;
12 | import java.awt.event.ActionListener;
13 | import java.awt.event.AdjustmentEvent;
14 | import java.awt.event.AdjustmentListener;
15 |
16 | import javax.swing.JButton;
17 |
18 | import cache.ObjectManager;
19 | import paint.misc.ActorNames;
20 |
21 | public class ColorChooserApplet extends Applet implements AdjustmentListener {
22 |
23 | public Color oldColor;
24 |
25 | int r = 100; // The RGB color components.
26 |
27 | int g = 0;
28 |
29 | int b = 0;
30 |
31 | public ColorChooserApplet(Color c) {
32 | this.oldColor = c;
33 | this.r = c.getRed();
34 | this.g = c.getGreen();
35 | this.b = c.getBlue();
36 | }
37 |
38 | /**
39 | *
40 | */
41 | private static final long serialVersionUID = 1L;
42 |
43 | private float[] hsb = new float[3]; // For holding HSB color components.
44 |
45 | private Scrollbar hueScroll, brightnessScroll, saturationScroll, // Scroll bars.
46 | redScroll, greenScroll, blueScroll;
47 |
48 | private Label hueLabel, brightnessLabel, saturationLabel, // Display component values.
49 | redLabel, greenLabel, blueLabel;
50 |
51 | private Canvas colorCanvas; // Color patch for displaying the color.
52 |
53 | public JButton confirm = new JButton("Confirm");
54 |
55 | @Override
56 | public void init() {
57 |
58 | this.confirm.addActionListener(new ActionListener() {
59 |
60 | @Override
61 | public void actionPerformed(ActionEvent e) {
62 | Color newColor = new Color(ColorChooserApplet.this.r, ColorChooserApplet.this.g,
63 | ColorChooserApplet.this.b);
64 | if (ColorChooserApplet.this.oldColor.equals(ObjectManager.outlineColor)) {
65 | ObjectManager.outlineColor = newColor;
66 | ColorChooserApplet.this.oldColor = newColor;
67 | } else if (ColorChooserApplet.this.oldColor.equals(ObjectManager.fillColor)) {
68 | Color newC = new Color(newColor.getRed(), newColor.getGreen(), newColor.getBlue(), 50);
69 | ObjectManager.fillColor = newC;
70 | ColorChooserApplet.this.oldColor = newC;
71 | } else if (ColorChooserApplet.this.oldColor.equals(ActorNames.npcNameColor)) {
72 | Color newC = new Color(newColor.getRed(), newColor.getGreen(), newColor.getBlue());
73 | ActorNames.npcNameColor = newC;
74 | ColorChooserApplet.this.oldColor = newC;
75 | } else if (ColorChooserApplet.this.oldColor.equals(ActorNames.playerNameColor)) {
76 | Color newC = new Color(newColor.getRed(), newColor.getGreen(), newColor.getBlue());
77 | ActorNames.playerNameColor = newC;
78 | ColorChooserApplet.this.oldColor = newC;
79 | } else if (ColorChooserApplet.this.oldColor.equals(ActorNames.clanMateNameColor)) {
80 | Color newC = new Color(newColor.getRed(), newColor.getGreen(), newColor.getBlue());
81 | ActorNames.clanMateNameColor = newC;
82 | ColorChooserApplet.this.oldColor = newC;
83 | }
84 |
85 | }
86 | });
87 |
88 | Color.RGBtoHSB(this.r, this.g, this.b, this.hsb); // Get HSB equivalent of RGB = (0,0,0);
89 |
90 | /* Create Scrollbars with possible values from 0 to 255. */
91 |
92 | this.hueScroll = new Scrollbar(Scrollbar.HORIZONTAL, (int) (255 * this.hsb[0]), 10, 0, 265);
93 | this.saturationScroll = new Scrollbar(Scrollbar.HORIZONTAL, (int) (255 * this.hsb[1]), 10, 0, 265);
94 | this.brightnessScroll = new Scrollbar(Scrollbar.HORIZONTAL, (int) (255 * this.hsb[2]), 10, 0, 265);
95 | this.redScroll = new Scrollbar(Scrollbar.HORIZONTAL, this.r, 10, 0, 265);
96 | this.greenScroll = new Scrollbar(Scrollbar.HORIZONTAL, this.g, 10, 0, 265);
97 | this.blueScroll = new Scrollbar(Scrollbar.HORIZONTAL, this.b, 10, 0, 265);
98 |
99 | /* Create Labels showing current RGB and HSB values. */
100 |
101 | this.hueLabel = new Label(" H = " + this.hsb[0]);
102 | this.saturationLabel = new Label(" S = " + this.hsb[1]);
103 | this.brightnessLabel = new Label(" B = " + this.hsb[2]);
104 | this.redLabel = new Label(" R = 0");
105 | this.greenLabel = new Label(" G = 0");
106 | this.blueLabel = new Label(" B = 0");
107 |
108 | /*
109 | * Set background colors for Scrollbars and Labels, so they don't inherit the
110 | * gray background of the applet.
111 | */
112 |
113 | this.hueScroll.setBackground(Color.lightGray);
114 | this.saturationScroll.setBackground(Color.lightGray);
115 | this.brightnessScroll.setBackground(Color.lightGray);
116 | this.redScroll.setBackground(Color.lightGray);
117 | this.greenScroll.setBackground(Color.lightGray);
118 | this.blueScroll.setBackground(Color.lightGray);
119 |
120 | this.hueLabel.setBackground(Color.white);
121 | this.saturationLabel.setBackground(Color.white);
122 | this.brightnessLabel.setBackground(Color.white);
123 | this.redLabel.setBackground(Color.white);
124 | this.greenLabel.setBackground(Color.white);
125 | this.blueLabel.setBackground(Color.white);
126 |
127 | /* Set the applet to listen for changes to the Scrollbars' values */
128 |
129 | this.hueScroll.addAdjustmentListener(this);
130 | this.saturationScroll.addAdjustmentListener(this);
131 | this.brightnessScroll.addAdjustmentListener(this);
132 | this.redScroll.addAdjustmentListener(this);
133 | this.greenScroll.addAdjustmentListener(this);
134 | this.blueScroll.addAdjustmentListener(this);
135 |
136 | /*
137 | * Create a canvas whose background color will always be set to the currently
138 | * selected color.
139 | */
140 |
141 | this.colorCanvas = new Canvas();
142 | this.colorCanvas.setBackground(new Color(this.r, this.g, this.b));
143 |
144 | /*
145 | * Create the applet format, which consists of a row of three equal-sized
146 | * regions holding the Scrollbars, the Labels, and the color patch. The
147 | * background color of the applet is gray, which will show around the edges and
148 | * between components.
149 | */
150 |
151 | setLayout(new GridLayout(1, 3, 3, 3));
152 | setBackground(Color.gray);
153 | Panel scrolls = new Panel();
154 | Panel labels = new Panel();
155 | add(scrolls);
156 | add(labels);
157 | add(this.colorCanvas);
158 | add(this.confirm);
159 |
160 | /* Add the Scrollbars and the Labels to their respective panels. */
161 |
162 | scrolls.setLayout(new GridLayout(6, 1, 2, 2));
163 | scrolls.add(this.redScroll);
164 | scrolls.add(this.greenScroll);
165 | scrolls.add(this.blueScroll);
166 | scrolls.add(this.hueScroll);
167 | scrolls.add(this.saturationScroll);
168 | scrolls.add(this.brightnessScroll);
169 |
170 | labels.setLayout(new GridLayout(6, 1, 2, 2));
171 | labels.add(this.redLabel);
172 | labels.add(this.greenLabel);
173 | labels.add(this.blueLabel);
174 | labels.add(this.hueLabel);
175 | labels.add(this.saturationLabel);
176 | labels.add(this.brightnessLabel);
177 |
178 | } // end init();
179 |
180 | @Override
181 | public void adjustmentValueChanged(AdjustmentEvent evt) {
182 | // This is called when the user has changed the values on
183 | // one of the scrollbars. All the scrollbars and labels
184 | // and the color patch are reset to correspond to the new color.
185 | int r1, g1, b1;
186 | r1 = this.redScroll.getValue();
187 | g1 = this.greenScroll.getValue();
188 | b1 = this.blueScroll.getValue();
189 | if (this.r != r1 || this.g != g1 || this.b != b1) { // One of the RGB components has changed.
190 | this.r = r1;
191 | this.g = g1;
192 | this.b = b1;
193 | Color.RGBtoHSB(this.r, this.g, this.b, this.hsb);
194 | } else { // One of the HSB components has changed.
195 | this.hsb[0] = this.hueScroll.getValue() / 255.0F;
196 | this.hsb[1] = this.saturationScroll.getValue() / 255.0F;
197 | this.hsb[2] = this.brightnessScroll.getValue() / 255.0F;
198 | int rgb = Color.HSBtoRGB(this.hsb[0], this.hsb[1], this.hsb[2]);
199 | this.r = (rgb >> 16) & 0xFF;
200 | this.g = (rgb >> 8) & 0xFF;
201 | this.b = rgb & 0xFF;
202 | }
203 | this.redLabel.setText(" R = " + this.r);
204 | this.greenLabel.setText(" G = " + this.g);
205 | this.blueLabel.setText(" B = " + this.b);
206 | this.hueLabel.setText(" H = " + this.hsb[0]);
207 | this.saturationLabel.setText(" S = " + this.hsb[1]);
208 | this.brightnessLabel.setText(" B = " + this.hsb[2]);
209 | this.redScroll.setValue(this.r);
210 | this.greenScroll.setValue(this.g);
211 | this.blueScroll.setValue(this.b);
212 | this.hueScroll.setValue((int) (255 * this.hsb[0]));
213 | this.saturationScroll.setValue((int) (255 * this.hsb[1]));
214 | this.brightnessScroll.setValue((int) (255 * this.hsb[2]));
215 | this.colorCanvas.setBackground(new Color(this.r, this.g, this.b));
216 | this.colorCanvas.repaint(); // Tell the system to redraw the canvas in its new color.
217 | } // end adjustmentValueChanged
218 |
219 | @Override
220 | public Insets getInsets() {
221 | // The system calls this method to find out how much space to
222 | // leave between the edges of the applet and the components that
223 | // it contains. I want a 3-pixel border at each edge.
224 | return new Insets(3, 3, 3, 3);
225 | }
226 | } // end class ColorChooserApplet
--------------------------------------------------------------------------------