Bug - Fixed Found unknown equipped item: "ittah bittah hookah" descid = 279445768

Ryo_Sangnoir

Developer
Staff member
Recently, in my session logs:
Code:
Found unknown equipped item: "ittah bittah hookah" descid = 279445768

I don't know why we've started not recognising the hookah (and apparently only the hookah).
 

Alium

Member
I got that when calling "refresh outfit" for grey down vest as part of debugging this issue

Code:
Found unknown equipped item: "grey down vest" descid = 994210569

 

Veracity

Developer
Staff member
That is from EquipmentRequest.parseEquipment.
Code:
    String descId = matcher.group(1) != null ? matcher.group(2) : "";
    String name = matcher.group(3).trim();
    int itemId = ItemDatabase.getItemIdFromDescription(descId);
    AdventureResult item;
    if (slot == EquipmentManager.HOLSTER || EquipmentDatabase.contains(itemId)) {
      item = ItemPool.get(itemId);
    } else {
      RequestLogger.printLine("Found unknown equipped item: \"" + name + "\" descid = " + descId);
"ittah bittah hookah" descid = 279445768

That is correct. I assume ItemDatabase.getItemIdFromDescription(descId); returned 4519.

What is EquipmentDatabase.contains(itemId)?

Code:
  public static final boolean contains(final int itemId) {
    return itemId > 0 && EquipmentDatabase.statRequirements.get(itemId) != null;
  }
Since when do familiar items have stat requirements?
There are no familiar items in equipment.txt.

Hmm. Didn't we have a recent change regarding EquipmentDatabase.statRequirements?

Yes. PR #865 changed:

Code:
  private static final StringArray statRequirements = new StringArray();
to this:
Code:
  private static final Map<Integer, String> statRequirements = new HashMap<>();

Maybe EquipmentRequest.parseEquipment should make an exception for both the "holster" slot and the "familiar item" slot.
Or maybe EquipmentDatabase.contains could have a better method which doesn't depend only on equipment which is in equipment.txt.
(Maybe we should have a DebugDatabase method which will look at all items and verify that every "equipment" item except for slots that do not have equipment requirements is in equipment.txt?)
 

Veracity

Developer
Staff member
I also notice that ItemDatabase has:

Code:
  public static final boolean isEquipment(final int itemId) {
    int useType = ItemDatabase.useTypeById.getOrDefault(itemId, 0);
    return KoLConstants.isEquipmentType(useType, true);
  }

And KoLConstants has:

Code:
  static boolean isEquipmentType(final int type, final boolean includeFamiliarEquipment) {
    return switch (type) {
      case EQUIP_ACCESSORY,
          EQUIP_CONTAINER,
          EQUIP_HAT,
          EQUIP_SHIRT,
          EQUIP_PANTS,
          EQUIP_WEAPON,
          EQUIP_OFFHAND -> true;
      default -> includeFamiliarEquipment && type == EQUIP_FAMILIAR;
    };
  }

Which also does not include CONSUME_SIXGUN.

KoLConstants.isEquipmentType is called exactly once in ItemDatabase with includeFamiliarEquipment = true and once with includeFamiliarEquipment = false.
 

Veracity

Developer
Staff member
The easiest fix might be in EquipmentDatabase.parseEquipment:

Code:
    if (slot == EquipmentManager.FAMILIAR || slot == EquipmentManager.HOLSTER || EquipmentDatabase.contains(itemId)) {
      item = ItemPool.get(itemId);
    } else {
In other words, only ask EquipmenDatabase to look in its database for slots that actually are in equipment.txt.

All the rest of what I pointed out may or may not be worth adjusting. :)
 
Top