package net.sourceforge.pain.data.type; import net.sourceforge.pain.data.*; import net.sourceforge.pain.db.*; import javax.crypto.*; public final class Equipped extends Role { public static final int WEAR_SLOTS = 1 + LAST_BASE_FIELD_INDEX;; public static final int INVENTORY = 2 + LAST_BASE_FIELD_INDEX;; public static final int NFIELDS = 3 + LAST_BASE_FIELD_INDEX;; public final static Class[] superroles = new Class[]{Interactive.class}; public Equipped(PainDB db) { super(db); } public Equipped() { } protected Class[] getSuperroles() { return superroles; } public DbClassSchema provideSchema() { byte types[] = new byte[NFIELDS]; String names[] = new String[NFIELDS]; fillSuperSchema(types, names); types[INVENTORY] = DbType.REFERENCE; names[INVENTORY] = "inventory"; types[WEAR_SLOTS] = DbType.INT_KEY_MAP; names[WEAR_SLOTS] = "wear_slots"; return new DbClassSchema(types, names); } public Wear getWearSlotContent(int wearSlot) { return (Wear) getIntKeyMap(WEAR_SLOTS).get(wearSlot); } public Wear setWearSlotContent(int wearSlot, Wear wear) { return (Wear) getIntKeyMap(WEAR_SLOTS).put(wearSlot, wear); } public Space getInventory() { return (Space) getReference(INVENTORY); } public final void delete() { getInventory().delete(); super.delete(); } public Interactive asInteractive() { return (Interactive) getRole(Interactive.class); } public Located asLocated() { return (Located) getRole(Located.class); } public void setInventory(Space inventory) { setReference(INVENTORY, inventory); } }