Commit 04f1118e authored by Marwolf's avatar Marwolf 💬

Changes for md5sum compatibility

parent 6081438e
......@@ -15,6 +15,12 @@ public class ItemDef extends EntityDef {
private int isNotedFormOf = -1;
private int notedFormID = -1;
public ItemDef(String name, String description, int authenticSpriteID, String spriteLocation,int id) {
super(name,description,id);
this.authenticSpriteID = authenticSpriteID;
this.spriteLocation = spriteLocation;
}
public ItemDef(String name, String description, String command, int basePrice, int authenticSpriteID, boolean stackable,
boolean wieldable, int wearableID, int pictureMask, boolean membersItem, boolean quest, int id) {
super(name, description, id);
......@@ -30,7 +36,6 @@ public class ItemDef extends EntityDef {
this.id = id;
}
public ItemDef(String name, String description, String command, int basePrice, int authenticSpriteID, String spriteLocation,
boolean stackable, boolean wieldable, int wearableID, int pictureMask, boolean membersItem,
boolean quest, int notedForm, int notedFormOf, int id) {
......@@ -50,7 +55,6 @@ public class ItemDef extends EntityDef {
this.spriteLocation = spriteLocation;
}
public ItemDef(int i, ItemDef item) {
super(item.name, "Swap this note at any bank for the equivalent item.", i);
this.command = item.command;
......@@ -65,13 +69,13 @@ public class ItemDef extends EntityDef {
this.id = i;
}
public String getCommand() {
return command;
}
public int getAuthenticSpriteID() { return authenticSpriteID; }
public int getAuthenticSpriteID() {
return authenticSpriteID;
}
public String getSpriteLocation() { return this.spriteLocation; }
......
......@@ -2,6 +2,13 @@ package orsc;
import com.openrsc.client.entityhandling.EntityHandler;
import com.openrsc.client.model.Sprite;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.util.Properties;
import orsc.buffers.RSBufferUtils;
import orsc.buffers.RSBuffer_Bits;
import orsc.enumerations.MessageType;
......@@ -15,12 +22,6 @@ import orsc.util.FastMath;
import orsc.util.GenUtil;
import orsc.util.StringUtil;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.util.Properties;
public class PacketHandler {
private final RSBuffer_Bits packetsIncoming = new RSBuffer_Bits(30000);
......
......@@ -3,12 +3,28 @@ package com.loader.openrsc.frame.elements;
import com.loader.openrsc.Constants;
import com.loader.openrsc.frame.listeners.CheckComboListener;
import javax.swing.*;
import java.awt.Color;
import java.awt.Component;
import java.awt.Rectangle;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.swing.JComboBox;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import javax.swing.SwingUtilities;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.*;
import java.io.*;
import java.util.*;
public class CheckCombo extends JComboBox implements ListCellRenderer {
public RadioButton checkBox;
......@@ -36,7 +52,7 @@ public class CheckCombo extends JComboBox implements ListCellRenderer {
checkBox.setContentAreaFilled(true);
CheckCombo.store[] stores = null;
String path = Constants.CONF_DIR + File.separator + "spritepacks";
String path = Constants.CONF_DIR;
File thingy = new File(path);
System.out.println("" + thingy.getAbsolutePath());
try {
......
......@@ -8,9 +8,13 @@ import com.loader.openrsc.util.Utils;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
public class ButtonListener implements ActionListener {
@Override
......@@ -176,7 +180,7 @@ public class ButtonListener implements ActionListener {
f.delete();
//update the sprite pack config file
File configFile = new File(Constants.CONF_DIR + File.separator + "spritepacks" + File.separator + "config.txt");
File configFile = new File(Constants.CONF_DIR + File.separator + "config.txt");
configFile.delete();
CheckCombo.store[] entries = AppFrame.get().getComboBoxState();
......@@ -187,7 +191,7 @@ public class ButtonListener implements ActionListener {
FileWriter write = new FileWriter(configFile, true);
PrintWriter writer = new PrintWriter(write);
for (CheckCombo.store entry : entries)
writer.println(entry.text + ":" + (entry.state==true ? 1 : 0));
writer.println(entry.text + ":" + (entry.state ? 1 : 0));
writer.close();
write.close();
} catch (IOException a) {
......
Cabbage Menus:1
\ No newline at end of file
......@@ -7,35 +7,34 @@ import com.openrsc.client.entityhandling.defs.ItemDef;
import com.openrsc.client.entityhandling.defs.NPCDef;
import com.openrsc.client.entityhandling.defs.PrayerDef;
import com.openrsc.client.entityhandling.defs.SpellDef;
import com.openrsc.client.entityhandling.defs.SpriteDef;
import com.openrsc.client.entityhandling.defs.TileDef;
import com.openrsc.client.entityhandling.defs.extras.AnimationDef;
import com.openrsc.client.entityhandling.defs.extras.TextureDef;
import com.openrsc.client.entityhandling.defs.SpriteDef;
import orsc.mudclient;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import orsc.Config;
import orsc.mudclient;
public class EntityHandler {
public static ArrayList<NPCDef> npcs = new ArrayList<NPCDef>();
private static ArrayList<ItemDef> items = new ArrayList<ItemDef>();
public static ArrayList<NPCDef> npcs = new ArrayList<>();
private static ArrayList<ItemDef> items = new ArrayList<>();
//public static ArrayList<ItemDef> specificSprites = new ArrayList<ItemDef>();
private static ArrayList<TextureDef> textures = new ArrayList<TextureDef>();
private static ArrayList<AnimationDef> animations = new ArrayList<AnimationDef>();
private static ArrayList<TextureDef> textures = new ArrayList<>();
private static ArrayList<AnimationDef> animations = new ArrayList<>();
public static ArrayList<SpriteDef> projectiles = new ArrayList<>();
public static ArrayList<SpriteDef> GUIparts = new ArrayList<>();
public static ArrayList<SpriteDef> crowns = new ArrayList<>();
private static ArrayList<SpellDef> spells = new ArrayList<SpellDef>();
private static ArrayList<PrayerDef> prayers = new ArrayList<PrayerDef>();
private static ArrayList<TileDef> tiles = new ArrayList<TileDef>();
private static ArrayList<DoorDef> doors = new ArrayList<DoorDef>();
private static ArrayList<ElevationDef> elevation = new ArrayList<ElevationDef>();
private static ArrayList<GameObjectDef> objects = new ArrayList<GameObjectDef>();
private static ArrayList<String> models = new ArrayList<String>();
private static ArrayList<SpellDef> spells = new ArrayList<>();
private static ArrayList<PrayerDef> prayers = new ArrayList<>();
private static ArrayList<TileDef> tiles = new ArrayList<>();
private static ArrayList<DoorDef> doors = new ArrayList<>();
private static ArrayList<ElevationDef> elevation = new ArrayList<>();
private static ArrayList<GameObjectDef> objects = new ArrayList<>();
private static ArrayList<String> models = new ArrayList<>();
private static int invPictureCount = 0;
......@@ -4540,7 +4539,7 @@ public class EntityHandler {
@SuppressWarnings("unchecked")
private static void loadSpellDefinitions() {
LinkedHashMap<Integer, Integer> runes = new LinkedHashMap<Integer, Integer>();
LinkedHashMap<Integer, Integer> runes = new LinkedHashMap<>();
runes.put(33, 1);
runes.put(35, 1);
spells.add(new SpellDef("Wind strike", "A strength 1 missile attack",
......
......@@ -4,22 +4,30 @@ import com.openrsc.client.entityhandling.EntityHandler;
import com.openrsc.client.entityhandling.defs.ItemDef;
import com.openrsc.client.entityhandling.defs.SpriteDef;
import com.openrsc.client.entityhandling.defs.extras.AnimationDef;
import com.openrsc.data.DataConversions;
import com.openrsc.client.model.Sprite;
import orsc.Config;
import orsc.MiscFunctions;
import orsc.util.FastMath;
import orsc.util.GenUtil;
import orsc.mudclient;
import com.openrsc.data.DataConversions;
import java.io.*;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.*;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import orsc.Config;
import orsc.MiscFunctions;
import orsc.mudclient;
import orsc.util.FastMath;
import orsc.util.GenUtil;
public class GraphicsController {
......@@ -56,8 +64,8 @@ public class GraphicsController {
private int[] m_tb;
private int[] m_Tb;
private int[] m_Wb;
public Map<String, List<Sprite>> spriteTree = new HashMap<String, List<Sprite>>();
public static Map<String, Integer> animationMap = new HashMap<>();
public Map<String, List<Sprite>> spriteTree = new HashMap<>();
private static Map<String, Integer> animationMap = new HashMap<>();
// public int[][] image2D_pixels;
private int[] m_Xb;
private ZipFile spriteArchive;
......@@ -2923,12 +2931,8 @@ public class GraphicsController {
//Loop through each spritesheet
try {
while (entries.hasMoreElements()) {
List<Sprite> spriteGroup = new ArrayList<Sprite>();
List<Sprite> spriteGroup;
ZipEntry entry = entries.nextElement();
//ZipInputStream entryStream = new ZipInputStream(spriteArchive.getInputStream(entry));
//InputStream in = spriteArchive.getInputStream(entry);
//ByteBuffer buffer = streamToBuffer(in);
spriteGroup = unpackSpriteData(spriteArchive, entry);
spriteTree.put(entry.getName(), spriteGroup);
}
......@@ -2940,7 +2944,7 @@ public class GraphicsController {
}
public static ArrayList<Sprite> unpackSpriteData(ZipFile ioe, ZipEntry zipEntry) throws IOException {
ArrayList<Sprite> sprites = new ArrayList<Sprite>();
ArrayList<Sprite> sprites = new ArrayList<>();
try {
InputStream fileIn = ioe.getInputStream(zipEntry);
......@@ -2965,7 +2969,7 @@ public class GraphicsController {
return sprites;
}
public static ArrayList<Sprite> unpackSpriteNew(ByteBuffer in) {
private static ArrayList<Sprite> unpackSpriteNew(ByteBuffer in) {
ArrayList<Sprite> spriteArray = new ArrayList<>();
......@@ -2988,7 +2992,7 @@ public class GraphicsController {
// throw new IOException("Provided buffer too short - Pixels missing");
for (int pixel = 0; pixel < pixels.length; pixel++)
pixels[pixel] = Integer.valueOf(in.getInt());
pixels[pixel] = in.getInt();
//if (in.remaining() <= 0)
// e.name = "Missing";
......@@ -3014,7 +3018,7 @@ public class GraphicsController {
return spriteArray;
}
private static final String readString(ByteBuffer buffer) {
private static String readString(ByteBuffer buffer) {
StringBuilder bldr = new StringBuilder();
byte b;
......
package orsc;
import com.openrsc.client.entityhandling.EntityHandler;
import com.openrsc.client.entityhandling.EntityHandler.*;
import com.openrsc.client.entityhandling.EntityHandler.GUIPARTS;
import com.openrsc.client.entityhandling.EntityHandler.PROJECTILE_TYPES;
import com.openrsc.client.entityhandling.defs.ItemDef;
import com.openrsc.client.entityhandling.defs.NPCDef;
import com.openrsc.client.entityhandling.defs.SpellDef;
......@@ -28,17 +29,28 @@ import com.openrsc.interfaces.misc.SkillGuideInterface;
import com.openrsc.interfaces.misc.TerritorySignupInterface;
import com.openrsc.interfaces.misc.clan.Clan;
import java.io.*;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.security.SecureRandom;
import java.util.*;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Timer;
import java.util.TimerTask;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.swing.text.html.parser.Entity;
import orsc.buffers.RSBufferUtils;
import orsc.enumerations.GameMode;
......@@ -61,6 +73,7 @@ import orsc.graphics.three.RSModel;
import orsc.graphics.three.Scene;
import orsc.graphics.three.World;
import orsc.graphics.two.Fonts;
import orsc.graphics.two.GraphicsController;
import orsc.graphics.two.MudClientGraphics;
import orsc.multiclient.ClientPort;
import orsc.net.Network_Socket;
......@@ -146,7 +159,6 @@ import static orsc.Config.getFPS;
import static orsc.Config.getServerName;
import static orsc.Config.getServerNameWelcome;
import static orsc.Config.getWelcomeText;
import static orsc.Config.getcLogoSpriteId;
import static orsc.Config.initConfig;
import static orsc.Config.isAndroid;
import static orsc.Config.isLenientContactDetails;
......@@ -11843,9 +11855,9 @@ public final class mudclient implements Runnable {
getSurface().fillSpriteTree();
//Load & apply sprite packs
File configFile = new File(clientPort.getCacheLocation() + "spritepacks");
File configFile = new File(clientPort.getCacheLocation());
if (configFile.isDirectory()) {
configFile = new File(clientPort.getCacheLocation() + "spritepacks" + File.separator + "config.txt");
configFile = new File(clientPort.getCacheLocation() + File.separator + "config.txt");
if (configFile.exists()) {
ArrayList<String> activePacks = new ArrayList<>();
try {
......@@ -11859,14 +11871,14 @@ public final class mudclient implements Runnable {
br.close();
for (String filename : activePacks) {
ZipFile spritePack = new ZipFile(clientPort.getCacheLocation() + "spritepacks" + File.separator + filename + ".pack");
ZipFile spritePack = new ZipFile(clientPort.getCacheLocation() + File.separator + filename + ".pack");
Enumeration<? extends ZipEntry> entries = spritePack.entries();
//Loop through each spritesheet in the sprite pack
while (entries.hasMoreElements()) {
List<Sprite> spriteGroup = new ArrayList<Sprite>();
List<Sprite> spriteGroup;
ZipEntry entry = entries.nextElement();
spriteGroup = getSurface().unpackSpriteData(spritePack, entry);
spriteGroup = GraphicsController.unpackSpriteData(spritePack, entry);
List<Sprite> defaultSprites = getSurface().spriteTree.get(entry.getName());
for (Sprite sprite : spriteGroup) {
for (int i = 0; i < defaultSprites.size(); i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment