::06 & ::osrs commands to switch GameFrames

This commit is contained in:
Ethan
2019-12-16 02:09:57 -06:00
parent de6a734588
commit e0cb723396
17 changed files with 161 additions and 65 deletions
+2
View File
@@ -0,0 +1,2 @@
# Default ignored files
/workspace.xml
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+54 -24
View File
@@ -2906,20 +2906,22 @@ public class Client extends GameApplet {
public void drawSideIcons() { public void drawSideIcons() {
// local variables will not stay in memory which will help with
// performance.
final int[] sideIconsX = {17, 49, 83, 114, 146, 180, 214, 16, 49, 82, 116, 148, 184, 216},
sideIconsY = {9, 7, 7, 5, 2, 3, 7, 303, 306, 306, 302, 305, 303, 303, 303},
sideIconsId = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
sideIconsTab = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 247; int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 247;
int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 336; int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 336;
int[] x;
int[] y;
if(frameMode == ScreenMode.FIXED && !Configuration.OSRS_GAMEFRAME) {
x = GameFrameIds.REDONE_ICONS_X;
y = GameFrameIds.REDONE_ICONS_Y;
} else {
x = GameFrameIds.OSRS_ICONS_X;
y = GameFrameIds.OSRS_ICONS_Y;
}
if (frameMode == ScreenMode.FIXED || frameMode != ScreenMode.FIXED && !changeTabArea) { if (frameMode == ScreenMode.FIXED || frameMode != ScreenMode.FIXED && !changeTabArea) {
for (int i = 0; i < sideIconsTab.length; i++) { for (int i = 0; i < GameFrameIds.SIDE_ICONS_ID.length; i++) {
if (tabInterfaceIDs[sideIconsTab[i]] != -1) { if (tabInterfaceIDs[GameFrameIds.SIDE_ICONS_ID[i]] != -1) {
if (sideIconsId[i] != -1) { if (GameFrameIds.SIDE_ICONS_ID[i] != -1) {
sideIcons[sideIconsId[i]].drawSprite(sideIconsX[i] + xOffset, sideIconsY[i] + yOffset); sideIcons[GameFrameIds.SIDE_ICONS_ID[i]].drawSprite(x[i] + xOffset, y[i] + yOffset);
} }
} }
} }
@@ -2927,8 +2929,8 @@ public class Client extends GameApplet {
int[] iconId = {0, 1, 2, 3, 4, 5, 6, -1, 8, 9, 7, 11, 12, 13}; int[] iconId = {0, 1, 2, 3, 4, 5, 6, -1, 8, 9, 7, 11, 12, 13};
int[] iconX = {219, 189, 156, 126, 93, 62, 30, 219, 189, 156, 124, 92, 59, 28}; int[] iconX = {219, 189, 156, 126, 93, 62, 30, 219, 189, 156, 124, 92, 59, 28};
int[] iconY = {67, 69, 67, 69, 72, 72, 69, 32, 29, 29, 32, 30, 33, 31, 32}; int[] iconY = {67, 69, 67, 69, 72, 72, 69, 32, 29, 29, 32, 30, 33, 31, 32};
for (int i = 0; i < sideIconsTab.length; i++) { for (int i = 0; i < GameFrameIds.SIDE_ICONS_ID.length; i++) {
if (tabInterfaceIDs[sideIconsTab[i]] != -1) { if (tabInterfaceIDs[GameFrameIds.SIDE_ICONS_ID[i]] != -1) {
if (iconId[i] != -1) { if (iconId[i] != -1) {
sideIcons[iconId[i]].drawSprite(frameWidth - iconX[i], frameHeight - iconY[i]); sideIcons[iconId[i]].drawSprite(frameWidth - iconX[i], frameHeight - iconY[i]);
} }
@@ -2938,8 +2940,8 @@ public class Client extends GameApplet {
int[] iconId = {0, 1, 2, 3, 4, 5, 6, -1, 8, 9, 7, 11, 12, 13}; int[] iconId = {0, 1, 2, 3, 4, 5, 6, -1, 8, 9, 7, 11, 12, 13};
int[] iconX = {50, 80, 114, 143, 176, 208, 240, 242, 273, 306, 338, 370, 404, 433}; int[] iconX = {50, 80, 114, 143, 176, 208, 240, 242, 273, 306, 338, 370, 404, 433};
int[] iconY = {30, 32, 30, 32, 34, 34, 32, 32, 29, 29, 32, 31, 32, 32, 32}; int[] iconY = {30, 32, 30, 32, 34, 34, 32, 32, 29, 29, 32, 31, 32, 32, 32};
for (int i = 0; i < sideIconsTab.length; i++) { for (int i = 0; i < GameFrameIds.SIDE_ICONS_ID.length; i++) {
if (tabInterfaceIDs[sideIconsTab[i]] != -1) { if (tabInterfaceIDs[GameFrameIds.SIDE_ICONS_ID[i]] != -1) {
if (iconId[i] != -1) { if (iconId[i] != -1) {
sideIcons[iconId[i]].drawSprite(frameWidth - 461 + iconX[i], frameHeight - iconY[i]); sideIcons[iconId[i]].drawSprite(frameWidth - 461 + iconX[i], frameHeight - iconY[i]);
} }
@@ -2950,16 +2952,24 @@ public class Client extends GameApplet {
private void drawRedStones() { private void drawRedStones() {
final int[] redStonesX = {6, 44, 77, 110, 143, 176, 209, 6, 44, 77, 110, 143, 176, 209},
redStonesY = {0, 0, 0, 0, 0, 0, 0, 298, 298, 298, 298, 298, 298, 298},
redStonesId = {35, 39, 39, 39, 39, 39, 36, 37, 39, 39, 39, 39, 39, 38};
int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 247; int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 247;
int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 336; int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 336;
int[] stones;
int[] x;
int[] y;
if(frameMode == ScreenMode.FIXED && !Configuration.OSRS_GAMEFRAME) {
stones = GameFrameIds.REDONE_STONES_IDS;
x = GameFrameIds.REDONE_STONES_X;
y = GameFrameIds.REDONE_STONES_Y;
} else {
stones = GameFrameIds.OSRS_STONES_IDS;
x = GameFrameIds.OSRS_STONES_X;
y = GameFrameIds.OSRS_STONES_Y;
}
if (frameMode == ScreenMode.FIXED || frameMode != ScreenMode.FIXED && !changeTabArea) { if (frameMode == ScreenMode.FIXED || frameMode != ScreenMode.FIXED && !changeTabArea) {
if (tabInterfaceIDs[tabId] != -1 && tabId != 15) { if (tabInterfaceIDs[tabId] != -1 && tabId != 15) {
SpriteCache.lookup(redStonesId[tabId]).drawSprite(redStonesX[tabId] + xOffset, SpriteCache.lookup(stones[tabId]).drawSprite(x[tabId] + xOffset,
redStonesY[tabId] + yOffset); y[tabId] + yOffset);
} }
} else if (changeTabArea && frameWidth < 1000) { } else if (changeTabArea && frameWidth < 1000) {
int[] stoneX = {226, 194, 162, 130, 99, 65, 34, 219, 195, 161, 130, 98, 65, 33}; int[] stoneX = {226, 194, 162, 130, 99, 65, 34, 219, 195, 161, 130, 98, 65, 33};
@@ -2985,12 +2995,18 @@ public class Client extends GameApplet {
tabImageProducer.initDrawingArea(); tabImageProducer.initDrawingArea();
} }
Rasterizer3D.scanOffsets = anIntArray1181; Rasterizer3D.scanOffsets = anIntArray1181;
final int fixedInventory;
if(Configuration.OSRS_GAMEFRAME) {
fixedInventory = GameFrameIds.OSRS_INVENTORY;
} else {
fixedInventory = GameFrameIds.REDONE_INVENTORY;
}
if (frameMode == ScreenMode.FIXED) { if (frameMode == ScreenMode.FIXED) {
SpriteCache.lookup(21).drawSprite(0, 0); SpriteCache.lookup(fixedInventory).drawSprite(0, 0);
} else if (frameMode != ScreenMode.FIXED && !changeTabArea) { } else if (frameMode != ScreenMode.FIXED && !changeTabArea) {
Rasterizer2D.drawTransparentBox(frameWidth - 217, frameHeight - 304, 195, 270, 0x3E3529, Rasterizer2D.drawTransparentBox(frameWidth - 217, frameHeight - 304, 195, 270, 0x3E3529,
transparentTabArea ? 80 : 256); transparentTabArea ? 80 : 256);
SpriteCache.lookup(47).drawSprite(xOffset, yOffset); SpriteCache.lookup(GameFrameIds.OSRS_INVENTORY_2).drawSprite(xOffset, yOffset);
} else { } else {
if (frameWidth >= 1000) { if (frameWidth >= 1000) {
if (showTabComponents) { if (showTabComponents) {
@@ -6551,6 +6567,19 @@ public class Client extends GameApplet {
frameMode(ScreenMode.FIXED); frameMode(ScreenMode.FIXED);
} }
if (inputString.equals("::osrs")) {
Configuration.OSRS_GAMEFRAME = true;
drawRedStones();
drawSideIcons();
drawTabArea();
}
if (inputString.equals("::06")) {
Configuration.OSRS_GAMEFRAME = false;
drawRedStones();
drawSideIcons();
drawTabArea();
}
if (inputString.equals("::resize")) { if (inputString.equals("::resize")) {
frameMode(ScreenMode.RESIZABLE); frameMode(ScreenMode.RESIZABLE);
} }
@@ -7964,6 +7993,7 @@ public class Client extends GameApplet {
return; return;
} }
if (response == 2) { if (response == 2) {
botFrame.setTitle(Configuration.CLIENT_NAME + " - ["+StringUtils.capitalizeEachWord(myUsername)+"]");
myPrivilege = socketStream.read(); myPrivilege = socketStream.read();
flagged = socketStream.read() == 1; flagged = socketStream.read() == 1;
aLong1220 = 0L; aLong1220 = 0L;
@@ -13703,7 +13733,7 @@ public class Client extends GameApplet {
menuActionRow = 2; menuActionRow = 2;
} }
if (hpHover && Configuration.enableOrbs) { if (hpHover && Configuration.enableOrbs) {
menuActionText[1] = Configuration.hpAboveHeads ? "Turn HP Above Heads on" : "Turn HP Above heads off"; menuActionText[1] = Configuration.hpAboveHeads ? "Turn HP Above Heads on" : "Turn HP Above Heads off";
menuActionTypes[1] = 1508; menuActionTypes[1] = 1508;
menuActionRow = 2; menuActionRow = 2;
} }
@@ -13,6 +13,8 @@ public final class Configuration {
} }
public static boolean OSRS_GAMEFRAME = false;
public static final BigInteger RSA_MODULUS = new BigInteger( public static final BigInteger RSA_MODULUS = new BigInteger(
"91553247461173033466542043374346300088148707506479543786501537350363031301992107112953015516557748875487935404852620239974482067336878286174236183516364787082711186740254168914127361643305190640280157664988536979163450791820893999053469529344247707567448479470137716627440246788713008490213212272520901741443"); "91553247461173033466542043374346300088148707506479543786501537350363031301992107112953015516557748875487935404852620239974482067336878286174236183516364787082711186740254168914127361643305190640280157664988536979163450791820893999053469529344247707567448479470137716627440246788713008490213212272520901741443");
+14 -1
View File
@@ -70,7 +70,10 @@ public class GameApplet extends Applet implements Runnable, MouseListener,
public void refreshFrameSize(boolean undecorated, int width, int height, public void refreshFrameSize(boolean undecorated, int width, int height,
boolean resizable, boolean full) { boolean resizable, boolean full) {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
Client.botFrame.setResizable(true); if(!resizable) {
Client.botFrame.setSize(new Dimension(774, 559));
}
Client.botFrame.setResizable(resizable);
}); });
} }
@@ -263,6 +266,8 @@ public class GameApplet extends Applet implements Runnable, MouseListener,
public void mouseWheelMoved(MouseWheelEvent event) { public void mouseWheelMoved(MouseWheelEvent event) {
int rotation = event.getWheelRotation(); int rotation = event.getWheelRotation();
handleInterfaceScrolling(event); handleInterfaceScrolling(event);
final Rectangle viewport = new Rectangle(0, 0, 515,335);
final Point p = new Point(mouseX, mouseY);
if (mouseX > 0 && mouseX < 512 && mouseY > Client.frameHeight - 165 if (mouseX > 0 && mouseX < 512 && mouseY > Client.frameHeight - 165
&& mouseY < Client.frameHeight - 25) { && mouseY < Client.frameHeight - 25) {
int scrollPos = Client.anInt1089; int scrollPos = Client.anInt1089;
@@ -275,6 +280,14 @@ public class GameApplet extends Applet implements Runnable, MouseListener,
Client.anInt1089 = scrollPos; Client.anInt1089 = scrollPos;
Client.updateChatbox = true; Client.updateChatbox = true;
} }
} else {
if(Client.loggedIn && viewport.contains(p)) {
if (Client.cameraZoom < 1800 && rotation == 1) {
Client.cameraZoom = Client.cameraZoom + 20;
} else if (Client.cameraZoom > 20 && rotation == -1) {
Client.cameraZoom = Client.cameraZoom - 20;
}
}
} }
} }
@@ -0,0 +1,31 @@
package org.rebotted;
public class GameFrameIds {
public static int OSRS_INVENTORY = 21;
public static int OSRS_INVENTORY_2 = 47;
public static int REDONE_INVENTORY = 62;
public static int[] OSRS_STONES_X = {6, 44, 77, 110, 143, 176, 209, 6, 44, 77, 110, 143, 176, 209};
public static int[] REDONE_STONES_X = {20, 52, 80, 108, 151, 179, 207, 20, 52, 80, 108, 151, 179, 207};
public static int[] OSRS_STONES_Y = {0, 0, 0, 0, 0, 0, 0, 298, 298, 298, 298, 298, 298, 298};
public static int[] REDONE_STONES_Y = {0, 0, 0, 0, 0, 0, 0, 298, 298, 298, 298, 298, 298, 298};
public static int[] OSRS_STONES_IDS = {35, 39, 39, 39, 39, 39, 36, 37, 39, 39, 39, 39, 39, 38};
public static int[] REDONE_STONES_IDS = {63, 72, 68, 65, 70, 71, 64, 66, 70, 71, 69, 72, 68, 67};
public static int[] OSRS_ICONS_X = {17, 49, 83, 114, 146, 180, 214, 16, 49, 82, 116, 148, 184, 216},
OSRS_ICONS_Y = {9, 7, 7, 5, 2, 3, 7, 303, 306, 306, 302, 305, 303, 303, 303};
public static int[] REDONE_ICONS_X = {29, 54, 84, 116, 153, 182, 210, 28, 56, 84, 118, 155, 185, 210},
REDONE_ICONS_Y = {10, 8, 7, 5, 2, 3, 9, 300, 306, 306, 302, 305, 303, 303, 303};
public static int[] SIDE_ICONS_ID = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
}
+10 -1
View File
@@ -22,6 +22,7 @@ public final class Sprite extends Rasterizer2D {
private int offsetY; private int offsetY;
private int maxWidth; private int maxWidth;
private int maxHeight; private int maxHeight;
private byte[] spriteData;
public Sprite() { public Sprite() {
@@ -41,7 +42,7 @@ public final class Sprite extends Rasterizer2D {
this.maxHeight = height; this.maxHeight = height;
offsetX = 0; offsetX = 0;
offsetY = 0; offsetY = 0;
setSpriteData(sprite.getSpriteData());
myPixels = new int[width * height]; myPixels = new int[width * height];
System.arraycopy(sprite.myPixels, 0, myPixels, 0, myPixels.length); System.arraycopy(sprite.myPixels, 0, myPixels, 0, myPixels.length);
@@ -59,6 +60,7 @@ public final class Sprite extends Rasterizer2D {
maxHeight = myHeight; maxHeight = myHeight;
offsetX = 0; offsetX = 0;
offsetY = 0; offsetY = 0;
spriteData = data;
myPixels = new int[myWidth * myHeight]; myPixels = new int[myWidth * myHeight];
PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, myWidth, myHeight, myPixels, 0, myWidth); PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, myWidth, myHeight, myPixels, 0, myWidth);
pixelgrabber.grabPixels(); pixelgrabber.grabPixels();
@@ -941,4 +943,11 @@ public final class Sprite extends Rasterizer2D {
this.maxHeight = maxHeight; this.maxHeight = maxHeight;
} }
public byte[] getSpriteData() {
return spriteData;
}
public void setSpriteData(byte[] spriteData) {
this.spriteData = spriteData;
}
} }
+2 -6
View File
@@ -1,10 +1,7 @@
package org.rebotted.cache.graphics; package org.rebotted.cache.graphics;
import java.io.ByteArrayInputStream; import java.io.*;
import java.io.DataInputStream;
import java.io.IOException;
import org.apache.commons.compress.compressors.xz.XZCompressorInputStream; import org.apache.commons.compress.compressors.xz.XZCompressorInputStream;
import org.rebotted.io.Buffer; import org.rebotted.io.Buffer;
import org.rebotted.sign.SignLink; import org.rebotted.sign.SignLink;
import org.rebotted.util.FileUtils; import org.rebotted.util.FileUtils;
@@ -14,7 +11,7 @@ public final class SpriteCache {
private static Sprite[] sprites; private static Sprite[] sprites;
private static int totalSprites; private static int totalSprites;
private static int i = 0;
public static void load() { public static void load() {
Buffer data = new Buffer(FileUtils.readFile(SignLink.findcachedir() + "main_file_sprites.dat")); Buffer data = new Buffer(FileUtils.readFile(SignLink.findcachedir() + "main_file_sprites.dat"));
@@ -29,7 +26,6 @@ public final class SpriteCache {
sprites[index].setTransparency(255, 0, 255); sprites[index].setTransparency(255, 0, 255);
} }
System.out.println("Sprites Loaded: " + totalSprites); System.out.println("Sprites Loaded: " + totalSprites);
} catch (IOException ex) { } catch (IOException ex) {
ex.printStackTrace(); ex.printStackTrace();
+2 -9
View File
@@ -10,25 +10,18 @@ import java.awt.event.ActionListener;
public final class BotFrame extends JFrame implements ActionListener { public final class BotFrame extends JFrame implements ActionListener {
private final GameApplet applet;
public Toolkit toolkit = Toolkit.getDefaultToolkit();
public Dimension screenSize = toolkit.getScreenSize();
public int screenWidth = (int) screenSize.getWidth();
public int screenHeight = (int) screenSize.getHeight();
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final BotMenuBar botMenuBar; private final BotMenuBar botMenuBar;
protected final Insets insets;
public BotFrame(GameApplet applet, boolean resizable) { public BotFrame(GameApplet applet, boolean resizable) {
this.applet = applet;
setTitle(Configuration.CLIENT_NAME); setTitle(Configuration.CLIENT_NAME);
setResizable(resizable); setResizable(resizable);
insets = getInsets();
botMenuBar = new BotMenuBar(this); botMenuBar = new BotMenuBar(this);
setJMenuBar(botMenuBar); setJMenuBar(botMenuBar);
add(applet, BorderLayout.CENTER); add(applet, BorderLayout.CENTER);
setMinimumSize(new Dimension(774, 559)); setMinimumSize(new Dimension(774, 559));
setSize(774, 559); setSize(new Dimension(774, 559));
pack(); pack();
setLocationRelativeTo(getParent()); setLocationRelativeTo(getParent());
setLocationRelativeTo(getOwner()); setLocationRelativeTo(getOwner());
@@ -9,7 +9,7 @@ import javax.swing.*;
public class BotMenuBar extends JMenuBar { public class BotMenuBar extends JMenuBar {
private BotFrame botUI; private BotFrame botUI;
private JButton startButton, pauseButton, stopButton; private JButton startButton, pauseButton, stopButton;
private JMenu features, file, scripts; private JMenu file, scripts;
private JMenuItem run, pause, stop; private JMenuItem run, pause, stop;
public BotMenuBar(BotFrame botUI) { public BotMenuBar(BotFrame botUI) {
@@ -25,7 +25,6 @@ public class BotMenuBar extends JMenuBar {
private void createMenu() { private void createMenu() {
file = new JMenu("File"); file = new JMenu("File");
features = new JMenu("Features");
scripts = new JMenu("Script"); scripts = new JMenu("Script");
final JMenuItem exit = new JMenuItem("Exit"); final JMenuItem exit = new JMenuItem("Exit");
@@ -76,7 +75,6 @@ public class BotMenuBar extends JMenuBar {
private void configureComponents() { private void configureComponents() {
removeAll(); removeAll();
add(file); add(file);
add(features);
add(scripts); add(scripts);
add(Box.createHorizontalGlue()); add(Box.createHorizontalGlue());
/*add(startButton); /*add(startButton);
@@ -85,11 +83,6 @@ public class BotMenuBar extends JMenuBar {
} }
public JMenu getFeatures() {
return features;
}
public JMenu getFile() { public JMenu getFile() {
return file; return file;
} }
@@ -90,4 +90,31 @@ public final class StringUtils {
stringbuffer.append("*"); stringbuffer.append("*");
return stringbuffer.toString(); return stringbuffer.toString();
} }
public static String capitalizeEachWord(String str){
if(str == null || str.length() == 0)
return "";
if(str.length() == 1)
return str.toUpperCase();
String[] words = str.split(" ");
StringBuilder sbCapitalizedWords = new StringBuilder(str.length());
for(String word : words){
if(word.length() > 1)
sbCapitalizedWords
.append(word.substring(0, 1).toUpperCase())
.append(word.substring(1));
else
sbCapitalizedWords.append(word.toUpperCase());
sbCapitalizedWords.append(" ");
}
return sbCapitalizedWords.toString().trim();
}
} }