Class GearNames

java.lang.Object
privbot.mechanics.GearNames

public final class GearNames extends Object
Which item names are the same piece of gear.

A gear set is configured as names, and a name can change while the item does not. A glory teleport turns "Amulet of glory (4)" into "(3)"; barrows degrade in combat from "Ahrim's robetop 100" to "75". Comparing names exactly made the worn (3) "missing", found no (4) to put on, and threw the WHOLE set out — one teleport, and the bot could not switch style for the rest of the fight. Supplies never had this problem because they have always matched by containment ("Super restore" finds "Super restore(4)"); gear matched exactly, and that inconsistency was the bug.

The rules, surveyed against the Elorin cache's 14,296 wearable items on 2026-09-22 rather than assumed from OSRS:

  • A trailing charge count in brackets is not part of the item's identity: (4), (t4), and Elorin spells it both ways — the cache holds "Amulet of glory (3)" (1710) AND "Amulet of glory(3)" (31710). Uncharged "Amulet of glory" is the same amulet too.
  • A trailing bare degrade tier is not either: barrows go 100/75/50/25, battle and combat robes and d'hide coifs go 100/80/60/40/20. A fresh barrows piece has no number at all.
  • Tier 0 IS part of the identity. A broken barrows piece has no Wear option; counting it as the set's piece would make the set "obtainable" and then fail every equip.
  • Letters in brackets are different items: enchanted bolts (e) have effects, and trims (t)/(g) are separate ids. Only digits (optionally after t) go.

The exact name always wins: a set naming glory (4) with a (4) and a (1) carried puts the (4) on. A variant is the fallback that keeps the set alive, never the first choice.

Pure; no client reads, any thread. Lifted unchanged from ElorinPvP model/GearName.

  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    base(String name)
    The name with any charge count or degrade tier taken off — the item's identity, used as the key for anything learned about it (a glory's slot is learned once for every charge).
    static int
    choose(String wanted, List<String> candidates)
    The index of the candidate to use for wanted: the exact name if it is there, otherwise the first variant of it, otherwise -1.
    static boolean
    Whether two names are the same piece of gear, ignoring charges and degrade tiers.
    static List<String>
    unmatched(List<String> wanted, List<String> have)
    The entries of wanted that have cannot cover, in wanted's order.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • sameItem

      public static boolean sameItem(String a, String b)
      Whether two names are the same piece of gear, ignoring charges and degrade tiers.
    • choose

      public static int choose(String wanted, List<String> candidates)
      The index of the candidate to use for wanted: the exact name if it is there, otherwise the first variant of it, otherwise -1.
    • unmatched

      public static List<String> unmatched(List<String> wanted, List<String> have)
      The entries of wanted that have cannot cover, in wanted's order. Each item covers exactly one requirement — a set can name the same item twice (Ghostly robe top and bottom are both "Ghostly robe") and one of them on is not both. Exact pairs are made first across the whole list, then variants, so an exact item is never spent on a requirement a variant could have met while another requirement goes short.
    • base

      public static String base(String name)
      The name with any charge count or degrade tier taken off — the item's identity, used as the key for anything learned about it (a glory's slot is learned once for every charge).