method header lines

This commit is contained in:
Denis Molony 2020-02-11 17:29:55 +10:00
parent 846c975be6
commit ebeea4706d
28 changed files with 3677 additions and 3223 deletions

View File

@ -2,10 +2,14 @@ package com.bytezone.diskbrowser.wizardry;
import com.bytezone.diskbrowser.applefile.AbstractFile; import com.bytezone.diskbrowser.applefile.AbstractFile;
public abstract class AbstractImage extends AbstractFile // -----------------------------------------------------------------------------------//
abstract class AbstractImage extends AbstractFile
// -----------------------------------------------------------------------------------//
{ {
public AbstractImage (String name, byte[] buffer) // ---------------------------------------------------------------------------------//
{ AbstractImage (String name, byte[] buffer)
super (name, buffer); // ---------------------------------------------------------------------------------//
} {
super (name, buffer);
}
} }

View File

@ -8,7 +8,9 @@ import java.util.List;
import com.bytezone.diskbrowser.applefile.AbstractFile; import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class Character extends AbstractFile class Character extends AbstractFile
// -----------------------------------------------------------------------------------//
{ {
private final Attributes attributes; private final Attributes attributes;
private final Statistics stats; private final Statistics stats;
@ -24,7 +26,9 @@ class Character extends AbstractFile
static String[] statuses = static String[] statuses =
{ "OK", "Afraid", "Asleep", "Paralyze", "Stoned", "Dead", "Ashes", "Lost" }; { "OK", "Afraid", "Asleep", "Paralyze", "Stoned", "Dead", "Ashes", "Lost" };
public Character (String name, byte[] buffer, int scenario) // ---------------------------------------------------------------------------------//
Character (String name, byte[] buffer, int scenario)
// ---------------------------------------------------------------------------------//
{ {
super (name, buffer); super (name, buffer);
this.scenario = scenario; this.scenario = scenario;
@ -77,7 +81,9 @@ class Character extends AbstractFile
attributes.array[5] = attributes.luck; attributes.array[5] = attributes.luck;
} }
// ---------------------------------------------------------------------------------//
public void linkItems (List<Item> itemList) public void linkItems (List<Item> itemList)
// ---------------------------------------------------------------------------------//
{ {
boolean equipped; boolean equipped;
boolean identified; boolean identified;
@ -104,7 +110,9 @@ class Character extends AbstractFile
} }
} }
// ---------------------------------------------------------------------------------//
public void linkSpells (List<Spell> spellList) public void linkSpells (List<Spell> spellList)
// ---------------------------------------------------------------------------------//
{ {
for (int i = 138; i < 145; i++) for (int i = 138; i < 145; i++)
for (int bit = 0; bit < 8; bit++) for (int bit = 0; bit < 8; bit++)
@ -119,8 +127,10 @@ class Character extends AbstractFile
} }
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getText () public String getText ()
// ---------------------------------------------------------------------------------//
{ {
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
@ -171,12 +181,16 @@ class Character extends AbstractFile
return text.toString (); return text.toString ();
} }
// ---------------------------------------------------------------------------------//
public void linkExperience (ExperienceLevel exp) public void linkExperience (ExperienceLevel exp)
// ---------------------------------------------------------------------------------//
{ {
stats.nextLevel = exp.getExperiencePoints (stats.level); stats.nextLevel = exp.getExperiencePoints (stats.level);
} }
// ---------------------------------------------------------------------------------//
public int[] getMageSpellPoints () public int[] getMageSpellPoints ()
// ---------------------------------------------------------------------------------//
{ {
int[] spells = new int[7]; int[] spells = new int[7];
@ -186,7 +200,9 @@ class Character extends AbstractFile
return spells; return spells;
} }
// ---------------------------------------------------------------------------------//
public int[] getPriestSpellPoints () public int[] getPriestSpellPoints ()
// ---------------------------------------------------------------------------------//
{ {
int[] spells = new int[7]; int[] spells = new int[7];
@ -196,13 +212,17 @@ class Character extends AbstractFile
return spells; return spells;
} }
// ---------------------------------------------------------------------------------//
public Long getNextLevel () public Long getNextLevel ()
// ---------------------------------------------------------------------------------//
{ {
return stats.nextLevel; return stats.nextLevel;
} }
// this is temporary until I have more data // this is temporary until I have more data
// ---------------------------------------------------------------------------------//
public String isWinner () public String isWinner ()
// ---------------------------------------------------------------------------------//
{ {
int v1 = buffer[206]; int v1 = buffer[206];
int v2 = buffer[207]; int v2 = buffer[207];
@ -221,53 +241,73 @@ class Character extends AbstractFile
return "Unknown : " + v1 + " " + v2; return "Unknown : " + v1 + " " + v2;
} }
// ---------------------------------------------------------------------------------//
public boolean isOut () public boolean isOut ()
// ---------------------------------------------------------------------------------//
{ {
return (buffer[32] == 1); return (buffer[32] == 1);
} }
// ---------------------------------------------------------------------------------//
public String getType () public String getType ()
// ---------------------------------------------------------------------------------//
{ {
return stats.type; return stats.type;
} }
// ---------------------------------------------------------------------------------//
public String getRace () public String getRace ()
// ---------------------------------------------------------------------------------//
{ {
return stats.race; return stats.race;
} }
// ---------------------------------------------------------------------------------//
public String getAlignment () public String getAlignment ()
// ---------------------------------------------------------------------------------//
{ {
return stats.alignment; return stats.alignment;
} }
// ---------------------------------------------------------------------------------//
public Attributes getAttributes () public Attributes getAttributes ()
// ---------------------------------------------------------------------------------//
{ {
return attributes; return attributes;
} }
// ---------------------------------------------------------------------------------//
public Statistics getStatistics () public Statistics getStatistics ()
// ---------------------------------------------------------------------------------//
{ {
return stats; return stats;
} }
// ---------------------------------------------------------------------------------//
public Iterator<Baggage> getBaggage () public Iterator<Baggage> getBaggage ()
// ---------------------------------------------------------------------------------//
{ {
return baggageList.iterator (); return baggageList.iterator ();
} }
// ---------------------------------------------------------------------------------//
public Iterator<Spell> getSpells () public Iterator<Spell> getSpells ()
// ---------------------------------------------------------------------------------//
{ {
return spellBook.iterator (); return spellBook.iterator ();
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String toString () public String toString ()
// ---------------------------------------------------------------------------------//
{ {
return name; return name;
} }
// ---------------------------------------------------------------------------------//
public class Baggage public class Baggage
// ---------------------------------------------------------------------------------//
{ {
public Item item; public Item item;
public boolean equipped; public boolean equipped;
@ -288,7 +328,9 @@ class Character extends AbstractFile
} }
} }
// ---------------------------------------------------------------------------------//
public class Statistics implements Cloneable public class Statistics implements Cloneable
// ---------------------------------------------------------------------------------//
{ {
public String race; public String race;
public String type; public String type;

View File

@ -2,17 +2,23 @@ package com.bytezone.diskbrowser.wizardry;
import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class CodedMessage extends Message class CodedMessage extends Message
// -----------------------------------------------------------------------------------//
{ {
public static int codeOffset = 185; public static int codeOffset = 185;
public CodedMessage (byte[] buffer) // ---------------------------------------------------------------------------------//
CodedMessage (byte[] buffer)
// ---------------------------------------------------------------------------------//
{ {
super (buffer); super (buffer);
} }
// ---------------------------------------------------------------------------------//
@Override @Override
protected String getLine (int offset) protected String getLine (int offset)
// ---------------------------------------------------------------------------------//
{ {
int length = buffer[offset] & 0xFF; int length = buffer[offset] & 0xFF;
byte[] translation = new byte[length]; byte[] translation = new byte[length];

View File

@ -1,27 +1,33 @@
package com.bytezone.diskbrowser.wizardry; package com.bytezone.diskbrowser.wizardry;
// -----------------------------------------------------------------------------------//
class Dice class Dice
// -----------------------------------------------------------------------------------//
{ {
int qty; int qty;
int sides; int sides;
int bonus; int bonus;
public Dice (byte[] buffer, int offset) // ---------------------------------------------------------------------------------//
{ Dice (byte[] buffer, int offset)
qty = buffer[offset]; // ---------------------------------------------------------------------------------//
sides = buffer[offset + 2]; {
bonus = buffer[offset + 4]; qty = buffer[offset];
} sides = buffer[offset + 2];
bonus = buffer[offset + 4];
}
@Override // ---------------------------------------------------------------------------------//
public String toString () @Override
{ public String toString ()
if (qty == 0) // ---------------------------------------------------------------------------------//
return ""; {
StringBuilder text = new StringBuilder (); if (qty == 0)
text.append (String.format ("%dd%d", qty, sides)); return "";
if (bonus > 0) StringBuilder text = new StringBuilder ();
text.append ("+" + bonus); text.append (String.format ("%dd%d", qty, sides));
return text.toString (); if (bonus > 0)
} text.append ("+" + bonus);
return text.toString ();
}
} }

View File

@ -2,15 +2,21 @@ package com.bytezone.diskbrowser.wizardry;
import com.bytezone.diskbrowser.applefile.AbstractFile; import com.bytezone.diskbrowser.applefile.AbstractFile;
public class DragonData extends AbstractFile // -----------------------------------------------------------------------------------//
class DragonData extends AbstractFile
// -----------------------------------------------------------------------------------//
{ {
public DragonData (String name, byte[] buffer) // ---------------------------------------------------------------------------------//
DragonData (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{ {
super (name, buffer); super (name, buffer);
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getText () public String getText ()
// ---------------------------------------------------------------------------------//
{ {
return "DragonData"; return "DragonData";
} }

View File

@ -3,42 +3,49 @@ package com.bytezone.diskbrowser.wizardry;
import com.bytezone.diskbrowser.applefile.AbstractFile; import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class ExperienceLevel extends AbstractFile class ExperienceLevel extends AbstractFile
// -----------------------------------------------------------------------------------//
{ {
private final long[] expLevels = new long[13]; private final long[] expLevels = new long[13];
public ExperienceLevel (String name, byte[] buffer) // ---------------------------------------------------------------------------------//
{ ExperienceLevel (String name, byte[] buffer)
super (name, buffer); // ---------------------------------------------------------------------------------//
{
super (name, buffer);
int seq = 0; int seq = 0;
for (int ptr = 0; ptr < buffer.length; ptr += 6) for (int ptr = 0; ptr < buffer.length; ptr += 6)
{ {
if (buffer[ptr] == 0) if (buffer[ptr] == 0)
break; break;
long points = long points = HexFormatter.intValue (buffer[ptr], buffer[ptr + 1])
HexFormatter.intValue (buffer[ptr], buffer[ptr + 1]) + HexFormatter.intValue (buffer[ptr + 2], buffer[ptr + 3]) * 10000
+ HexFormatter.intValue (buffer[ptr + 2], buffer[ptr + 3]) * 10000 + HexFormatter.intValue (buffer[ptr + 4], buffer[ptr + 5]) * 100000000L;
+ HexFormatter.intValue (buffer[ptr + 4], buffer[ptr + 5]) * 100000000L; expLevels[seq++] = points;
expLevels[seq++] = points; }
} }
}
public long getExperiencePoints (int level) // ---------------------------------------------------------------------------------//
{ long getExperiencePoints (int level)
if (level < 13) // ---------------------------------------------------------------------------------//
return expLevels[level]; {
return (level - 12) * expLevels[0] + expLevels[12]; if (level < 13)
} return expLevels[level];
return (level - 12) * expLevels[0] + expLevels[12];
}
@Override // ---------------------------------------------------------------------------------//
public String getText () @Override
{ public String getText ()
StringBuilder line = new StringBuilder (); // ---------------------------------------------------------------------------------//
for (long exp : expLevels) {
line.append (exp + "\n"); StringBuilder line = new StringBuilder ();
return line.toString (); for (long exp : expLevels)
} line.append (exp + "\n");
return line.toString ();
}
} }

View File

@ -12,7 +12,9 @@ import com.bytezone.diskbrowser.disk.DiskAddress;
import com.bytezone.diskbrowser.disk.FormattedDisk; import com.bytezone.diskbrowser.disk.FormattedDisk;
import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class Header class Header
// -----------------------------------------------------------------------------------//
{ {
static String[] typeText = { "header", "maze", "monsters", "rewards", "items", static String[] typeText = { "header", "maze", "monsters", "rewards", "items",
"characters", "images", "char levels" }; "characters", "images", "char levels" };
@ -33,7 +35,9 @@ class Header
List<ScenarioData> data = new ArrayList<> (8); List<ScenarioData> data = new ArrayList<> (8);
FormattedDisk owner; FormattedDisk owner;
public Header (DefaultMutableTreeNode dataNode, FormattedDisk owner) // ---------------------------------------------------------------------------------//
Header (DefaultMutableTreeNode dataNode, FormattedDisk owner)
// ---------------------------------------------------------------------------------//
{ {
this.owner = owner; this.owner = owner;
@ -98,7 +102,9 @@ class Header
} }
} }
// ---------------------------------------------------------------------------------//
private void linkText (String title, DiskAddress da, DefaultMutableTreeNode headerNode) private void linkText (String title, DiskAddress da, DefaultMutableTreeNode headerNode)
// ---------------------------------------------------------------------------------//
{ {
List<DiskAddress> blocks = new ArrayList<> (); List<DiskAddress> blocks = new ArrayList<> ();
blocks.add (da); blocks.add (da);
@ -129,8 +135,10 @@ class Header
headerNode.add (node); headerNode.add (node);
} }
// ---------------------------------------------------------------------------------//
private void linkPictures (String title, DiskAddress da, private void linkPictures (String title, DiskAddress da,
DefaultMutableTreeNode headerNode) DefaultMutableTreeNode headerNode)
// ---------------------------------------------------------------------------------//
{ {
List<DiskAddress> blocks = new ArrayList<> (); List<DiskAddress> blocks = new ArrayList<> ();
blocks.add (da); blocks.add (da);
@ -145,8 +153,10 @@ class Header
headerNode.add (node); headerNode.add (node);
} }
// ---------------------------------------------------------------------------------//
private void linkSpells (String title, DiskAddress da, private void linkSpells (String title, DiskAddress da,
DefaultMutableTreeNode headerNode) DefaultMutableTreeNode headerNode)
// ---------------------------------------------------------------------------------//
{ {
List<DiskAddress> blocks = new ArrayList<> (); List<DiskAddress> blocks = new ArrayList<> ();
blocks.add (da); blocks.add (da);
@ -177,7 +187,9 @@ class Header
headerNode.add (node); headerNode.add (node);
} }
// ---------------------------------------------------------------------------------//
private String printChars (byte[] buffer, int block) private String printChars (byte[] buffer, int block)
// ---------------------------------------------------------------------------------//
{ {
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
for (int i = block * 512; i < (block + 1) * 512; i += 64) for (int i = block * 512; i < (block + 1) * 512; i += 64)
@ -205,7 +217,9 @@ class Header
} }
// this could be the base factory class for all Wizardry types // this could be the base factory class for all Wizardry types
// ---------------------------------------------------------------------------------//
class ScenarioData class ScenarioData
// ---------------------------------------------------------------------------------//
{ {
int dunno; int dunno;
int total; int total;

View File

@ -7,7 +7,9 @@ import com.bytezone.diskbrowser.applefile.AbstractFile;
// link for possible display algorithm: // link for possible display algorithm:
// http://stackoverflow.com/questions/14184655/set-position-for-drawing-binary-tree // http://stackoverflow.com/questions/14184655/set-position-for-drawing-binary-tree
public class Huffman extends AbstractFile // -----------------------------------------------------------------------------------//
class Huffman extends AbstractFile
// -----------------------------------------------------------------------------------//
{ {
private static final byte[] mask = { 2, 1 }; // bits: 10 or 01 private static final byte[] mask = { 2, 1 }; // bits: 10 or 01
private static final int[] offset = { 512, 256 }; // offset to left/right nodes private static final int[] offset = { 512, 256 }; // offset to left/right nodes
@ -19,12 +21,16 @@ public class Huffman extends AbstractFile
private String bufferContents; private String bufferContents;
public Huffman (String name, byte[] buffer) // ---------------------------------------------------------------------------------//
Huffman (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{ {
super (name, buffer); super (name, buffer);
} }
public String decodeMessage (byte[] message) // ---------------------------------------------------------------------------------//
String decodeMessage (byte[] message)
// ---------------------------------------------------------------------------------//
{ {
this.message = message; this.message = message;
depth = 0; depth = 0;
@ -39,7 +45,9 @@ public class Huffman extends AbstractFile
return text.toString (); return text.toString ();
} }
// ---------------------------------------------------------------------------------//
private byte getChar () private byte getChar ()
// ---------------------------------------------------------------------------------//
{ {
int treePtr = 0; // start at the root int treePtr = 0; // start at the root
@ -63,8 +71,10 @@ public class Huffman extends AbstractFile
} }
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getText () public String getText ()
// ---------------------------------------------------------------------------------//
{ {
if (bufferContents == null) if (bufferContents == null)
{ {
@ -75,7 +85,9 @@ public class Huffman extends AbstractFile
return bufferContents; return bufferContents;
} }
// ---------------------------------------------------------------------------------//
private void walk (int treePtr, String path, StringBuilder text) private void walk (int treePtr, String path, StringBuilder text)
// ---------------------------------------------------------------------------------//
{ {
for (int currentBit = 1; currentBit >= 0; --currentBit) for (int currentBit = 1; currentBit >= 0; --currentBit)
if ((buffer[treePtr] & mask[currentBit]) == 0) if ((buffer[treePtr] & mask[currentBit]) == 0)

View File

@ -3,57 +3,63 @@ package com.bytezone.diskbrowser.wizardry;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer; import java.awt.image.DataBuffer;
// -----------------------------------------------------------------------------------//
class Image extends AbstractImage class Image extends AbstractImage
// -----------------------------------------------------------------------------------//
{ {
public Image (String name, byte[] buffer) // ---------------------------------------------------------------------------------//
{ Image (String name, byte[] buffer)
super (name, buffer); // ---------------------------------------------------------------------------------//
{
super (name, buffer);
if (buffer[0] == -61 && buffer[1] == -115) if (buffer[0] == -61 && buffer[1] == -115)
fixSlime (buffer); fixSlime (buffer);
image = new BufferedImage (70, 50, BufferedImage.TYPE_BYTE_GRAY); // width/height image = new BufferedImage (70, 50, BufferedImage.TYPE_BYTE_GRAY); // width/height
DataBuffer db = image.getRaster ().getDataBuffer (); DataBuffer db = image.getRaster ().getDataBuffer ();
int element = 0; int element = 0;
for (int j = 0; j < 500; j++) for (int j = 0; j < 500; j++)
{ {
int bits = buffer[j] & 0xFF; int bits = buffer[j] & 0xFF;
for (int m = 0; m < 7; m++) for (int m = 0; m < 7; m++)
{ {
if (bits == 0) if (bits == 0)
{ {
element += 7 - m; element += 7 - m;
break; break;
} }
if ((bits & 1) == 1) if ((bits & 1) == 1)
db.setElem (element, 255); db.setElem (element, 255);
bits >>= 1; bits >>= 1;
element++; element++;
} }
} }
} }
private void fixSlime (byte[] buffer) // ---------------------------------------------------------------------------------//
{ private void fixSlime (byte[] buffer)
for (int i = 0; i < 208; i++) // ---------------------------------------------------------------------------------//
buffer[i] = 0; {
buffer[124] = -108; for (int i = 0; i < 208; i++)
buffer[134] = -43; buffer[i] = 0;
buffer[135] = -128; buffer[124] = -108;
buffer[144] = -44; buffer[134] = -43;
buffer[145] = -126; buffer[135] = -128;
buffer[154] = -48; buffer[144] = -44;
buffer[155] = -118; buffer[145] = -126;
buffer[164] = -64; buffer[154] = -48;
buffer[165] = -86; buffer[155] = -118;
buffer[174] = -64; buffer[164] = -64;
buffer[175] = -86; buffer[165] = -86;
buffer[184] = -63; buffer[174] = -64;
buffer[185] = -86; buffer[175] = -86;
buffer[194] = -44; buffer[184] = -63;
buffer[195] = -86; buffer[185] = -86;
buffer[204] = -44; buffer[194] = -44;
buffer[205] = -126; buffer[195] = -86;
} buffer[204] = -44;
buffer[205] = -126;
}
} }

View File

@ -3,30 +3,34 @@ package com.bytezone.diskbrowser.wizardry;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer; import java.awt.image.DataBuffer;
// -----------------------------------------------------------------------------------//
class ImageV2 extends AbstractImage class ImageV2 extends AbstractImage
// -----------------------------------------------------------------------------------//
{ {
public ImageV2 (String name, byte[] buffer) // ---------------------------------------------------------------------------------//
{ ImageV2 (String name, byte[] buffer)
super (name, buffer); // ---------------------------------------------------------------------------------//
{
super (name, buffer);
image = new BufferedImage (70, 48, BufferedImage.TYPE_BYTE_GRAY); // width/height image = new BufferedImage (70, 48, BufferedImage.TYPE_BYTE_GRAY); // width/height
DataBuffer db = image.getRaster ().getDataBuffer (); DataBuffer db = image.getRaster ().getDataBuffer ();
int offset = 0; int offset = 0;
int size = 7; int size = 7;
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
for (int j = 0; j < 10; j++) for (int j = 0; j < 10; j++)
for (int k = 7; k >= 0; k--) for (int k = 7; k >= 0; k--)
{ {
int element = i * 560 + j * 7 + k * 70; int element = i * 560 + j * 7 + k * 70;
int bits = buffer[offset++] & 0xFF; int bits = buffer[offset++] & 0xFF;
for (int m = size - 1; m >= 0; m--) for (int m = size - 1; m >= 0; m--)
{ {
if ((bits & 1) == 1) if ((bits & 1) == 1)
db.setElem (element, 255); db.setElem (element, 255);
bits >>= 1; bits >>= 1;
element++; element++;
} }
} }
} }
} }

View File

@ -3,7 +3,9 @@ package com.bytezone.diskbrowser.wizardry;
import com.bytezone.diskbrowser.applefile.AbstractFile; import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class Item extends AbstractFile implements Comparable<Item> class Item extends AbstractFile implements Comparable<Item>
// -----------------------------------------------------------------------------------//
{ {
public final int itemID; public final int itemID;
private final int type; private final int type;
@ -15,7 +17,9 @@ class Item extends AbstractFile implements Comparable<Item>
public final int armourClass; public final int armourClass;
public final int speed; public final int speed;
public Item (String name, byte[] buffer) // ---------------------------------------------------------------------------------//
Item (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{ {
super (name, buffer); super (name, buffer);
itemID = counter++; itemID = counter++;
@ -29,8 +33,10 @@ class Item extends AbstractFile implements Comparable<Item>
speed = buffer[72]; speed = buffer[72];
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getText () public String getText ()
// ---------------------------------------------------------------------------------//
{ {
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
@ -51,7 +57,9 @@ class Item extends AbstractFile implements Comparable<Item>
return text.toString (); return text.toString ();
} }
// ---------------------------------------------------------------------------------//
public int getType () public int getType ()
// ---------------------------------------------------------------------------------//
{ {
return type; return type;
} }
@ -66,17 +74,23 @@ class Item extends AbstractFile implements Comparable<Item>
// return HexFormatter.intValue (buffer[72]); // return HexFormatter.intValue (buffer[72]);
// } // }
// ---------------------------------------------------------------------------------//
public long getCost () public long getCost ()
// ---------------------------------------------------------------------------------//
{ {
return cost; return cost;
} }
// ---------------------------------------------------------------------------------//
public boolean isCursed () public boolean isCursed ()
// ---------------------------------------------------------------------------------//
{ {
return buffer[36] != 0; return buffer[36] != 0;
} }
// ---------------------------------------------------------------------------------//
public int getStockOnHand () public int getStockOnHand ()
// ---------------------------------------------------------------------------------//
{ {
if (buffer[50] == -1 && buffer[51] == -1) if (buffer[50] == -1 && buffer[51] == -1)
return -1; return -1;
@ -84,14 +98,18 @@ class Item extends AbstractFile implements Comparable<Item>
return HexFormatter.intValue (buffer[50], buffer[51]); return HexFormatter.intValue (buffer[50], buffer[51]);
} }
// ---------------------------------------------------------------------------------//
public boolean canUse (int type2) public boolean canUse (int type2)
// ---------------------------------------------------------------------------------//
{ {
int users = buffer[54] & 0xFF; int users = buffer[54] & 0xFF;
return ((users >>> type2) & 1) == 1; return ((users >>> type2) & 1) == 1;
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String toString () public String toString ()
// ---------------------------------------------------------------------------------//
{ {
StringBuilder line = new StringBuilder (); StringBuilder line = new StringBuilder ();
line.append (String.format ("%-16s", name)); line.append (String.format ("%-16s", name));
@ -120,7 +138,9 @@ class Item extends AbstractFile implements Comparable<Item>
return line.toString (); return line.toString ();
} }
// ---------------------------------------------------------------------------------//
public String getDump (int block) public String getDump (int block)
// ---------------------------------------------------------------------------------//
{ {
StringBuilder line = new StringBuilder (String.format ("%3d %-16s", itemID, name)); StringBuilder line = new StringBuilder (String.format ("%3d %-16s", itemID, name));
int lo = block == 0 ? 32 : block == 1 ? 46 : 70; int lo = block == 0 ? 32 : block == 1 ? 46 : 70;
@ -132,8 +152,10 @@ class Item extends AbstractFile implements Comparable<Item>
return line.toString (); return line.toString ();
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public int compareTo (Item otherItem) public int compareTo (Item otherItem)
// ---------------------------------------------------------------------------------//
{ {
Item item = otherItem; Item item = otherItem;
return this.type - item.type; return this.type - item.type;

View File

@ -1,21 +1,27 @@
package com.bytezone.diskbrowser.wizardry; package com.bytezone.diskbrowser.wizardry;
// -----------------------------------------------------------------------------------//
class MazeAddress class MazeAddress
// -----------------------------------------------------------------------------------//
{ {
public final int level; public final int level;
public final int row; public final int row;
public final int column; public final int column;
public MazeAddress (int level, int row, int column) // ---------------------------------------------------------------------------------//
{ MazeAddress (int level, int row, int column)
this.level = level; // ---------------------------------------------------------------------------------//
this.row = row; {
this.column = column; this.level = level;
} this.row = row;
this.column = column;
}
@Override // ---------------------------------------------------------------------------------//
public String toString () @Override
{ public String toString ()
return level + "/" + row + "/" + column; // ---------------------------------------------------------------------------------//
} {
return level + "/" + row + "/" + column;
}
} }

View File

@ -7,7 +7,9 @@ import java.util.List;
import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class MazeCell class MazeCell
// -----------------------------------------------------------------------------------//
{ {
static Dimension cellSize = new Dimension (22, 22); // size in pixels static Dimension cellSize = new Dimension (22, 22); // size in pixels
@ -50,12 +52,16 @@ class MazeCell
public Item itemRequired; public Item itemRequired;
public Item itemObtained; public Item itemObtained;
public MazeCell (MazeAddress address) // ---------------------------------------------------------------------------------//
MazeCell (MazeAddress address)
// ---------------------------------------------------------------------------------//
{ {
this.address = address; this.address = address;
} }
public void draw (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void draw (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
g.setColor (Color.BLACK); g.setColor (Color.BLACK);
g.fillRect (x, y, 22, 22); g.fillRect (x, y, 22, 22);
@ -127,29 +133,39 @@ class MazeCell
drawChar (g, x, y, HexFormatter.format1 (unknown), Color.GRAY); drawChar (g, x, y, HexFormatter.format1 (unknown), Color.GRAY);
} }
public void drawWest (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void drawWest (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
g.drawLine (x + 1, y + 1, x + 1, y + cellSize.height - 1); g.drawLine (x + 1, y + 1, x + 1, y + cellSize.height - 1);
} }
private void drawEast (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void drawEast (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
g.drawLine (x + cellSize.width - 1, y + 1, x + cellSize.width - 1, g.drawLine (x + cellSize.width - 1, y + 1, x + cellSize.width - 1,
y + cellSize.height - 1); y + cellSize.height - 1);
} }
private void drawNorth (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void drawNorth (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
g.drawLine (x + 1, y + 1, x + cellSize.width - 1, y + 1); g.drawLine (x + 1, y + 1, x + cellSize.width - 1, y + 1);
} }
private void drawSouth (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void drawSouth (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
g.drawLine (x + 1, y + cellSize.height - 1, x + cellSize.width - 1, g.drawLine (x + 1, y + cellSize.height - 1, x + cellSize.width - 1,
y + cellSize.height - 1); y + cellSize.height - 1);
} }
public void drawStairsUp (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void drawStairsUp (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
g.drawLine (x + 6, y + 18, x + 6, y + 14); g.drawLine (x + 6, y + 18, x + 6, y + 14);
g.drawLine (x + 6, y + 14, x + 10, y + 14); g.drawLine (x + 6, y + 14, x + 10, y + 14);
@ -159,7 +175,9 @@ class MazeCell
g.drawLine (x + 14, y + 6, x + 18, y + 6); g.drawLine (x + 14, y + 6, x + 18, y + 6);
} }
public void drawStairsDown (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void drawStairsDown (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
g.drawLine (x + 4, y + 7, x + 8, y + 7); g.drawLine (x + 4, y + 7, x + 8, y + 7);
g.drawLine (x + 8, y + 7, x + 8, y + 11); g.drawLine (x + 8, y + 7, x + 8, y + 11);
@ -169,20 +187,26 @@ class MazeCell
g.drawLine (x + 16, y + 15, x + 16, y + 19); g.drawLine (x + 16, y + 15, x + 16, y + 19);
} }
public void drawPit (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void drawPit (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
g.drawLine (x + 5, y + 14, x + 5, y + 19); g.drawLine (x + 5, y + 14, x + 5, y + 19);
g.drawLine (x + 5, y + 19, x + 17, y + 19); g.drawLine (x + 5, y + 19, x + 17, y + 19);
g.drawLine (x + 17, y + 14, x + 17, y + 19); g.drawLine (x + 17, y + 14, x + 17, y + 19);
} }
public void drawChute (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void drawChute (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
g.drawLine (x + 6, y + 6, x + 10, y + 6); g.drawLine (x + 6, y + 6, x + 10, y + 6);
g.drawLine (x + 10, y + 6, x + 18, y + 18); g.drawLine (x + 10, y + 6, x + 18, y + 18);
} }
public void drawElevator (Graphics2D g, int x, int y, int rows) // ---------------------------------------------------------------------------------//
void drawElevator (Graphics2D g, int x, int y, int rows)
// ---------------------------------------------------------------------------------//
{ {
for (int i = 0; i < rows; i++) for (int i = 0; i < rows; i++)
{ {
@ -191,35 +215,45 @@ class MazeCell
} }
} }
public void drawMonsterLair (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void drawMonsterLair (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
g.setColor (Color.YELLOW); g.setColor (Color.YELLOW);
g.fillOval (x + 4, y + 4, 2, 2); g.fillOval (x + 4, y + 4, 2, 2);
g.setColor (Color.WHITE); g.setColor (Color.WHITE);
} }
public void drawTeleport (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void drawTeleport (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
g.setColor (Color.GREEN); g.setColor (Color.GREEN);
g.fillOval (x + 8, y + 8, 8, 8); g.fillOval (x + 8, y + 8, 8, 8);
g.setColor (Color.WHITE); g.setColor (Color.WHITE);
} }
public void drawSpellsBlocked (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void drawSpellsBlocked (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
g.setColor (Color.YELLOW); g.setColor (Color.YELLOW);
g.fillOval (x + 8, y + 8, 8, 8); g.fillOval (x + 8, y + 8, 8, 8);
g.setColor (Color.WHITE); g.setColor (Color.WHITE);
} }
public void drawMonster (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void drawMonster (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
g.setColor (Color.RED); g.setColor (Color.RED);
g.fillOval (x + 8, y + 8, 8, 8); g.fillOval (x + 8, y + 8, 8, 8);
g.setColor (Color.WHITE); g.setColor (Color.WHITE);
} }
public void drawDarkness (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void drawDarkness (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
g.setColor (Color.gray); g.setColor (Color.gray);
for (int h = 0; h < 15; h += 7) for (int h = 0; h < 15; h += 7)
@ -228,14 +262,18 @@ class MazeCell
g.setColor (Color.white); g.setColor (Color.white);
} }
public void drawRock (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void drawRock (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
for (int h = 0; h < 15; h += 7) for (int h = 0; h < 15; h += 7)
for (int offset = 0; offset < 15; offset += 7) for (int offset = 0; offset < 15; offset += 7)
g.drawOval (x + offset + 4, y + h + 4, 1, 1); g.drawOval (x + offset + 4, y + h + 4, 1, 1);
} }
public void drawChar (Graphics2D g, int x, int y, String c, Color colour) // ---------------------------------------------------------------------------------//
void drawChar (Graphics2D g, int x, int y, String c, Color colour)
// ---------------------------------------------------------------------------------//
{ {
g.setColor (colour); g.setColor (colour);
g.fillRect (x + 7, y + 6, 11, 11); g.fillRect (x + 7, y + 6, 11, 11);
@ -243,7 +281,9 @@ class MazeCell
g.drawString (c, x + 8, y + 16); g.drawString (c, x + 8, y + 16);
} }
public void drawHotDogStand (Graphics2D g, int x, int y) // ---------------------------------------------------------------------------------//
void drawHotDogStand (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{ {
g.drawRect (x + 5, y + 11, 12, 6); g.drawRect (x + 5, y + 11, 12, 6);
g.drawOval (x + 6, y + 18, 3, 3); g.drawOval (x + 6, y + 18, 3, 3);
@ -253,7 +293,9 @@ class MazeCell
g.drawLine (x + 5, y + 5, x + 17, y + 5); g.drawLine (x + 5, y + 5, x + 17, y + 5);
} }
public String getTooltipText () // ---------------------------------------------------------------------------------//
String getTooltipText ()
// ---------------------------------------------------------------------------------//
{ {
StringBuilder sign = new StringBuilder ("<html><pre>"); StringBuilder sign = new StringBuilder ("<html><pre>");
sign.append ("&nbsp;<b>"); sign.append ("&nbsp;<b>");

View File

@ -12,7 +12,9 @@ import com.bytezone.common.Utility;
import com.bytezone.diskbrowser.applefile.AbstractFile; import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.HexFormatter;
public class MazeGridV5 extends AbstractFile // -----------------------------------------------------------------------------------//
class MazeGridV5 extends AbstractFile
// -----------------------------------------------------------------------------------//
{ {
private final MessageBlock messageBlock; private final MessageBlock messageBlock;
List<MazeGrid> grids = new ArrayList<> (); List<MazeGrid> grids = new ArrayList<> ();
@ -21,7 +23,9 @@ public class MazeGridV5 extends AbstractFile
int maxX = 0; int maxX = 0;
int maxY = 0; int maxY = 0;
public MazeGridV5 (String name, byte[] buffer, MessageBlock messageBlock) // ---------------------------------------------------------------------------------//
MazeGridV5 (String name, byte[] buffer, MessageBlock messageBlock)
// ---------------------------------------------------------------------------------//
{ {
super (name, buffer); super (name, buffer);
@ -45,8 +49,10 @@ public class MazeGridV5 extends AbstractFile
} }
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public BufferedImage getImage () public BufferedImage getImage ()
// ---------------------------------------------------------------------------------//
{ {
Dimension cellSize = new Dimension (22, 22); Dimension cellSize = new Dimension (22, 22);
int fudge = 30; int fudge = 30;
@ -80,7 +86,9 @@ public class MazeGridV5 extends AbstractFile
return image; return image;
} }
// ---------------------------------------------------------------------------------//
private MazeCell getLayout (int gridNo, int row, int column) private MazeCell getLayout (int gridNo, int row, int column)
// ---------------------------------------------------------------------------------//
{ {
MazeAddress address = new MazeAddress (0, row, column); MazeAddress address = new MazeAddress (0, row, column);
MazeCell cell = new MazeCell (address); MazeCell cell = new MazeCell (address);
@ -103,8 +111,10 @@ public class MazeGridV5 extends AbstractFile
return cell; return cell;
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getHexDump () public String getHexDump ()
// ---------------------------------------------------------------------------------//
{ {
StringBuilder text = new StringBuilder (super.getHexDump ()); StringBuilder text = new StringBuilder (super.getHexDump ());
@ -187,7 +197,9 @@ public class MazeGridV5 extends AbstractFile
return text.toString (); return text.toString ();
} }
// ---------------------------------------------------------------------------------//
private class MazeGrid private class MazeGrid
// ---------------------------------------------------------------------------------//
{ {
MazeCell[][] grid; MazeCell[][] grid;
int xOffset; int xOffset;

View File

@ -10,21 +10,27 @@ import java.util.List;
import com.bytezone.diskbrowser.applefile.AbstractFile; import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class MazeLevel extends AbstractFile class MazeLevel extends AbstractFile
// -----------------------------------------------------------------------------------//
{ {
public final int level; public final int level;
private List<Message> messages; private List<Message> messages;
private List<Monster> monsters; private List<Monster> monsters;
private List<Item> items; private List<Item> items;
// ---------------------------------------------------------------------------------//
public MazeLevel (byte[] buffer, int level) public MazeLevel (byte[] buffer, int level)
// ---------------------------------------------------------------------------------//
{ {
super ("Level " + level, buffer); super ("Level " + level, buffer);
this.level = level; this.level = level;
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getHexDump () public String getHexDump ()
// ---------------------------------------------------------------------------------//
{ {
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
@ -149,7 +155,9 @@ class MazeLevel extends AbstractFile
return text.toString (); return text.toString ();
} }
// ---------------------------------------------------------------------------------//
private void addWalls (StringBuilder text, int ptr) private void addWalls (StringBuilder text, int ptr)
// ---------------------------------------------------------------------------------//
{ {
text.append ("\n\n"); text.append ("\n\n");
for (int i = 0; i < 20; i++) for (int i = 0; i < 20; i++)
@ -157,7 +165,9 @@ class MazeLevel extends AbstractFile
HexFormatter.getHexString (buffer, ptr + i * 6, 6))); HexFormatter.getHexString (buffer, ptr + i * 6, 6)));
} }
// ---------------------------------------------------------------------------------//
private void addEncounters (StringBuilder text, int ptr) private void addEncounters (StringBuilder text, int ptr)
// ---------------------------------------------------------------------------------//
{ {
text.append ("\n\n"); text.append ("\n\n");
for (int i = 0; i < 20; i++) for (int i = 0; i < 20; i++)
@ -185,7 +195,9 @@ class MazeLevel extends AbstractFile
} }
} }
// ---------------------------------------------------------------------------------//
private void addExtras (StringBuilder text, int ptr) private void addExtras (StringBuilder text, int ptr)
// ---------------------------------------------------------------------------------//
{ {
text.append ("\n\n"); text.append ("\n\n");
for (int i = 0; i < 20; i++) for (int i = 0; i < 20; i++)
@ -202,8 +214,10 @@ class MazeLevel extends AbstractFile
} }
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public BufferedImage getImage () public BufferedImage getImage ()
// ---------------------------------------------------------------------------------//
{ {
Dimension cellSize = new Dimension (22, 22); Dimension cellSize = new Dimension (22, 22);
image = new BufferedImage (20 * cellSize.width + 1, 20 * cellSize.height + 1, image = new BufferedImage (20 * cellSize.width + 1, 20 * cellSize.height + 1,
@ -223,22 +237,30 @@ class MazeLevel extends AbstractFile
return image; return image;
} }
// ---------------------------------------------------------------------------------//
public void setMessages (List<Message> messages) public void setMessages (List<Message> messages)
// ---------------------------------------------------------------------------------//
{ {
this.messages = messages; this.messages = messages;
} }
// ---------------------------------------------------------------------------------//
public void setMonsters (List<Monster> monsters) public void setMonsters (List<Monster> monsters)
// ---------------------------------------------------------------------------------//
{ {
this.monsters = monsters; this.monsters = monsters;
} }
// ---------------------------------------------------------------------------------//
public void setItems (List<Item> items) public void setItems (List<Item> items)
// ---------------------------------------------------------------------------------//
{ {
this.items = items; this.items = items;
} }
// ---------------------------------------------------------------------------------//
public MazeCell getLocation (int row, int column) public MazeCell getLocation (int row, int column)
// ---------------------------------------------------------------------------------//
{ {
MazeAddress address = new MazeAddress (level, row, column); MazeAddress address = new MazeAddress (level, row, column);
MazeCell cell = new MazeCell (address); MazeCell cell = new MazeCell (address);
@ -411,7 +433,9 @@ class MazeLevel extends AbstractFile
return cell; return cell;
} }
// ---------------------------------------------------------------------------------//
private MazeAddress getAddress (int b) // 0:F private MazeAddress getAddress (int b) // 0:F
// ---------------------------------------------------------------------------------//
{ {
int x = b * 2; int x = b * 2;
return new MazeAddress (HexFormatter.intValue (buffer[768 + x], buffer[769 + x]), return new MazeAddress (HexFormatter.intValue (buffer[768 + x], buffer[769 + x]),
@ -419,7 +443,9 @@ class MazeLevel extends AbstractFile
HexFormatter.intValue (buffer[832 + x], buffer[833 + x])); HexFormatter.intValue (buffer[832 + x], buffer[833 + x]));
} }
// ---------------------------------------------------------------------------------//
private Message getMessage (int messageNo) private Message getMessage (int messageNo)
// ---------------------------------------------------------------------------------//
{ {
if (messages == null) if (messages == null)
return null; return null;
@ -431,7 +457,9 @@ class MazeLevel extends AbstractFile
return null; return null;
} }
// ---------------------------------------------------------------------------------//
private Monster getMonster (int monsterNo) private Monster getMonster (int monsterNo)
// ---------------------------------------------------------------------------------//
{ {
if (monsters == null) if (monsters == null)
return null; return null;
@ -443,12 +471,16 @@ class MazeLevel extends AbstractFile
return null; return null;
} }
// ---------------------------------------------------------------------------------//
public int getRows () public int getRows ()
// ---------------------------------------------------------------------------------//
{ {
return 20; return 20;
} }
// ---------------------------------------------------------------------------------//
public int getColumns () public int getColumns ()
// ---------------------------------------------------------------------------------//
{ {
return 20; return 20;
} }

View File

@ -5,7 +5,9 @@ import java.util.List;
import com.bytezone.diskbrowser.applefile.AbstractFile; import com.bytezone.diskbrowser.applefile.AbstractFile;
// -----------------------------------------------------------------------------------//
abstract class Message extends AbstractFile abstract class Message extends AbstractFile
// -----------------------------------------------------------------------------------//
{ {
private static int nextId = 0; private static int nextId = 0;
protected String message; protected String message;
@ -13,7 +15,9 @@ abstract class Message extends AbstractFile
private int totalLines; private int totalLines;
List<String> lines = new ArrayList<> (); List<String> lines = new ArrayList<> ();
public Message (byte[] buffer) // ---------------------------------------------------------------------------------//
Message (byte[] buffer)
// ---------------------------------------------------------------------------------//
{ {
super ("Message " + nextId, buffer); super ("Message " + nextId, buffer);
this.id = nextId; this.id = nextId;
@ -33,9 +37,13 @@ abstract class Message extends AbstractFile
message = text.toString (); message = text.toString ();
} }
// ---------------------------------------------------------------------------------//
protected abstract String getLine (int offset); protected abstract String getLine (int offset);
// ---------------------------------------------------------------------------------//
// ---------------------------------------------------------------------------------//
public boolean match (int messageNum) public boolean match (int messageNum)
// ---------------------------------------------------------------------------------//
{ {
if (id == messageNum) if (id == messageNum)
return true; return true;
@ -47,13 +55,17 @@ abstract class Message extends AbstractFile
return false; return false;
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getText () public String getText ()
// ---------------------------------------------------------------------------------//
{ {
return message; return message;
} }
// ---------------------------------------------------------------------------------//
public String toHTMLString () public String toHTMLString ()
// ---------------------------------------------------------------------------------//
{ {
StringBuilder message = new StringBuilder (); StringBuilder message = new StringBuilder ();
for (String line : lines) for (String line : lines)
@ -64,7 +76,9 @@ abstract class Message extends AbstractFile
return message.toString (); return message.toString ();
} }
// ---------------------------------------------------------------------------------//
public static void resetMessageId () public static void resetMessageId ()
// ---------------------------------------------------------------------------------//
{ {
nextId = 0; nextId = 0;
} }

View File

@ -7,7 +7,9 @@ import java.util.List;
import com.bytezone.common.Utility; import com.bytezone.common.Utility;
import com.bytezone.diskbrowser.applefile.AbstractFile; import com.bytezone.diskbrowser.applefile.AbstractFile;
public class MessageBlock extends AbstractFile implements Iterable<MessageDataBlock> // -----------------------------------------------------------------------------------//
class MessageBlock extends AbstractFile implements Iterable<MessageDataBlock>
// -----------------------------------------------------------------------------------//
{ {
private final int indexOffset; private final int indexOffset;
private final int indexLength; private final int indexLength;
@ -15,7 +17,9 @@ public class MessageBlock extends AbstractFile implements Iterable<MessageDataBl
private final List<MessageDataBlock> messageDataBlocks = new ArrayList<> (); private final List<MessageDataBlock> messageDataBlocks = new ArrayList<> ();
public MessageBlock (byte[] buffer, Huffman huffman) // ---------------------------------------------------------------------------------//
MessageBlock (byte[] buffer, Huffman huffman)
// ---------------------------------------------------------------------------------//
{ {
super ("bollocks", buffer); super ("bollocks", buffer);
@ -35,7 +39,9 @@ public class MessageBlock extends AbstractFile implements Iterable<MessageDataBl
} }
} }
// ---------------------------------------------------------------------------------//
public String getMessageText (int messageNo) public String getMessageText (int messageNo)
// ---------------------------------------------------------------------------------//
{ {
for (int i = 0; i < messageDataBlocks.size (); i++) for (int i = 0; i < messageDataBlocks.size (); i++)
{ {
@ -46,7 +52,9 @@ public class MessageBlock extends AbstractFile implements Iterable<MessageDataBl
return null; return null;
} }
// ---------------------------------------------------------------------------------//
public List<String> getMessageLines (int messageNo) public List<String> getMessageLines (int messageNo)
// ---------------------------------------------------------------------------------//
{ {
List<String> lines = new ArrayList<> (); List<String> lines = new ArrayList<> ();
@ -72,7 +80,9 @@ public class MessageBlock extends AbstractFile implements Iterable<MessageDataBl
return lines; return lines;
} }
// ---------------------------------------------------------------------------------//
public byte[] getMessage (int messageNo) public byte[] getMessage (int messageNo)
// ---------------------------------------------------------------------------------//
{ {
for (int i = 0; i < messageDataBlocks.size (); i++) for (int i = 0; i < messageDataBlocks.size (); i++)
{ {
@ -83,8 +93,10 @@ public class MessageBlock extends AbstractFile implements Iterable<MessageDataBl
return null; return null;
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getText () public String getText ()
// ---------------------------------------------------------------------------------//
{ {
if (text != null) if (text != null)
return text; return text;
@ -102,8 +114,10 @@ public class MessageBlock extends AbstractFile implements Iterable<MessageDataBl
return this.text; return this.text;
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public Iterator<MessageDataBlock> iterator () public Iterator<MessageDataBlock> iterator ()
// ---------------------------------------------------------------------------------//
{ {
return messageDataBlocks.iterator (); return messageDataBlocks.iterator ();
} }

View File

@ -6,7 +6,9 @@ import java.util.List;
import com.bytezone.common.Utility; import com.bytezone.common.Utility;
import com.bytezone.diskbrowser.applefile.AbstractFile; import com.bytezone.diskbrowser.applefile.AbstractFile;
public class MessageDataBlock extends AbstractFile // -----------------------------------------------------------------------------------//
class MessageDataBlock extends AbstractFile
// -----------------------------------------------------------------------------------//
{ {
final int firstMessageNo; final int firstMessageNo;
final int lastMessageNo; final int lastMessageNo;
@ -16,8 +18,9 @@ public class MessageDataBlock extends AbstractFile
private final Huffman huffman; private final Huffman huffman;
public MessageDataBlock (String name, byte[] buffer, int firstMessageNo, // ---------------------------------------------------------------------------------//
Huffman huffman) MessageDataBlock (String name, byte[] buffer, int firstMessageNo, Huffman huffman)
// ---------------------------------------------------------------------------------//
{ {
super (name, buffer); super (name, buffer);
@ -75,7 +78,9 @@ public class MessageDataBlock extends AbstractFile
this.name += " - " + lastMessageNo; this.name += " - " + lastMessageNo;
} }
// ---------------------------------------------------------------------------------//
byte[] getMessage (int messageNo) byte[] getMessage (int messageNo)
// ---------------------------------------------------------------------------------//
{ {
for (Message message : messages) for (Message message : messages)
if (message.msgNo == messageNo) if (message.msgNo == messageNo)
@ -87,7 +92,9 @@ public class MessageDataBlock extends AbstractFile
return null; return null;
} }
// ---------------------------------------------------------------------------------//
String getText (int messageNo) String getText (int messageNo)
// ---------------------------------------------------------------------------------//
{ {
for (Message message : messages) for (Message message : messages)
if (message.msgNo == messageNo) if (message.msgNo == messageNo)
@ -99,8 +106,10 @@ public class MessageDataBlock extends AbstractFile
return null; return null;
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getText () public String getText ()
// ---------------------------------------------------------------------------------//
{ {
if (messages.size () == 0) if (messages.size () == 0)
return "No Messages"; return "No Messages";
@ -128,8 +137,10 @@ public class MessageDataBlock extends AbstractFile
return text.toString (); return text.toString ();
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String toString () public String toString ()
// ---------------------------------------------------------------------------------//
{ {
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
@ -145,7 +156,9 @@ public class MessageDataBlock extends AbstractFile
return text.toString (); return text.toString ();
} }
// ---------------------------------------------------------------------------------//
class Message class Message
// ---------------------------------------------------------------------------------//
{ {
final int msgNo; final int msgNo;
final int offset; final int offset;

View File

@ -7,7 +7,9 @@ import java.util.List;
import com.bytezone.diskbrowser.applefile.AbstractFile; import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class Monster extends AbstractFile implements Comparable<Monster> class Monster extends AbstractFile implements Comparable<Monster>
// -----------------------------------------------------------------------------------//
{ {
public final String genericName; public final String genericName;
public final String realName; public final String realName;
@ -65,8 +67,9 @@ class Monster extends AbstractFile implements Comparable<Monster>
2200, 1000, 1900 // 90-100 2200, 1000, 1900 // 90-100
}; };
public Monster (String name, byte[] buffer, List<Reward> rewards, // ---------------------------------------------------------------------------------//
List<Monster> monsters) Monster (String name, byte[] buffer, List<Reward> rewards, List<Monster> monsters)
// ---------------------------------------------------------------------------------//
{ {
super (name, buffer); super (name, buffer);
@ -106,8 +109,10 @@ class Monster extends AbstractFile implements Comparable<Monster>
} }
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getText () public String getText ()
// ---------------------------------------------------------------------------------//
{ {
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
@ -193,7 +198,9 @@ class Monster extends AbstractFile implements Comparable<Monster>
return text.toString (); return text.toString ();
} }
// ---------------------------------------------------------------------------------//
public int getExperience () public int getExperience ()
// ---------------------------------------------------------------------------------//
{ {
// these values definitely affect the damage a monster does (when breathing?) // these values definitely affect the damage a monster does (when breathing?)
int exp2 = ((buffer[72] & 0xFF) * (buffer[74] & 0xFF) - 1) * 20; int exp2 = ((buffer[72] & 0xFF) * (buffer[74] & 0xFF) - 1) * 20;
@ -210,28 +217,38 @@ class Monster extends AbstractFile implements Comparable<Monster>
return exp2 + exp3 + exp4 + exp5 + exp6 + exp7 + exp8 + exp9 + exp10 + exp11 + exp12; return exp2 + exp3 + exp4 + exp5 + exp6 + exp7 + exp8 + exp9 + exp10 + exp11 + exp12;
} }
// ---------------------------------------------------------------------------------//
private int getBonus (int base, int value) private int getBonus (int base, int value)
// ---------------------------------------------------------------------------------//
{ {
return base * pwr[value]; return base * pwr[value];
} }
// ---------------------------------------------------------------------------------//
public void setImage (BufferedImage image) public void setImage (BufferedImage image)
// ---------------------------------------------------------------------------------//
{ {
this.image = image; this.image = image;
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getName () public String getName ()
// ---------------------------------------------------------------------------------//
{ {
return realName; return realName;
} }
// ---------------------------------------------------------------------------------//
public String getRealName () public String getRealName ()
// ---------------------------------------------------------------------------------//
{ {
return realName; return realName;
} }
// ---------------------------------------------------------------------------------//
public String getDamage () public String getDamage ()
// ---------------------------------------------------------------------------------//
{ {
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
for (Dice d : damage) for (Dice d : damage)
@ -241,7 +258,9 @@ class Monster extends AbstractFile implements Comparable<Monster>
return text.toString (); return text.toString ();
} }
// ---------------------------------------------------------------------------------//
public String getDump (int block) public String getDump (int block)
// ---------------------------------------------------------------------------------//
{ {
StringBuilder line = StringBuilder line =
new StringBuilder (String.format ("%3d %-16s", monsterID, realName)); new StringBuilder (String.format ("%3d %-16s", monsterID, realName));
@ -261,13 +280,17 @@ class Monster extends AbstractFile implements Comparable<Monster>
return line.toString (); return line.toString ();
} }
// ---------------------------------------------------------------------------------//
public boolean match (int monsterID) public boolean match (int monsterID)
// ---------------------------------------------------------------------------------//
{ {
return this.monsterID == monsterID; return this.monsterID == monsterID;
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public int compareTo (Monster other) // where is this used? public int compareTo (Monster other) // where is this used?
// ---------------------------------------------------------------------------------//
{ {
if (this.type == other.type) if (this.type == other.type)
return 0; return 0;
@ -276,8 +299,10 @@ class Monster extends AbstractFile implements Comparable<Monster>
return 1; return 1;
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String toString () public String toString ()
// ---------------------------------------------------------------------------------//
{ {
return realName; return realName;
} }

View File

@ -2,15 +2,21 @@ package com.bytezone.diskbrowser.wizardry;
import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class PlainMessage extends Message class PlainMessage extends Message
// -----------------------------------------------------------------------------------//
{ {
public PlainMessage (byte[] buffer) // ---------------------------------------------------------------------------------//
PlainMessage (byte[] buffer)
// ---------------------------------------------------------------------------------//
{ {
super (buffer); super (buffer);
} }
// ---------------------------------------------------------------------------------//
@Override @Override
protected String getLine (int offset) protected String getLine (int offset)
// ---------------------------------------------------------------------------------//
{ {
int length = buffer[offset] & 0xFF; int length = buffer[offset] & 0xFF;
return HexFormatter.getString (buffer, offset + 1, length); return HexFormatter.getString (buffer, offset + 1, length);

View File

@ -9,7 +9,9 @@ import com.bytezone.diskbrowser.disk.Disk;
import com.bytezone.diskbrowser.disk.DiskAddress; import com.bytezone.diskbrowser.disk.DiskAddress;
import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
public class Relocator extends AbstractFile public class Relocator extends AbstractFile
// -----------------------------------------------------------------------------------//
{ {
private final int checkByte; private final int checkByte;
private final List<DiskRecord> diskRecords = new ArrayList<> (); private final List<DiskRecord> diskRecords = new ArrayList<> ();
@ -17,7 +19,9 @@ public class Relocator extends AbstractFile
private final int[] diskBlocks = new int[0x800]; private final int[] diskBlocks = new int[0x800];
private final int[] diskOffsets = new int[0x800]; private final int[] diskOffsets = new int[0x800];
// ---------------------------------------------------------------------------------//
public Relocator (String name, byte[] buffer) public Relocator (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{ {
super (name, buffer); super (name, buffer);
@ -37,7 +41,9 @@ public class Relocator extends AbstractFile
addLogicalBlock ((byte) diskRecord.diskNumber, diskSegment); addLogicalBlock ((byte) diskRecord.diskNumber, diskSegment);
} }
// ---------------------------------------------------------------------------------//
private void addLogicalBlock (byte disk, DiskSegment diskSegment) private void addLogicalBlock (byte disk, DiskSegment diskSegment)
// ---------------------------------------------------------------------------------//
{ {
int lo = diskSegment.logicalBlock; int lo = diskSegment.logicalBlock;
int hi = diskSegment.logicalBlock + diskSegment.segmentLength; int hi = diskSegment.logicalBlock + diskSegment.segmentLength;
@ -50,7 +56,9 @@ public class Relocator extends AbstractFile
} }
} }
// ---------------------------------------------------------------------------------//
public void createNewBuffer (Disk[] dataDisks) public void createNewBuffer (Disk[] dataDisks)
// ---------------------------------------------------------------------------------//
{ {
AppleDisk master = (AppleDisk) dataDisks[0]; AppleDisk master = (AppleDisk) dataDisks[0];
// byte[] key1 = { 0x55, 0x55, 0x15, 0x55 }; // byte[] key1 = { 0x55, 0x55, 0x15, 0x55 };
@ -78,8 +86,10 @@ public class Relocator extends AbstractFile
} }
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getText () public String getText ()
// ---------------------------------------------------------------------------------//
{ {
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
@ -149,7 +159,9 @@ public class Relocator extends AbstractFile
return text.toString (); return text.toString ();
} }
// ---------------------------------------------------------------------------------//
private class DiskRecord private class DiskRecord
// ---------------------------------------------------------------------------------//
{ {
int diskNumber; int diskNumber;
int totDiskSegments; int totDiskSegments;
@ -202,7 +214,9 @@ public class Relocator extends AbstractFile
} }
} }
// ---------------------------------------------------------------------------------//
private class DiskSegment private class DiskSegment
// ---------------------------------------------------------------------------------//
{ {
int logicalBlock; int logicalBlock;
int physicalBlock; int physicalBlock;

View File

@ -5,7 +5,9 @@ import java.util.List;
import com.bytezone.diskbrowser.applefile.AbstractFile; import com.bytezone.diskbrowser.applefile.AbstractFile;
// -----------------------------------------------------------------------------------//
class Reward extends AbstractFile class Reward extends AbstractFile
// -----------------------------------------------------------------------------------//
{ {
static String[] types = { "gold", "item" }; static String[] types = { "gold", "item" };
static final int SEGMENT_LENGTH = 18; static final int SEGMENT_LENGTH = 18;
@ -16,7 +18,9 @@ class Reward extends AbstractFile
List<Monster> goldMonsters = new ArrayList<> (); List<Monster> goldMonsters = new ArrayList<> ();
List<Monster> chestMonsters = new ArrayList<> (); List<Monster> chestMonsters = new ArrayList<> ();
public Reward (String name, byte[] buffer, int id, List<Item> items) // ---------------------------------------------------------------------------------//
Reward (String name, byte[] buffer, int id, List<Item> items)
// ---------------------------------------------------------------------------------//
{ {
super (name, buffer); super (name, buffer);
this.id = id; this.id = id;
@ -32,7 +36,9 @@ class Reward extends AbstractFile
} }
} }
// ---------------------------------------------------------------------------------//
public void addMonster (Monster monster, int location) public void addMonster (Monster monster, int location)
// ---------------------------------------------------------------------------------//
{ {
if (location == 0) if (location == 0)
goldMonsters.add (monster); goldMonsters.add (monster);
@ -40,13 +46,17 @@ class Reward extends AbstractFile
chestMonsters.add (monster); chestMonsters.add (monster);
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getText () public String getText ()
// ---------------------------------------------------------------------------------//
{ {
return getText (true); return getText (true);
} }
// ---------------------------------------------------------------------------------//
public String getText (boolean showLinks) public String getText (boolean showLinks)
// ---------------------------------------------------------------------------------//
{ {
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
for (RewardElement re : elements) for (RewardElement re : elements)
@ -71,7 +81,9 @@ class Reward extends AbstractFile
return text.toString (); return text.toString ();
} }
// ---------------------------------------------------------------------------------//
public String getDump () public String getDump ()
// ---------------------------------------------------------------------------------//
{ {
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
int seq = 0; int seq = 0;
@ -84,7 +96,9 @@ class Reward extends AbstractFile
return text.toString (); return text.toString ();
} }
// ---------------------------------------------------------------------------------//
private class RewardElement private class RewardElement
// ---------------------------------------------------------------------------------//
{ {
int type; int type;
int odds; int odds;

View File

@ -2,368 +2,407 @@ package com.bytezone.diskbrowser.wizardry;
import com.bytezone.diskbrowser.applefile.AbstractFile; import com.bytezone.diskbrowser.applefile.AbstractFile;
// -----------------------------------------------------------------------------------//
class Spell extends AbstractFile class Spell extends AbstractFile
// -----------------------------------------------------------------------------------//
{ {
private final SpellType spellType; private final SpellType spellType;
private SpellThrown whenCast; private SpellThrown whenCast;
private final int level; private final int level;
private String translation; private String translation;
private SpellTarget target; private SpellTarget target;
private String description; private String description;
public enum SpellType { public enum SpellType
MAGE, PRIEST {
}; MAGE, PRIEST
};
public enum SpellTarget { public enum SpellTarget
PERSON, PARTY, MONSTER, MONSTER_GROUP, ALL_MONSTERS, VARIABLE, NONE, CASTER {
}; PERSON, PARTY, MONSTER, MONSTER_GROUP, ALL_MONSTERS, VARIABLE, NONE, CASTER
};
public enum SpellThrown { public enum SpellThrown
COMBAT, ANY_TIME, LOOTING, CAMP, COMBAT_OR_CAMP {
}; COMBAT, ANY_TIME, LOOTING, CAMP, COMBAT_OR_CAMP
};
private static int lastSpellFound = -1; private static int lastSpellFound = -1;
private Spell (String spellName, SpellType type, int level, byte[] buffer) // ---------------------------------------------------------------------------------//
{ private Spell (String spellName, SpellType type, int level, byte[] buffer)
super (spellName, buffer); // ---------------------------------------------------------------------------------//
this.spellType = type; {
this.level = level; super (spellName, buffer);
this.spellType = type;
this.level = level;
if (lastSpellFound + 1 < spellNames.length && spellName.equals (spellNames[lastSpellFound + 1])) if (lastSpellFound + 1 < spellNames.length
setSpell (++lastSpellFound); && spellName.equals (spellNames[lastSpellFound + 1]))
else setSpell (++lastSpellFound);
{ else
for (int i = 0; i < spellNames.length; i++) {
if (spellName.equals (spellNames[i])) for (int i = 0; i < spellNames.length; i++)
{ if (spellName.equals (spellNames[i]))
setSpell (i); {
lastSpellFound = i; setSpell (i);
break; lastSpellFound = i;
} break;
} }
} }
}
private void setSpell (int spellNo) // ---------------------------------------------------------------------------------//
{ private void setSpell (int spellNo)
this.translation = translations[spellNo]; // ---------------------------------------------------------------------------------//
this.description = descriptions[spellNo]; {
this.whenCast = when[spellNo]; this.translation = translations[spellNo];
this.target = affects[spellNo]; this.description = descriptions[spellNo];
} this.whenCast = when[spellNo];
this.target = affects[spellNo];
}
public static Spell getSpell (String spellName, SpellType type, int level, byte[] buffer) // ---------------------------------------------------------------------------------//
{ public static Spell getSpell (String spellName, SpellType type, int level,
return new Spell (spellName, type, level, buffer); byte[] buffer)
} // ---------------------------------------------------------------------------------//
{
return new Spell (spellName, type, level, buffer);
}
public String getName () // ---------------------------------------------------------------------------------//
{ @Override
return name; public String getName ()
} // ---------------------------------------------------------------------------------//
{
return name;
}
public SpellType getType () // ---------------------------------------------------------------------------------//
{ public SpellType getType ()
return spellType; // ---------------------------------------------------------------------------------//
} {
return spellType;
}
public int getLevel () // ---------------------------------------------------------------------------------//
{ public int getLevel ()
return level; // ---------------------------------------------------------------------------------//
} {
return level;
}
public String getTranslation () // ---------------------------------------------------------------------------------//
{ public String getTranslation ()
return translation; // ---------------------------------------------------------------------------------//
} {
return translation;
}
@Override // ---------------------------------------------------------------------------------//
public String getText () @Override
{ public String getText ()
return description; // ---------------------------------------------------------------------------------//
} {
return description;
}
public String getWhenCast () // ---------------------------------------------------------------------------------//
{ public String getWhenCast ()
switch (whenCast) // ---------------------------------------------------------------------------------//
{ {
case COMBAT: switch (whenCast)
return "Combat"; {
case LOOTING: case COMBAT:
return "Looting"; return "Combat";
case ANY_TIME: case LOOTING:
return "Any time"; return "Looting";
case CAMP: case ANY_TIME:
return "Camp"; return "Any time";
case COMBAT_OR_CAMP: case CAMP:
return "Combat or camp"; return "Camp";
default: case COMBAT_OR_CAMP:
return "?"; return "Combat or camp";
} default:
return "?";
}
} }
public String getArea () // ---------------------------------------------------------------------------------//
{ public String getArea ()
switch (target) // ---------------------------------------------------------------------------------//
{ {
case PERSON: switch (target)
return "1 Person"; {
case PARTY: case PERSON:
return "Entire party"; return "1 Person";
case MONSTER: case PARTY:
return "1 Monster"; return "Entire party";
case MONSTER_GROUP: case MONSTER:
return "1 Monster group"; return "1 Monster";
case ALL_MONSTERS: case MONSTER_GROUP:
return "All monsters"; return "1 Monster group";
case VARIABLE: case ALL_MONSTERS:
return "Variable"; return "All monsters";
case NONE: case VARIABLE:
return "None"; return "Variable";
case CASTER: case NONE:
return "Caster"; return "None";
default: case CASTER:
return "?"; return "Caster";
} default:
return "?";
}
}
} // ---------------------------------------------------------------------------------//
public String toHTMLTable ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ("<table border=\"1\"");
text.append (" width=\"100%\">\n");
public String toHTMLTable () text.append (" <tr>\n <td width=\"110\">Spell name</td>\n");
{ text.append (" <td>" + name + "</td>\n </tr>\n");
StringBuilder text = new StringBuilder ("<table border=\"1\"");
text.append (" width=\"100%\">\n");
text.append (" <tr>\n <td width=\"110\">Spell name</td>\n"); text.append (" <tr>\n <td>Translation</td>\n");
text.append (" <td>" + name + "</td>\n </tr>\n"); text.append (" <td>" + translation + "</td>\n </tr>\n");
text.append (" <tr>\n <td>Translation</td>\n"); text.append (" <tr>\n <td>Spell level</td>\n");
text.append (" <td>" + translation + "</td>\n </tr>\n"); text.append (" <td>" + level + "</td>\n </tr>\n");
text.append (" <tr>\n <td>Spell level</td>\n"); text.append (" <tr>\n <td>Spell type</td>\n");
text.append (" <td>" + level + "</td>\n </tr>\n"); text.append (" <td>" + getWhenCast () + "</td>\n </tr>\n");
text.append (" <tr>\n <td>Spell type</td>\n"); text.append (" <tr>\n <td>Area of effect</td>\n");
text.append (" <td>" + getWhenCast () + "</td>\n </tr>\n"); text.append (" <td>" + getArea () + "</td>\n </tr>\n");
text.append (" <tr>\n <td>Area of effect</td>\n"); text.append (" <tr>\n <td>Description</td>\n");
text.append (" <td>" + getArea () + "</td>\n </tr>\n"); text.append (" <td>" + getText () + "</td>\n </tr>\n");
text.append (" <tr>\n <td>Description</td>\n"); text.append ("</table>");
text.append (" <td>" + getText () + "</td>\n </tr>\n"); return text.toString ();
}
text.append ("</table>"); // ---------------------------------------------------------------------------------//
return text.toString (); @Override
} public String toString ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder (name);
while (text.length () < 14)
text.append (" ");
if (spellType == SpellType.PRIEST)
text.append ("P");
else
text.append ("M");
text.append (level);
while (text.length () < 20)
text.append (" ");
text.append (translation);
while (text.length () < 40)
text.append (" ");
text.append (getArea ());
while (text.length () < 60)
text.append (" ");
text.append (getWhenCast ());
return text.toString ();
}
@Override private static String[] spellNames =
public String toString () { "KALKI", "DIOS", "BADIOS", "MILWA", "PORFIC", "MATU", "CALFO", "MANIFO",
{ "MONTINO", "LOMILWA", "DIALKO", "LATUMAPIC", "BAMATU", "DIAL", "BADIAL",
StringBuilder text = new StringBuilder (name); "LATUMOFIS", "MAPORFIC", "DIALMA", "BADIALMA", "LITOKAN", "KANDI", "DI", "BADI",
while (text.length () < 14) "LORTO", "MADI", "MABADI", "LOKTOFEIT", "MALIKTO", "KADORTO",
text.append (" ");
if (spellType == SpellType.PRIEST)
text.append ("P");
else
text.append ("M");
text.append (level);
while (text.length () < 20)
text.append (" ");
text.append (translation);
while (text.length () < 40)
text.append (" ");
text.append (getArea ());
while (text.length () < 60)
text.append (" ");
text.append (getWhenCast ());
return text.toString ();
}
private static String[] spellNames = "HALITO", "MOGREF", "KATINO", "DUMAPIC", "DILTO", "SOPIC", "MAHALITO", "MOLITO",
{ "KALKI", "DIOS", "BADIOS", "MILWA", "PORFIC", "MATU", "CALFO", "MANIFO", "MONTINO", "MORLIS", "DALTO", "LAHALITO", "MAMORLIS", "MAKANITO", "MADALTO", "LAKANITO",
"LOMILWA", "DIALKO", "LATUMAPIC", "BAMATU", "DIAL", "BADIAL", "LATUMOFIS", "MAPORFIC", "ZILWAN", "MASOPIC", "HAMAN", "MALOR", "MAHAMAN", "TILTOWAIT" };
"DIALMA", "BADIALMA", "LITOKAN", "KANDI", "DI", "BADI", "LORTO", "MADI", "MABADI",
"LOKTOFEIT", "MALIKTO", "KADORTO",
"HALITO", "MOGREF", "KATINO", "DUMAPIC", "DILTO", "SOPIC", "MAHALITO", "MOLITO", private static String[] translations =
"MORLIS", "DALTO", "LAHALITO", "MAMORLIS", "MAKANITO", "MADALTO", "LAKANITO", "ZILWAN", { "Blessings", "Heal", "Harm", "Light", "Shield", "Blessing & zeal", "X-ray vision",
"MASOPIC", "HAMAN", "MALOR", "MAHAMAN", "TILTOWAIT" }; "Statue", "Still air", "More light", "Softness/supple", "Identification",
"Prayer", "Heal (more)", "Hurt (more)", "Cure poison", "Shield (big)",
"Heal (greatly)", "Hurt (greatly)", "Flame tower", "Location", "Life", "Death",
"Blades", "Healing", "Harm (incredibly)", "Recall", "The Word of Death",
"Resurrection",
private static String[] translations = "Little Fire", "Body Iron", "Bad Air", "Clarity", "Darkness", "Glass", "Big fire",
{ "Blessings", "Heal", "Harm", "Light", "Shield", "Blessing & zeal", "X-ray vision", "Spark storm", "Fear", "Blizzard blast", "Flame storm", "Terror", "Deadly air",
"Statue", "Still air", "More light", "Softness/supple", "Identification", "Prayer", "Frost", "Suffocation", "Dispell", "Big glass", "Change", "Apport",
"Heal (more)", "Hurt (more)", "Cure poison", "Shield (big)", "Heal (greatly)", "Great change", "(untranslatable)" };
"Hurt (greatly)", "Flame tower", "Location", "Life", "Death", "Blades", "Healing",
"Harm (incredibly)", "Recall", "The Word of Death", "Resurrection",
"Little Fire", "Body Iron", "Bad Air", "Clarity", "Darkness", "Glass", "Big fire", private static SpellThrown[] when =
"Spark storm", "Fear", "Blizzard blast", "Flame storm", "Terror", "Deadly air", "Frost", { SpellThrown.COMBAT, SpellThrown.ANY_TIME, SpellThrown.COMBAT,
"Suffocation", "Dispell", "Big glass", "Change", "Apport", "Great change", SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.LOOTING,
"(untranslatable)" }; SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.ANY_TIME,
SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.COMBAT,
SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.ANY_TIME,
SpellThrown.ANY_TIME, SpellThrown.ANY_TIME, SpellThrown.COMBAT,
SpellThrown.COMBAT, SpellThrown.CAMP, SpellThrown.CAMP, SpellThrown.COMBAT,
SpellThrown.COMBAT, SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.COMBAT,
SpellThrown.COMBAT, SpellThrown.ANY_TIME,
private static SpellThrown[] when = SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.CAMP,
{ SpellThrown.COMBAT, SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT,
SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.LOOTING, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT,
SpellThrown.COMBAT, SpellThrown.ANY_TIME, SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT,
SpellThrown.COMBAT, SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT_OR_CAMP,
SpellThrown.ANY_TIME, SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, };
SpellThrown.CAMP, SpellThrown.CAMP, SpellThrown.COMBAT, SpellThrown.COMBAT,
SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT,
SpellThrown.ANY_TIME,
SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.CAMP, private static SpellTarget[] affects =
SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, { SpellTarget.PARTY, SpellTarget.PERSON, SpellTarget.MONSTER, SpellTarget.PARTY,
SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellTarget.CASTER, SpellTarget.PARTY, SpellTarget.CASTER,
SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP, SpellTarget.PARTY,
SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT_OR_CAMP, SpellThrown.COMBAT, SpellTarget.PERSON, SpellTarget.PARTY, SpellTarget.PARTY, SpellTarget.PERSON,
SpellThrown.COMBAT, }; SpellTarget.MONSTER, SpellTarget.PERSON, SpellTarget.PARTY, SpellTarget.PERSON,
SpellTarget.MONSTER, SpellTarget.PARTY, SpellTarget.PERSON, SpellTarget.PERSON,
SpellTarget.MONSTER, SpellTarget.MONSTER_GROUP, SpellTarget.PERSON,
SpellTarget.MONSTER, SpellTarget.PARTY, SpellTarget.MONSTER_GROUP,
SpellTarget.PERSON,
private static SpellTarget[] affects = SpellTarget.MONSTER, SpellTarget.CASTER, SpellTarget.MONSTER_GROUP,
{ SpellTarget.PARTY, SpellTarget.PERSON, SpellTarget.MONSTER, SpellTarget.PARTY, SpellTarget.NONE, SpellTarget.MONSTER_GROUP, SpellTarget.CASTER,
SpellTarget.CASTER, SpellTarget.PARTY, SpellTarget.CASTER, SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP,
SpellTarget.MONSTER_GROUP, SpellTarget.PARTY, SpellTarget.PERSON, SpellTarget.PARTY, SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP, SpellTarget.ALL_MONSTERS,
SpellTarget.PARTY, SpellTarget.PERSON, SpellTarget.MONSTER, SpellTarget.PERSON, SpellTarget.ALL_MONSTERS, SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP,
SpellTarget.PARTY, SpellTarget.PERSON, SpellTarget.MONSTER, SpellTarget.PARTY, SpellTarget.MONSTER, SpellTarget.PARTY, SpellTarget.VARIABLE, SpellTarget.PARTY,
SpellTarget.PERSON, SpellTarget.PERSON, SpellTarget.MONSTER, SpellTarget.MONSTER_GROUP, SpellTarget.PARTY, SpellTarget.ALL_MONSTERS };
SpellTarget.PERSON, SpellTarget.MONSTER, SpellTarget.PARTY, SpellTarget.MONSTER_GROUP,
SpellTarget.PERSON,
SpellTarget.MONSTER, SpellTarget.CASTER, SpellTarget.MONSTER_GROUP, SpellTarget.NONE, private static String[] descriptions =
SpellTarget.MONSTER_GROUP, SpellTarget.CASTER, SpellTarget.MONSTER_GROUP, { "KALKI reduces the AC of all party members by one, and thus makes"
SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP, + " them harder to hit.",
SpellTarget.MONSTER_GROUP, SpellTarget.ALL_MONSTERS, SpellTarget.ALL_MONSTERS, "DIOS restores from one to eight hit points of damage from a party"
SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER, + "member. It will not bring dead back to life.",
SpellTarget.PARTY, SpellTarget.VARIABLE, SpellTarget.PARTY, SpellTarget.PARTY, "BADIOS causes one to eight hit points of damage to a monster, and"
SpellTarget.ALL_MONSTERS }; + " may kill it. It is the reverse of dios. Note the BA prefix which"
+ " means 'not'.",
"MILWA causes a softly glowing light to follow the party, allowing"
+ " them to see further into the maze, and also revealing all secret"
+ " doors. See also LOMILWA. This spell lasts only a short while.",
"PORFIC lowers the AC of the caster considerably. The effects last"
+ " for the duration of combat.",
"MATU has the same effects as KALKI, but at double the strength.",
"CALFO allows the caster to determine the exact nature of a trap"
+ " on a chest 95% of the time.",
"MANIFO causes some of the monsters in a group to become stiff as"
+ " statues for one or more melee rounds. The chance of success,"
+ " and the duration of the effects, depend on the power of the"
+ " target monsters.",
"MONTINO causes the air around a group of monsters to stop"
+ " transmitting sound. Like MANIFO, only some of the monsters will"
+ " be affected, and for varying lengths of time. Monsters and"
+ " Party members under the influence of this spell cannot cast"
+ " spells, as they cannot utter the spell words!",
"LOMILWA is a MILWA spell with a much longer life span. Note that"
+ " when this spell, or MILWA are active, the Q option while"
+ " moving through the maze is active. If Q)UICK PLOTTING is on,"
+ " only the square you are in, and the next two squares, will"
+ " plot. Normally you might see five or six squares ahead with"
+ " LOMILWA on. Quick Plotting lets you move fast through known"
+ " areas. Note that it will be turned off when you enter camp or"
+ " combat mode.",
"DIALKO cures paralysis, and removes the effects of MANIFO and"
+ " KATINO from one member of the party.",
"LATUMAPIC makes it readily apparent exactly what the opposing"
+ " monsters really are.",
"BAMATU has the effects of MATU at twice the effectiveness.",
"DIAL restores two to 16 hit points of damage, and is similar to" + " DIOS.",
"BADIAL causes two to 16 hit points of damage in the same way as" + " BADIOS.",
"LATUMOFIS makes a poisoned person whole and fit again. Note that"
+ " poison causes a person to lose hit points steadily during"
+ " movement and combat.",
"MAPORFIC is an improved PORFIC, with effects that last for the"
+ " entire expedition.",
"DIALMA restores three to 24 hit points.",
"BADIALMA causes three to 24 hit points of damage.",
"LITOKAN causes a pillar of flame to strike a group of monsters,"
+ " doing three to 24 hits of damage to each. However, as with"
+ " many spells that affect entire groups, there is a chance that"
+ " individual monsters will be able to avoid or minimise its"
+ " effects. And some monsters will be resistant to it.",
"KANDI allows the user to locate characters in the maze. It tells on"
+ " which level, and in which rough area the dead one can be found.",
"DI causes a dead person to be resurrected. However, the renewed"
+ " character has but one hit point. Also, this spell is not as"
+ " effective or as safe as using the Temple.",
"BADI gives the affected monster a coronary attack. It may or may"
+ " not cause death to occur.",
"LORTO causes sharp blades to slice through a group, causing six to"
+ " 36 points of damage.",
"MADI causes all hit points to be restored and cures any condition"
+ " but death.",
"MABADI causes all but one to eight hit points to be removed from"
+ " the target.",
"LOKTOFEIT causes all party members to be teleported back to the"
+ " castle, minus all their equipment and most of their gold. There"
+ " is also a good chance this spell will not function.",
"MALIKTO causes 12 to 72 hit points of damage to all monsters. None"
+ " can escape or minimise its effects.",
"KADORTO restores the dead to life as does DI, but also restores all"
+ " hit points. However, it has the same drawbacks as the DI spell."
+ " KADORTO can be used to resurrect people even if they are ashes.",
private static String[] descriptions = "HALITO causes a flame ball the size of a baseball to hit a monster,"
{ + " doing from one to eight points of damage.",
"KALKI reduces the AC of all party members by one, and thus makes" "MOGREF reduces the caster's AC by two. The effect lasts the entire"
+ " them harder to hit.", + " encounter.",
"DIOS restores from one to eight hit points of damage from a party" "KATINO causes most of the monsters in a group to fall asleep."
+ "member. It will not bring dead back to life.", + " Katino only effects normal, animal or humanoid monsters. The"
"BADIOS causes one to eight hit points of damage to a monster, and" + " chance of the spell affecting an individual monster, and the"
+ " may kill it. It is the reverse of dios. Note the BA prefix which" + " duration of the effect, is inversely proportional to the power"
+ " means 'not'.", + " of the monster. While asleep, monsters are easier to hit and"
"MILWA causes a softly glowing light to follow the party, allowing" + " successful strikes do double damage.",
+ " them to see further into the maze, and also revealing all secret" "DUMAPIC informs you of the party's exact displacement from the"
+ " doors. See also LOMILWA. This spell lasts only a short while.", + " stairs to the castle, vertically, and North and East, and also"
"PORFIC lowers the AC of the caster considerably. The effects last" + " tells you what direction you are facing.",
+ " for the duration of combat.",
"MATU has the same effects as KALKI, but at double the strength.",
"CALFO allows the caster to determine the exact nature of a trap"
+ " on a chest 95% of the time.",
"MANIFO causes some of the monsters in a group to become stiff as"
+ " statues for one or more melee rounds. The chance of success,"
+ " and the duration of the effects, depend on the power of the"
+ " target monsters.",
"MONTINO causes the air around a group of monsters to stop"
+ " transmitting sound. Like MANIFO, only some of the monsters will"
+ " be affected, and for varying lengths of time. Monsters and"
+ " Party members under the influence of this spell cannot cast"
+ " spells, as they cannot utter the spell words!",
"LOMILWA is a MILWA spell with a much longer life span. Note that"
+ " when this spell, or MILWA are active, the Q option while"
+ " moving through the maze is active. If Q)UICK PLOTTING is on,"
+ " only the square you are in, and the next two squares, will"
+ " plot. Normally you might see five or six squares ahead with"
+ " LOMILWA on. Quick Plotting lets you move fast through known"
+ " areas. Note that it will be turned off when you enter camp or"
+ " combat mode.",
"DIALKO cures paralysis, and removes the effects of MANIFO and"
+ " KATINO from one member of the party.",
"LATUMAPIC makes it readily apparent exactly what the opposing" + " monsters really are.",
"BAMATU has the effects of MATU at twice the effectiveness.",
"DIAL restores two to 16 hit points of damage, and is similar to" + " DIOS.",
"BADIAL causes two to 16 hit points of damage in the same way as" + " BADIOS.",
"LATUMOFIS makes a poisoned person whole and fit again. Note that"
+ " poison causes a person to lose hit points steadily during"
+ " movement and combat.",
"MAPORFIC is an improved PORFIC, with effects that last for the" + " entire expedition.",
"DIALMA restores three to 24 hit points.",
"BADIALMA causes three to 24 hit points of damage.",
"LITOKAN causes a pillar of flame to strike a group of monsters,"
+ " doing three to 24 hits of damage to each. However, as with"
+ " many spells that affect entire groups, there is a chance that"
+ " individual monsters will be able to avoid or minimise its"
+ " effects. And some monsters will be resistant to it.",
"KANDI allows the user to locate characters in the maze. It tells on"
+ " which level, and in which rough area the dead one can be found.",
"DI causes a dead person to be resurrected. However, the renewed"
+ " character has but one hit point. Also, this spell is not as"
+ " effective or as safe as using the Temple.",
"BADI gives the affected monster a coronary attack. It may or may"
+ " not cause death to occur.",
"LORTO causes sharp blades to slice through a group, causing six to"
+ " 36 points of damage.",
"MADI causes all hit points to be restored and cures any condition" + " but death.",
"MABADI causes all but one to eight hit points to be removed from" + " the target.",
"LOKTOFEIT causes all party members to be teleported back to the"
+ " castle, minus all their equipment and most of their gold. There"
+ " is also a good chance this spell will not function.",
"MALIKTO causes 12 to 72 hit points of damage to all monsters. None"
+ " can escape or minimise its effects.",
"KADORTO restores the dead to life as does DI, but also restores all"
+ " hit points. However, it has the same drawbacks as the DI spell."
+ " KADORTO can be used to resurrect people even if they are ashes.",
"HALITO causes a flame ball the size of a baseball to hit a monster," "DILTO causes one group of monsters to be enveloped in darkness,"
+ " doing from one to eight points of damage.", + " which reduces their ability to defend against your attacks.",
"MOGREF reduces the caster's AC by two. The effect lasts the entire" + " encounter.", "SOPIC causes the caster to become transparent. This means that"
"KATINO causes most of the monsters in a group to fall asleep." + " he is harder to see, and thus his AC is reduced by four.",
+ " Katino only effects normal, animal or humanoid monsters. The"
+ " chance of the spell affecting an individual monster, and the"
+ " duration of the effect, is inversely proportional to the power"
+ " of the monster. While asleep, monsters are easier to hit and"
+ " successful strikes do double damage.",
"DUMAPIC informs you of the party's exact displacement from the"
+ " stairs to the castle, vertically, and North and East, and also"
+ " tells you what direction you are facing.",
"DILTO causes one group of monsters to be enveloped in darkness," "MAHALITO causes a fiery explosion in a monster group, doing four"
+ " which reduces their ability to defend against your attacks.", + " to 24 hit points of damage. As with other similar spells,"
"SOPIC causes the caster to become transparent. This means that" + " monsters may be able to minimise the damage done.",
+ " he is harder to see, and thus his AC is reduced by four.", "MOLITO causes sparks to fly out and damage about half of the"
+ " monsters in a group. Three to 18 hit points of damage are done"
"MAHALITO causes a fiery explosion in a monster group, doing four" + " with no chance of avoiding the sparks.",
+ " to 24 hit points of damage. As with other similar spells," "MORLIS causes one group of monsters to fear the party greatly. The"
+ " monsters may be able to minimise the damage done.", + " effects are the same as a double strength DILTO spell.",
"MOLITO causes sparks to fly out and damage about half of the" "DALTO is similar to MAHALITO except that cold replaces flames."
+ " monsters in a group. Three to 18 hit points of damage are done" + " Also, six to 36 hit points of damage are done.",
+ " with no chance of avoiding the sparks.", "LAHALITO is an improved MAHALITO, doing the same damage as DALTO.",
"MORLIS causes one group of monsters to fear the party greatly. The" "MAMORLIS is similar to MORLIS, except that all monster groups are"
+ " effects are the same as a double strength DILTO spell.", + " affected.",
"DALTO is similar to MAHALITO except that cold replaces flames." "Any monsters of less than eigth level (i.e. about 35-40 hit points)"
+ " Also, six to 36 hit points of damage are done.", + " are killed by this spell outright.",
"LAHALITO is an improved MAHALITO, doing the same damage as DALTO.", "An improved DALTO causing eight to 64 hit points of damage.",
"MAMORLIS is similar to MORLIS, except that all monster groups are" + " affected.", "All monsters in the group affected by this spell die. Of course,"
"Any monsters of less than eigth level (i.e. about 35-40 hit points)" + " there is a chance that some of the monsters will not be affected.",
+ " are killed by this spell outright.", "This spell will destroy any one monster that is of the Undead" + " variety",
"An improved DALTO causing eight to 64 hit points of damage.", "This spell duplicates the effects of SOPIC for the entire party.",
"All monsters in the group affected by this spell die. Of course," "This spell is indeed terrible, and may backfire on the caster."
+ " there is a chance that some of the monsters will not be affected.", + " First, to even cast it, you must be of the thirteenth level or"
"This spell will destroy any one monster that is of the Undead" + " variety", + " higher, and casting it will cost you one level of experience."
"This spell duplicates the effects of SOPIC for the entire party.", + " The effects of HAMAN are random, and usually help the party.",
"This spell is indeed terrible, and may backfire on the caster." "This spell's effects depend on the situation the party is in when it"
+ " First, to even cast it, you must be of the thirteenth level or" + " is cast.Basically, MALOR will teleport the entire party from one"
+ " higher, and casting it will cost you one level of experience." + " location to another. When used in melee, the teleport is random,"
+ " The effects of HAMAN are random, and usually help the party.", + " but when used in camp, where there is more chance for concentration"
"This spell's effects depend on the situation the party is in when it" + ", it can be used to move the party anywhere in the maze. Be warned,"
+ " is cast.Basically, MALOR will teleport the entire party from one" + " however, that if you teleport outside of the maze, or into an"
+ " location to another. When used in melee, the teleport is random," + " area that is solid rock, you will be lost forever, so this spell"
+ " but when used in camp, where there is more chance for concentration" + " is to be used with the greatest of care. Combat use of MALOR will"
+ ", it can be used to move the party anywhere in the maze. Be warned," + " never put you outside of the maze, but it may move you deeper in,"
+ " however, that if you teleport outside of the maze, or into an" + " so it should be used only in panic situations.",
+ " area that is solid rock, you will be lost forever, so this spell" "The same restrictions and qualifications apply to this spell as do"
+ " is to be used with the greatest of care. Combat use of MALOR will" + " to HAMAN. However, the effects are even greater. Generally these"
+ " never put you outside of the maze, but it may move you deeper in," + " spells are only used when there is no other hope for survival.",
+ " so it should be used only in panic situations.", "The effect of this spell can be described as similar to that of a"
"The same restrictions and qualifications apply to this spell as do" + " nuclear fusion explosion. Luckily the party is shielded from its"
+ " to HAMAN. However, the effects are even greater. Generally these" + " effects. Unluckily (for them) the monsters are not. This spell"
+ " spells are only used when there is no other hope for survival.", + " will do from 10-100 hit points of damage." };
"The effect of this spell can be described as similar to that of a"
+ " nuclear fusion explosion. Luckily the party is shielded from its"
+ " effects. Unluckily (for them) the monsters are not. This spell"
+ " will do from 10-100 hit points of damage." };
} }

View File

@ -3,9 +3,13 @@ package com.bytezone.diskbrowser.wizardry;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer; import java.awt.image.DataBuffer;
// -----------------------------------------------------------------------------------//
public class Wiz4Image extends AbstractImage public class Wiz4Image extends AbstractImage
// -----------------------------------------------------------------------------------//
{ {
// ---------------------------------------------------------------------------------//
public Wiz4Image (String name, byte[] buffer, int rows, int cols) // 5, 6 public Wiz4Image (String name, byte[] buffer, int rows, int cols) // 5, 6
// ---------------------------------------------------------------------------------//
{ {
super (name, buffer); super (name, buffer);

View File

@ -6,12 +6,16 @@ import java.util.List;
import com.bytezone.diskbrowser.applefile.AbstractFile; import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
public class Wiz4Monsters extends AbstractFile public class Wiz4Monsters extends AbstractFile
// -----------------------------------------------------------------------------------//
{ {
final List<Wiz4Image> images = new ArrayList<> (); final List<Wiz4Image> images = new ArrayList<> ();
final List<Integer> blocks = new ArrayList<> (); final List<Integer> blocks = new ArrayList<> ();
// ---------------------------------------------------------------------------------//
public Wiz4Monsters (String name, byte[] buffer) public Wiz4Monsters (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{ {
super (name, buffer); super (name, buffer);
@ -30,8 +34,10 @@ public class Wiz4Monsters extends AbstractFile
} }
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getText () public String getText ()
// ---------------------------------------------------------------------------------//
{ {
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();

View File

@ -8,12 +8,16 @@ import com.bytezone.common.Utility;
import com.bytezone.diskbrowser.applefile.AbstractFile; import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.HexFormatter;
public class Wiz5Monsters extends AbstractFile implements Iterable<Wiz5Monsters.Monster> // -----------------------------------------------------------------------------------//
class Wiz5Monsters extends AbstractFile implements Iterable<Wiz5Monsters.Monster>
// -----------------------------------------------------------------------------------//
{ {
private static final int BLOCK_SIZE = 512; private static final int BLOCK_SIZE = 512;
private final List<Monster> monsters = new ArrayList<> (); private final List<Monster> monsters = new ArrayList<> ();
public Wiz5Monsters (String name, byte[] buffer) // ---------------------------------------------------------------------------------//
Wiz5Monsters (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{ {
super (name, buffer); super (name, buffer);
@ -56,14 +60,18 @@ public class Wiz5Monsters extends AbstractFile implements Iterable<Wiz5Monsters.
} }
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public Iterator<Monster> iterator () public Iterator<Monster> iterator ()
// ---------------------------------------------------------------------------------//
{ {
return monsters.iterator (); return monsters.iterator ();
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getText () public String getText ()
// ---------------------------------------------------------------------------------//
{ {
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
@ -90,7 +98,9 @@ public class Wiz5Monsters extends AbstractFile implements Iterable<Wiz5Monsters.
return text.toString (); return text.toString ();
} }
// ---------------------------------------------------------------------------------//
class Monster class Monster
// ---------------------------------------------------------------------------------//
{ {
private final int id; private final int id;
private final List<DataBuffer> dataBuffers = new ArrayList<> (); private final List<DataBuffer> dataBuffers = new ArrayList<> ();
@ -151,7 +161,9 @@ public class Wiz5Monsters extends AbstractFile implements Iterable<Wiz5Monsters.
} }
} }
// ---------------------------------------------------------------------------------//
class DataBuffer class DataBuffer
// ---------------------------------------------------------------------------------//
{ {
private final int block; private final int block;
private final int offset; private final int offset;

View File

@ -17,7 +17,9 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
import com.bytezone.diskbrowser.utilities.Utility; import com.bytezone.diskbrowser.utilities.Utility;
import com.bytezone.diskbrowser.wizardry.Header.ScenarioData; import com.bytezone.diskbrowser.wizardry.Header.ScenarioData;
// -----------------------------------------------------------------------------------//
public class Wizardry4BootDisk extends PascalDisk public class Wizardry4BootDisk extends PascalDisk
// -----------------------------------------------------------------------------------//
{ {
public Header scenarioHeader; public Header scenarioHeader;
// private final List<AppleDisk> disks = new ArrayList<> (); // private final List<AppleDisk> disks = new ArrayList<> ();
@ -26,7 +28,9 @@ public class Wizardry4BootDisk extends PascalDisk
private Huffman huffman; private Huffman huffman;
private final int version; private final int version;
// ---------------------------------------------------------------------------------//
public Wizardry4BootDisk (AppleDisk[] dataDisks) public Wizardry4BootDisk (AppleDisk[] dataDisks)
// ---------------------------------------------------------------------------------//
{ {
super (dataDisks[0]); super (dataDisks[0]);
@ -133,8 +137,10 @@ public class Wizardry4BootDisk extends PascalDisk
} }
} }
// ---------------------------------------------------------------------------------//
private void linkMonsterImages4 (DefaultMutableTreeNode monstersNode, private void linkMonsterImages4 (DefaultMutableTreeNode monstersNode,
FileEntry fileEntry) FileEntry fileEntry)
// ---------------------------------------------------------------------------------//
{ {
List<DiskAddress> pictureBlocks = fileEntry.getSectors (); List<DiskAddress> pictureBlocks = fileEntry.getSectors ();
@ -151,8 +157,10 @@ public class Wizardry4BootDisk extends PascalDisk
} }
} }
// ---------------------------------------------------------------------------------//
private void linkMonsterImages5 (DefaultMutableTreeNode monstersNode, private void linkMonsterImages5 (DefaultMutableTreeNode monstersNode,
FileEntry fileEntry) FileEntry fileEntry)
// ---------------------------------------------------------------------------------//
{ {
List<DiskAddress> pictureBlocks = fileEntry.getSectors (); List<DiskAddress> pictureBlocks = fileEntry.getSectors ();
@ -169,7 +177,9 @@ public class Wizardry4BootDisk extends PascalDisk
} }
} }
// ---------------------------------------------------------------------------------//
private void linkMazeLevels4 (DefaultMutableTreeNode scenarioNode, FileEntry fileEntry) private void linkMazeLevels4 (DefaultMutableTreeNode scenarioNode, FileEntry fileEntry)
// ---------------------------------------------------------------------------------//
{ {
ScenarioData mazeData = scenarioHeader.data.get (Header.MAZE_AREA); ScenarioData mazeData = scenarioHeader.data.get (Header.MAZE_AREA);
@ -191,7 +201,9 @@ public class Wizardry4BootDisk extends PascalDisk
} }
} }
// ---------------------------------------------------------------------------------//
private void linkMazeLevels5 (DefaultMutableTreeNode scenarioNode, FileEntry fileEntry) private void linkMazeLevels5 (DefaultMutableTreeNode scenarioNode, FileEntry fileEntry)
// ---------------------------------------------------------------------------------//
{ {
byte[] buffer = fileEntry.getDataSource ().buffer; byte[] buffer = fileEntry.getDataSource ().buffer;
List<DiskAddress> blocks = fileEntry.getSectors (); List<DiskAddress> blocks = fileEntry.getSectors ();
@ -221,7 +233,9 @@ public class Wizardry4BootDisk extends PascalDisk
afs.setSectors (allMazeBlocks); afs.setSectors (allMazeBlocks);
} }
// ---------------------------------------------------------------------------------//
private void linkBlock1 (DefaultMutableTreeNode scenarioNode, FileEntry fileEntry) private void linkBlock1 (DefaultMutableTreeNode scenarioNode, FileEntry fileEntry)
// ---------------------------------------------------------------------------------//
{ {
byte[] buffer = fileEntry.getDataSource ().buffer; byte[] buffer = fileEntry.getDataSource ().buffer;
List<DiskAddress> blocks = fileEntry.getSectors (); List<DiskAddress> blocks = fileEntry.getSectors ();
@ -248,7 +262,9 @@ public class Wizardry4BootDisk extends PascalDisk
afs.setSectors (allBlocks); afs.setSectors (allBlocks);
} }
// ---------------------------------------------------------------------------------//
private void linkBlock2 (DefaultMutableTreeNode scenarioNode, FileEntry fileEntry) private void linkBlock2 (DefaultMutableTreeNode scenarioNode, FileEntry fileEntry)
// ---------------------------------------------------------------------------------//
{ {
byte[] buffer = fileEntry.getDataSource ().buffer; byte[] buffer = fileEntry.getDataSource ().buffer;
List<DiskAddress> blocks = fileEntry.getSectors (); List<DiskAddress> blocks = fileEntry.getSectors ();
@ -275,7 +291,9 @@ public class Wizardry4BootDisk extends PascalDisk
afs.setSectors (allBlocks); afs.setSectors (allBlocks);
} }
// ---------------------------------------------------------------------------------//
private void linkOracle (DefaultMutableTreeNode scenarioNode, FileEntry fileEntry) private void linkOracle (DefaultMutableTreeNode scenarioNode, FileEntry fileEntry)
// ---------------------------------------------------------------------------------//
{ {
byte[] buffer = fileEntry.getDataSource ().buffer; byte[] buffer = fileEntry.getDataSource ().buffer;
List<DiskAddress> blocks = fileEntry.getSectors (); List<DiskAddress> blocks = fileEntry.getSectors ();
@ -309,8 +327,10 @@ public class Wizardry4BootDisk extends PascalDisk
afs.setSectors (allOracleBlocks); afs.setSectors (allOracleBlocks);
} }
// ---------------------------------------------------------------------------------//
private void addToNode (AbstractFile af, DefaultMutableTreeNode node, private void addToNode (AbstractFile af, DefaultMutableTreeNode node,
List<DiskAddress> blocks) List<DiskAddress> blocks)
// ---------------------------------------------------------------------------------//
{ {
DefaultAppleFileSource dafs = DefaultAppleFileSource dafs =
new DefaultAppleFileSource (af.getName (), af, this, blocks); new DefaultAppleFileSource (af.getName (), af, this, blocks);
@ -319,8 +339,10 @@ public class Wizardry4BootDisk extends PascalDisk
node.add (childNode); node.add (childNode);
} }
// ---------------------------------------------------------------------------------//
private DefaultMutableTreeNode linkNode (String name, String text, private DefaultMutableTreeNode linkNode (String name, String text,
DefaultMutableTreeNode parent) DefaultMutableTreeNode parent)
// ---------------------------------------------------------------------------------//
{ {
DefaultAppleFileSource afs = new DefaultAppleFileSource (name, text, this); DefaultAppleFileSource afs = new DefaultAppleFileSource (name, text, this);
DefaultMutableTreeNode node = new DefaultMutableTreeNode (afs); DefaultMutableTreeNode node = new DefaultMutableTreeNode (afs);
@ -328,7 +350,9 @@ public class Wizardry4BootDisk extends PascalDisk
return node; return node;
} }
// ---------------------------------------------------------------------------------//
public static boolean isWizardryIVorV (Disk disk, boolean debug) public static boolean isWizardryIVorV (Disk disk, boolean debug)
// ---------------------------------------------------------------------------------//
{ {
// Wizardry IV or V boot code // Wizardry IV or V boot code
byte[] header = { 0x00, (byte) 0xEA, (byte) 0xA9, 0x60, (byte) 0x8D, 0x01, 0x08 }; byte[] header = { 0x00, (byte) 0xEA, (byte) 0xA9, 0x60, (byte) 0x8D, 0x01, 0x08 };

View File

@ -22,7 +22,9 @@ import com.bytezone.diskbrowser.wizardry.Character.Statistics;
import com.bytezone.diskbrowser.wizardry.Header.ScenarioData; import com.bytezone.diskbrowser.wizardry.Header.ScenarioData;
import com.bytezone.diskbrowser.wizardry.Spell.SpellType; import com.bytezone.diskbrowser.wizardry.Spell.SpellType;
// ---------------------------------------------------------------------------------//
public class WizardryScenarioDisk extends PascalDisk public class WizardryScenarioDisk extends PascalDisk
// ---------------------------------------------------------------------------------//
{ {
public Header scenarioHeader; public Header scenarioHeader;
@ -47,7 +49,9 @@ public class WizardryScenarioDisk extends PascalDisk
SectorType experienceSector = new SectorType ("Experience", Color.darkGray); SectorType experienceSector = new SectorType ("Experience", Color.darkGray);
SectorType treasureSector = new SectorType ("Treasure", Color.pink); SectorType treasureSector = new SectorType ("Treasure", Color.pink);
// ---------------------------------------------------------------------------------//
public WizardryScenarioDisk (Disk disk) public WizardryScenarioDisk (Disk disk)
// ---------------------------------------------------------------------------------//
{ {
super (disk); super (disk);
@ -116,8 +120,10 @@ public class WizardryScenarioDisk extends PascalDisk
} }
} }
// ---------------------------------------------------------------------------------//
private DefaultMutableTreeNode linkNode (String name, String text, private DefaultMutableTreeNode linkNode (String name, String text,
DefaultMutableTreeNode parent) DefaultMutableTreeNode parent)
// ---------------------------------------------------------------------------------//
{ {
DefaultAppleFileSource afs = new DefaultAppleFileSource (name, text, this); DefaultAppleFileSource afs = new DefaultAppleFileSource (name, text, this);
DefaultMutableTreeNode node = new DefaultMutableTreeNode (afs); DefaultMutableTreeNode node = new DefaultMutableTreeNode (afs);
@ -125,7 +131,9 @@ public class WizardryScenarioDisk extends PascalDisk
return node; return node;
} }
// ---------------------------------------------------------------------------------//
public static boolean isWizardryFormat (Disk disk, boolean debug) public static boolean isWizardryFormat (Disk disk, boolean debug)
// ---------------------------------------------------------------------------------//
{ {
byte[] buffer = disk.readSector (2); byte[] buffer = disk.readSector (2);
int totalFiles = HexFormatter.intValue (buffer[16], buffer[17]); int totalFiles = HexFormatter.intValue (buffer[16], buffer[17]);
@ -142,31 +150,41 @@ public class WizardryScenarioDisk extends PascalDisk
return true; return true;
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public AppleFileSource getFile (String fileName) public AppleFileSource getFile (String fileName)
// ---------------------------------------------------------------------------------//
{ {
// System.out.println ("Wizardry disk looking for : " + fileName); // System.out.println ("Wizardry disk looking for : " + fileName);
return null; return null;
} }
// ---------------------------------------------------------------------------------//
public String getCatalogText () public String getCatalogText ()
// ---------------------------------------------------------------------------------//
{ {
return null; return null;
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public List<DiskAddress> getFileSectors (int fileNo) public List<DiskAddress> getFileSectors (int fileNo)
// ---------------------------------------------------------------------------------//
{ {
return null; return null;
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public DataSource getFile (int fileNo) public DataSource getFile (int fileNo)
// ---------------------------------------------------------------------------------//
{ {
return null; return null;
} }
// ---------------------------------------------------------------------------------//
private void extractRewards (DefaultMutableTreeNode node, List<DiskAddress> sectors) private void extractRewards (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{ {
List<DiskAddress> nodeSectors = new ArrayList<> (); List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.TREASURE_TABLE_AREA); ScenarioData sd = scenarioHeader.data.get (Header.TREASURE_TABLE_AREA);
@ -192,8 +210,10 @@ public class WizardryScenarioDisk extends PascalDisk
dds.text = text.toString (); dds.text = text.toString ();
} }
// ---------------------------------------------------------------------------------//
private int addReward (byte[] buffer, List<DiskAddress> blocks, private int addReward (byte[] buffer, List<DiskAddress> blocks,
DefaultMutableTreeNode node, int seq) DefaultMutableTreeNode node, int seq)
// ---------------------------------------------------------------------------------//
{ {
int recLen = 168; int recLen = 168;
for (int ptr = 0; ptr < 1008; ptr += recLen) for (int ptr = 0; ptr < 1008; ptr += recLen)
@ -208,7 +228,9 @@ public class WizardryScenarioDisk extends PascalDisk
return seq; return seq;
} }
// ---------------------------------------------------------------------------------//
private void extractCharacters (DefaultMutableTreeNode node, List<DiskAddress> sectors) private void extractCharacters (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{ {
List<DiskAddress> nodeSectors = new ArrayList<> (); List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.CHARACTER_AREA); ScenarioData sd = scenarioHeader.data.get (Header.CHARACTER_AREA);
@ -249,8 +271,10 @@ public class WizardryScenarioDisk extends PascalDisk
dds.text = text.toString (); dds.text = text.toString ();
} }
// ---------------------------------------------------------------------------------//
private void addCharacters (byte[] buffer, List<DiskAddress> blocks, private void addCharacters (byte[] buffer, List<DiskAddress> blocks,
DefaultMutableTreeNode node) DefaultMutableTreeNode node)
// ---------------------------------------------------------------------------------//
{ {
int recLen = 208; int recLen = 208;
for (int ptr = 0; ptr < 832; ptr += recLen) for (int ptr = 0; ptr < 832; ptr += recLen)
@ -269,7 +293,9 @@ public class WizardryScenarioDisk extends PascalDisk
} }
} }
// ---------------------------------------------------------------------------------//
private void extractMonsters (DefaultMutableTreeNode node, List<DiskAddress> sectors) private void extractMonsters (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{ {
List<DiskAddress> nodeSectors = new ArrayList<> (); List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.MONSTER_AREA); ScenarioData sd = scenarioHeader.data.get (Header.MONSTER_AREA);
@ -302,8 +328,10 @@ public class WizardryScenarioDisk extends PascalDisk
dds.text = text.toString (); dds.text = text.toString ();
} }
// ---------------------------------------------------------------------------------//
private void addMonsters (byte[] buffer, List<DiskAddress> blocks, private void addMonsters (byte[] buffer, List<DiskAddress> blocks,
DefaultMutableTreeNode node) DefaultMutableTreeNode node)
// ---------------------------------------------------------------------------------//
{ {
int recLen = 158; int recLen = 158;
for (int ptr = 0; ptr < 948; ptr += recLen) for (int ptr = 0; ptr < 948; ptr += recLen)
@ -322,7 +350,9 @@ public class WizardryScenarioDisk extends PascalDisk
} }
} }
// ---------------------------------------------------------------------------------//
private void extractItems (DefaultMutableTreeNode node, List<DiskAddress> sectors) private void extractItems (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{ {
List<DiskAddress> nodeSectors = new ArrayList<> (); List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.ITEM_AREA); ScenarioData sd = scenarioHeader.data.get (Header.ITEM_AREA);
@ -355,8 +385,10 @@ public class WizardryScenarioDisk extends PascalDisk
dds.text = text.toString (); dds.text = text.toString ();
} }
// ---------------------------------------------------------------------------------//
private void addItems (byte[] buffer, List<DiskAddress> blocks, private void addItems (byte[] buffer, List<DiskAddress> blocks,
DefaultMutableTreeNode node) DefaultMutableTreeNode node)
// ---------------------------------------------------------------------------------//
{ {
int recLen = 78; int recLen = 78;
for (int ptr = 0; ptr < 1014; ptr += recLen) for (int ptr = 0; ptr < 1014; ptr += recLen)
@ -374,7 +406,9 @@ public class WizardryScenarioDisk extends PascalDisk
} }
} }
// ---------------------------------------------------------------------------------//
private void extractSpells (DefaultMutableTreeNode node, List<DiskAddress> sectors) private void extractSpells (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{ {
spells = new ArrayList<> (); spells = new ArrayList<> ();
List<DiskAddress> blocks = new ArrayList<> (2); List<DiskAddress> blocks = new ArrayList<> (2);
@ -410,7 +444,9 @@ public class WizardryScenarioDisk extends PascalDisk
} }
} }
// ---------------------------------------------------------------------------------//
private void extractMessages (DefaultMutableTreeNode node, List<DiskAddress> sectors) private void extractMessages (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{ {
Message.resetMessageId (); Message.resetMessageId ();
messages = new ArrayList<> (); messages = new ArrayList<> ();
@ -469,7 +505,9 @@ public class WizardryScenarioDisk extends PascalDisk
} }
} }
// ---------------------------------------------------------------------------------//
private void extractLevels (DefaultMutableTreeNode node, List<DiskAddress> sectors) private void extractLevels (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{ {
List<DiskAddress> nodeSectors = new ArrayList<> (); List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.MAZE_AREA); ScenarioData sd = scenarioHeader.data.get (Header.MAZE_AREA);
@ -503,7 +541,9 @@ public class WizardryScenarioDisk extends PascalDisk
dds.text = text.toString (); dds.text = text.toString ();
} }
// ---------------------------------------------------------------------------------//
private void extractImages (DefaultMutableTreeNode node, List<DiskAddress> sectors) private void extractImages (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{ {
List<DiskAddress> nodeSectors = new ArrayList<> (); List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.IMAGE_AREA); ScenarioData sd = scenarioHeader.data.get (Header.IMAGE_AREA);
@ -542,8 +582,10 @@ public class WizardryScenarioDisk extends PascalDisk
dds.text = text.toString (); dds.text = text.toString ();
} }
// ---------------------------------------------------------------------------------//
private void extractExperienceLevels (DefaultMutableTreeNode node, private void extractExperienceLevels (DefaultMutableTreeNode node,
List<DiskAddress> sectors) List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{ {
List<DiskAddress> nodeSectors = new ArrayList<> (); List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.EXPERIENCE_AREA); ScenarioData sd = scenarioHeader.data.get (Header.EXPERIENCE_AREA);
@ -573,16 +615,20 @@ public class WizardryScenarioDisk extends PascalDisk
afs.setSectors (nodeSectors); afs.setSectors (nodeSectors);
} }
// ---------------------------------------------------------------------------------//
private void addToNode (AbstractFile af, DefaultMutableTreeNode node, DiskAddress block, private void addToNode (AbstractFile af, DefaultMutableTreeNode node, DiskAddress block,
SectorType type) SectorType type)
// ---------------------------------------------------------------------------------//
{ {
List<DiskAddress> blocks = new ArrayList<> (1); List<DiskAddress> blocks = new ArrayList<> (1);
blocks.add (block); blocks.add (block);
addToNode (af, node, blocks, type); addToNode (af, node, blocks, type);
} }
// ---------------------------------------------------------------------------------//
private void addToNode (AbstractFile af, DefaultMutableTreeNode node, private void addToNode (AbstractFile af, DefaultMutableTreeNode node,
List<DiskAddress> blocks, SectorType type) List<DiskAddress> blocks, SectorType type)
// ---------------------------------------------------------------------------------//
{ {
DefaultAppleFileSource dafs = DefaultAppleFileSource dafs =
new DefaultAppleFileSource (af.getName (), af, this, blocks); new DefaultAppleFileSource (af.getName (), af, this, blocks);
@ -591,8 +637,10 @@ public class WizardryScenarioDisk extends PascalDisk
childNode.setAllowsChildren (false); childNode.setAllowsChildren (false);
} }
// ---------------------------------------------------------------------------------//
private List<DiskAddress> getTwoBlocks (ScenarioData sd, int i, private List<DiskAddress> getTwoBlocks (ScenarioData sd, int i,
List<DiskAddress> sectors) List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{ {
List<DiskAddress> blocks = new ArrayList<> (2); List<DiskAddress> blocks = new ArrayList<> (2);
blocks.add (sectors.get (sd.dataOffset + i * 2)); blocks.add (sectors.get (sd.dataOffset + i * 2));