예제 #1
1
  private void checkItemAttribute(CreResource cre) {
    List<StructEntry> list = cre.getList();
    for (int i = 0; i < list.size(); i++)
      if (list.get(i) instanceof Item) {
        Item item = (Item) list.get(i);
        if (((ResourceRef) item.getAttribute("Item"))
            .getResourceName()
            .equalsIgnoreCase("None.ITM")) {
          table.addTableItem(new CreInvError(cre.getResourceEntry(), item, "Empty item ref"));
          continue;
        }

        StructEntry wear = item.getAttribute("Wear");
        if (((DecNumber) wear).getValue() != 0) {
          table.addTableItem(
              new CreInvError(
                  cre.getResourceEntry(), item, "Wear is: " + ((DecNumber) wear).getValue()));
        }

        for (int j = 4; j < 8 * ((Flag) item.getAttribute("Flags")).getSize(); j++)
          if (((Flag) item.getAttribute("Flags")).isFlagSet(j)) {
            table.addTableItem(
                new CreInvError(
                    cre.getResourceEntry(),
                    item,
                    "Item flag is: " + item.getAttribute("Flags").toString()));
            break;
          }
      }
  }
예제 #2
0
  private void checkActorPosition(ResourceEntry entry, Actor actor, BmpResource searchMap) {
    String anim = actor.getAttribute("Animation").toString();
    ResourceEntry creEntry;
    CreResource creature = null;

    if (actor.getAttribute("Character") instanceof ResourceRef
        && actor.getAttribute("Character").toString() != "None") {
      creEntry =
          ResourceFactory.getInstance()
              .getResourceEntry(((ResourceRef) actor.getAttribute("Character")).getResourceName());

      creature = (CreResource) ResourceFactory.getResource(creEntry);
    } else if (actor.getAttribute("CRE file") != null)
      creature = (CreResource) actor.getAttribute("CRE file");

    if (creature == null
        || ((IdsFlag) creature.getAttribute("Status")).isFlagSet(0)
        || ((IdsFlag) creature.getAttribute("Status")).isFlagSet(11)) return;

    if (!exclude.contains(anim.substring(0, anim.indexOf(" ")))) {
      int x = ((DecNumber) actor.getAttribute("Position: X")).getValue() / 16;
      int y = ((DecNumber) actor.getAttribute("Position: Y")).getValue() / 12;
      if (!Passable[searchMap.getPalette().getIndex(searchMap.getImage().getRGB(x, y) & 0xFFFFFF)])
        errorTable.addTableItem(
            new AreaTableLine(
                entry,
                actor,
                "Impassable actor position (" + creature.getAttribute("Name").toString() + ")"));
    }
  }
예제 #3
0
 private void checkCreatureInventory(CreResource cre) {
   HexNumber slots_offset = (HexNumber) cre.getAttribute("Item slots offset");
   items.clear();
   slots.clear();
   for (int i = 0; i < cre.getRowCount(); i++) {
     StructEntry entry = cre.getStructEntryAt(i);
     if (entry instanceof Item) items.add(entry);
     else if (entry.getOffset() >= slots_offset.getValue() + cre.getOffset()
         && entry instanceof DecNumber
         && !entry.getName().equals("Weapon slot selected")
         && !entry.getName().equals("Weapon ability selected")) slots.add(entry);
   }
   for (int i = 0; i < slots.size(); i++) {
     DecNumber slot = (DecNumber) slots.get(i);
     if (slot.getValue() >= 0 && slot.getValue() < items.size())
       items.set(slot.getValue(), slots_offset); // Dummy object
   }
   for (int i = 0; i < items.size(); i++) {
     if (items.get(i) != slots_offset) {
       Item item = (Item) items.get(i);
       table.addTableItem(new CreInvError(cre.getResourceEntry(), item, "Item not in inventory"));
     }
   }
 }