├── .DS_Store ├── .classpath ├── .gitignore ├── .project ├── .settings └── org.eclipse.jdt.core.prefs ├── README.md ├── bin └── .DS_Store ├── data ├── .DS_Store └── xteas │ ├── 12084.txt │ ├── 12085.txt │ ├── 12086.txt │ ├── 12087.txt │ ├── 12340.txt │ ├── 12341.txt │ ├── 12342.txt │ ├── 12343.txt │ ├── 12596.txt │ ├── 12597.txt │ ├── 12598.txt │ ├── 12599.txt │ ├── 12852.txt │ ├── 12853.txt │ └── 12854.txt ├── imgs ├── flags │ ├── 0.png │ ├── 1.png │ └── 7.png └── skill_icons │ ├── Agility-icon.png │ ├── Attack_icon.png │ ├── Construction_icon.png │ ├── Cooking-icon.png │ ├── Crafting-icon.png │ ├── Defence-icon.png │ ├── Farming-icon.png │ ├── Firemaking-icon.png │ ├── Fishing-icon.png │ ├── Fletching-icon.png │ ├── Herblore-icon.png │ ├── Hitpoints_icon.png │ ├── Hunter-icon.png │ ├── Magic-icon.png │ ├── Mining-icon.png │ ├── Prayer-icon.png │ ├── Ranged-icon.png │ ├── Runecrafting-icon.png │ ├── Slayer-icon.png │ ├── Smithing-icon.png │ ├── Strength-icon.png │ ├── Thieving-icon.png │ └── Woodcutting-icon.png ├── reflection_cache.xml └── src ├── .DS_Store ├── Boot.java ├── TestScript.java ├── api ├── .DS_Store ├── methods │ ├── ActionBar.java │ ├── Bank.java │ ├── Calculations.java │ ├── Camera.java │ ├── Client.java │ ├── Equipment.java │ ├── GroundItems.java │ ├── Interfaces.java │ ├── Inventory.java │ ├── Keyboard.java │ ├── Magic.java │ ├── Menu.java │ ├── ModelCapture.java │ ├── Mouse.java │ ├── MousePathGenerator.java │ ├── NPCs.java │ ├── Nodes.java │ ├── Objects.java │ ├── Players.java │ ├── Randoms.java │ ├── Settings.java │ ├── Skills.java │ ├── Tabs.java │ ├── Timer.java │ └── Walking.java ├── walking │ └── TheWalker.java └── wrappers │ ├── Animable.java │ ├── AnimableNode.java │ ├── AnimableObject.java │ ├── AnimatedAnimableObject.java │ ├── AnimatedBoundaryObject.java │ ├── AnimatedFloorObject.java │ ├── AnimatedObject.java │ ├── AnimatedWallObject.java │ ├── Animation.java │ ├── Animator.java │ ├── BaseInfo.java │ ├── Boundary.java │ ├── BoundaryObject.java │ ├── Cache.java │ ├── Canvas.java │ ├── CapturedModel.java │ ├── Character.java │ ├── Chatline.java │ ├── DetailInfo.java │ ├── DetailInfoNode.java │ ├── EntityNode.java │ ├── Facade.java │ ├── FileOnDisk.java │ ├── FileSystem.java │ ├── FileWorker.java │ ├── FloorDecoration.java │ ├── FloorObject.java │ ├── GZIPDecompressor.java │ ├── GameObject.java │ ├── Graphics.java │ ├── Ground.java │ ├── GroundBytes.java │ ├── GroundData.java │ ├── GroundEntity.java │ ├── GroundInfo.java │ ├── GroundItem.java │ ├── GroundObject.java │ ├── HardReference.java │ ├── HashTable.java │ ├── HintArrow.java │ ├── Info.java │ ├── Interactable.java │ ├── InteractableLocation.java │ ├── Interface.java │ ├── InterfaceChild.java │ ├── InterfaceItem.java │ ├── InterfaceNode.java │ ├── Item.java │ ├── ItemDef.java │ ├── ItemDefLoader.java │ ├── Keyboard.java │ ├── LookupTable.java │ ├── MLString.java │ ├── MenuGroupNode.java │ ├── MenuItemNode.java │ ├── Model.java │ ├── ModelDirectX.java │ ├── ModelLD.java │ ├── ModelOpenGL.java │ ├── ModelSoftware.java │ ├── Mouse.java │ ├── NPC.java │ ├── NPCDef.java │ ├── NPCNode.java │ ├── Node.java │ ├── NodeList.java │ ├── NodeListCache.java │ ├── NodeSub.java │ ├── NodeSubQueue.java │ ├── Object3D.java │ ├── ObjectComposite.java │ ├── ObjectDef.java │ ├── ObjectDefLoader.java │ ├── Player.java │ ├── PlayerDef.java │ ├── Projectile.java │ ├── ProjectileNode.java │ ├── Reference.java │ ├── ReferenceTable.java │ ├── Render.java │ ├── RenderLD.java │ ├── RenderOpenGL.java │ ├── Settings.java │ ├── SkillInfo.java │ ├── SoftReference.java │ ├── Tile.java │ ├── TileArea.java │ ├── TileData.java │ ├── Viewport.java │ ├── WallDecoration.java │ ├── WallObject.java │ └── WorldController.java ├── environment └── Data.java ├── gui ├── AccountSetter.java └── AppletFrame.java ├── injection ├── ClientInjector.java ├── Crawler.java ├── Dumper.java ├── InstructionSearcher.java ├── XteaInjector.java ├── transforms │ ├── Canvas.java │ ├── KeyListener.java │ └── MouseListener.java └── wrappers │ ├── Canvas.java │ ├── FocusListener.java │ ├── KeyListener.java │ ├── MouseListener.java │ └── RuneHD.java ├── reflection ├── ClassHook.java ├── FieldHook.java └── cache │ └── Loader.java ├── rsloader ├── ClientDownloader.java ├── PageParser.java └── RSClassLoader.java └── script ├── ScriptDef.java └── ScriptLoader.java /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/.DS_Store -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # BlueJ files 4 | *.ctxt 5 | 6 | # Mobile Tools for Java (J2ME) 7 | .mtj.tmp/ 8 | 9 | # Package Files # 10 | *.jar 11 | *.war 12 | *.ear 13 | 14 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 15 | hs_err_pid* -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | RuneHD Java 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.7 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.7 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rsloader 2 | The java portion of the RuneHD/OSHD client 3 | 4 | ### Instructions 5 | 6 | TODO 7 | 8 | ### Links 9 | 10 | Follow me on Twitter [@AndrewMD5](https://twitter.com/andrewmd5) 11 | 12 | Check out Ulterius [ulterius.io](https://ulterius.io) 13 | -------------------------------------------------------------------------------- /bin/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/bin/.DS_Store -------------------------------------------------------------------------------- /data/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/data/.DS_Store -------------------------------------------------------------------------------- /data/xteas/12084.txt: -------------------------------------------------------------------------------- 1 | 1557441550 2 | -1715239917 3 | 935736231 4 | -382426572 5 | -------------------------------------------------------------------------------- /data/xteas/12085.txt: -------------------------------------------------------------------------------- 1 | 346452736 2 | -1406685396 3 | 1258413237 4 | 2003757492 5 | -------------------------------------------------------------------------------- /data/xteas/12086.txt: -------------------------------------------------------------------------------- 1 | 2085966776 2 | -2014649016 3 | 2041354125 4 | 1183651413 5 | -------------------------------------------------------------------------------- /data/xteas/12087.txt: -------------------------------------------------------------------------------- 1 | -295731020 2 | -1575280864 3 | -1427786523 4 | 2033614117 5 | -------------------------------------------------------------------------------- /data/xteas/12340.txt: -------------------------------------------------------------------------------- 1 | 1724698226 2 | 1614717592 3 | -2057673947 4 | 701403632 5 | -------------------------------------------------------------------------------- /data/xteas/12341.txt: -------------------------------------------------------------------------------- 1 | 775720140 2 | -156517594 3 | -324228658 4 | 514974388 5 | -------------------------------------------------------------------------------- /data/xteas/12342.txt: -------------------------------------------------------------------------------- 1 | -1186106879 2 | -258036335 3 | -625746420 4 | -1812079746 5 | -------------------------------------------------------------------------------- /data/xteas/12343.txt: -------------------------------------------------------------------------------- 1 | -1711664456 2 | -1215624250 3 | 506564739 4 | 1302166376 5 | -------------------------------------------------------------------------------- /data/xteas/12596.txt: -------------------------------------------------------------------------------- 1 | 1670921057 2 | 868587259 3 | -21543777 4 | -356028659 5 | -------------------------------------------------------------------------------- /data/xteas/12597.txt: -------------------------------------------------------------------------------- 1 | 1431932221 2 | 1331921660 3 | 1437145332 4 | -1095203255 5 | -------------------------------------------------------------------------------- /data/xteas/12598.txt: -------------------------------------------------------------------------------- 1 | 630389964 2 | 47471342 3 | 764703061 4 | 2133293208 5 | -------------------------------------------------------------------------------- /data/xteas/12599.txt: -------------------------------------------------------------------------------- 1 | -550336185 2 | 659264845 3 | 412777756 4 | 1834471441 5 | -------------------------------------------------------------------------------- /data/xteas/12852.txt: -------------------------------------------------------------------------------- 1 | -1754000759 2 | -644226437 3 | -928343674 4 | -1071510911 5 | -------------------------------------------------------------------------------- /data/xteas/12853.txt: -------------------------------------------------------------------------------- 1 | 1286750256 2 | -2107084355 3 | -1271515925 4 | 479668825 5 | -------------------------------------------------------------------------------- /data/xteas/12854.txt: -------------------------------------------------------------------------------- 1 | -1115419071 2 | -1486888222 3 | -985307184 4 | 298154281 5 | -------------------------------------------------------------------------------- /imgs/flags/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/flags/0.png -------------------------------------------------------------------------------- /imgs/flags/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/flags/1.png -------------------------------------------------------------------------------- /imgs/flags/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/flags/7.png -------------------------------------------------------------------------------- /imgs/skill_icons/Agility-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Agility-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Attack_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Attack_icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Construction_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Construction_icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Cooking-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Cooking-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Crafting-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Crafting-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Defence-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Defence-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Farming-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Farming-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Firemaking-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Firemaking-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Fishing-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Fishing-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Fletching-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Fletching-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Herblore-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Herblore-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Hitpoints_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Hitpoints_icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Hunter-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Hunter-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Magic-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Magic-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Mining-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Mining-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Prayer-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Prayer-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Ranged-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Ranged-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Runecrafting-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Runecrafting-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Slayer-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Slayer-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Smithing-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Smithing-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Strength-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Strength-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Thieving-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Thieving-icon.png -------------------------------------------------------------------------------- /imgs/skill_icons/Woodcutting-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/imgs/skill_icons/Woodcutting-icon.png -------------------------------------------------------------------------------- /reflection_cache.xml: -------------------------------------------------------------------------------- 1 | jh2064875789fbga1mn-140834255mr183343252cl1h1ec1fz1355759835fg1784829965fh716978923fn-1774046803fw-1894076819g1z-1316966379h1a1961555871at-184603173ao-771439697at-184603173cw544615727dg-771797447hb1dm1g1l1k1s1o1p-1026555351v-349793161n-1396892499 -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/src/.DS_Store -------------------------------------------------------------------------------- /src/Boot.java: -------------------------------------------------------------------------------- 1 | import java.io.File; 2 | import java.io.FileOutputStream; 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.io.OutputStream; 6 | import java.net.MalformedURLException; 7 | import java.net.URL; 8 | 9 | import org.apache.commons.io.FileUtils; 10 | 11 | import environment.Data; 12 | import gui.AppletFrame; 13 | import injection.ClientInjector; 14 | import injection.XteaInjector; 15 | import injection.wrappers.RuneHD; 16 | import reflection.cache.Loader; 17 | import rsloader.PageParser; 18 | 19 | public class Boot { 20 | 21 | public static void main(String[] args) throws IllegalAccessException, InstantiationException, ClassNotFoundException, MalformedURLException, IOException { 22 | /** 23 | * Obtaining all page PARAMETERS 24 | */ 25 | new PageParser(); 26 | /** 27 | * Loading all ClassNodes 28 | * Injecting Canvas into the client 29 | * Saving injected Client 30 | */ 31 | File gamepack = new File("gamepack.jar"); 32 | if(!gamepack.exists()) 33 | { 34 | System.out.println("Downloading gamepack"); 35 | FileUtils.copyURLToFile(new URL(PageParser.jarLocation), gamepack); 36 | } 37 | ClientInjector.injectClient("gamepack.jar"); 38 | /** 39 | * Starting client GUI + APPLET 40 | * */ 41 | new Thread(new RuneHD()).start(); 42 | Data.appletFrame = new AppletFrame(); 43 | /** 44 | * Loading our hooked classes and fields 45 | * */ 46 | Loader.loadCache(); 47 | 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/TestScript.java: -------------------------------------------------------------------------------- 1 | import script.ScriptDef; 2 | 3 | import java.awt.*; 4 | 5 | public class TestScript extends ScriptDef { 6 | 7 | @Override 8 | public void run() { 9 | //System.out.println("Starting test script... : " + Data.CLIENT_APPLET.getComponentAt(0, 0).getMousePosition()); 10 | 11 | } 12 | 13 | @Override 14 | public void repaint(Graphics g) { 15 | g.drawString("asdasdasdasdasdada" , 10, 50); 16 | // System.out.println(Data.CLIENT_APPLET.getComponentAt(0, 0).getMousePosition()); 17 | 18 | 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/api/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSHD/rsloader/7bf37433fe3ec2c2fa7d2e625a99f87a7db110f8/src/api/.DS_Store -------------------------------------------------------------------------------- /src/api/methods/GroundItems.java: -------------------------------------------------------------------------------- 1 | 2 | package api.methods; 3 | 4 | import api.wrappers.*; 5 | 6 | import java.util.ArrayList; 7 | 8 | public class GroundItems { 9 | public static GroundItem[] getAll() { 10 | ArrayList temp = new ArrayList(); 11 | Tile tile = Players.getMyPlayer().getLocation(); 12 | int minX = Math.max(Client.getBaseX(), tile.getX() - 104), minY = Math.max(Client.getBaseY(), tile.getY() - 104); 13 | int maxX = Math.min(Client.getBaseX() + 104, tile.getX() + 104), maxY = Math.min(Client.getBaseY() + 104, tile.getY() + 104); 14 | for (int x = minX; x < maxX; x++) { 15 | for (int y = minY; y < maxY; y++) { 16 | GroundItem[] items = getItemsAt(x, y); 17 | for (final GroundItem item : items) { 18 | if (item != null) { 19 | temp.add(item); 20 | } 21 | } 22 | } 23 | } 24 | return temp.toArray(new GroundItem[]{}); 25 | } 26 | public static GroundItem[] getItemsAt(int x, int y){ 27 | try{ 28 | ArrayList items = new ArrayList(); 29 | HashTable itemTable = Client.getItemHashTable(); 30 | int index = x | y << 14 | Client.getPlane() << 28; 31 | NodeListCache cache = new NodeListCache(Nodes.lookup(itemTable, index).currentObject); 32 | NodeList nodeList = cache.getNodeList(); 33 | Node tail = nodeList.getTail(); 34 | for(Node curr = tail.getPrevious();curr!=null && !curr.currentObject.equals(tail.currentObject);curr=curr.getPrevious()){ 35 | if(Item.isInstance(curr.currentObject)){ 36 | items.add(new GroundItem(x, y, new Item(curr.currentObject))); 37 | } 38 | } 39 | return items.toArray(new GroundItem[]{}); 40 | } 41 | catch(Exception e){ 42 | } 43 | return new GroundItem[]{}; 44 | } 45 | public static GroundItem getNearestItemByID(int...ids) { 46 | GroundItem temp = null; 47 | double dist = Double.MAX_VALUE; 48 | for (GroundItem ao : getAll()) { 49 | int id = ao.item.getID(); 50 | for (int i : ids) { 51 | if (i == id) { 52 | double distance = Calculations.distanceTo(ao.getLocationX(), ao.getLocationY()); 53 | if (distance < dist) { 54 | dist = distance; 55 | temp = ao; 56 | } 57 | } 58 | } 59 | } 60 | return temp; 61 | } 62 | public static GroundItem getNearestItemByName(String...names) { 63 | GroundItem temp = null; 64 | double dist = Double.MAX_VALUE; 65 | for (GroundItem ao : getAll()) { 66 | String name = ao.item.getItemDef().getName(); 67 | for (String i : names) { 68 | if (i.equals(name)) { 69 | double distance = Calculations.distanceTo(ao.getLocationX(), ao.getLocationY()); 70 | if (distance < dist) { 71 | dist = distance; 72 | temp = ao; 73 | } 74 | } 75 | } 76 | } 77 | return temp; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/api/methods/Interfaces.java: -------------------------------------------------------------------------------- 1 | 2 | package api.methods; 3 | 4 | import api.wrappers.*; 5 | 6 | import java.awt.*; 7 | import java.util.Random; 8 | 9 | public class Interfaces { 10 | public static boolean canContinue() { 11 | InterfaceChild ic = getContinueComponent(); 12 | return ic != null && !ic.isHidden(); 13 | } 14 | public static boolean clickContinue(){ 15 | InterfaceChild button = getContinueComponent(); 16 | if(button!=null) 17 | return button.doAction("Continue"); 18 | return false; 19 | } 20 | public static Interface get(int index){ 21 | Interface[] faces = getInterfaces(); 22 | if(faces.length>index) 23 | return faces[index]; 24 | return null; 25 | } 26 | public static InterfaceChild get(int index1, int index2){ 27 | Interface i = get(index1); 28 | if(i!=null){ 29 | if(i.getChildren().length>index2){ 30 | return i.getChildren()[index2]; 31 | } 32 | } 33 | return null; 34 | } 35 | public static InterfaceChild getChild(final int id) { 36 | final int y = id >> 0x10; 37 | final int x = id & 0xffff; 38 | return get(x, y); 39 | } 40 | public static InterfaceChild getContinueComponent(){ 41 | InterfaceChild button = get(1184, 18);//NPC talking with our player 42 | if(button!=null) 43 | return button; 44 | button = get(1191, 18);//Our player talking with an NPC 45 | if(button!=null) 46 | return button; 47 | button = get(1186, 10); 48 | if(button!=null) 49 | return button; 50 | return null; 51 | } 52 | public static Interface[] getInterfaces(){ 53 | Interface[] interfaces = Client.getInterfaceCache(); 54 | for(int i=0;ii && !valid[i]) 57 | interfaces[i]=null; 58 | } 59 | return interfaces; 60 | } 61 | public static boolean scrollTo(InterfaceChild component, InterfaceChild scrollBar) { 62 | if (component == null || scrollBar == null || scrollBar.getChildren().length!=6) { 63 | return false; 64 | } 65 | InterfaceChild scrollableArea = component; 66 | for (int i=0;i<10 && scrollableArea.getVerticalScrollbarSize() == 0 67 | && scrollableArea.getParentID() != -1;++i) { 68 | scrollableArea = Interfaces.getChild(scrollableArea.getParentID()); 69 | } 70 | if (scrollableArea.getVerticalScrollbarSize() == 0) { 71 | return false; 72 | } 73 | int areaY = scrollableArea.getAbsoluteY(); 74 | int areaHeight = scrollableArea.getVerticalScrollbarThumbSize(); 75 | if (component.getAbsoluteY() >= areaY 76 | && component.getAbsoluteY() <= areaY + areaHeight 77 | - component.getVerticalScrollbarThumbSize()) { 78 | return true; 79 | } 80 | InterfaceChild scrollBarArea = scrollBar.getChildren()[0]; 81 | int contentHeight = scrollableArea.getVerticalScrollbarSize(); 82 | int pos = (int) ((float) scrollBarArea.getVerticalScrollbarThumbSize() / contentHeight * (component.getRelativeY() + new Random().nextInt(areaHeight / 2 - component.getVerticalScrollbarThumbSize())+-areaHeight / 2)); 83 | if (pos < 0){ 84 | pos = 0; 85 | } 86 | else if (pos >= scrollBarArea.getVerticalScrollbarThumbSize()) { 87 | pos = scrollBarArea.getVerticalScrollbarThumbSize() - 1; 88 | } 89 | Point p = new Point(scrollBarArea.getAbsoluteX() + new Random().nextInt(scrollBarArea.getWidth()-2)+2, scrollBarArea.getAbsoluteY() + pos); 90 | Mouse.move(p); 91 | for(int i=0;i<3;++i){ 92 | int curr = component.getAbsoluteY(); 93 | Mouse.click(); 94 | try { 95 | Thread.sleep(new Random().nextInt(150)+100); 96 | } catch (InterruptedException e) { 97 | } 98 | if(component.getAbsoluteY()!=curr) 99 | break; 100 | } 101 | try { 102 | Thread.sleep(new Random().nextInt(200)+200); 103 | } catch (InterruptedException e) { 104 | } 105 | if(component.getAbsoluteY() >= areaY && component.getAbsoluteY() <= areaY + areaHeight - component.getVerticalScrollbarThumbSize()) 106 | return true; 107 | final boolean scrollUp = component.getAbsoluteY() < areaY; 108 | p = scrollBar.getChildren()[scrollUp ? 4 : 5].getRandomPoint(); 109 | Mouse.move(p); 110 | try { 111 | Thread.sleep(new Random().nextInt(150)); 112 | } catch (InterruptedException e) { 113 | } 114 | Mouse.press(Mouse.LEFT_BUTTON); 115 | for(int i=0;i<20;++i){ 116 | if(component.getAbsoluteY() >= areaY && component.getAbsoluteY() <= areaY + areaHeight - component.getVerticalScrollbarThumbSize()) 117 | break; 118 | int curr = component.getAbsoluteY(); 119 | try { 120 | Thread.sleep(500); 121 | } catch (InterruptedException e) { 122 | } 123 | if(curr!=component.getAbsoluteY()) 124 | i=0; 125 | } 126 | Mouse.release(Mouse.LEFT_BUTTON); 127 | return component.getAbsoluteY() >= areaY && component.getAbsoluteY() <= areaY + areaHeight - component.getVerticalScrollbarThumbSize(); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /src/api/methods/Keyboard.java: -------------------------------------------------------------------------------- 1 | 2 | package api.methods; 3 | 4 | import environment.Data; 5 | 6 | import java.awt.*; 7 | import java.awt.event.KeyEvent; 8 | import java.util.Random; 9 | 10 | public class Keyboard { 11 | public static int getLocation(final char ch) { 12 | if (ch >= KeyEvent.VK_SHIFT && ch <= KeyEvent.VK_ALT) { 13 | return new Random().nextInt((KeyEvent.KEY_LOCATION_RIGHT + 1)-KeyEvent.KEY_LOCATION_LEFT)+KeyEvent.KEY_LOCATION_LEFT; 14 | } 15 | return KeyEvent.KEY_LOCATION_STANDARD; 16 | } 17 | public static void pressKey(char s){ 18 | int code = s; 19 | if (s >= 'a' && s <= 'z') { 20 | code -= 32; 21 | } 22 | Component keyboardTarget = Data.CLIENT_APPLET.getComponent(0); 23 | KeyEvent event = new KeyEvent(keyboardTarget, KeyEvent.KEY_PRESSED, 0, 0, code, s, Keyboard.getLocation(s)); 24 | keyboardTarget.dispatchEvent(event); 25 | event = new KeyEvent(keyboardTarget, KeyEvent.KEY_TYPED, 0, 0, KeyEvent.VK_UNDEFINED, s, 0); 26 | keyboardTarget.dispatchEvent(event); 27 | } 28 | public static void releaseKey(char s){ 29 | int code = s; 30 | if (s >= 'a' && s <= 'z') { 31 | code -= 32; 32 | } 33 | Component keyboardTarget = Data.CLIENT_APPLET.getComponent(0); 34 | KeyEvent event = new KeyEvent(keyboardTarget, KeyEvent.KEY_RELEASED, 0, 0, code, s, Keyboard.getLocation(s)); 35 | keyboardTarget.dispatchEvent(event); 36 | } 37 | public static void sendKey(char s){ 38 | int code = s; 39 | if (s >= 'a' && s <= 'z') { 40 | code -= 32; 41 | } 42 | Component keyboardTarget = Data.CLIENT_APPLET.getComponent(0); 43 | KeyEvent event = new KeyEvent(keyboardTarget, KeyEvent.KEY_PRESSED, 0, 0, code, s, Keyboard.getLocation(s)); 44 | keyboardTarget.dispatchEvent(event); 45 | event = new KeyEvent(keyboardTarget, KeyEvent.KEY_TYPED, 0, 0, KeyEvent.VK_UNDEFINED, s, 0); 46 | keyboardTarget.dispatchEvent(event); 47 | event = new KeyEvent(keyboardTarget, KeyEvent.KEY_RELEASED, 0, 0, code, s, Keyboard.getLocation(s)); 48 | keyboardTarget.dispatchEvent(event); 49 | } 50 | public static void sendKeys(String str){ 51 | for(int i=0;i 1) { 46 | int id = npc.getNPCDef().getID(); 47 | for (int i : ids) { 48 | if (i == id) { 49 | double distance = Calculations.distanceTo(npc.getLocationX(), npc.getLocationY()); 50 | if (distance < dist) { 51 | dist = distance; 52 | temp = npc; 53 | } 54 | } 55 | } 56 | } 57 | } 58 | if(temp != null) 59 | if(temp.isOnScreen()) 60 | return temp; 61 | return getNearestOnScreen(ids); 62 | } 63 | 64 | 65 | public static NPC[] getNPCsByID(int... npcIDs) { 66 | ArrayList matchedNPCs = new ArrayList(); 67 | for (NPC npc : getNPCArray()) { 68 | if(npc==null) 69 | continue; 70 | for (int currentID : npcIDs) { 71 | if (npc.getNPCDef().getID() == currentID) { 72 | matchedNPCs.add(npc); 73 | } 74 | } 75 | } 76 | return matchedNPCs.toArray(new NPC[]{}); 77 | } 78 | 79 | public static NPC[] getNPCsByName(String... npcNames) { 80 | ArrayList matchedNPCs = new ArrayList(); 81 | for (NPC npc : getNPCArray()) { 82 | if(npc==null) 83 | continue; 84 | for (String currentName : npcNames) { 85 | if (npc.getNPCName().toLowerCase().equals(currentName.toLowerCase())) { 86 | matchedNPCs.add(npc); 87 | } 88 | } 89 | } 90 | return matchedNPCs.toArray(new NPC[]{}); 91 | } 92 | 93 | public static NPC[] getNPCArray(){ 94 | ArrayList npcs = new ArrayList(); 95 | for(NPCNode node : Client.getNPCNodeArray()){ 96 | if(node!=null){ 97 | NPC npc = node.getNPC(); 98 | if(npc==null) 99 | continue; 100 | if(!npc.getNPCName().equals("null") && !npc.getNPCName().equals("")) 101 | npcs.add(npc); 102 | } 103 | } 104 | return npcs.toArray(new NPC[]{}); 105 | } 106 | 107 | public static NPC getNPCAt(Tile t){ 108 | if(t==null) 109 | return null; 110 | return getNPCAt(t.getX(), t.getY()); 111 | } 112 | 113 | public static NPC getNPCAt(int x, int y){ 114 | for(NPC npc : getNPCArray()){ 115 | if(npc.getLocation().equals(new Tile(x, y, Client.getPlane()))) 116 | return npc; 117 | } 118 | return null; 119 | } 120 | 121 | } 122 | -------------------------------------------------------------------------------- /src/api/methods/Nodes.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.methods; 11 | 12 | import api.wrappers.*; 13 | 14 | public class Nodes { 15 | public static Node lookup(HashTable nc, long id) { 16 | try { 17 | if (nc == null || nc.getBuckets() == null || id < 0) { 18 | return null; 19 | } 20 | for(Node node : nc.getBuckets()){ 21 | for(Node in = node.getNext();in!=null && !in.currentObject.equals(node.currentObject);in=in.getNext()){ 22 | try{ 23 | if(in.getID()==id) 24 | return in; 25 | } 26 | catch(Exception e){} 27 | } 28 | } 29 | } catch (Exception e) { 30 | } 31 | return null; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/api/methods/Players.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.methods; 11 | 12 | import api.wrappers.Player; 13 | import api.wrappers.PlayerDef; 14 | 15 | import java.util.ArrayList; 16 | 17 | 18 | public class Players { 19 | public static String[] getAllPlayerNames(){ 20 | ArrayList names = new ArrayList(); 21 | for(Player p : getPlayerArray()){ 22 | if(p!=null && !p.getPlayerName().equals("")){ 23 | names.add(p.getPlayerName()); 24 | } 25 | } 26 | return names.toArray(new String[]{}); 27 | } 28 | public static Player getMyPlayer(){ 29 | return Client.getMyPlayer(); 30 | } 31 | public static Player[] getPlayerArray(){ 32 | ArrayList players = new ArrayList(); 33 | for(Player p : Client.getPlayerArray()) 34 | if(p!=null) 35 | players.add(p); 36 | return players.toArray(new Player[]{}); 37 | } 38 | public static Player getPlayerByID(int id){ 39 | for(Player p : getPlayerArray()){ 40 | PlayerDef def = p.getPlayerDef(); 41 | if(def==null) 42 | continue; 43 | if(def.getID()==id) 44 | return p; 45 | } 46 | return null; 47 | } 48 | public static Player getPlayerByName(String name){ 49 | for(Player p : getPlayerArray()) 50 | if(p.getPlayerName().equals(name)) 51 | return p; 52 | return null; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/api/methods/Randoms.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.methods; 11 | 12 | 13 | import script.ScriptDef; 14 | 15 | import java.util.HashMap; 16 | 17 | public class Randoms { 18 | private static HashMap runningRandoms = new HashMap(); 19 | public static void loadAllRandoms(){ 20 | for(ScriptDef random : runningRandoms.values()) 21 | random.stopScript(); 22 | runningRandoms.clear(); 23 | //runningRandoms.put("AppletRefresh", new AppletRefresh()); 24 | //runningRandoms.put("LoginHandler", new LoginHandler()); 25 | } 26 | public static void pauseAllRandoms(){ 27 | for(ScriptDef random : runningRandoms.values()){ 28 | if(!random.isPaused) 29 | random.pause(); 30 | else 31 | System.out.println(random.getClass().getName()+" is already paused..."); 32 | } 33 | } 34 | public static void pauseRandom(String name){ 35 | ScriptDef random = runningRandoms.get(name); 36 | if(random!=null){ 37 | if(!random.isPaused) 38 | random.pause(); 39 | else 40 | System.out.println(name+" is already paused..."); 41 | } 42 | else 43 | System.out.println("No such random is running..."); 44 | } 45 | public static void startAllRandoms(){ 46 | for(ScriptDef random : runningRandoms.values()) 47 | random.start(); 48 | } 49 | public static void startRandom(String name){ 50 | ScriptDef random = runningRandoms.get(name); 51 | if(random!=null){ 52 | if(random.isPaused) 53 | random.unpause(); 54 | else if(!random.isAlive()) 55 | random.start(); 56 | else 57 | System.out.println(name+" is already running..."); 58 | } 59 | else 60 | System.out.println("No such random is running..."); 61 | } 62 | public static void stopRandom(String name){ 63 | ScriptDef random = runningRandoms.get(name); 64 | if(random!=null){ 65 | random.stopScript(); 66 | runningRandoms.remove(name); 67 | } 68 | else 69 | System.out.println("No such random is running..."); 70 | } 71 | public static void unpauseAllRandoms(){ 72 | for(ScriptDef random : runningRandoms.values()){ 73 | if(random.isPaused) 74 | random.unpause(); 75 | else 76 | System.out.println(random.getClass().getName()+" is already unpaused..."); 77 | } 78 | } 79 | public static void unpauseRandom(String name){ 80 | ScriptDef random = runningRandoms.get(name); 81 | if(random!=null){ 82 | if(random.isPaused) 83 | random.unpause(); 84 | else 85 | System.out.println(name+" is already unpaused..."); 86 | } 87 | else 88 | System.out.println("No such random is running..."); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/api/methods/Settings.java: -------------------------------------------------------------------------------- 1 | package api.methods; 2 | 3 | import api.wrappers.*; 4 | 5 | public class Settings { 6 | public static int[] getAll(){ 7 | Facade fac = Client.getFacade(); 8 | if(fac!=null){ 9 | api.wrappers.Settings sets = fac.getSettings(); 10 | if(sets!=null) 11 | return sets.getData(); 12 | } 13 | return new int[]{}; 14 | } 15 | public static int get(int index){ 16 | int[] all = getAll(); 17 | if(all.length>index) 18 | return all[index]; 19 | return -1; 20 | } 21 | public static int get(int index, int mask){ 22 | return get(index) & mask; 23 | } 24 | public static int get(int index, int shift, int mask){ 25 | return (get(index)>>shift)&mask; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/api/methods/Skills.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.methods; 11 | 12 | import api.wrappers.*; 13 | 14 | public class Skills { 15 | public static int[] XP_TABLE = {0, 0, 83, 174, 276, 388, 512, 650, 801, 969, 1154, 1358, 1584, 1833, 2107, 16 | 2411, 2746, 3115, 3523, 3973, 4470, 5018, 5624, 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363, 14833, 17 | 16456, 18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224, 41171, 45529, 50339, 55649, 61512, 67983, 18 | 75127, 83014, 91721, 101333, 111945, 123660, 136594, 150872, 166636, 184040, 203254, 224466, 247886, 273742, 19 | 302288, 333804, 368599, 407015, 449428, 496254, 547953, 605032, 668051, 737627, 814445, 899257, 992895, 20 | 1096278, 1210421, 1336443, 1475581, 1629200, 1798808, 1986068, 2192818, 2421087, 2673114, 2951373, 3258594, 21 | 3597792, 3972294, 4385776, 4842295, 5346332, 5902831, 6517253, 7195629, 7944614, 8771558, 9684577, 10692629, 22 | 11805606, 13034431, 14391160, 15889109, 17542976, 19368992, 21385073, 23611006, 26068632, 28782069, 23 | 31777943, 35085654, 38737661, 42769801, 47221641, 52136869, 57563718, 63555443, 70170840, 77474828, 24 | 85539082, 94442737, 104273167}; 25 | public static String[] SKILL_NAMES = {"attack", "defence", "strength", "constitution", "range", "prayer", 26 | "magic", "cooking", "woodcutting", "fletching", "fishing", "firemaking", "crafting", "smithing", "mining", 27 | "herblore", "agility", "thieving", "slayer", "farming", "runecrafting", "hunter", "construction", 28 | "summoning", "dungeoneering"}; 29 | public static int ATTACK_INDEX = 0; 30 | public static int DEFENSE_INDEX = 1; 31 | public static int STRENGTH_INDEX = 2; 32 | public static int CONSTITUTION_INDEX = 3; 33 | public static int RANGE_INDEX = 4; 34 | public static int PRAYER_INDEX = 5; 35 | public static int MAGIC_INDEX = 6; 36 | public static int COOKING_INDEX = 7; 37 | public static int WOODCUTTING_INDEX = 8; 38 | public static int FLETCHING_INDEX = 9; 39 | public static int FISHING_INDEX = 10; 40 | public static int FIREMAKING_INDEX = 11; 41 | public static int CRAFTING_INDEX = 12; 42 | public static int SMITHING_INDEX = 13; 43 | public static int MINING_INDEX = 14; 44 | public static int HERBLORE_INDEX = 15; 45 | public static int AGILITY_INDEX = 16; 46 | public static int THIEVING_INDEX = 17; 47 | public static int SLAYER_INDEX = 18; 48 | public static int FARMING_INDEX = 19; 49 | public static int RUNECRAFTING_INDEX = 20; 50 | public static int HUNTER_INDEX = 21; 51 | public static int CONSTRUCTION_INDEX = 22; 52 | public static int SUMMONING_INDEX = 23; 53 | public static int DUNGEONEERING_INDEX = 24; 54 | 55 | public static int getExpTillLevel(int index, int level){ 56 | int real = getRealSkillLevel(index); 57 | if(real==-1) 58 | return -1; 59 | if (index == DUNGEONEERING_INDEX && (real == 120 || level > 120)) 60 | return 0; 61 | else if (real == 99 || level > 99) 62 | return 0; 63 | return XP_TABLE[level+1] - getSkillExperience(index); 64 | } 65 | public static int getExpTillNextLevel(int index){ 66 | return getExpTillLevel(index, getSkillLevel(index)); 67 | } 68 | public static int getLevel(int exp) { 69 | for (int i = XP_TABLE.length-1; i>0; i--) 70 | if (exp>XP_TABLE[i]) 71 | return i; 72 | return -1; 73 | } 74 | public static int getRealSkillLevel(int index){ 75 | return getLevel(getSkillExperience(index)); 76 | } 77 | public static int getSkillExperience(int index){ 78 | Facade fac = Client.getFacade(); 79 | if(fac!=null){ 80 | SkillInfo[] array = fac.getSkillArray(); 81 | if(array.length>index){ 82 | SkillInfo skill = array[index]; 83 | if(skill!=null){ 84 | return skill.getExperience(); 85 | } 86 | } 87 | } 88 | return -1; 89 | } 90 | public static int getSkillIndex(String statName) { 91 | for (int i = 0; i < SKILL_NAMES.length; i++) 92 | if (SKILL_NAMES[i].equalsIgnoreCase(statName)) 93 | return i; 94 | return -1; 95 | } 96 | public static int getSkillLevel(int index){ 97 | Facade fac = Client.getFacade(); 98 | if(fac!=null){ 99 | SkillInfo[] array = fac.getSkillArray(); 100 | if(array.length>index){ 101 | SkillInfo skill = array[index]; 102 | if(skill!=null){ 103 | return skill.getCurrentLevel(); 104 | } 105 | } 106 | } 107 | return -1; 108 | } 109 | public static int getSkillMaxLevel(int index){ 110 | Facade fac = Client.getFacade(); 111 | if(fac!=null){ 112 | SkillInfo[] array = fac.getSkillArray(); 113 | if(array.length>index){ 114 | SkillInfo skill = array[index]; 115 | if(skill!=null){ 116 | return skill.getMaxLevel(); 117 | } 118 | } 119 | } 120 | return -1; 121 | } 122 | public static String getSkillName(int index) { 123 | if (index>=SKILL_NAMES.length) { 124 | return "invalid skill index"; 125 | } 126 | return SKILL_NAMES[index]; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /src/api/methods/Tabs.java: -------------------------------------------------------------------------------- 1 | 2 | package api.methods; 3 | 4 | import api.wrappers.*; 5 | import environment.Data; 6 | 7 | import java.awt.*; 8 | import java.awt.event.KeyEvent; 9 | import java.util.Random; 10 | 11 | /** 12 | * 13 | * @author Steven10172 14 | * @notes Open() won't click the correct spot if not using Fixed 15 | * as the AbsoluteLocation Settings are incorrect 16 | * 17 | * If using Re-sizable setting user interface 746 18 | * 19 | * findParentInferface() needs to be updated to read the 20 | * current client display settings 21 | * 22 | */ 23 | public enum Tabs { 24 | COMBAT(116, "Combat Styles", KeyEvent.VK_F5), 25 | TASK_LIST(117, "Task List"), 26 | STATS(118, "Stats"), 27 | INVENTORY(120, "Inventory", KeyEvent.VK_F1), 28 | EQUIPMENT(121, "Worn Equipment", KeyEvent.VK_F2), 29 | PRAYER(122, "Prayer List", KeyEvent.VK_F3), 30 | MAGIC(123, "Magic Spellbook", KeyEvent.VK_F4), 31 | EXTRAS(84, "Extras"), 32 | FRIENDS_LIST(85, "Friends List"), 33 | FRIENDS_CHAT(86, "Friends Chat"), 34 | CLAN_CHAT(87, "Clan Chat"), 35 | OPTIONS(88, "Options"), 36 | EMOTES(89, "Emotes"), 37 | MUSIC(90, "Music Play"), 38 | NOTES(91, "Notes"); 39 | 40 | private String description; 41 | private int fnKey; 42 | private int interfaceID; 43 | private static int parentInterface; 44 | 45 | Tabs(int interfaceID, String description) { 46 | this(interfaceID, description, -1); 47 | } 48 | 49 | Tabs(int interfaceID, String description, int fnKey) { 50 | this.description = description; 51 | this.fnKey = fnKey; 52 | this.interfaceID = interfaceID; 53 | } 54 | 55 | public String getDescription() { 56 | return description; 57 | } 58 | 59 | public int getFnKey() { 60 | return fnKey; 61 | } 62 | 63 | public int getInterfaceID() { 64 | return interfaceID; 65 | } 66 | 67 | public boolean hasFnKey() { 68 | return (fnKey != -1); 69 | } 70 | 71 | public boolean isOpen() { 72 | return (this == getCurrent()); 73 | } 74 | 75 | public int getParentInterface() { 76 | return parentInterface; 77 | } 78 | 79 | private static int findParentInferface() { 80 | //return 746; // Resizeable client is being used 81 | return 548; // Fixed client is being used 82 | } 83 | 84 | public Point getClickLocation() { 85 | int height = Client.getInterfaceCache()[parentInterface].getChildren()[getInterfaceID()].getHeight(); 86 | int width = Client.getInterfaceCache()[parentInterface].getChildren()[getInterfaceID()].getWidth(); 87 | int absLocX = Client.getInterfaceCache()[parentInterface].getChildren()[getInterfaceID()].getAbsoluteX(); 88 | int absLocY = Client.getInterfaceCache()[parentInterface].getChildren()[getInterfaceID()].getAbsoluteY(); 89 | Random rand = new Random(); 90 | 91 | return new Point(absLocX + rand.nextInt(width), 92 | absLocY + rand.nextInt(height)); 93 | } 94 | 95 | public boolean open() { 96 | return open(false); 97 | } 98 | 99 | public boolean open(boolean useFnKey) { 100 | if(!isOpen()) { 101 | if(useFnKey && hasFnKey()) { //Use the Function Key 102 | Component keyboardTarget = Data.CLIENT_APPLET.getComponent(0); 103 | KeyEvent event = new KeyEvent(keyboardTarget, KeyEvent.KEY_PRESSED, 0, 0, getFnKey(), KeyEvent.CHAR_UNDEFINED); 104 | keyboardTarget.dispatchEvent(event); 105 | event = new KeyEvent(keyboardTarget, KeyEvent.KEY_PRESSED, 0, 0, getFnKey(), KeyEvent.CHAR_UNDEFINED); 106 | keyboardTarget.dispatchEvent(event); 107 | } else { //Use the Mouse 108 | Mouse.move(getClickLocation()); 109 | try { 110 | Thread.sleep(100); 111 | } catch (Exception e) { 112 | } 113 | Mouse.click(); 114 | } 115 | } 116 | return isOpen(); 117 | } 118 | 119 | public static Tabs getCurrent() { 120 | parentInterface = findParentInferface(); 121 | Interface tabsInterface = Client.getInterfaceCache()[parentInterface]; 122 | if(tabsInterface != null && tabsInterface.getChildren().length > 0){ 123 | InterfaceChild[] tabsChild = tabsInterface.getChildren(); 124 | for(Tabs t : Tabs.values()) { 125 | if(tabsChild[t.getInterfaceID()].getTextureID() != -1) { 126 | return t; 127 | } 128 | } 129 | } 130 | return null; 131 | } 132 | } -------------------------------------------------------------------------------- /src/api/methods/Timer.java: -------------------------------------------------------------------------------- 1 | package api.methods; 2 | 3 | /** 4 | * A Timer utility. 5 | * 6 | * @author Tilt, inspired by timer's "Timer" class. 7 | */ 8 | public class Timer { 9 | private long end; 10 | private final long start; 11 | private final long period; 12 | 13 | /** 14 | * Instantiates a new Timer with a given time 15 | * period in milliseconds. 16 | * 17 | * @param period Time period in milliseconds. 18 | */ 19 | public Timer(final long period) { 20 | this.period = period; 21 | start = System.currentTimeMillis(); 22 | end = start + period; 23 | } 24 | 25 | /** 26 | * Returns the number of milliseconds elapsed since 27 | * the start time. 28 | * 29 | * @return The elapsed time in milliseconds. 30 | */ 31 | public long getElapsed() { 32 | return System.currentTimeMillis() - start; 33 | } 34 | 35 | /** 36 | * Returns the number of milliseconds remaining 37 | * until the timer is up. 38 | * 39 | * @return The remaining time in milliseconds. 40 | */ 41 | public long getRemaining() { 42 | if (isRunning()) { 43 | return end - System.currentTimeMillis(); 44 | } 45 | return 0; 46 | } 47 | 48 | /** 49 | * Returns true if this timer's time period 50 | * has not yet elapsed. 51 | * 52 | * @return true if the time period has not yet passed. 53 | */ 54 | public boolean isRunning() { 55 | return System.currentTimeMillis() < end; 56 | } 57 | 58 | /** 59 | * Restarts this timer using its period. 60 | */ 61 | public void reset() { 62 | end = System.currentTimeMillis() + period; 63 | } 64 | 65 | /** 66 | * Sets the end time of this timer to a given number of 67 | * milliseconds from the time it is called. This does 68 | * not edit the period of the timer (so will not affect 69 | * operation after reset). 70 | * 71 | * @param ms The number of milliseconds before the timer 72 | * should stop running. 73 | * @return The new end time. 74 | */ 75 | public long setEndIn(final long ms) { 76 | end = System.currentTimeMillis() + ms; 77 | return end; 78 | } 79 | 80 | /** 81 | * Returns a formatted String of the time elapsed. 82 | * 83 | * @return The elapsed time formatted hh:mm:ss. 84 | */ 85 | public String toElapsedString() { 86 | return ""+getElapsed(); 87 | } 88 | 89 | /** 90 | * Returns a formatted String of the time remaining. 91 | * 92 | * @return The remaining time formatted hh:mm:ss. 93 | */ 94 | public String toRemainingString() { 95 | return ""+getRemaining(); 96 | } 97 | } -------------------------------------------------------------------------------- /src/api/wrappers/Animable.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class Animable extends Interactable{ 23 | public Object currentObject; 24 | public static ClassHook currentHook; 25 | private static FieldHook minX; 26 | private static FieldHook minY; 27 | private static FieldHook maxX; 28 | private static FieldHook maxY; 29 | public Animable(Object o){ 30 | super(o); 31 | currentObject = o; 32 | if(currentHook==null){ 33 | currentHook = Data.runtimeClassHooks.get("Animable"); 34 | minX=currentHook.getFieldHook("getMinX"); 35 | minY=currentHook.getFieldHook("getMinY"); 36 | maxX=currentHook.getFieldHook("getMaxX"); 37 | maxY=currentHook.getFieldHook("getMaxY"); 38 | } 39 | } 40 | public static void resetHooks(){ 41 | currentHook=null; 42 | minX=null; 43 | minY=null; 44 | maxX=null; 45 | maxY=null; 46 | } 47 | public short getMinX(){ 48 | if(minX==null) 49 | minX=currentHook.getFieldHook("getMinX"); 50 | if(minX!=null){ 51 | Object data = minX.get(currentObject); 52 | if(data!=null) 53 | return (Short)data; 54 | } 55 | return -1; 56 | } 57 | public short getMaxX(){ 58 | if(maxX==null) 59 | maxX=currentHook.getFieldHook("getMaxX"); 60 | if(maxX!=null){ 61 | Object data = maxX.get(currentObject); 62 | if(data!=null) 63 | return (Short)data; 64 | } 65 | return -1; 66 | } 67 | public short getMinY(){ 68 | if(minY==null) 69 | minY=currentHook.getFieldHook("getMinY"); 70 | if(minY!=null){ 71 | Object data = minY.get(currentObject); 72 | if(data!=null) 73 | return (Short)data; 74 | } 75 | return -1; 76 | } 77 | public short getMaxY(){ 78 | if(maxY==null) 79 | maxY=currentHook.getFieldHook("getMaxY"); 80 | if(maxY!=null){ 81 | Object data = maxY.get(currentObject); 82 | if(data!=null) 83 | return (Short)data; 84 | } 85 | return -1; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/api/wrappers/AnimableNode.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class AnimableNode { 23 | public Object currentObject; 24 | public static ClassHook currentHook; 25 | private static FieldHook next; 26 | private static FieldHook animable; 27 | public AnimableNode(Object o){ 28 | currentObject = o; 29 | if(currentHook==null){ 30 | currentHook = Data.runtimeClassHooks.get("AnimableNode"); 31 | next=currentHook.getFieldHook("getNext"); 32 | animable=currentHook.getFieldHook("getAnimable"); 33 | } 34 | } 35 | public static void resetHooks(){ 36 | currentHook=null; 37 | next=null; 38 | animable=null; 39 | } 40 | public AnimableNode getNext(){ 41 | if(next==null) 42 | next=currentHook.getFieldHook("getNext"); 43 | if(next!=null){ 44 | Object data = next.get(currentObject); 45 | if(data!=null) 46 | return new AnimableNode(data); 47 | } 48 | return null; 49 | } 50 | public Animable getAnimable(){ 51 | if(animable==null) 52 | animable=currentHook.getFieldHook("getAnimable"); 53 | if(animable!=null){ 54 | Object data = animable.get(currentObject); 55 | if(data!=null) 56 | return new Animable(data); 57 | } 58 | return null; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/api/wrappers/AnimatedAnimableObject.java: -------------------------------------------------------------------------------- 1 | package api.wrappers; 2 | 3 | import api.methods.Calculations; 4 | import api.methods.Client; 5 | import api.methods.Menu; 6 | import api.methods.Nodes; 7 | import environment.Data; 8 | import reflection.ClassHook; 9 | import reflection.FieldHook; 10 | 11 | import java.awt.*; 12 | 13 | public class AnimatedAnimableObject extends Animable{ 14 | public Object currentObject; 15 | public static ClassHook currentHook; 16 | private static FieldHook animatedObject; 17 | public AnimatedAnimableObject(Object o) { 18 | super(o); 19 | currentObject = o; 20 | if(currentHook==null){ 21 | currentHook = Data.runtimeClassHooks.get("AnimatedAnimableObject"); 22 | animatedObject = currentHook.getFieldHook("getAnimatedObject"); 23 | } 24 | } 25 | public static void resetHooks(){ 26 | currentHook=null; 27 | animatedObject=null; 28 | } 29 | public AnimatedObject getAnimatedObject(){ 30 | if(animatedObject==null) 31 | animatedObject = currentHook.getFieldHook("getAnimatedObject"); 32 | if(animatedObject!=null){ 33 | Object data = animatedObject.get(currentObject); 34 | if(data!=null){ 35 | return new AnimatedObject(data, this.getMinX(), this.getMinY()); 36 | } 37 | } 38 | return null; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/api/wrappers/AnimatedBoundaryObject.java: -------------------------------------------------------------------------------- 1 | package api.wrappers; 2 | 3 | import api.methods.Calculations; 4 | import api.methods.Client; 5 | import api.methods.Menu; 6 | import api.methods.Nodes; 7 | import environment.Data; 8 | import reflection.ClassHook; 9 | import reflection.FieldHook; 10 | 11 | import java.awt.*; 12 | 13 | public class AnimatedBoundaryObject extends Boundary{ 14 | public Object currentObject; 15 | public static ClassHook currentHook; 16 | private int localX; 17 | private int localY; 18 | private static FieldHook animatedObject; 19 | public AnimatedBoundaryObject(Object o, int x, int y) { 20 | super(o); 21 | currentObject = o; 22 | localX=x; 23 | localY=y; 24 | if(currentHook==null){ 25 | currentHook = Data.runtimeClassHooks.get("AnimatedBoundaryObject"); 26 | animatedObject = currentHook.getFieldHook("getAnimatedObject"); 27 | } 28 | } 29 | public static void resetHooks(){ 30 | currentHook=null; 31 | animatedObject=null; 32 | } 33 | public AnimatedObject getAnimatedObject(){ 34 | if(animatedObject==null) 35 | animatedObject = currentHook.getFieldHook("getAnimatedObject"); 36 | if(animatedObject!=null){ 37 | Object data = animatedObject.get(currentObject); 38 | if(data!=null){ 39 | return new AnimatedObject(data, (short)localX, (short)localY); 40 | } 41 | } 42 | return null; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/api/wrappers/AnimatedFloorObject.java: -------------------------------------------------------------------------------- 1 | package api.wrappers; 2 | 3 | import api.methods.Calculations; 4 | import api.methods.Client; 5 | import api.methods.Menu; 6 | import api.methods.Nodes; 7 | import environment.Data; 8 | import reflection.ClassHook; 9 | import reflection.FieldHook; 10 | 11 | import java.awt.*; 12 | public class AnimatedFloorObject extends FloorDecoration{ 13 | public Object currentObject; 14 | public static ClassHook currentHook; 15 | private static FieldHook animatedObject; 16 | public AnimatedFloorObject(Object o, int x, int y) { 17 | super(o); 18 | currentObject = o; 19 | localX=x; 20 | localY=y; 21 | if(currentHook==null){ 22 | currentHook = Data.runtimeClassHooks.get("AnimatedFloorObject"); 23 | animatedObject = currentHook.getFieldHook("getAnimatedObject"); 24 | } 25 | } 26 | public static void resetHooks(){ 27 | currentHook=null; 28 | animatedObject=null; 29 | } 30 | private int localX; 31 | private int localY; 32 | public AnimatedObject getAnimatedObject(){ 33 | if(animatedObject==null) 34 | animatedObject = currentHook.getFieldHook("getAnimatedObject"); 35 | if(animatedObject!=null){ 36 | Object data = animatedObject.get(currentObject); 37 | if(data!=null){ 38 | return new AnimatedObject(data, (short)localX, (short)localY); 39 | } 40 | } 41 | return null; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/api/wrappers/AnimatedWallObject.java: -------------------------------------------------------------------------------- 1 | package api.wrappers; 2 | 3 | import api.methods.Calculations; 4 | import api.methods.Client; 5 | import api.methods.Menu; 6 | import api.methods.Nodes; 7 | import environment.Data; 8 | import reflection.ClassHook; 9 | import reflection.FieldHook; 10 | 11 | import java.awt.*; 12 | 13 | public class AnimatedWallObject extends WallDecoration{ 14 | public Object currentObject; 15 | public static ClassHook currentHook; 16 | private int localX; 17 | private int localY; 18 | private static FieldHook animatedObject; 19 | public AnimatedWallObject(Object o, int x, int y) { 20 | super(o); 21 | currentObject = o; 22 | localX=x; 23 | localY=y; 24 | if(currentHook==null){ 25 | currentHook = Data.runtimeClassHooks.get("AnimatedWallObject"); 26 | animatedObject=currentHook.getFieldHook("getAnimatedObject"); 27 | } 28 | } 29 | public static void resetHooks(){ 30 | currentHook=null; 31 | animatedObject=null; 32 | } 33 | public AnimatedObject getAnimatedObject(){ 34 | if(animatedObject==null) 35 | animatedObject = currentHook.getFieldHook("getAnimatedObject"); 36 | if(animatedObject!=null){ 37 | Object data = animatedObject.get(currentObject); 38 | if(data!=null){ 39 | return new AnimatedObject(data, (short)localX, (short)localY); 40 | } 41 | } 42 | return null; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/api/wrappers/Animation.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class Animation { 23 | public Object currentObject; 24 | public static ClassHook currentHook; 25 | private static FieldHook id; 26 | public Animation(Object o){ 27 | currentObject = o; 28 | if(currentHook==null){ 29 | currentHook = Data.runtimeClassHooks.get("Animation"); 30 | id=currentHook.getFieldHook("getID"); 31 | } 32 | } 33 | public static void resetHooks(){ 34 | currentHook=null; 35 | id=null; 36 | } 37 | public int getID(){ 38 | if(id==null) 39 | id=currentHook.getFieldHook("getID"); 40 | if(id!=null){ 41 | Object data = id.get(currentObject); 42 | if(data!=null) 43 | return (Integer)data * id.getIntMultiplier(); 44 | } 45 | return -1; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/api/wrappers/Animator.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class Animator { 23 | public Object currentObject; 24 | public static ClassHook currentHook; 25 | private static FieldHook animation; 26 | public Animator(Object o){ 27 | currentObject = o; 28 | if(currentHook==null){ 29 | currentHook = Data.runtimeClassHooks.get("Animator"); 30 | animation=currentHook.getFieldHook("getAnimation"); 31 | } 32 | } 33 | public static void resetHooks(){ 34 | currentHook=null; 35 | animation=null; 36 | } 37 | public Animation getAnimation(){ 38 | if(animation==null) 39 | animation=currentHook.getFieldHook("getAnimation"); 40 | if(animation!=null){ 41 | Object data = animation.get(currentObject); 42 | if(data!=null) 43 | return new Animation(data); 44 | } 45 | return null; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/api/wrappers/BaseInfo.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class BaseInfo { 23 | public Object currentObject; 24 | public static ClassHook currentHook; 25 | private static FieldHook x; 26 | private static FieldHook y; 27 | public BaseInfo(Object o){ 28 | currentObject = o; 29 | if(currentHook==null){ 30 | currentHook = Data.runtimeClassHooks.get("BaseInfo"); 31 | x=currentHook.getFieldHook("getX"); 32 | y=currentHook.getFieldHook("getY"); 33 | } 34 | } 35 | public static void resetHooks(){ 36 | currentHook=null; 37 | x=null; 38 | y=null; 39 | } 40 | public int getX(){ 41 | if(x==null) 42 | x=currentHook.getFieldHook("getX"); 43 | if(x!=null){ 44 | Object data = x.get(currentObject); 45 | if(data!=null) 46 | return ((Integer)data) * x.getIntMultiplier(); 47 | } 48 | return -1; 49 | } 50 | public int getY(){ 51 | if(y==null) 52 | y=currentHook.getFieldHook("getY"); 53 | if(y!=null){ 54 | Object data = y.get(currentObject); 55 | if(data!=null) 56 | return ((Integer)data) * y.getIntMultiplier(); 57 | } 58 | return -1; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/api/wrappers/Boundary.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class Boundary extends Interactable{ 23 | public Object currentObject; 24 | public static ClassHook currentHook; 25 | public Boundary(Object o){ 26 | super(o); 27 | currentObject = o; 28 | if(currentHook==null) 29 | currentHook = Data.runtimeClassHooks.get("Boundary"); 30 | } 31 | public static void resetHooks(){ 32 | currentHook=null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/api/wrappers/Cache.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class Cache { 23 | public Object currentObject; 24 | public static ClassHook currentHook; 25 | private static FieldHook table; 26 | public Cache(Object o){ 27 | currentObject = o; 28 | if(currentHook==null){ 29 | currentHook = Data.runtimeClassHooks.get("Cache"); 30 | table=currentHook.getFieldHook("getTable"); 31 | } 32 | } 33 | public static void resetHooks(){ 34 | currentHook=null; 35 | table=null; 36 | } 37 | public HashTable getTable(){ 38 | if(table==null) 39 | table=currentHook.getFieldHook("getTable"); 40 | if(table!=null){ 41 | Object data = table.get(currentObject); 42 | if(data!=null) 43 | return new HashTable(data); 44 | } 45 | return null; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/api/wrappers/Canvas.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class Canvas { 23 | public Object currentObject; 24 | public static ClassHook currentHook; 25 | public Canvas(Object o){ 26 | currentObject = o; 27 | if(currentHook==null) 28 | currentHook = Data.runtimeClassHooks.get("Canvas"); 29 | } 30 | public static void resetHooks(){ 31 | currentHook=null; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/api/wrappers/Chatline.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class Chatline { 23 | public Object currentObject; 24 | public static ClassHook currentHook; 25 | private static FieldHook message; 26 | public Chatline(Object o){ 27 | currentObject = o; 28 | if(currentHook==null){ 29 | currentHook = Data.runtimeClassHooks.get("Chatline"); 30 | message = currentHook.getFieldHook("getMessage"); 31 | } 32 | } 33 | public static void resetHooks(){ 34 | currentHook=null; 35 | message=null; 36 | } 37 | public String getMessage(){ 38 | if(message==null) 39 | message = currentHook.getFieldHook("getMessage"); 40 | if(message!=null){ 41 | Object data = message.get(currentObject); 42 | if(data!=null) 43 | return data.toString(); 44 | } 45 | return ""; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/api/wrappers/DetailInfo.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | public class DetailInfo { 22 | public Object currentObject; 23 | public static ClassHook currentHook; 24 | private static FieldHook level; 25 | public DetailInfo(Object o){ 26 | currentObject = o; 27 | if(currentHook==null){ 28 | currentHook = Data.runtimeClassHooks.get("DetailInfo"); 29 | level = currentHook.getFieldHook("getLevel"); 30 | } 31 | } 32 | public static void resetHooks(){ 33 | currentHook=null; 34 | level=null; 35 | } 36 | public int getLevel(){ 37 | if(level==null) 38 | level = currentHook.getFieldHook("getLevel"); 39 | if(level!=null){ 40 | Object data = level.get(currentObject); 41 | if(data!=null) 42 | return (Integer)data * level.getIntMultiplier(); 43 | } 44 | return -1; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/api/wrappers/DetailInfoNode.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class DetailInfoNode extends Node{ 23 | public Object currentObject; 24 | public static ClassHook currentHook; 25 | public DetailInfoNode(Object o){ 26 | super(o); 27 | currentObject = o; 28 | if(currentHook==null) 29 | currentHook = Data.runtimeClassHooks.get("DetailInfoNode"); 30 | } 31 | public static void resetHooks(){ 32 | currentHook=null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/api/wrappers/EntityNode.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class EntityNode { 23 | public Object currentObject; 24 | public static ClassHook currentHook; 25 | private static FieldHook next; 26 | private static FieldHook previous; 27 | private static FieldHook unique; 28 | public EntityNode(Object o){ 29 | currentObject = o; 30 | if(currentHook==null){ 31 | currentHook = Data.runtimeClassHooks.get("EntityNode"); 32 | next = currentHook.getFieldHook("getNext"); 33 | previous = currentHook.getFieldHook("getPrevious"); 34 | } 35 | } 36 | public static void resetHooks(){ 37 | currentHook=null; 38 | next=null; 39 | previous=null; 40 | unique=null; 41 | } 42 | public EntityNode getNext(){ 43 | if(next==null) 44 | next = currentHook.getFieldHook("getNext"); 45 | if(next!=null){ 46 | Object data = next.get(currentObject); 47 | if(data!=null) 48 | return new EntityNode(data); 49 | } 50 | return null; 51 | } 52 | 53 | public int getUniqueID() 54 | { 55 | if(unique==null) 56 | unique=currentHook.getFieldHook("getUnique"); 57 | if(unique!=null){ 58 | Object data = unique.get(currentObject); 59 | if(data!=null) 60 | return (int)data; 61 | } 62 | return -1; 63 | } 64 | 65 | public EntityNode getPrevious(){ 66 | if(previous==null) 67 | previous = currentHook.getFieldHook("getPrevious"); 68 | if(previous!=null){ 69 | Object data = previous.get(currentObject); 70 | if(data!=null) 71 | return new EntityNode(data); 72 | } 73 | return null; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/api/wrappers/Facade.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | import java.lang.reflect.Array; 22 | 23 | public class Facade { 24 | public Object currentObject; 25 | public static ClassHook currentHook; 26 | private static FieldHook skillArray; 27 | private static FieldHook settings; 28 | public Facade(Object o){ 29 | currentObject = o; 30 | if(currentHook==null){ 31 | currentHook = Data.runtimeClassHooks.get("Facade"); 32 | skillArray=currentHook.getFieldHook("getSkillArray"); 33 | settings=currentHook.getFieldHook("getSettings"); 34 | } 35 | } 36 | public static void resetHooks(){ 37 | currentHook=null; 38 | skillArray=null; 39 | settings=null; 40 | } 41 | public Settings getSettings(){ 42 | if(settings==null) 43 | settings=currentHook.getFieldHook("getSettings"); 44 | if(settings!=null){ 45 | Object data = settings.get(currentObject); 46 | if(data!=null) 47 | return new Settings(data); 48 | } 49 | return null; 50 | } 51 | public SkillInfo[] getSkillArray(){ 52 | if(skillArray==null) 53 | skillArray=currentHook.getFieldHook("getEntryBuffers"); 54 | if(skillArray!=null){ 55 | Object data = skillArray.get(currentObject); 56 | if(data!=null){ 57 | SkillInfo[] skills = new SkillInfo[Array.getLength(data)]; 58 | for(int i=0;i0){ 76 | Mouse.rightClick(); 77 | for(int i=0;i<10;++i){ 78 | if(Menu.isOpen()) 79 | break; 80 | try { 81 | Thread.sleep(100); 82 | } catch (Exception e) { 83 | } 84 | } 85 | } 86 | } 87 | if(Menu.isOpen()) 88 | return Menu.click(action); 89 | return false; 90 | } 91 | public int getLevel(){ 92 | if(level==null) 93 | level = currentHook.getFieldHook("getLevel"); 94 | if(level!=null){ 95 | Object data = level.get(currentObject); 96 | if(data!=null) 97 | return (Integer)data * level.getIntMultiplier(); 98 | } 99 | return -1; 100 | } 101 | 102 | public int getID(){ 103 | NPCDef def = getNPCDef(); 104 | if(def!=null) 105 | return def.getID(); 106 | return -1; 107 | } 108 | public NPCDef getNPCDef(){ 109 | if(def==null) 110 | def = currentHook.getFieldHook("getNPCDef"); 111 | if(def!=null){ 112 | Object data = def.get(currentObject); 113 | if(data!=null) 114 | return new NPCDef(data); 115 | } 116 | return null; 117 | } 118 | public String getNPCName(){ 119 | if(name==null) 120 | name = currentHook.getFieldHook("getNPCName"); 121 | if(name!=null){ 122 | Object data = name.get(currentObject); 123 | if(data!=null) 124 | return data.toString(); 125 | } 126 | return ""; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /src/api/wrappers/NPCDef.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | public class NPCDef { 21 | public Object currentObject; 22 | private static ClassHook currentHook; 23 | private static FieldHook actions; 24 | private static FieldHook id; 25 | private static FieldHook name; 26 | private static FieldHook nodeTable; 27 | public NPCDef(Object o){ 28 | currentObject=o; 29 | if(currentHook==null){ 30 | currentHook = Data.runtimeClassHooks.get("NPCDef"); 31 | actions = currentHook.getFieldHook("getActions"); 32 | id = currentHook.getFieldHook("getID"); 33 | name = currentHook.getFieldHook("getName"); 34 | nodeTable = currentHook.getFieldHook("getNodeTable"); 35 | } 36 | } 37 | public static void resetHooks(){ 38 | currentHook=null; 39 | actions=null; 40 | id=null; 41 | name=null; 42 | nodeTable=null; 43 | } 44 | public String[] getActions(){ 45 | if(actions==null) 46 | actions = currentHook.getFieldHook("getActions"); 47 | if(actions!=null){ 48 | Object data = actions.get(currentObject); 49 | if(data!=null) 50 | return (String[])data; 51 | } 52 | return null; 53 | } 54 | public int getID(){ 55 | if(id==null) 56 | id = currentHook.getFieldHook("getID"); 57 | if(id!=null){ 58 | Object data = id.get(currentObject); 59 | if(data!=null) 60 | return (Integer)data * id.getIntMultiplier(); 61 | } 62 | return -1; 63 | } 64 | public String getName(){ 65 | if(name==null) 66 | name = currentHook.getFieldHook("getName"); 67 | if(name!=null){ 68 | Object data = name.get(currentObject); 69 | if(data!=null) 70 | return data.toString(); 71 | } 72 | return ""; 73 | } 74 | public HashTable getNodeTable(){ 75 | if(nodeTable==null) 76 | nodeTable = currentHook.getFieldHook("getNodeTable"); 77 | if(nodeTable!=null){ 78 | Object data = nodeTable.get(currentObject); 79 | if(data!=null) 80 | return new HashTable(data); 81 | } 82 | return null; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/api/wrappers/NPCNode.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import java.util.Random; 13 | 14 | import api.methods.Calculations; 15 | import api.methods.Client; 16 | import api.methods.Menu; 17 | import api.methods.Nodes; 18 | import environment.Data; 19 | import reflection.ClassHook; 20 | import reflection.FieldHook; 21 | 22 | public class NPCNode extends Node{ 23 | public Object currentObject; 24 | public static ClassHook currentHook; 25 | private static FieldHook npc; 26 | 27 | public NPCNode(Object o){ 28 | super(o); 29 | currentObject = o; 30 | if(currentHook==null){ 31 | currentHook = Data.runtimeClassHooks.get("NPCNode"); 32 | npc = currentHook.getFieldHook("getNPC"); 33 | } 34 | } 35 | 36 | public int getUnique() 37 | { 38 | return 0; 39 | } 40 | 41 | public static void resetHooks(){ 42 | currentHook=null; 43 | npc=null; 44 | } 45 | public NPC getNPC(){ 46 | if(npc==null) 47 | npc = currentHook.getFieldHook("getNPC"); 48 | if(npc!=null){ 49 | Object data = npc.get(currentObject); 50 | if(data!=null) return new NPC(data); 51 | } 52 | return null; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/api/wrappers/Node.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class Node { 23 | public Object currentObject; 24 | public static ClassHook currentHook; 25 | private static FieldHook id; 26 | private static FieldHook next; 27 | private static FieldHook previous; 28 | public Node(Object o){ 29 | currentObject = o; 30 | if(currentHook==null){ 31 | currentHook = Data.runtimeClassHooks.get("Node"); 32 | id = currentHook.getFieldHook("getID"); 33 | next = currentHook.getFieldHook("getNext"); 34 | previous = currentHook.getFieldHook("getPrevious"); 35 | } 36 | } 37 | public static void resetHooks(){ 38 | currentHook=null; 39 | id=null; 40 | next=null; 41 | previous=null; 42 | } 43 | public long getID(){ 44 | if(id==null) 45 | id = currentHook.getFieldHook("getID"); 46 | if(id!=null){ 47 | Object data = id.get(currentObject); 48 | if(data!=null) 49 | return ((Long)data) * id.getLongMultiplier(); 50 | } 51 | return -1; 52 | } 53 | public Node getNext(){ 54 | if(next==null) 55 | next = currentHook.getFieldHook("getNext"); 56 | if(next!=null){ 57 | Object data = next.get(currentObject); 58 | if(data!=null){ 59 | if(data.getClass().getName().equals(Data.runtimeClassHooks.get("MenuItemNode").getClassName())) 60 | return new MenuItemNode(data); 61 | return new Node(data); 62 | } 63 | } 64 | return null; 65 | } 66 | public Node getPrevious(){ 67 | if(previous==null) 68 | previous = currentHook.getFieldHook("getPrevious"); 69 | if(previous!=null){ 70 | Object data = previous.get(currentObject); 71 | if(data!=null){ 72 | if(data.getClass().getName().equals(Data.runtimeClassHooks.get("MenuItemNode").getClassName())) 73 | return new MenuItemNode(data); 74 | return new Node(data); 75 | } 76 | } 77 | return null; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/api/wrappers/NodeList.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class NodeList { 23 | private Object currentObject; 24 | private static ClassHook currentHook; 25 | private static FieldHook tail; 26 | public NodeList(Object o){ 27 | currentObject=o; 28 | if(currentHook==null){ 29 | currentHook = Data.runtimeClassHooks.get("NodeList"); 30 | tail = currentHook.getFieldHook("getTail"); 31 | } 32 | } 33 | public static void resetHooks(){ 34 | currentHook=null; 35 | tail=null; 36 | } 37 | public Node getTail(){ 38 | if(tail==null) 39 | tail = currentHook.getFieldHook("getTail"); 40 | if(tail!=null){ 41 | Object data = tail.get(currentObject); 42 | if(data!=null) 43 | return new Node(data); 44 | } 45 | return null; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/api/wrappers/NodeListCache.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class NodeListCache extends Node{ 23 | public Object currentObject; 24 | public static ClassHook currentHook; 25 | private static FieldHook nodeList; 26 | public NodeListCache(Object o){ 27 | super(o); 28 | currentObject = o; 29 | if(currentHook==null){ 30 | currentHook = Data.runtimeClassHooks.get("NodeListCache"); 31 | nodeList = currentHook.getFieldHook("getNodeList"); 32 | } 33 | } 34 | public static void resetHooks(){ 35 | currentHook=null; 36 | nodeList=null; 37 | } 38 | public NodeList getNodeList(){ 39 | if(nodeList==null) 40 | nodeList = currentHook.getFieldHook("getNodeList"); 41 | if(nodeList!=null){ 42 | Object data = nodeList.get(currentObject); 43 | if(data!=null) 44 | return new NodeList(data); 45 | } 46 | return null; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/api/wrappers/NodeSub.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class NodeSub extends Node{ 23 | public Object currentObject; 24 | public static ClassHook currentHook; 25 | private static FieldHook idSub; 26 | private static FieldHook nextSub; 27 | private static FieldHook previousSub; 28 | public NodeSub(Object o){ 29 | super(o); 30 | currentObject = o; 31 | if(currentHook==null){ 32 | currentHook = Data.runtimeClassHooks.get("NodeSub"); 33 | idSub = currentHook.getFieldHook("getIDSub"); 34 | nextSub = currentHook.getFieldHook("getNextSub"); 35 | previousSub = currentHook.getFieldHook("getPreviousSub"); 36 | } 37 | } 38 | public static void resetHooks(){ 39 | currentHook=null; 40 | idSub=null; 41 | nextSub=null; 42 | previousSub=null; 43 | } 44 | public int getIDSub(){ 45 | if(idSub==null) 46 | idSub = currentHook.getFieldHook("getIDSub"); 47 | if(idSub!=null){ 48 | Object data = idSub.get(currentObject); 49 | if(data!=null) 50 | return (Integer)data; 51 | } 52 | return -1; 53 | } 54 | public NodeSub getNextSub(){ 55 | if(nextSub==null) 56 | nextSub = currentHook.getFieldHook("getNextSub"); 57 | if(nextSub!=null){ 58 | Object data = nextSub.get(currentObject); 59 | if(data!=null) 60 | return new NodeSub(data); 61 | } 62 | return null; 63 | } 64 | public NodeSub getPreviousSub(){ 65 | if(previousSub==null) 66 | previousSub = currentHook.getFieldHook("getPreviousSub"); 67 | if(previousSub!=null){ 68 | Object data = previousSub.get(currentObject); 69 | if(data!=null) 70 | return new NodeSub(data); 71 | } 72 | return null; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/api/wrappers/NodeSubQueue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | import java.awt.*; 21 | 22 | public class NodeSubQueue { 23 | private Object currentObject; 24 | private static ClassHook currentHook; 25 | private static FieldHook tail; 26 | public NodeSubQueue(Object o){ 27 | currentObject=o; 28 | if(currentHook==null){ 29 | currentHook = Data.runtimeClassHooks.get("NodeSubQueue"); 30 | tail = currentHook.getFieldHook("getTail"); 31 | } 32 | } 33 | public static void resetHooks(){ 34 | currentHook=null; 35 | tail=null; 36 | } 37 | public NodeSub getTail(){ 38 | if(tail==null) 39 | tail = currentHook.getFieldHook("getTail"); 40 | if(tail!=null){ 41 | Object data = tail.get(currentObject); 42 | if(data!=null) 43 | return new NodeSub(data); 44 | } 45 | return null; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/api/wrappers/Object3D.java: -------------------------------------------------------------------------------- 1 | package api.wrappers; 2 | 3 | import api.methods.Calculations; 4 | import api.methods.Client; 5 | import api.methods.Menu; 6 | import api.methods.Nodes; 7 | import environment.Data; 8 | import reflection.ClassHook; 9 | import reflection.FieldHook; 10 | import java.awt.*; 11 | 12 | public class Object3D { 13 | 14 | int xLoc, yLoc; 15 | 16 | int startX = -32; 17 | int stopX = 32; 18 | int startY = -32; 19 | int stopY = 32; 20 | int startHeight = 0; 21 | int stopHeight = 50; 22 | 23 | private Polygon objectPoly; 24 | 25 | public Object3D(int xLoc, int yLoc) { 26 | //startHeight = new Tile(xLoc, yLoc).getPlane(); 27 | //stopHeight = startHeight + 20; 28 | xLoc = transform(xLoc); 29 | yLoc = transform(yLoc); 30 | } 31 | 32 | public static int transform(int x) { 33 | return (x - Client.getBaseX()) * 128 + 64; 34 | } 35 | /** 36 | * Essentially will return an initial boundary object 37 | * More of a testing method than anything. 38 | * @author Greg 39 | * @param xLoc 40 | * @param yLoc 41 | * @return 42 | */ 43 | public Polygon getBounds(int xLoc, int yLoc) { 44 | return setBounds(xLoc, yLoc, startX, stopX, startY, stopY, startHeight, stopHeight); 45 | } 46 | 47 | public Polygon getPolygon() { 48 | if(this.objectPoly != null) 49 | return getBounds(xLoc, yLoc); 50 | return null; 51 | } 52 | 53 | private Polygon setBounds(int xLoc, int yLoc, int startX, int stopX, 54 | int startY, int stopY, int startHeight, int stopHeight) { 55 | 56 | Point p = Calculations.worldToScreen(xLoc + startX, yLoc + startY, startHeight); 57 | Point p1 = Calculations.worldToScreen(xLoc + startX, yLoc + stopY, startHeight); 58 | Point p2 = Calculations.worldToScreen(xLoc + stopX, yLoc + startY, startHeight); 59 | Point p3 = Calculations.worldToScreen(xLoc + stopX, yLoc + stopY, startHeight); 60 | 61 | Point p4 = Calculations.worldToScreen(xLoc + startX, yLoc + startY, stopHeight); 62 | Point p5 = Calculations.worldToScreen(xLoc + startX, yLoc + stopY, stopHeight); 63 | Point p6 = Calculations.worldToScreen(xLoc + stopX, yLoc + startY, stopHeight); 64 | Point p7 = Calculations.worldToScreen(xLoc + stopX, yLoc + stopY, stopHeight); 65 | 66 | if (p.x == -1 || p1.x == -1 || p2.x == -1 || p3.x == -1 || p4.x == -1 67 | || p5.x == -1 || p6.x == -1 || p7.x == -1) { 68 | if (Calculations.locationToScreen(xLoc, yLoc, (startHeight + stopHeight) / 2).x == -1) { 69 | System.out.println("null"); 70 | return null; 71 | } 72 | System.out.println("RETURNING POLYGON"); 73 | return setBounds(xLoc, yLoc, startHeight - 2, stopX - 2, startY - 2, 74 | stopY - 2, startHeight - 2, stopHeight - 2); 75 | } 76 | int xp[] = {p.x, p1.x, p3.x, p2.x, p.x, p4.x, p5.x, p1.x, p5.x, p7.x, 77 | p3.x, p7.x, p6.x, p2.x, p6.x, p4.x}; 78 | int yp[] = {p.y, p1.y, p3.y, p2.y, p.y, p4.y, p5.y, p1.y, p5.y, p7.y, 79 | p3.y, p7.y, p6.y, p2.y, p6.y, p4.y}; 80 | 81 | return new Polygon(xp, yp, xp.length); 82 | } 83 | 84 | /** 85 | * Set the bounds of an object3D to your fitting 86 | * @author Greg 87 | * @param xLoc 88 | * @param yLoc 89 | * @param startX 90 | * @param stopX 91 | * @param startY 92 | * @param stopY 93 | * @param startHeight 94 | * @param stopHeight 95 | * @return 96 | */ 97 | public Polygon setObjectDimensions(int xLoc, int yLoc, int startX, int stopX, 98 | int startY, int stopY, int startHeight, int stopHeight) { 99 | return objectPoly = setBounds(xLoc, yLoc, startX, stopX, 100 | startY, stopY, startHeight, stopHeight); 101 | } 102 | 103 | public int getxLoc() { 104 | return xLoc; 105 | } 106 | 107 | public void setxLoc(int xLoc) { 108 | this.xLoc = xLoc; 109 | } 110 | 111 | public int getyLoc() { 112 | return yLoc; 113 | } 114 | 115 | public void setyLoc(int yLoc) { 116 | this.yLoc = yLoc; 117 | } 118 | 119 | public int getStartX() { 120 | return startX; 121 | } 122 | 123 | 124 | public int getStopX() { 125 | return stopX; 126 | } 127 | 128 | 129 | public int getStartY() { 130 | return startY; 131 | } 132 | 133 | 134 | public int getStopY() { 135 | return stopY; 136 | } 137 | 138 | public int getStartHeight() { 139 | return startHeight; 140 | } 141 | 142 | public int getStopHeight() { 143 | return stopHeight; 144 | } 145 | 146 | } 147 | -------------------------------------------------------------------------------- /src/api/wrappers/ObjectComposite.java: -------------------------------------------------------------------------------- 1 | package api.wrappers; 2 | 3 | import api.methods.Calculations; 4 | import api.methods.Client; 5 | import api.methods.Menu; 6 | import api.methods.Nodes; 7 | import environment.Data; 8 | import reflection.ClassHook; 9 | import reflection.FieldHook; 10 | 11 | public class ObjectComposite { 12 | public Object currentObject; 13 | public static ClassHook currentHook; 14 | private static FieldHook model; 15 | public ObjectComposite(Object o){ 16 | currentObject = o; 17 | if(currentHook==null){ 18 | currentHook = Data.runtimeClassHooks.get("ObjectComposite"); 19 | model = currentHook.getFieldHook("getModel"); 20 | } 21 | } 22 | public static void resetHooks(){ 23 | currentHook=null; 24 | model=null; 25 | } 26 | public ModelLD getModel(){ 27 | if(model==null) 28 | model = currentHook.getFieldHook("getModel"); 29 | if(model!=null){ 30 | Object data = model.get(currentObject); 31 | if(data!=null) 32 | return new ModelLD(data); 33 | } 34 | return null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/api/wrappers/ObjectDef.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | public class ObjectDef { 20 | public Object currentObject; 21 | public static ClassHook currentHook; 22 | private static FieldHook actions; 23 | private static FieldHook id; 24 | private static FieldHook name; 25 | private static FieldHook defLoader; 26 | public ObjectDef(Object o){ 27 | currentObject = o; 28 | if(currentHook==null){ 29 | currentHook = Data.runtimeClassHooks.get("ObjectDef"); 30 | actions = currentHook.getFieldHook("getActions"); 31 | id = currentHook.getFieldHook("getID"); 32 | name = currentHook.getFieldHook("getName"); 33 | defLoader = currentHook.getFieldHook("getObjectDefLoader"); 34 | } 35 | } 36 | public static void resetHooks(){ 37 | currentHook=null; 38 | actions=null; 39 | id=null; 40 | name=null; 41 | defLoader=null; 42 | } 43 | public String[] getActions(){ 44 | if(actions==null) 45 | actions = currentHook.getFieldHook("getActions"); 46 | if(actions!=null){ 47 | Object data = actions.get(currentObject); 48 | if(data!=null) 49 | return (String[])data; 50 | } 51 | return new String[]{}; 52 | } 53 | public int getID(){ 54 | if(id==null) 55 | id = currentHook.getFieldHook("getID"); 56 | if(id!=null){ 57 | Object data = id.get(currentObject); 58 | if(data!=null) 59 | return (Integer)data * id.getIntMultiplier(); 60 | } 61 | return -1; 62 | } 63 | public String getName(){ 64 | if(name==null) 65 | name = currentHook.getFieldHook("getName"); 66 | if(name!=null){ 67 | Object data = name.get(currentObject); 68 | if(data!=null) 69 | return data.toString(); 70 | } 71 | return ""; 72 | } 73 | public ObjectDefLoader getObjectDefLoader(){ 74 | if(defLoader==null) 75 | defLoader = currentHook.getFieldHook("getObjectDefLoader"); 76 | if(defLoader!=null){ 77 | Object data = defLoader.get(currentObject); 78 | if(data!=null) 79 | return new ObjectDefLoader(data); 80 | } 81 | return null; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/api/wrappers/ObjectDefLoader.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | public class ObjectDefLoader { 21 | public Object currentObject; 22 | public static ClassHook currentHook; 23 | private static FieldHook defCache; 24 | private static FieldHook modelCache; 25 | private static FieldHook composite; 26 | private static FieldHook groundActions; 27 | public ObjectDefLoader(Object o){ 28 | currentObject = o; 29 | if(currentHook==null){ 30 | currentHook = Data.runtimeClassHooks.get("ObjectDefLoader"); 31 | defCache = currentHook.getFieldHook("getDefCache"); 32 | modelCache = currentHook.getFieldHook("getModelCache"); 33 | composite = currentHook.getFieldHook("getComposite"); 34 | groundActions = currentHook.getFieldHook("getGroundActions"); 35 | } 36 | } 37 | public static void resetHooks(){ 38 | currentHook=null; 39 | defCache=null; 40 | modelCache=null; 41 | composite=null; 42 | groundActions=null; 43 | } 44 | public Cache getDefCache(){ 45 | if(defCache==null) 46 | defCache = currentHook.getFieldHook("getDefCache"); 47 | if(defCache!=null){ 48 | Object data = defCache.get(currentObject); 49 | if(data!=null) 50 | return new Cache(data); 51 | } 52 | return null; 53 | } 54 | public Cache getModelCache(){ 55 | if(modelCache==null) 56 | modelCache = currentHook.getFieldHook("getModelCache"); 57 | if(modelCache!=null){ 58 | Object data = modelCache.get(currentObject); 59 | if(data!=null) 60 | return new Cache(data); 61 | } 62 | return null; 63 | } 64 | public ObjectComposite getComposite(){ 65 | if(composite==null) 66 | composite = currentHook.getFieldHook("getComposite"); 67 | if(composite!=null){ 68 | Object data = composite.get(currentObject); 69 | if(data!=null) 70 | return new ObjectComposite(data); 71 | } 72 | return null; 73 | } 74 | public String[] getGroundActions(){ 75 | if(groundActions==null) 76 | groundActions = currentHook.getFieldHook("getGroundActions"); 77 | if(groundActions!=null){ 78 | Object data = groundActions.get(currentObject); 79 | if(data!=null) 80 | return (String[])data; 81 | } 82 | return new String[]{}; 83 | } 84 | public ObjectDef getObjectDef(int id){ 85 | Cache cache = getDefCache(); 86 | if(cache!=null){ 87 | Node node = Nodes.lookup(cache.getTable(), id); 88 | if(node!=null){ 89 | ObjectDef def = new ObjectDef(node.currentObject); 90 | return def; 91 | } 92 | } 93 | return null; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/api/wrappers/PlayerDef.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | public class PlayerDef { 21 | public Object currentObject; 22 | public static ClassHook currentHook; 23 | private static FieldHook equipment; 24 | private static FieldHook colors; 25 | private static FieldHook id; 26 | private static FieldHook male; 27 | private static FieldHook modelHash; 28 | public PlayerDef(Object o){ 29 | currentObject = o; 30 | if(currentHook==null){ 31 | currentHook = Data.runtimeClassHooks.get("PlayerDef"); 32 | equipment = currentHook.getFieldHook("getEquipment"); 33 | colors = currentHook.getFieldHook("getColors"); 34 | id = currentHook.getFieldHook("getID"); 35 | male = currentHook.getFieldHook("isMale"); 36 | modelHash = currentHook.getFieldHook("getModelHash"); 37 | } 38 | } 39 | public static void resetHooks(){ 40 | currentHook=null; 41 | equipment=null; 42 | colors=null; 43 | id=null; 44 | male=null; 45 | modelHash=null; 46 | } 47 | public int[] getEquipment(){ 48 | if(equipment==null) 49 | equipment = currentHook.getFieldHook("getEquipment"); 50 | if(equipment!=null){ 51 | Object data = equipment.get(currentObject); 52 | if(data!=null) 53 | return (int[])data; 54 | } 55 | return new int[]{}; 56 | } 57 | public int[] getColors(){ 58 | if(colors==null) 59 | colors = currentHook.getFieldHook("getColors"); 60 | if(colors!=null){ 61 | Object data = colors.get(currentObject); 62 | if(data!=null) 63 | return (int[])data; 64 | } 65 | return new int[]{}; 66 | } 67 | public int getID(){ 68 | if(id==null) 69 | id = currentHook.getFieldHook("getID"); 70 | if(id!=null){ 71 | Object data = id.get(currentObject); 72 | if(data!=null) 73 | return (Integer)data * id.getIntMultiplier(); 74 | } 75 | return -1; 76 | } 77 | public boolean isMale(){ 78 | if(male==null) 79 | male = currentHook.getFieldHook("isMale"); 80 | if(male!=null){ 81 | Object data = male.get(currentObject); 82 | if(data!=null) 83 | return (Boolean)data; 84 | } 85 | return false; 86 | } 87 | public long getModelHash(){ 88 | if(modelHash==null) 89 | modelHash = currentHook.getFieldHook("getModelHash"); 90 | if(modelHash!=null){ 91 | Object data = modelHash.get(currentObject); 92 | if(data!=null) 93 | return (Long)data * modelHash.getLongMultiplier(); 94 | } 95 | return -1; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/api/wrappers/Projectile.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | public class Projectile extends Animable{ 21 | public Object currentObject; 22 | public static ClassHook currentHook; 23 | private static FieldHook animator; 24 | private static FieldHook target; 25 | public Projectile(Object o){ 26 | super(o); 27 | currentObject=o; 28 | if(currentHook==null){ 29 | currentHook = Data.runtimeClassHooks.get("Projectile"); 30 | animator = currentHook.getFieldHook("getAnimator"); 31 | target = currentHook.getFieldHook("getTarget"); 32 | } 33 | } 34 | public static void resetHooks(){ 35 | currentHook=null; 36 | animator=null; 37 | target=null; 38 | } 39 | public Animator getAnimator(){ 40 | if(animator==null) 41 | animator = currentHook.getFieldHook("getAnimator"); 42 | if(animator!=null){ 43 | Object data = animator.get(currentObject); 44 | if(data!=null) 45 | return new Animator(data); 46 | } 47 | return null; 48 | } 49 | public int getAnimationID(){ 50 | Animator animator = getAnimator(); 51 | if(animator!=null){ 52 | Animation animation = animator.getAnimation(); 53 | if(animation!=null) 54 | return animation.getID(); 55 | } 56 | return -1; 57 | } 58 | public int getTarget(){ 59 | if(target==null) 60 | target = currentHook.getFieldHook("getTarget"); 61 | if(target!=null){ 62 | Object data = target.get(currentObject); 63 | if(data!=null) 64 | return (Integer)data; 65 | } 66 | return -1; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/api/wrappers/ProjectileNode.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | public class ProjectileNode extends Animable{ 21 | public Object currentObject; 22 | public static ClassHook currentHook; 23 | private static FieldHook projectile; 24 | public ProjectileNode(Object o){ 25 | super(o); 26 | currentObject=o; 27 | if(currentHook==null){ 28 | currentHook = Data.runtimeClassHooks.get("ProjectileNode"); 29 | projectile = currentHook.getFieldHook("getProjectile"); 30 | } 31 | } 32 | public static void resetHooks(){ 33 | currentHook=null; 34 | projectile=null; 35 | } 36 | public Projectile getProjectile(){ 37 | if(projectile==null) 38 | projectile = currentHook.getFieldHook("getProjectile"); 39 | if(projectile!=null){ 40 | Object data = projectile.get(currentObject); 41 | if(data!=null) 42 | return new Projectile(data); 43 | } 44 | return null; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/api/wrappers/Reference.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | public class Reference extends NodeSub{ 21 | public Object currentObject; 22 | public static ClassHook currentHook; 23 | private static FieldHook index; 24 | public Reference(Object o){ 25 | super(o); 26 | currentObject = o; 27 | if(currentHook==null){ 28 | currentHook = Data.runtimeClassHooks.get("Reference"); 29 | index = currentHook.getFieldHook("getIndex"); 30 | } 31 | } 32 | public static void resetHooks(){ 33 | currentHook=null; 34 | index=null; 35 | } 36 | public int getIndex(){ 37 | if(index==null) 38 | index = currentHook.getFieldHook("getIndex"); 39 | if(index!=null){ 40 | Object data = index.get(currentObject); 41 | if(data!=null) 42 | return ((Integer)data) * index.getIntMultiplier(); 43 | } 44 | return -1; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/api/wrappers/Render.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | public class Render { 21 | public Object currentObject; 22 | public static ClassHook currentHook; 23 | public Render(Object o){ 24 | currentObject = o; 25 | if(currentHook==null) 26 | currentHook = Data.runtimeClassHooks.get("Render"); 27 | } 28 | public static void resetHooks(){ 29 | currentHook=null; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/api/wrappers/RenderLD.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | public class RenderLD extends Render{ 21 | public Object currentObject; 22 | public static ClassHook currentHook; 23 | private static float absoluteX=(float) 260.0; 24 | private static float absoluteY=(float) 171.0; 25 | private static float xMultiplier=(float) 256.0; 26 | private static float yMultiplier=(float) 167.0; 27 | private static FieldHook viewport; 28 | public RenderLD(Object o){ 29 | super(o); 30 | currentObject = o; 31 | if(currentHook==null){ 32 | currentHook = Data.runtimeClassHooks.get("RenderLD"); 33 | viewport = currentHook.getFieldHook("getViewport"); 34 | } 35 | } 36 | public static void resetHooks(){ 37 | currentHook=null; 38 | viewport=null; 39 | } 40 | public float getAbsoluteX(){ 41 | return absoluteX; 42 | } 43 | public float getAbsoluteY(){ 44 | return absoluteY; 45 | } 46 | public float getXMultiplier(){ 47 | return xMultiplier; 48 | } 49 | public float getYMultiplier(){ 50 | return yMultiplier; 51 | } 52 | public Viewport getViewport(){ 53 | if(viewport==null) 54 | viewport = currentHook.getFieldHook("getViewport"); 55 | if(viewport!=null){ 56 | Object data = viewport.get(currentObject); 57 | if(data!=null) 58 | return new Viewport(data); 59 | } 60 | return null; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/api/wrappers/RenderOpenGL.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | public class RenderOpenGL extends Render{ 21 | public Object currentObject; 22 | public static ClassHook currentHook; 23 | public RenderOpenGL(Object o){ 24 | super(o); 25 | currentObject = o; 26 | if(currentHook==null) 27 | currentHook = Data.runtimeClassHooks.get("RenderOpenGL"); 28 | } 29 | public static void resetHooks(){ 30 | currentHook=null; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/api/wrappers/Settings.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | public class Settings { 21 | public Object currentObject; 22 | public static ClassHook currentHook; 23 | private static FieldHook data; 24 | public Settings(Object o){ 25 | currentObject = o; 26 | if(currentHook==null){ 27 | currentHook = Data.runtimeClassHooks.get("Settings"); 28 | data = currentHook.getFieldHook("getData"); 29 | } 30 | } 31 | public static void resetHooks(){ 32 | currentHook=null; 33 | data=null; 34 | } 35 | public int[] getData(){ 36 | if(data==null) 37 | data = currentHook.getFieldHook("getData"); 38 | if(data!=null){ 39 | Object dat = data.get(currentObject); 40 | if(dat!=null) 41 | return (int[])dat; 42 | } 43 | return new int[]{}; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/api/wrappers/SkillInfo.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | package api.wrappers; 11 | 12 | import api.methods.Calculations; 13 | import api.methods.Client; 14 | import api.methods.Menu; 15 | import api.methods.Nodes; 16 | import environment.Data; 17 | import reflection.ClassHook; 18 | import reflection.FieldHook; 19 | 20 | public class SkillInfo { 21 | public Object currentObject; 22 | public static ClassHook currentHook; 23 | private static FieldHook maxLevel; 24 | private static FieldHook experience; 25 | private static FieldHook currentLevel; 26 | public SkillInfo(Object o){ 27 | currentObject = o; 28 | if(currentHook==null){ 29 | currentHook = Data.runtimeClassHooks.get("SkillInfo"); 30 | maxLevel = currentHook.getFieldHook("getMaxLevel"); 31 | experience = currentHook.getFieldHook("getExperience"); 32 | currentLevel = currentHook.getFieldHook("getCurrentLevel"); 33 | } 34 | } 35 | public static void resetHooks(){ 36 | currentHook=null; 37 | maxLevel=null; 38 | experience=null; 39 | currentLevel=null; 40 | } 41 | public int getCurrentLevel(){ 42 | if(currentLevel==null) 43 | currentLevel = currentHook.getFieldHook("getCurrentLevel"); 44 | if(currentLevel!=null){ 45 | Object data = currentLevel.get(currentObject); 46 | if(data!=null) 47 | return (Integer)data * currentLevel.getIntMultiplier(); 48 | } 49 | return -1; 50 | } 51 | public int getExperience(){ 52 | if(experience==null) 53 | experience = currentHook.getFieldHook("getExperience"); 54 | if(experience!=null){ 55 | Object data = experience.get(currentObject); 56 | if(data!=null) 57 | return (Integer)data * experience.getIntMultiplier(); 58 | } 59 | return -1; 60 | } 61 | public int getMaxLevel(){ 62 | if(maxLevel==null) 63 | maxLevel = currentHook.getFieldHook("getData"); 64 | if(maxLevel!=null){ 65 | Object data = maxLevel.get(currentObject); 66 | if(data!=null) 67 | return (Integer)data * maxLevel.getIntMultiplier(); 68 | } 69 | return -1; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/api/wrappers/SoftReference.java: -------------------------------------------------------------------------------- 1 | 2 | package api.wrappers; 3 | 4 | import api.methods.Calculations; 5 | import api.methods.Client; 6 | import api.methods.Menu; 7 | import api.methods.Nodes; 8 | import environment.Data; 9 | import reflection.ClassHook; 10 | import reflection.FieldHook; 11 | 12 | public class SoftReference extends Reference{ 13 | public Object currentObject; 14 | public static ClassHook currentHook; 15 | private static FieldHook reference; 16 | public SoftReference(Object o){ 17 | super(o); 18 | currentObject = o; 19 | if(currentHook==null){ 20 | currentHook = Data.runtimeClassHooks.get("SoftReference"); 21 | reference = currentHook.getFieldHook("getSoftReference"); 22 | } 23 | } 24 | public static void resetHooks(){ 25 | currentHook=null; 26 | reference=null; 27 | } 28 | public java.lang.ref.SoftReference getSoftReference(){ 29 | if(reference==null) 30 | reference = currentHook.getFieldHook("getSoftReference"); 31 | if(reference!=null){ 32 | Object data = reference.get(currentObject); 33 | if(data!=null) 34 | return (java.lang.ref.SoftReference)data; 35 | } 36 | return null; 37 | } 38 | public static boolean isInstance(Object o){ 39 | if(currentHook==null) 40 | currentHook = Data.runtimeClassHooks.get("SoftReference"); 41 | if(currentHook!=null) 42 | return o.getClass().getName().equals(currentHook.getClassName()); 43 | return false; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/api/wrappers/TileArea.java: -------------------------------------------------------------------------------- 1 | package api.wrappers; 2 | 3 | import java.awt.*; 4 | 5 | public class TileArea { 6 | 7 | Polygon polygon; 8 | int plane = -1; 9 | 10 | public TileArea(final Tile t1, final Tile t2) { 11 | this( 12 | new Tile(Math.min(t1.getX(), t2.getX()), Math.min(t1.getY(), t2.getY()), t1.getPlane()), 13 | new Tile(Math.max(t1.getX(), t2.getX()), Math.min(t1.getY(), t2.getY()), t1.getPlane()), 14 | new Tile(Math.max(t1.getX(), t2.getX()), Math.max(t1.getY(), t2.getY()), t2.getPlane()), 15 | new Tile(Math.min(t1.getX(), t2.getX()), Math.max(t1.getY(), t2.getY()), t2.getPlane()) 16 | ); 17 | } 18 | 19 | public TileArea(final Tile... bounds) { 20 | polygon = new Polygon(); 21 | for (Tile tile : bounds) { 22 | if (plane != -1 && tile.getPlane() != plane) { 23 | throw new RuntimeException("area does not support 3d"); 24 | } 25 | plane = tile.getPlane(); 26 | addTile(tile); 27 | } 28 | } 29 | 30 | public void addTile(Tile t) { 31 | addTile(t.getX(), t.getY()); 32 | } 33 | 34 | public void addTile(int tilex, int tiley) { 35 | polygon.addPoint(tilex, tiley); 36 | } 37 | 38 | public boolean contains(GameObject go) { 39 | if(go!= null) 40 | return contains(go.getLocation()); 41 | return false; 42 | } 43 | 44 | public boolean contains(NPC npc) { 45 | if(npc != null) 46 | return contains(npc.getLocation()); 47 | return false; 48 | } 49 | 50 | public boolean contains(int tilex, int tiley) { 51 | if(tilex > 0 || tilex != -1 || tiley >0 || tiley != -1 ) 52 | return polygon.contains(tilex, tiley); 53 | return false; 54 | } 55 | 56 | public boolean contains(Tile tile) { 57 | if(tile != null) 58 | return contains(tile.getX(), tile.getY()); 59 | return false; 60 | } 61 | 62 | public int[] getAreaXPoints() { 63 | return polygon.xpoints; 64 | } 65 | 66 | 67 | public int getAreaNPoints() { 68 | return polygon.npoints; 69 | } 70 | 71 | public int[] getAreaYPoints() { 72 | return polygon.ypoints; 73 | } 74 | 75 | public Rectangle getBounds() { 76 | return polygon.getBounds(); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/api/wrappers/TileData.java: -------------------------------------------------------------------------------- 1 | 2 | package api.wrappers; 3 | 4 | import api.methods.Calculations; 5 | import api.methods.Client; 6 | import api.methods.Menu; 7 | import api.methods.Nodes; 8 | import environment.Data; 9 | import reflection.ClassHook; 10 | import reflection.FieldHook; 11 | 12 | public class TileData { 13 | public Object currentObject; 14 | public static ClassHook currentHook; 15 | private static FieldHook heights; 16 | public TileData(Object o){ 17 | currentObject = o; 18 | if(currentHook==null){ 19 | currentHook = Data.runtimeClassHooks.get("TileData"); 20 | heights = currentHook.getFieldHook("getHeights"); 21 | } 22 | } 23 | public static void resetHooks(){ 24 | currentHook=null; 25 | heights=null; 26 | } 27 | public int[][] getHeights(){ 28 | if(heights==null) 29 | heights = currentHook.getFieldHook("getHeights"); 30 | if(heights!=null){ 31 | Object data = heights.get(currentObject); 32 | if(data!=null) 33 | return (int[][])data; 34 | } 35 | return new int[][]{{}}; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/api/wrappers/Viewport.java: -------------------------------------------------------------------------------- 1 | 2 | package api.wrappers; 3 | 4 | import api.methods.Calculations; 5 | import api.methods.Client; 6 | import api.methods.Menu; 7 | import api.methods.Nodes; 8 | import environment.Data; 9 | import reflection.ClassHook; 10 | import reflection.FieldHook; 11 | 12 | public class Viewport { 13 | public Object currentObject; 14 | public static ClassHook currentHook; 15 | private static FieldHook floats; 16 | public Viewport(Object o){ 17 | currentObject = o; 18 | if(currentHook==null){ 19 | currentHook = Data.runtimeClassHooks.get("Viewport"); 20 | floats = currentHook.getFieldHook("getFloats"); 21 | } 22 | } 23 | public static void resetHooks(){ 24 | currentHook=null; 25 | floats=null; 26 | } 27 | public float[] getFloats(){ 28 | if(floats==null) 29 | floats = currentHook.getFieldHook("getFloats"); 30 | if(floats!=null){ 31 | Object data = floats.get(currentObject); 32 | if(data!=null) 33 | return (float[])data; 34 | } 35 | return new float[]{}; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/api/wrappers/WallDecoration.java: -------------------------------------------------------------------------------- 1 | 2 | package api.wrappers; 3 | 4 | import api.methods.Calculations; 5 | import api.methods.Client; 6 | import api.methods.Menu; 7 | import api.methods.Nodes; 8 | import environment.Data; 9 | import reflection.ClassHook; 10 | import reflection.FieldHook; 11 | 12 | public class WallDecoration extends Interactable{ 13 | public Object currentObject; 14 | public static ClassHook currentHook; 15 | public WallDecoration(Object o){ 16 | super(o); 17 | currentObject = o; 18 | if(currentHook==null) 19 | currentHook = Data.runtimeClassHooks.get("WallDecoration"); 20 | } 21 | public static void resetHooks(){ 22 | currentHook=null; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/api/wrappers/WorldController.java: -------------------------------------------------------------------------------- 1 | 2 | package api.wrappers; 3 | 4 | import environment.Data; 5 | import reflection.ClassHook; 6 | 7 | public class WorldController { 8 | public Object currentObject; 9 | public static ClassHook currentHook; 10 | public WorldController(Object o){ 11 | currentObject = o; 12 | if(currentHook==null) 13 | currentHook = Data.runtimeClassHooks.get("WorldController"); 14 | } 15 | public static void resetHooks(){ 16 | currentHook=null; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/environment/Data.java: -------------------------------------------------------------------------------- 1 | 2 | package environment; 3 | 4 | 5 | import gui.AppletFrame; 6 | import injection.XteaInjector; 7 | import jdk.internal.org.objectweb.asm.tree.ClassNode; 8 | import reflection.ClassHook; 9 | import reflection.FieldHook; 10 | import rsloader.RSClassLoader; 11 | import script.ScriptDef; 12 | 13 | import java.applet.Applet; 14 | import java.util.HashMap; 15 | 16 | public class Data { 17 | public static HashMap PARAMETERS = new HashMap<>(); 18 | public static HashMap clientClasses = new HashMap<>(); 19 | public static Object clientBootClass = null; 20 | public static RSClassLoader LOADER; 21 | public static HashMap runtimeClassHooks = new HashMap(); 22 | public static HashMap staticFieldHooks = new HashMap(); 23 | public static Applet CLIENT_APPLET; 24 | public static long crcHash; 25 | public static ScriptDef currentScript; 26 | public static AppletFrame appletFrame; 27 | public static String BASE_LINK = "http://oldschool27.runescape.com/j1/"; 28 | public static boolean hd = false; 29 | public static boolean debugFrame = true; 30 | } 31 | -------------------------------------------------------------------------------- /src/gui/AccountSetter.java: -------------------------------------------------------------------------------- 1 | package gui; 2 | 3 | 4 | public class AccountSetter extends javax.swing.JFrame { 5 | public static boolean isDisplayed = false; 6 | private static final long serialVersionUID = 1L; 7 | 8 | public AccountSetter() { 9 | if (!isDisplayed) 10 | initComponents(); 11 | } 12 | 13 | private void initComponents() { 14 | jLabel1 = new javax.swing.JLabel(); 15 | usernameField = new javax.swing.JTextField(); 16 | jLabel2 = new javax.swing.JLabel(); 17 | passwordField = new javax.swing.JTextField(); 18 | jButton3 = new javax.swing.JButton(); 19 | 20 | setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE); 21 | 22 | setTitle("Account Info"); 23 | 24 | jLabel1.setText("Username : "); 25 | 26 | jLabel2.setText("Password : "); 27 | 28 | jButton3.setText("Set Account"); 29 | jButton3.addActionListener(new java.awt.event.ActionListener() { 30 | public void actionPerformed(java.awt.event.ActionEvent evt) { 31 | jButton3ActionPerformed(evt); 32 | } 33 | }); 34 | 35 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); 36 | getContentPane().setLayout(layout); 37 | layout.setHorizontalGroup( 38 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 39 | .addGroup(layout.createSequentialGroup() 40 | .addContainerGap() 41 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 42 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() 43 | .addComponent(jLabel2) 44 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)) 45 | .addGroup(layout.createSequentialGroup() 46 | .addComponent(jLabel1) 47 | .addGap(8, 8, 8))) 48 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 49 | .addComponent(jButton3) 50 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) 51 | .addComponent(usernameField) 52 | .addComponent(passwordField, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE))) 53 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 54 | ); 55 | layout.setVerticalGroup( 56 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 57 | .addGroup(layout.createSequentialGroup() 58 | .addContainerGap() 59 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 60 | .addComponent(jLabel1) 61 | .addComponent(usernameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 62 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 63 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 64 | .addComponent(jLabel2) 65 | .addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 66 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 67 | .addComponent(jButton3) 68 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 69 | ); 70 | 71 | pack(); 72 | isDisplayed = true; 73 | } 74 | 75 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { 76 | /*LoginHandler.setAccount(usernameField.getText(), passwordField.getText()); 77 | setVisible(false); 78 | isDisplayed=false;*/ 79 | } 80 | 81 | private javax.swing.JButton jButton3; 82 | private javax.swing.JLabel jLabel1; 83 | private javax.swing.JLabel jLabel2; 84 | private javax.swing.JTextField passwordField; 85 | private javax.swing.JTextField usernameField; 86 | } -------------------------------------------------------------------------------- /src/injection/ClientInjector.java: -------------------------------------------------------------------------------- 1 | 2 | package injection; 3 | 4 | import environment.Data; 5 | import injection.transforms.Canvas; 6 | import injection.transforms.KeyListener; 7 | import injection.transforms.MouseListener; 8 | import jdk.internal.org.objectweb.asm.ClassReader; 9 | import jdk.internal.org.objectweb.asm.ClassWriter; 10 | import jdk.internal.org.objectweb.asm.tree.ClassNode; 11 | 12 | import java.io.File; 13 | import java.io.FileInputStream; 14 | import java.io.FileOutputStream; 15 | import java.io.InputStream; 16 | import java.util.Enumeration; 17 | import java.util.HashMap; 18 | import java.util.jar.JarEntry; 19 | import java.util.jar.JarFile; 20 | import java.util.jar.JarOutputStream; 21 | import java.util.zip.CRC32; 22 | import java.util.zip.CheckedInputStream; 23 | 24 | public class ClientInjector { 25 | private static long getChecksum(String file) { 26 | try { 27 | FileInputStream fis = new FileInputStream(file); 28 | CRC32 crc = new CRC32(); 29 | CheckedInputStream cis = new CheckedInputStream(fis, crc); 30 | byte[] buffer = new byte[(int) new File(file).length()]; 31 | cis.read(buffer); 32 | return cis.getChecksum().getValue(); 33 | } catch (Exception e) { 34 | 35 | } 36 | return -1; 37 | } 38 | 39 | public static void injectClient(String clientName) { 40 | try { 41 | HashMap clientData = new HashMap<>(); 42 | Data.crcHash = getChecksum(clientName); 43 | System.out.println("Injecting into client : " + Data.crcHash); 44 | JarFile theJar = new JarFile(clientName); 45 | Enumeration en = theJar.entries(); 46 | while (en.hasMoreElements()) { 47 | JarEntry entry = (JarEntry) en.nextElement(); 48 | if (entry.getName().startsWith("META")) 49 | continue; 50 | byte[] buffer = new byte[1024]; 51 | int read; 52 | InputStream is = theJar.getInputStream(entry); 53 | byte[] allByteData = new byte[0]; 54 | while ((read = is.read(buffer)) != -1) { 55 | byte[] tempBuff = new byte[read + allByteData.length]; 56 | for (int i = 0; i < allByteData.length; ++i) 57 | tempBuff[i] = allByteData[i]; 58 | for (int i = 0; i < read; ++i) 59 | tempBuff[i + allByteData.length] = buffer[i]; 60 | allByteData = tempBuff; 61 | } 62 | if (entry.getName().endsWith(".class")) { 63 | ClassReader cr = new ClassReader(allByteData); 64 | ClassNode cn = new ClassNode(); 65 | cr.accept(cn, ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES); 66 | Data.clientClasses.put(cn.name, cn); 67 | } 68 | clientData.put(entry, allByteData); 69 | } 70 | HashMap newNodes = new HashMap<>(); 71 | for (ClassNode cn : Data.clientClasses.values()) { 72 | Canvas.transformClass(cn); 73 | // MouseListener.transformClass(cn); 74 | //KeyListener.transformClass(cn); 75 | newNodes.put(cn.name, cn); 76 | } 77 | Data.clientClasses = newNodes; 78 | File newJar = new File(clientName); 79 | FileOutputStream stream = new FileOutputStream(newJar); 80 | JarOutputStream out = new JarOutputStream(stream); 81 | for (JarEntry je : clientData.keySet()) { 82 | byte[] entryData = clientData.get(je); 83 | if (je.getName().endsWith(".class")) { 84 | ClassNode cn = Data.clientClasses.get(je.getName().substring(0, je.getName().indexOf(".class"))); 85 | ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS); 86 | cn.accept(cw); 87 | entryData = cw.toByteArray(); 88 | JarEntry newEntry = new JarEntry(je.getName()); 89 | out.putNextEntry(newEntry); 90 | } else 91 | out.putNextEntry(je); 92 | out.write(entryData); 93 | } 94 | out.close(); 95 | stream.close(); 96 | } catch (Exception e) { 97 | e.printStackTrace(); 98 | } 99 | } 100 | 101 | } -------------------------------------------------------------------------------- /src/injection/Crawler.java: -------------------------------------------------------------------------------- 1 | package injection; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.IOException; 5 | import java.net.URL; 6 | import java.net.URLConnection; 7 | 8 | public class Crawler { 9 | 10 | public static String get(String page) throws IOException { 11 | URLConnection uc = new URL(page).openConnection(); 12 | uc.setRequestProperty("User-Agent", "Mozilla/4.0"); 13 | uc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); 14 | byte[] data = new byte[uc.getContentLength()]; 15 | new DataInputStream(uc.getInputStream()).readFully(data); 16 | return new String(data); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/injection/Dumper.java: -------------------------------------------------------------------------------- 1 | package injection; 2 | 3 | import java.io.BufferedWriter; 4 | import java.io.File; 5 | import java.io.FileWriter; 6 | import java.io.IOException; 7 | 8 | public class Dumper { 9 | 10 | public static void dump(int region, int[] keys) { 11 | try { 12 | System.out.print("Dumping region: " + region + " (" + (region >> 8) + "," + (region & 0xFF) + "), ["); 13 | BufferedWriter writer = new BufferedWriter(new FileWriter(new File("./data/xteas/" + region + ".txt"))); 14 | for (int i = 0; i < keys.length; i++) { 15 | writer.write(String.valueOf(keys[i])); 16 | System.out.print(keys[i]+" "); 17 | writer.newLine(); 18 | } 19 | writer.close(); 20 | System.out.println("]"); 21 | } catch (IOException ioex) { 22 | ioex.printStackTrace(); 23 | } 24 | } 25 | 26 | public static void dumpPacket(int multiplier, int region) { 27 | // System.out.println("PacketReceived: " + (region*multiplier)); 28 | } 29 | 30 | public static void dumpPacketData(byte[] data) { 31 | // System.out.println("Data="+new String(data)); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/injection/InstructionSearcher.java: -------------------------------------------------------------------------------- 1 | package injection; 2 | 3 | import org.apache.bcel.generic.*; 4 | import org.apache.bcel.classfile.Method; 5 | 6 | public class InstructionSearcher { 7 | 8 | public static interface Constraint { 9 | 10 | public boolean accept(Instruction instr); 11 | 12 | } 13 | 14 | private InstructionList list; 15 | private Instruction[] instructions; 16 | private ConstantPoolGen cpg; 17 | private int index; 18 | 19 | public InstructionSearcher(ClassGen cg, Method m) { 20 | cpg = cg.getConstantPool(); 21 | list = new InstructionList(m.getCode().getCode()); 22 | instructions = list.getInstructions(); 23 | index = -1; 24 | } 25 | 26 | public void index(int index) { 27 | this.index = index; 28 | } 29 | 30 | public Instruction current() { 31 | return (index < 0 || index >= instructions.length) ? null : instructions[index]; 32 | } 33 | 34 | public InstructionHandle currentHandle() { 35 | return list.getInstructionHandles()[index]; 36 | } 37 | 38 | public Instruction next() { 39 | ++index; 40 | return current(); 41 | } 42 | 43 | public Instruction previous() { 44 | --index; 45 | return current(); 46 | } 47 | 48 | public T next(Class type, Constraint constr) { 49 | while (++index < instructions.length) { 50 | Instruction instr = instructions[index]; 51 | if (type.isAssignableFrom(instr.getClass()) && (constr == null || constr.accept(instr))) { 52 | return type.cast(instr); 53 | } 54 | } 55 | return null; 56 | } 57 | 58 | public T previous(Class type, Constraint constr) { 59 | while (--index >= 0) { 60 | Instruction instr = instructions[index]; 61 | if (type.isAssignableFrom(instr.getClass()) && (constr == null || constr.accept(instr))) { 62 | return type.cast(instr); 63 | } 64 | } 65 | return null; 66 | } 67 | 68 | public LDC nextLDC(final Object val) { 69 | Constraint constraint = new Constraint() { 70 | public boolean accept(Instruction instr) { 71 | LDC ldc = (LDC) instr; 72 | return ldc.getValue(cpg).equals(val); 73 | } 74 | }; 75 | return next(LDC.class, constraint); 76 | } 77 | 78 | public ConstantPushInstruction nextConstant(final int... values) { 79 | Constraint constraint = new Constraint() { 80 | public boolean accept(Instruction instr) { 81 | ConstantPushInstruction cpi = (ConstantPushInstruction) instr; 82 | for (int val : values) { 83 | if (cpi.getValue().equals(val)) { 84 | return true; 85 | } 86 | } 87 | return false; 88 | } 89 | }; 90 | return next(ConstantPushInstruction.class, constraint); 91 | } 92 | 93 | public ConstantPushInstruction previousConstant(final int... values) { 94 | Constraint constraint = new Constraint() { 95 | public boolean accept(Instruction instr) { 96 | ConstantPushInstruction cpi = (ConstantPushInstruction) instr; 97 | for (int val : values) { 98 | if (cpi.getValue().equals(val)) { 99 | return true; 100 | } 101 | } 102 | return false; 103 | } 104 | }; 105 | return previous(ConstantPushInstruction.class, constraint); 106 | } 107 | 108 | } 109 | -------------------------------------------------------------------------------- /src/injection/transforms/Canvas.java: -------------------------------------------------------------------------------- 1 | 2 | package injection.transforms; 3 | 4 | 5 | import jdk.internal.org.objectweb.asm.Opcodes; 6 | import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode; 7 | import jdk.internal.org.objectweb.asm.tree.ClassNode; 8 | import jdk.internal.org.objectweb.asm.tree.MethodInsnNode; 9 | import jdk.internal.org.objectweb.asm.tree.MethodNode; 10 | 11 | import java.util.ListIterator; 12 | 13 | public class Canvas { 14 | public static ClassNode transformClass(ClassNode cn) { 15 | if (cn.superName.equals("java/awt/Canvas")) { 16 | System.out.println("Injected canvas: " + cn.name); 17 | cn.superName = "injection/wrappers/Canvas"; 18 | for (MethodNode mn : cn.methods) { 19 | if (mn.name.equals("")) { 20 | ListIterator ili = mn.instructions.iterator(); 21 | while (ili.hasNext()) { 22 | AbstractInsnNode ain = ili.next(); 23 | if (ain.getOpcode() == Opcodes.INVOKESPECIAL) { 24 | MethodInsnNode min = (MethodInsnNode) ain; 25 | min.owner = "injection/wrappers/Canvas"; 26 | break; 27 | } 28 | } 29 | break; 30 | } 31 | } 32 | } 33 | return cn; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/injection/transforms/KeyListener.java: -------------------------------------------------------------------------------- 1 | 2 | package injection.transforms; 3 | 4 | 5 | import environment.Data; 6 | import jdk.internal.org.objectweb.asm.Opcodes; 7 | import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode; 8 | import jdk.internal.org.objectweb.asm.tree.ClassNode; 9 | import jdk.internal.org.objectweb.asm.tree.MethodInsnNode; 10 | import jdk.internal.org.objectweb.asm.tree.MethodNode; 11 | 12 | import java.util.ListIterator; 13 | 14 | public class KeyListener { 15 | public static ClassNode transformClass(ClassNode cn){ 16 | if(cn.access==49){ 17 | for(MethodNode mn : cn.methods){ 18 | if(mn.name.startsWith("key") || mn.name.startsWith("focus")){ 19 | ClassNode superClass = Data.clientClasses.get(cn.superName); 20 | if(superClass!=null && !superClass.superName.equals("injection/wrappers/KeyListener")){ 21 | superClass.superName="injection/wrappers/KeyListener"; 22 | //System.out.println("Changed superclass of : "+superClass.name+" = "+superClass.superName); 23 | ListIterator mli = superClass.methods.listIterator(); 24 | while (mli.hasNext()) { 25 | MethodNode node = mli.next(); 26 | if (node.name.equals("")) { 27 | ListIterator ili = node.instructions.iterator(); 28 | while (ili.hasNext()) { 29 | AbstractInsnNode ain = ili.next(); 30 | if (ain.getOpcode() == Opcodes.INVOKESPECIAL) { 31 | MethodInsnNode min = (MethodInsnNode) ain; 32 | if(min.owner.equals("java/lang/Object")){ 33 | //System.out.println("Changed initialization owner."); 34 | min.owner = "injection/wrappers/KeyListener"; 35 | break; 36 | } 37 | } 38 | } 39 | break; 40 | } 41 | } 42 | } 43 | mn.name="_"+mn.name; 44 | //System.out.println("Hooked method : "+mn.name); 45 | } 46 | } 47 | } 48 | return cn; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/injection/transforms/MouseListener.java: -------------------------------------------------------------------------------- 1 | 2 | package injection.transforms; 3 | 4 | 5 | import environment.Data; 6 | import jdk.internal.org.objectweb.asm.Opcodes; 7 | import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode; 8 | import jdk.internal.org.objectweb.asm.tree.ClassNode; 9 | import jdk.internal.org.objectweb.asm.tree.MethodInsnNode; 10 | import jdk.internal.org.objectweb.asm.tree.MethodNode; 11 | 12 | import java.util.ListIterator; 13 | 14 | public class MouseListener { 15 | public static ClassNode transformClass(ClassNode cn){ 16 | for(MethodNode mn : cn.methods){ 17 | if(mn.name.startsWith("mouse")){ 18 | ClassNode superClass = Data.clientClasses.get(cn.superName); 19 | if(superClass!=null && !superClass.superName.equals("injection/wrappers/MouseListener")){ 20 | superClass.superName="injection/wrappers/MouseListener"; 21 | System.out.println("Changed superclass of : "+superClass.name+" = "+superClass.superName); 22 | for (MethodNode node : superClass.methods) { 23 | if (node.name.equals("")) { 24 | ListIterator ili = node.instructions.iterator(); 25 | while (ili.hasNext()) { 26 | AbstractInsnNode ain = ili.next(); 27 | if (ain.getOpcode() == Opcodes.INVOKESPECIAL) { 28 | MethodInsnNode min = (MethodInsnNode) ain; 29 | if (min.owner.equals("java/lang/Object")) { 30 | System.out.println("Changed initialization owner."); 31 | min.owner = "injection/wrappers/MouseListener"; 32 | break; 33 | } 34 | } 35 | } 36 | break; 37 | } 38 | } 39 | } 40 | mn.name="_"+mn.name; 41 | System.out.println("Hooked method : "+mn.name); 42 | } 43 | } 44 | return cn; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/injection/wrappers/Canvas.java: -------------------------------------------------------------------------------- 1 | 2 | package injection.wrappers; 3 | 4 | import environment.Data; 5 | import gui.AppletFrame; 6 | 7 | import java.awt.*; 8 | import java.awt.image.BufferedImage; 9 | 10 | import api.methods.Client; 11 | import api.methods.Players; 12 | 13 | public class Canvas extends java.awt.Canvas { 14 | private static BufferedImage gameImage = new BufferedImage(765, 503, BufferedImage.TYPE_INT_RGB); 15 | 16 | @Override 17 | public void paint(Graphics g) 18 | { 19 | 20 | 21 | } 22 | 23 | @Override 24 | public void update(Graphics g) 25 | { 26 | 27 | 28 | } 29 | 30 | 31 | public void repaint(Graphics g) 32 | { 33 | 34 | 35 | } 36 | 37 | @Override 38 | public Graphics getGraphics() { 39 | Graphics g = gameImage.getGraphics(); 40 | g.setColor(Color.CYAN); 41 | if(Data.appletFrame != null && Client.getMyPlayer() != null) 42 | { 43 | g.drawString("Screen Size - " + Data.appletFrame.getSize().getWidth() + "," + Data.appletFrame.getSize().getHeight(), 5, 15); 44 | g.drawString("Base X - " + Client.getBaseX() + ", Base Y - " + Client.getBaseY(), 5, 30); 45 | g.drawString("Player X - " + Client.getMyPlayer().getLocationX() + ", Player Y - " + Client.getMyPlayer().getLocationY(), 5, 45); 46 | g.drawString("Region X - " + Client.getCurrentRegionX() + ", Region Y - " + Client.getCurrentRegionY(), 5, 60); 47 | if((gameImage.getWidth() != Data.appletFrame.getSize().getWidth()) || (gameImage.getHeight() != Data.appletFrame.getSize().getHeight())) gameImage = new BufferedImage((int)Data.appletFrame.getSize().getWidth(), (int)Data.appletFrame.getSize().getHeight(), BufferedImage.TYPE_INT_RGB); 48 | } 49 | 50 | if(Data.hd != AppletFrame.hdCheck.getState()) 51 | { 52 | Data.hd = AppletFrame.hdCheck.getState(); 53 | if(Data.hd) 54 | { 55 | Data.appletFrame.setSize(765, 503); 56 | Data.CLIENT_APPLET.setBounds(5, 5, 765, 503); 57 | } 58 | if(!Data.debugFrame) Data.appletFrame.setVisible(Data.hd ? false : true); 59 | } 60 | 61 | if(RuneHD.bufImage == null) RuneHD.bufImage = gameImage; 62 | if(Data.hd) RuneHD.sendScreen = true; 63 | if(!Data.hd || Data.debugFrame) super.getGraphics().drawImage(gameImage, 0, 0, null); 64 | return g; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/injection/wrappers/FocusListener.java: -------------------------------------------------------------------------------- 1 | 2 | package injection.wrappers; 3 | 4 | import java.awt.event.FocusEvent; 5 | 6 | public abstract class FocusListener implements java.awt.event.FocusListener{ 7 | public abstract void _focusGained(FocusEvent fe); 8 | public abstract void _focusLost(FocusEvent fe); 9 | @Override 10 | public void focusGained(FocusEvent arg0) { 11 | _focusGained(arg0); 12 | } 13 | @Override 14 | public void focusLost(FocusEvent arg0) { 15 | _focusLost(arg0); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/injection/wrappers/KeyListener.java: -------------------------------------------------------------------------------- 1 | 2 | package injection.wrappers; 3 | 4 | import java.awt.event.KeyEvent; 5 | 6 | public abstract class KeyListener extends FocusListener implements java.awt.event.KeyListener{ 7 | public abstract void _keyPressed(KeyEvent e); 8 | public abstract void _keyReleased(KeyEvent e); 9 | public abstract void _keyTyped(KeyEvent e); 10 | @Override 11 | public void keyPressed(KeyEvent e) { 12 | _keyPressed(e); 13 | } 14 | @Override 15 | public void keyReleased(KeyEvent e) { 16 | _keyReleased(e); 17 | } 18 | @Override 19 | public void keyTyped(KeyEvent e) { 20 | _keyTyped(e); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/injection/wrappers/RuneHD.java: -------------------------------------------------------------------------------- 1 | package injection.wrappers; 2 | 3 | import java.applet.Applet; 4 | import java.awt.Component; 5 | import java.awt.Container; 6 | import java.awt.Dimension; 7 | import java.awt.Graphics; 8 | import java.awt.Graphics2D; 9 | import java.awt.Point; 10 | import java.awt.Rectangle; 11 | import java.awt.Robot; 12 | import java.awt.Toolkit; 13 | import java.awt.image.BufferedImage; 14 | import java.io.BufferedReader; 15 | import java.io.ByteArrayOutputStream; 16 | import java.io.DataInputStream; 17 | import java.io.DataOutputStream; 18 | import java.io.File; 19 | import java.io.IOException; 20 | import java.io.InputStream; 21 | import java.io.InputStreamReader; 22 | import java.io.OutputStream; 23 | import java.io.UnsupportedEncodingException; 24 | import java.net.ConnectException; 25 | import java.net.DatagramPacket; 26 | import java.net.DatagramSocket; 27 | import java.net.InetAddress; 28 | import java.net.ServerSocket; 29 | import java.net.Socket; 30 | import java.net.SocketAddress; 31 | import java.net.SocketException; 32 | 33 | import javax.imageio.ImageIO; 34 | import javax.swing.JFrame; 35 | 36 | import api.methods.Client; 37 | import api.wrappers.NPCNode; 38 | import api.wrappers.Player; 39 | 40 | import java.awt.Canvas; 41 | 42 | public class RuneHD implements Runnable { 43 | 44 | public static BufferedImage bufImage; 45 | private static byte[] imageBytes; 46 | private static byte[] gameInfo; 47 | public static DatagramSocket socket; 48 | public static boolean sendScreen = false; 49 | 50 | @Override 51 | public void run() { 52 | System.out.println("Starting OSHD Server"); 53 | try { 54 | socket = new DatagramSocket(); 55 | } catch (SocketException e) { 56 | e.printStackTrace(); 57 | } 58 | while(true) 59 | { 60 | if(!sendScreen) 61 | { 62 | try { 63 | Thread.sleep(1); 64 | } catch (InterruptedException e) { 65 | // TODO Auto-generated catch block 66 | e.printStackTrace(); 67 | } 68 | } 69 | if(sendScreen) 70 | { 71 | sendScreen = false; 72 | try { 73 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); 74 | ImageIO.write(bufImage, "jpg", baos); 75 | baos.flush(); 76 | imageBytes = PacketType((byte)0,baos.toByteArray()); 77 | baos.close(); 78 | GetGameInfo(); 79 | gameInfo = PacketType((byte)1,gameInfo); 80 | socket.send(toDatagram(imageBytes, 81 | InetAddress.getByName("127.0.0.1"), 43592)); 82 | 83 | socket.send(toDatagram(gameInfo, 84 | InetAddress.getByName("127.0.0.1"), 43592)); 85 | } catch (Exception e) { 86 | e.printStackTrace(); 87 | } 88 | } 89 | } 90 | } 91 | 92 | public static void GetGameInfo() 93 | { 94 | String gameData = ""; 95 | 96 | gameData += "Players:"; 97 | Player[] allPlayers = Client.getPlayerArray(); 98 | for(Player player : allPlayers) 99 | { 100 | if(player != null) 101 | { 102 | gameData += player.getPlayerName() + ","; 103 | gameData += player.getLocationX() + ","; 104 | gameData += player.getLocationY() + ","; 105 | gameData += player.getHeight() + ","; 106 | gameData += player.getLevel(); 107 | gameData += "#"; 108 | } 109 | } 110 | gameData += "}"; 111 | 112 | gameData += "Npcs:"; 113 | NPCNode[] allNpcs = Client.getNPCNodeArray(); 114 | for(NPCNode npc : allNpcs) 115 | { 116 | if(npc != null && npc.getNPC() != null) 117 | { 118 | gameData += npc.getNPC().getNPCName() + ","; 119 | gameData += npc.getNPC().getLocationX() + ","; 120 | gameData += npc.getNPC().getLocationY() + ","; 121 | gameData += npc.getNPC().getHeight() + ","; 122 | gameData += npc.getNPC().getLevel() + ","; 123 | gameData += npc.getUnique(); 124 | gameData += "#"; 125 | } 126 | } 127 | gameData += "}"; 128 | 129 | gameData += "GameInfo:"; 130 | gameData += Client.getBaseX() + ","; 131 | gameData += Client.getBaseY() + ","; 132 | gameData += Client.getCameraX() + ","; 133 | gameData += Client.getCameraY() + ","; 134 | gameData += Client.getCameraZ() + ","; 135 | gameData += Client.getCameraPitch() + ","; 136 | gameData += Client.getCameraYaw() + ","; 137 | gameData += Client.getCurrentRegionX() + ","; 138 | gameData += Client.getCurrentRegionY(); 139 | gameData += "}"; 140 | 141 | try { 142 | gameInfo = gameData.getBytes("UTF-8"); 143 | } catch (UnsupportedEncodingException e) { 144 | // TODO Auto-generated catch block 145 | e.printStackTrace(); 146 | } 147 | 148 | } 149 | 150 | public static byte[] PacketType(byte packetId, byte[] input) 151 | { 152 | byte[] returnBytes = new byte[input.length + 1]; 153 | returnBytes[0] = packetId; 154 | for(int i = 0; i < input.length; ++i) returnBytes[i+1] = input[i]; 155 | return returnBytes; 156 | } 157 | 158 | public static DatagramPacket toDatagram(byte[] buf, InetAddress destIA, 159 | int destPort) { 160 | // Deprecated in Java 1.1, but it works: 161 | if(buf.length >= 64000) return new DatagramPacket(new byte[]{buf[0]}, 1, destIA, destPort); 162 | return new DatagramPacket(buf, buf.length, destIA, destPort); 163 | } 164 | 165 | } -------------------------------------------------------------------------------- /src/reflection/ClassHook.java: -------------------------------------------------------------------------------- 1 | 2 | package reflection; 3 | 4 | 5 | import environment.Data; 6 | import jdk.internal.org.objectweb.asm.Opcodes; 7 | import jdk.internal.org.objectweb.asm.tree.ClassNode; 8 | 9 | import java.lang.reflect.Field; 10 | import java.util.HashMap; 11 | 12 | public class ClassHook { 13 | private ClassNode bytecodeClass; 14 | private Class reflectedClass; 15 | private String refactoredName = ""; 16 | private HashMap fieldHooks = new HashMap<>(); 17 | 18 | public ClassHook(String name, ClassNode cn) { 19 | refactoredName = name; 20 | bytecodeClass = cn; 21 | } 22 | 23 | public boolean addFieldHook(FieldHook fh) { 24 | return fieldHooks.put(fh.getRefactoredName(), fh) != null; 25 | } 26 | 27 | public FieldHook[] getAllFieldHooks() { 28 | return fieldHooks.values().toArray(new FieldHook[]{}); 29 | } 30 | 31 | public String getClassName() { 32 | return reflectedClass.getName(); 33 | } 34 | 35 | public FieldHook getFieldHook(String refName) { 36 | return fieldHooks.get(refName); 37 | } 38 | 39 | public String getRefactoredName() { 40 | return refactoredName; 41 | } 42 | 43 | public void loadRuntime() { 44 | try { 45 | reflectedClass = Data.LOADER.loadClass(bytecodeClass.name); 46 | if (reflectedClass == null) { 47 | System.out.println("ClassLoader failed to load class : " + bytecodeClass.name); 48 | return; 49 | } 50 | System.out.println("Loaded runtime class hook : " + refactoredName); 51 | System.out.println("Loading " + fieldHooks.size() + " field hooks..."); 52 | HashMap staticFields = new HashMap<>(); 53 | for (FieldHook fh : fieldHooks.values()) { 54 | for (Field f : reflectedClass.getDeclaredFields()) { 55 | if (f.getName().equals(fh.getName())) { 56 | fh.setHook(f); 57 | if (fh.getBytecodeField().access == Opcodes.ACC_STATIC) { 58 | staticFields.put(fh.getRefactoredName(), fh); 59 | System.out.println("Loaded runtime static hook : " + fh.getRefactoredName()); 60 | } else 61 | System.out.println("Loaded runtime field hook : " + fh.getRefactoredName()); 62 | } 63 | } 64 | } 65 | for (FieldHook fh : staticFields.values()) { 66 | Data.staticFieldHooks.put(fh.getRefactoredName(), fh); 67 | fieldHooks.remove(fh.getRefactoredName()); 68 | } 69 | } catch (Exception e) { 70 | System.out.println("Failed to load runtime class hook : " + refactoredName); 71 | e.printStackTrace(); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/reflection/FieldHook.java: -------------------------------------------------------------------------------- 1 | 2 | package reflection; 3 | 4 | 5 | import environment.Data; 6 | import jdk.internal.org.objectweb.asm.tree.FieldNode; 7 | 8 | import java.lang.reflect.Field; 9 | 10 | public class FieldHook { 11 | private String refactoredName = ""; 12 | private Field reflectedField = null; 13 | private FieldNode bytecodeField; 14 | private int intMultiplier = 1; 15 | private long longMultiplier = 1; 16 | 17 | public FieldHook(String name, FieldNode fn) { 18 | refactoredName = name; 19 | bytecodeField = fn; 20 | } 21 | 22 | /** 23 | * Gets the field value. 24 | * Static field use only. 25 | * 26 | * @return Field data 27 | */ 28 | public Object get() { 29 | try { 30 | boolean isAccessible = reflectedField.isAccessible(); 31 | if (!isAccessible) 32 | reflectedField.setAccessible(true); 33 | Object data = reflectedField.get(Data.clientBootClass); 34 | if (!isAccessible) 35 | reflectedField.setAccessible(false); 36 | return data; 37 | } catch (Exception e) { 38 | //Should not happen. 39 | return null; 40 | } 41 | } 42 | 43 | /** 44 | * Gets the field value. 45 | * For non-static fields. 46 | * 47 | * @param Parent instance 48 | * @return Field data 49 | */ 50 | public Object get(Object parent) { 51 | try { 52 | boolean isAccessible = reflectedField.isAccessible(); 53 | if (!isAccessible) 54 | reflectedField.setAccessible(true); 55 | Object data = reflectedField.get(parent); 56 | if (!isAccessible) 57 | reflectedField.setAccessible(false); 58 | return data; 59 | } catch (Exception e) { 60 | //Should not happen in wrappers. 61 | return null; 62 | } 63 | } 64 | 65 | public FieldNode getBytecodeField() { 66 | return bytecodeField; 67 | } 68 | 69 | public int getIntMultiplier() { 70 | return intMultiplier; 71 | } 72 | 73 | public long getLongMultiplier() { 74 | return longMultiplier; 75 | } 76 | 77 | public String getName() { 78 | return bytecodeField.name; 79 | } 80 | 81 | public Field getReflectedField() { 82 | return reflectedField; 83 | } 84 | 85 | public String getRefactoredName() { 86 | return refactoredName; 87 | } 88 | 89 | public void setHook(Field f) { 90 | reflectedField = f; 91 | } 92 | 93 | public void setMultiplier(int i) { 94 | intMultiplier = i; 95 | } 96 | 97 | public void setMultiplier(long l) { 98 | longMultiplier = l; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/rsloader/ClientDownloader.java: -------------------------------------------------------------------------------- 1 | package rsloader; 2 | 3 | import java.io.FileOutputStream; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.net.URL; 7 | 8 | public class ClientDownloader { 9 | public ClientDownloader(String jarLocation) { 10 | long start = System.currentTimeMillis(); 11 | System.out.println("\n[ - Client Downloader - ]"); 12 | if (!jarLocation.equals("")) { 13 | System.out.println("JAR Location : " + jarLocation); 14 | System.out.println("Downloading runescape client... "); 15 | if (downloadFile(jarLocation)) { 16 | System.out.println("Succesfully downloaded client in : " + (System.currentTimeMillis() - start) + "ms"); 17 | } else 18 | System.out.println("Failed to download client."); 19 | } else 20 | System.out.println("Invalid JAR Location!"); 21 | 22 | } 23 | 24 | @SuppressWarnings("unused") 25 | private boolean downloadFile(final String link) { 26 | try { 27 | URL url = new URL(link); 28 | url.openConnection(); 29 | InputStream reader = url.openStream(); 30 | FileOutputStream writer = new FileOutputStream("gamepack.jar"); 31 | byte[] buffer = new byte[153600]; 32 | int read; 33 | while ((read = reader.read(buffer)) > 0) { 34 | writer.write(buffer, 0, read); 35 | buffer = new byte[153600]; 36 | } 37 | writer.close(); 38 | reader.close(); 39 | } catch (IOException e) { 40 | e.printStackTrace(); 41 | } 42 | return false; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/rsloader/PageParser.java: -------------------------------------------------------------------------------- 1 | package rsloader; 2 | 3 | import environment.Data; 4 | 5 | import java.io.DataInputStream; 6 | import java.net.URL; 7 | import java.net.URLConnection; 8 | import java.util.Random; 9 | import java.util.regex.Matcher; 10 | import java.util.regex.Pattern; 11 | 12 | public class PageParser { 13 | private String HTML; 14 | public static String jarLocation; 15 | 16 | public PageParser() { 17 | long start = System.currentTimeMillis(); 18 | System.out.println("[ - Parameter Parser - ]"); 19 | if (!parseParams()) { 20 | System.out.println("Failed to parse parameters."); 21 | return; 22 | } 23 | System.out.println("Succesfully parsed parameters in : " + (System.currentTimeMillis() - start) + "ms"); 24 | //new ClientDownloader(jarLocation); 25 | } 26 | 27 | private String getContent(String link) { 28 | try { 29 | URL url = new URL(link); 30 | String referer = url.toExternalForm(); 31 | URLConnection uc = url.openConnection(); 32 | uc 33 | .addRequestProperty( 34 | "Accept", 35 | "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"); 36 | uc.addRequestProperty("Accept-Charset", 37 | "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); 38 | uc.addRequestProperty("Accept-Encoding", "gzip,deflate"); 39 | uc.addRequestProperty("Accept-Language", "en-gb,en;q=0.5"); 40 | uc.addRequestProperty("Connection", "keep-alive"); 41 | uc.addRequestProperty("Host", "www.runescape.com"); 42 | uc.addRequestProperty("Keep-Alive", "300"); 43 | if (referer != null) 44 | uc.addRequestProperty("Referer", referer); 45 | uc 46 | .addRequestProperty( 47 | "User-Agent", 48 | "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6"); 49 | DataInputStream di = new DataInputStream(uc.getInputStream()); 50 | byte[] buffer = new byte[uc.getContentLength()]; 51 | di.readFully(buffer); 52 | di.close(); 53 | Thread.sleep(250 + (int) (Math.random() * 500)); 54 | return new String(buffer); 55 | } catch (Exception e) { 56 | e.printStackTrace(); 57 | } 58 | return null; 59 | } 60 | 61 | private String getUrl() throws Exception { 62 | return Data.BASE_LINK + ext("archive=", " ", HTML); 63 | } 64 | 65 | private String ext(String from, String to, String str1) { 66 | int p = 0; 67 | p = str1.indexOf(from, p) + from.length(); 68 | return str1.substring(p, str1.indexOf(to, p)); 69 | } 70 | 71 | private String getNewBaseLink() { 72 | int[] worlds = {27}; 73 | return "http://oldschool" + worlds[new Random().nextInt(worlds.length)] + ".runescape.com/"; 74 | } 75 | 76 | private String remove(String str) { 77 | return str.replaceAll("\"", ""); 78 | } 79 | 80 | private boolean parseParams() { 81 | try { 82 | System.out.println("Parsing parameters..."); 83 | Data.BASE_LINK = getNewBaseLink(); 84 | System.out.println("Base Link : " + Data.BASE_LINK); 85 | HTML = getContent(Data.BASE_LINK); 86 | Pattern regex = Pattern.compile("]*)\"?>", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); 87 | Matcher regexMatcher = regex.matcher(HTML); 88 | while (regexMatcher.find()) 89 | if (!Data.PARAMETERS.containsKey(regexMatcher.group(1))) { 90 | Data.PARAMETERS.put(remove(regexMatcher.group(1)), remove(regexMatcher.group(2))); 91 | } 92 | jarLocation = getUrl(); 93 | System.out.println(jarLocation); 94 | return true; 95 | } catch (Exception e) { 96 | e.printStackTrace(); 97 | } 98 | return false; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/rsloader/RSClassLoader.java: -------------------------------------------------------------------------------- 1 | 2 | package rsloader; 3 | 4 | import java.io.File; 5 | import java.io.InputStream; 6 | import java.util.Enumeration; 7 | import java.util.HashMap; 8 | import java.util.Hashtable; 9 | import java.util.jar.JarEntry; 10 | import java.util.jar.JarFile; 11 | 12 | public class RSClassLoader extends ClassLoader { 13 | public Hashtable> classes = new Hashtable<>(); 14 | public HashMap classBytes = new HashMap<>(); 15 | 16 | public RSClassLoader(File file) { 17 | super(RSClassLoader.class.getClassLoader()); 18 | 19 | try { 20 | JarFile jar = new JarFile(file); 21 | Enumeration entries = jar.entries(); 22 | while (entries.hasMoreElements()) { 23 | JarEntry entry = entries.nextElement(); 24 | byte[] buffer = new byte[1024]; 25 | int read; 26 | InputStream is = jar.getInputStream(entry); 27 | byte[] allByteData = new byte[0]; 28 | while ((read = is.read(buffer)) != -1) { 29 | byte[] tempBuff = new byte[read + allByteData.length]; 30 | System.arraycopy(allByteData, 0, tempBuff, 0, allByteData.length); 31 | System.arraycopy(buffer, 0, tempBuff, allByteData.length, read); 32 | allByteData = tempBuff; 33 | } 34 | classBytes.put(entry.getName(), allByteData); 35 | } 36 | 37 | } catch (Exception e) { 38 | e.printStackTrace(); 39 | } 40 | } 41 | 42 | public Class loadClass(String name) throws ClassNotFoundException { 43 | String entryName = name.replace('.', '/') + ".class"; 44 | if (classes.containsKey(name)) 45 | return classes.get(name); 46 | if (this.classBytes.containsKey(entryName)) { 47 | byte[] buf = this.classBytes.get(entryName); 48 | Class clazz = defineClass(name, buf, 0, buf.length); 49 | if (clazz != null) { 50 | classes.put(name, clazz); 51 | return clazz; 52 | } 53 | } 54 | return super.loadClass(name); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/script/ScriptDef.java: -------------------------------------------------------------------------------- 1 | 2 | package script; 3 | 4 | 5 | import environment.Data; 6 | 7 | import java.awt.*; 8 | import java.util.Random; 9 | 10 | public abstract class ScriptDef extends Thread { 11 | public boolean isPaused = false; 12 | 13 | public static int random(int min, int max) { 14 | return new Random().nextInt(max - min) + min; 15 | } 16 | 17 | public static void sleep(long delay) { 18 | try { 19 | Thread.sleep(delay); 20 | } catch (Exception e) { 21 | } 22 | } 23 | 24 | public abstract void run(); 25 | 26 | public abstract void repaint(Graphics g); 27 | 28 | @SuppressWarnings("deprecation") 29 | public void stopScript() { 30 | isPaused = false; 31 | if (this.equals(Data.currentScript)) { 32 | Data.appletFrame.startScriptOption.setLabel("Start Script"); 33 | Data.appletFrame.pauseScriptOption.setLabel("Pause Script"); 34 | Data.appletFrame.pauseScriptOption.setEnabled(false); 35 | Data.currentScript = null; 36 | Runtime.getRuntime().gc(); 37 | } 38 | this.stop(); 39 | } 40 | 41 | @SuppressWarnings("deprecation") 42 | public void pause() { 43 | isPaused = true; 44 | this.suspend(); 45 | } 46 | 47 | @SuppressWarnings("deprecation") 48 | public void unpause() { 49 | isPaused = false; 50 | this.resume(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/script/ScriptLoader.java: -------------------------------------------------------------------------------- 1 | 2 | package script; 3 | 4 | import java.io.ByteArrayOutputStream; 5 | import java.io.File; 6 | import java.io.FileInputStream; 7 | import java.io.InputStream; 8 | import java.util.Enumeration; 9 | import java.util.HashMap; 10 | import java.util.jar.JarEntry; 11 | import java.util.jar.JarFile; 12 | 13 | /** 14 | * org.dynamac.bot.script 15 | * Date: 17/12/12 16 | * Time: 11:13 17 | */ 18 | public class ScriptLoader extends ClassLoader { 19 | private HashMap classes; 20 | 21 | public ScriptLoader(String path) { 22 | super(ScriptLoader.class.getClassLoader()); 23 | 24 | this.classes = new HashMap<>(); 25 | if (path.endsWith(".jar")) { 26 | try { 27 | JarFile jar = new JarFile(new File(path)); 28 | Enumeration entries = jar.entries(); 29 | while (entries.hasMoreElements()) { 30 | JarEntry entry = entries.nextElement(); 31 | if (entry.getName().endsWith(".class")) { 32 | InputStream in = jar.getInputStream(entry); 33 | ByteArrayOutputStream out = new ByteArrayOutputStream(); 34 | byte[] data = new byte[4096]; 35 | int len; 36 | while ((len = in.read(data)) != -1) { 37 | out.write(data, 0, len); 38 | } 39 | System.out.println(entry.getName()); 40 | classes.put(entry.getName(), out.toByteArray()); 41 | } 42 | } 43 | 44 | } catch (Exception e) { 45 | e.printStackTrace(); 46 | } 47 | } else if (path.endsWith(".class")) { 48 | try { 49 | File clazz = new File(path); 50 | FileInputStream stream = new FileInputStream(clazz); 51 | byte[] bytes = new byte[stream.available()]; 52 | stream.read(bytes); 53 | classes.put(clazz.getName(), bytes); 54 | stream.close(); 55 | } catch (Exception ignored) { 56 | } 57 | } 58 | } 59 | 60 | 61 | @Override 62 | public Class loadClass(String name) throws ClassNotFoundException { 63 | System.out.println("Trying to load class : " + name); 64 | String entry = name.replace('.', '/') + ".class"; 65 | if (this.classes.containsKey(entry)) { 66 | try { 67 | byte[] buf = this.classes.remove(entry); 68 | return defineClass(name, buf, 0, buf.length); 69 | } catch (Exception ignored) { 70 | } 71 | } 72 | try { 73 | return getClass().getClassLoader().loadClass(name); 74 | } catch (Exception ignored) { 75 | } 76 | return super.loadClass(name); 77 | } 78 | } --------------------------------------------------------------------------------