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