mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-01 03:41:29 +00:00
tidying
This commit is contained in:
parent
f9038810d2
commit
40c2afbd48
|
@ -45,12 +45,14 @@ class Character extends AbstractFile
|
||||||
stats.status = statuses[stats.statusValue];
|
stats.status = statuses[stats.statusValue];
|
||||||
stats.alignment = alignments[buffer[42] & 0xFF];
|
stats.alignment = alignments[buffer[42] & 0xFF];
|
||||||
|
|
||||||
stats.gold = Utility.getShort (buffer, 52) + Utility.getShort (buffer, 54) * 10000;
|
stats.gold = Utility.getShort (buffer, 52) + Utility.getShort (buffer, 54) * 10000
|
||||||
|
+ Utility.getShort (buffer, 56) * 100000000L;
|
||||||
stats.experience = Utility.getShort (buffer, 124) + Utility.getShort (buffer, 126) * 10000;
|
stats.experience = Utility.getShort (buffer, 124) + Utility.getShort (buffer, 126) * 10000;
|
||||||
stats.level = Utility.getShort (buffer, 132);
|
stats.level = Utility.getShort (buffer, 132);
|
||||||
|
|
||||||
stats.hitsLeft = Utility.getShort (buffer, 134);
|
stats.hitsLeft = Utility.getShort (buffer, 134);
|
||||||
stats.hitsMax = Utility.getShort (buffer, 136);
|
stats.hitsMax = Utility.getShort (buffer, 136);
|
||||||
|
|
||||||
stats.armourClass = buffer[176];
|
stats.armourClass = buffer[176];
|
||||||
|
|
||||||
attributes.strength = (buffer[44] & 0xFF) % 16;
|
attributes.strength = (buffer[44] & 0xFF) % 16;
|
||||||
|
@ -113,17 +115,20 @@ class Character extends AbstractFile
|
||||||
public void linkSpells (List<Spell> spellList)
|
public void linkSpells (List<Spell> spellList)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
|
System.out.println (name);
|
||||||
|
int index = 0;
|
||||||
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++)
|
||||||
if (((buffer[i] >>> bit) & 1) == 1)
|
{
|
||||||
|
if (((buffer[i] >>> bit) & 0x01) != 0)
|
||||||
{
|
{
|
||||||
int index = (i - 138) * 8 + bit;
|
spellBook.add (spellList.get (index));
|
||||||
if (index > 0 && index <= spellList.size ())
|
System.out.println (spellList.get (index));
|
||||||
spellBook.add (spellList.get (index - 1));
|
|
||||||
else
|
|
||||||
System.out.println ("LinkSpell: " + getName () + " SpellID : " + index
|
|
||||||
+ " is outside range 1:" + spellList.size ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (++index >= spellList.size ())
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -333,7 +338,7 @@ class Character extends AbstractFile
|
||||||
public String status;
|
public String status;
|
||||||
public int typeInt;
|
public int typeInt;
|
||||||
public int statusValue;
|
public int statusValue;
|
||||||
public int gold;
|
public long gold;
|
||||||
public int experience;
|
public int experience;
|
||||||
public long nextLevel;
|
public long nextLevel;
|
||||||
public int level;
|
public int level;
|
||||||
|
@ -344,7 +349,9 @@ class Character extends AbstractFile
|
||||||
public int assetValue;
|
public int assetValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public class Attributes
|
public class Attributes
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
public int strength;
|
public int strength;
|
||||||
public int intelligence;
|
public int intelligence;
|
||||||
|
@ -352,11 +359,6 @@ class Character extends AbstractFile
|
||||||
public int vitality;
|
public int vitality;
|
||||||
public int agility;
|
public int agility;
|
||||||
public int luck;
|
public int luck;
|
||||||
public int[] array;
|
public int[] array = new int[6];
|
||||||
|
|
||||||
public Attributes ()
|
|
||||||
{
|
|
||||||
array = new int[6];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,8 +13,8 @@ class Image extends AbstractImage
|
||||||
{
|
{
|
||||||
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 ();
|
||||||
|
@ -30,8 +30,10 @@ class Image extends AbstractImage
|
||||||
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++;
|
||||||
}
|
}
|
||||||
|
@ -44,6 +46,7 @@ class Image extends AbstractImage
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 208; i++)
|
for (int i = 0; i < 208; i++)
|
||||||
buffer[i] = 0;
|
buffer[i] = 0;
|
||||||
|
|
||||||
buffer[124] = -108;
|
buffer[124] = -108;
|
||||||
buffer[134] = -43;
|
buffer[134] = -43;
|
||||||
buffer[135] = -128;
|
buffer[135] = -128;
|
||||||
|
|
|
@ -24,13 +24,13 @@ class Item extends AbstractFile implements Comparable<Item>
|
||||||
{
|
{
|
||||||
super (name, buffer);
|
super (name, buffer);
|
||||||
itemID = counter++;
|
itemID = counter++;
|
||||||
|
genericName = HexFormatter.getPascalString (buffer, 16);
|
||||||
type = buffer[32];
|
type = buffer[32];
|
||||||
cost = Utility.getShort (buffer, 44) + Utility.getShort (buffer, 46) * 10000
|
cost = Utility.getShort (buffer, 44) + Utility.getShort (buffer, 46) * 10000
|
||||||
+ Utility.getShort (buffer, 48) * 100000000L;
|
+ Utility.getShort (buffer, 48) * 100000000L;
|
||||||
genericName = HexFormatter.getPascalString (buffer, 16);
|
|
||||||
damage = new Dice (buffer, 66);
|
|
||||||
armourClass = buffer[62];
|
armourClass = buffer[62];
|
||||||
speed = buffer[72];
|
damage = new Dice (buffer, 66);
|
||||||
|
speed = buffer[72]; // 14 flags
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -142,14 +142,16 @@ class Item extends AbstractFile implements Comparable<Item>
|
||||||
public String getDump (int block)
|
public String getDump (int block)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
StringBuilder line =
|
StringBuilder line = new StringBuilder (String.format ("%3d %-16s", itemID, getName ()));
|
||||||
new StringBuilder (String.format ("%3d %-16s", itemID, getName ()));
|
|
||||||
int lo = block == 0 ? 32 : block == 1 ? 46 : 70;
|
int lo = block == 0 ? 32 : block == 1 ? 56 : 80;
|
||||||
int hi = lo + 24;
|
int hi = lo + 24;
|
||||||
if (hi > buffer.length)
|
if (hi > buffer.length)
|
||||||
hi = buffer.length;
|
hi = buffer.length;
|
||||||
|
|
||||||
for (int i = lo; i < hi; i++)
|
for (int i = lo; i < hi; i++)
|
||||||
line.append (String.format ("%02X ", buffer[i]));
|
line.append (String.format ("%02X ", buffer[i]));
|
||||||
|
|
||||||
return line.toString ();
|
return line.toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ class Monster extends AbstractFile
|
||||||
damage.add (new Dice (buffer, ptr));
|
damage.add (new Dice (buffer, ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
experiencePoints = Utility.readTriple (buffer, 126);
|
experiencePoints = getWizLong (buffer, 126);
|
||||||
levelDrain = buffer[132];
|
levelDrain = buffer[132];
|
||||||
healPts = buffer[134];
|
healPts = buffer[134];
|
||||||
goldReward = rewards.get (buffer[136]);
|
goldReward = rewards.get (buffer[136]);
|
||||||
|
@ -112,6 +112,17 @@ class Monster extends AbstractFile
|
||||||
chestReward.addMonster (this, 1);
|
chestReward.addMonster (this, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
private int getWizLong (byte[] buffer, int offset)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
int low = Utility.getShort (buffer, offset);
|
||||||
|
int mid = Utility.getShort (buffer, offset + 2);
|
||||||
|
int high = Utility.getShort (buffer, offset + 4);
|
||||||
|
|
||||||
|
return high * 100000000 + mid * 10000 + low;
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public String getText ()
|
public String getText ()
|
||||||
|
@ -267,11 +278,14 @@ class Monster extends AbstractFile
|
||||||
for (int i = lo; i < hi; i++)
|
for (int i = lo; i < hi; i++)
|
||||||
line.append (String.format ("%02X ", buffer[i]));
|
line.append (String.format ("%02X ", buffer[i]));
|
||||||
|
|
||||||
if (block == 3 && scenarioId == 1)
|
if (block == 3)
|
||||||
{
|
if (scenarioId == 1)
|
||||||
int exp = getExperience ();
|
{
|
||||||
line.append (String.format (" %,6d %,6d", exp, exp - experience[monsterID]));
|
int exp = getExperience ();
|
||||||
}
|
line.append (String.format (" %,6d %,6d", exp, exp - experience[monsterID]));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
line.append (String.format (" %,6d", experiencePoints));
|
||||||
|
|
||||||
return line.toString ();
|
return line.toString ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,7 @@ class Reward extends AbstractFile
|
||||||
public RewardElement (byte[] buffer)
|
public RewardElement (byte[] buffer)
|
||||||
{
|
{
|
||||||
this.buffer = buffer;
|
this.buffer = buffer;
|
||||||
|
|
||||||
type = buffer[8];
|
type = buffer[8];
|
||||||
odds = buffer[6];
|
odds = buffer[6];
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ class Spell extends AbstractFile
|
||||||
private String translation;
|
private String translation;
|
||||||
private SpellTarget target;
|
private SpellTarget target;
|
||||||
private String description;
|
private String description;
|
||||||
|
private int value;
|
||||||
|
|
||||||
public enum SpellType
|
public enum SpellType
|
||||||
{
|
{
|
||||||
|
@ -35,6 +36,7 @@ class Spell extends AbstractFile
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super (spellName, buffer);
|
super (spellName, buffer);
|
||||||
|
|
||||||
this.spellType = type;
|
this.spellType = type;
|
||||||
this.level = level;
|
this.level = level;
|
||||||
|
|
||||||
|
@ -60,6 +62,7 @@ class Spell extends AbstractFile
|
||||||
this.description = descriptions[spellNo];
|
this.description = descriptions[spellNo];
|
||||||
this.whenCast = when[spellNo];
|
this.whenCast = when[spellNo];
|
||||||
this.target = affects[spellNo];
|
this.target = affects[spellNo];
|
||||||
|
value = spellValue[spellNo];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -189,24 +192,8 @@ class Spell extends AbstractFile
|
||||||
public String toString ()
|
public String toString ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
StringBuilder text = new StringBuilder (getName ());
|
return String.format ("%-16s %-6s %d %-20s %-20s %-20s %5d %<04X", getName (), spellType,
|
||||||
while (text.length () < 14)
|
level, translation, getArea (), getWhenCast (), value);
|
||||||
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 = { "KALKI", "DIOS", "BADIOS", "MILWA", "PORFIC", "MATU",
|
private static String[] spellNames = { "KALKI", "DIOS", "BADIOS", "MILWA", "PORFIC", "MATU",
|
||||||
|
@ -261,6 +248,13 @@ class Spell extends AbstractFile
|
||||||
SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER, SpellTarget.PARTY,
|
SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER, SpellTarget.PARTY,
|
||||||
SpellTarget.VARIABLE, SpellTarget.PARTY, SpellTarget.PARTY, SpellTarget.ALL_MONSTERS };
|
SpellTarget.VARIABLE, SpellTarget.PARTY, SpellTarget.PARTY, SpellTarget.ALL_MONSTERS };
|
||||||
|
|
||||||
|
private static int[] spellValue =
|
||||||
|
{ 1449, 2301, 3675, 2889, 2287, 3139, 1717, 2619, 5970, 5333, 2718, 6491, 5169, 761, 1253,
|
||||||
|
9463, 4322, 1614, 2446, 4396, 1885, 180, 382, 4296, 547, 759, 8330, 5514, 6673,
|
||||||
|
|
||||||
|
4178, 2409, 3983, 3245, 3340, 1953, 6181, 4731, 4744, 3180, 6156, 7525, 6612, 4925, 6587,
|
||||||
|
4573, 3990, 1562, 3128, 2597, 11157 };
|
||||||
|
|
||||||
private static String[] descriptions = {
|
private static String[] descriptions = {
|
||||||
"KALKI reduces the AC of all party members by one, and thus makes" + " them harder to hit.",
|
"KALKI reduces the AC of all party members by one, and thus makes" + " them harder to hit.",
|
||||||
"DIOS restores from one to eight hit points of damage from a party"
|
"DIOS restores from one to eight hit points of damage from a party"
|
||||||
|
|
|
@ -366,10 +366,12 @@ public class WizardryScenarioDisk extends PascalDisk
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder text = new StringBuilder ();
|
StringBuilder text = new StringBuilder ();
|
||||||
for (int block = 0; block < 3; block++)
|
for (int block = 0; block < 2; block++)
|
||||||
{
|
{
|
||||||
text.append (" ID Name\n");
|
text.append (" ID Name ");
|
||||||
text.append ("--- ---------------");
|
for (int i = 0; i < 24; i++)
|
||||||
|
text.append (String.format ("%2d ", i));
|
||||||
|
text.append ("\n--- ---------------");
|
||||||
for (int i = 0; i < 24; i++)
|
for (int i = 0; i < 24; i++)
|
||||||
text.append (" --");
|
text.append (" --");
|
||||||
text.append ("\n");
|
text.append ("\n");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user