dmolony-DiskBrowser/src/com/bytezone/diskbrowser/wizardry/Item.java

96 lines
3.2 KiB
Java
Raw Permalink Normal View History

2020-02-11 07:29:55 +00:00
package com.bytezone.diskbrowser.wizardry;
import com.bytezone.diskbrowser.applefile.AbstractFile;
// -----------------------------------------------------------------------------------//
2022-05-31 07:44:41 +00:00
public class Item extends AbstractFile
2020-02-11 07:29:55 +00:00
// -----------------------------------------------------------------------------------//
{
2022-05-31 07:44:41 +00:00
int itemId;
2020-02-11 07:29:55 +00:00
String genericName;
2022-05-31 07:44:41 +00:00
protected long price;
public Dice wephpdam;
public int armourClass;
public int xtraSwing;
boolean cursed;
int changeTo;
int changeChance;
int special;
int boltac;
int spellPwr;
int classUseFlags;
int healPts;
2022-06-04 03:06:20 +00:00
int flags1;
int flags2;
int flags3;
2022-05-31 07:44:41 +00:00
int wephitmd;
boolean crithitm;
ObjectType type;
Alignment alignment;
Item changeToItem;
Spell spell;
2022-06-04 03:06:20 +00:00
String spellName;
2022-05-31 07:44:41 +00:00
public enum Alignment
{
UNALIGN, GOOD, NEUTRAL, EVIL
}
public enum ObjectType
{
WEAPON, ARMOR, SHIELD, HELMET, GAUNTLET, SPECIAL, MISC
}
2020-02-11 07:29:55 +00:00
// ---------------------------------------------------------------------------------//
Item (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
2022-05-31 07:44:41 +00:00
text.append (String.format ("ID ............... %s%n%n", itemId));
text.append (String.format ("Name ............. %s%n", name));
text.append (String.format ("Generic name ..... %s%n", genericName));
2020-02-11 07:29:55 +00:00
2022-05-31 07:44:41 +00:00
text.append (String.format ("Cost ............. %,d%n", price));
text.append (String.format ("Damage ........... %s%n", wephpdam));
text.append (String.format ("Hit mod .......... %d%n", wephitmd));
text.append (String.format ("Critical hit ..... %s%n", crithitm));
2020-02-11 07:29:55 +00:00
2022-05-31 07:44:41 +00:00
text.append (String.format ("Type ............. %s%n", type));
text.append (String.format ("Alignment ........ %s%n", alignment));
text.append (String.format ("Armour class ..... %d%n", armourClass));
text.append (String.format ("Speed ............ %d%n", xtraSwing));
text.append (String.format ("Cursed? .......... %s%n", cursed));
2020-02-11 07:29:55 +00:00
2022-05-31 07:44:41 +00:00
String changeItemName = changeToItem == null ? "" : changeToItem.getName ();
text.append (String.format ("Decay odds ....... %d%%%n", changeChance));
text.append (String.format ("Decay to ......... %s%n", changeItemName));
2020-02-11 07:29:55 +00:00
2022-05-31 07:44:41 +00:00
text.append (String.format ("Special .......... %d%n", special));
text.append (String.format ("Boltac ........... %d%n", boltac));
2020-02-11 07:29:55 +00:00
2022-05-31 07:44:41 +00:00
String spellName = spell == null ? "" : spell.getName ();
2022-06-04 03:06:20 +00:00
if (this.spellName != null)
spellName = this.spellName;
2022-05-31 07:44:41 +00:00
text.append (String.format ("Spell ............ %s%n", spellName));
2020-02-11 07:29:55 +00:00
2022-05-31 07:44:41 +00:00
text.append (String.format ("Heal ............. %d%n", healPts));
text.append (String.format ("Class use ........ %d%n", classUseFlags));
2022-06-04 03:06:20 +00:00
text.append (String.format ("Flags ............ %d%n", flags1));
text.append (String.format ("Flags2 ........... %d%n", flags2));
text.append (String.format ("Flags3 ........... %d%n", flags3));
2020-02-11 07:29:55 +00:00
2022-05-31 07:44:41 +00:00
return text.toString ();
2020-02-11 07:29:55 +00:00
}
2022-05-31 07:44:41 +00:00
}