mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-01-30 18:31:20 +00:00
tidying
This commit is contained in:
parent
97fe58d94d
commit
8765299cf4
@ -10,15 +10,16 @@ class ItemV1 extends Item // implements Comparable<ItemV1>
|
|||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
// public int partyOwns;
|
// public int partyOwns;
|
||||||
static int counter = 0;
|
// static int counter = 0;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
ItemV1 (String name, byte[] buffer)
|
ItemV1 (int itemId, String name, byte[] buffer)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super (name, buffer);
|
super (name, buffer);
|
||||||
|
|
||||||
itemId = counter++;
|
// itemId = counter++;
|
||||||
|
this.itemId = itemId;
|
||||||
genericName = HexFormatter.getPascalString (buffer, 16);
|
genericName = HexFormatter.getPascalString (buffer, 16);
|
||||||
|
|
||||||
type = ObjectType.values ()[buffer[32]];
|
type = ObjectType.values ()[buffer[32]];
|
||||||
|
@ -346,11 +346,11 @@ class MazeCell
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
MonsterV1 monster = monsters.get (monsterID);
|
MonsterV1 monster = monsters.get (monsterID);
|
||||||
sign.append (" <b>" + monster.getRealName () + " </b>");
|
sign.append (" <b>" + monster.getName () + " </b>");
|
||||||
while (monster.partnerOdds == 100)
|
while (monster.partnerOdds == 100)
|
||||||
{
|
{
|
||||||
monster = monsters.get (monster.partnerID);
|
monster = monsters.get (monster.partnerID);
|
||||||
sign.append ("<br> <b>" + monster.getRealName () + " </b>");
|
sign.append ("<br> <b>" + monster.getName () + " </b>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (itemRequired != null)
|
if (itemRequired != null)
|
||||||
|
@ -97,4 +97,12 @@ public abstract class Monster extends AbstractFile
|
|||||||
|
|
||||||
return text.toString ();
|
return text.toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@Override
|
||||||
|
public String toString ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ class MonsterV1 extends Monster
|
|||||||
int experiencePoints;
|
int experiencePoints;
|
||||||
int unique;
|
int unique;
|
||||||
|
|
||||||
static int counter = 0;
|
// static int counter = 0;
|
||||||
|
|
||||||
// Scenario #1 values
|
// Scenario #1 values
|
||||||
private static int[] experience = { //
|
private static int[] experience = { //
|
||||||
@ -42,7 +42,7 @@ class MonsterV1 extends Monster
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
MonsterV1 (String name, byte[] buffer, List<Reward> rewards, List<MonsterV1> monsters,
|
MonsterV1 (int id, String name, byte[] buffer, List<Reward> rewards, List<MonsterV1> monsters,
|
||||||
int scenarioId)
|
int scenarioId)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
@ -54,7 +54,8 @@ class MonsterV1 extends Monster
|
|||||||
genericNamePlural = HexFormatter.getPascalString (buffer, 16);
|
genericNamePlural = HexFormatter.getPascalString (buffer, 16);
|
||||||
namePlural = HexFormatter.getPascalString (buffer, 48);
|
namePlural = HexFormatter.getPascalString (buffer, 48);
|
||||||
|
|
||||||
this.monsterID = counter++;
|
// this.monsterID = counter++;
|
||||||
|
this.monsterID = id;
|
||||||
this.monsters = monsters;
|
this.monsters = monsters;
|
||||||
|
|
||||||
imageID = buffer[64];
|
imageID = buffer[64];
|
||||||
@ -184,20 +185,14 @@ class MonsterV1 extends Monster
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
public String getRealName ()
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
public String getDump (int block)
|
public String getDump (int block)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
StringBuilder line = new StringBuilder (String.format ("%3d %-16s", monsterID, name));
|
StringBuilder line = new StringBuilder (String.format ("%3d %-16s", monsterID, name));
|
||||||
|
|
||||||
int lo = block == 0 ? 64 : block == 1 ? 88 : block == 2 ? 112 : 136;
|
// int lo = block == 0 ? 64 : block == 1 ? 88 : block == 2 ? 112 : 136;
|
||||||
|
int lo = 64 + block * 24;
|
||||||
int hi = lo + 24;
|
int hi = lo + 24;
|
||||||
if (hi > buffer.length)
|
if (hi > buffer.length)
|
||||||
hi = buffer.length;
|
hi = buffer.length;
|
||||||
@ -218,17 +213,9 @@ class MonsterV1 extends Monster
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
public boolean match (int monsterID)
|
boolean match (int monsterID)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
return this.monsterID == monsterID;
|
return this.monsterID == monsterID;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
@Override
|
|
||||||
public String toString ()
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -39,6 +39,9 @@ public class WizardryScenarioDisk extends PascalDisk
|
|||||||
List<ExperienceLevel> experiences;
|
List<ExperienceLevel> experiences;
|
||||||
List<Reward> rewards;
|
List<Reward> rewards;
|
||||||
|
|
||||||
|
private int monsterId;
|
||||||
|
private int itemId;
|
||||||
|
|
||||||
// leave these here until I decide whether to use them or not
|
// leave these here until I decide whether to use them or not
|
||||||
SectorType mazeSector = new SectorType ("Maze", Color.lightGray);
|
SectorType mazeSector = new SectorType ("Maze", Color.lightGray);
|
||||||
SectorType monsterSector = new SectorType ("Monsters", Color.black);
|
SectorType monsterSector = new SectorType ("Monsters", Color.black);
|
||||||
@ -70,8 +73,6 @@ public class WizardryScenarioDisk extends PascalDisk
|
|||||||
}
|
}
|
||||||
|
|
||||||
CodedMessage.codeOffset = 185;
|
CodedMessage.codeOffset = 185;
|
||||||
MonsterV1.counter = 0;
|
|
||||||
ItemV1.counter = 0;
|
|
||||||
|
|
||||||
DefaultTreeModel model = (DefaultTreeModel) catalogTree.getModel ();
|
DefaultTreeModel model = (DefaultTreeModel) catalogTree.getModel ();
|
||||||
DefaultMutableTreeNode currentRoot = (DefaultMutableTreeNode) model.getRoot ();
|
DefaultMutableTreeNode currentRoot = (DefaultMutableTreeNode) model.getRoot ();
|
||||||
@ -111,12 +112,12 @@ public class WizardryScenarioDisk extends PascalDisk
|
|||||||
// makeNodeVisible (node);
|
// makeNodeVisible (node);
|
||||||
|
|
||||||
// add information about each characters' baggage, spells known etc.
|
// add information about each characters' baggage, spells known etc.
|
||||||
for (CharacterV1 c : characters)
|
for (CharacterV1 character : characters)
|
||||||
{
|
{
|
||||||
c.linkItems (items);
|
character.linkItems (items);
|
||||||
c.linkSpells (spells);
|
character.linkSpells (spells);
|
||||||
int type = c.getStatistics ().typeInt;
|
int type = character.getStatistics ().typeInt;
|
||||||
c.linkExperience (experiences.get (type));
|
character.linkExperience (experiences.get (type));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ItemV1 item : items)
|
for (ItemV1 item : items)
|
||||||
@ -346,7 +347,8 @@ public class WizardryScenarioDisk extends PascalDisk
|
|||||||
byte[] data2 = new byte[recLen];
|
byte[] data2 = new byte[recLen];
|
||||||
System.arraycopy (buffer, ptr, data2, 0, recLen);
|
System.arraycopy (buffer, ptr, data2, 0, recLen);
|
||||||
|
|
||||||
MonsterV1 m = new MonsterV1 (itemName, data2, rewards, monsters, scenarioHeader.scenarioID);
|
MonsterV1 m = new MonsterV1 (monsterId++, itemName, data2, rewards, monsters,
|
||||||
|
scenarioHeader.scenarioID);
|
||||||
monsters.add (m);
|
monsters.add (m);
|
||||||
addToNode (m, node, blocks, monsterSector);
|
addToNode (m, node, blocks, monsterSector);
|
||||||
}
|
}
|
||||||
@ -403,7 +405,7 @@ public class WizardryScenarioDisk extends PascalDisk
|
|||||||
byte[] data2 = new byte[recLen];
|
byte[] data2 = new byte[recLen];
|
||||||
System.arraycopy (buffer, ptr, data2, 0, recLen);
|
System.arraycopy (buffer, ptr, data2, 0, recLen);
|
||||||
|
|
||||||
ItemV1 i = new ItemV1 (itemName, data2);
|
ItemV1 i = new ItemV1 (itemId++, itemName, data2);
|
||||||
items.add (i);
|
items.add (i);
|
||||||
addToNode (i, node, blocks, itemSector);
|
addToNode (i, node, blocks, itemSector);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user