# DecorDrops (WoW AddOn)

Interactive World of Warcraft addon for dungeon/raid decoration farming.

## Features
- Adventure Journal-inspired interactive layout with scrollable instance and item lists
- Centered draggable menu (`/decordrops` or `/ddrops`)
- Minimap button to toggle the menu (drag to reposition)
- Left-side grouped view by expansion with collapsible headers
- Type icons in instance list (blue = dungeon, green = raid)
- Fixed Midnight visual style
- Shows decoration item, source boss, and drop-rate percent
- Clickable waypoint buttons to set dungeon/raid entrance route
- Search filter (instance, boss/source, or item name)
- Type filter (`All` / `Dungeon` / `Raid`)
- Minimum drop-rate filter
- Collection filter (`All` / `Collected` / `Missing`)
- Global top-bar `Clear Waypoints` button (clears TomTom + Blizzard user waypoint)
- Item icon on each row
- Row tooltip with blue status line (`Warband collected: Yes/No`)
- Top-left row status icon:
  - Green check = collected
  - Red cross = not collected
- Blizzard quality colors on item names:
  - White = Common
  - Green = Uncommon
  - Blue = Rare
  - Purple = Epic
  - Orange = Legendary
- Source modes: `Vendor`, `Quest`, `Achievement`, `Reputation`, `Endeavor`
- Tracker mode for per-item tracking across instances/professions/source modes

## Install
1. Copy the `DecorDrops` folder into your WoW AddOns directory:
   - `_retail_/Interface/AddOns/DecorDrops`
2. Restart WoW or reload UI with `/reload`
3. Open with `/decordrops`

Minimap button:
- Left-click: toggle menu
- Drag with left mouse: move button around minimap

## In-Game Auto Scan
- `/decordrops scan`
  - Opens a confirmation popup before scanning.
  - Manual scan start is rate-limited to once every 60 seconds (with remaining-time feedback in chat).
  - Pulls loot/source data from Encounter Journal APIs across all available tiers and stores it in saved variables.
  - Keeps only items recognized by the Housing Catalog API (decor-only filtering).
  - Merges scanned data with static `Data.lua` data.
  - Runs in throttled mode to reduce frame spikes/lag.
- `/decordrops clearauto`
  - Clears scanned saved-variable data.

### Performance Notes
- Selecting categories now reuses the existing filtered dataset and refreshes selection visuals/items without forcing a full data rebuild each click.
- Instance scan merge now canonicalizes instance identity by expansion + instance name + mapID (not type), which prevents raid/dungeon split duplicates for the same instance record.

Notes:
- Scanned dungeon/raid entries now auto-read visible `%` rates from EJ/Housing tooltip text when available, and fall back to `100%` when no rate is exposed.
- This follows Blizzard's current Midnight decor-drop guidance (one decor item when a decor drop is present).
- Scan results are saved in local WoW SavedVariables (`DecorDropsDB.autoData`) and reused on next login.

## Data
Edit:
- `Data.lua`

Each instance entry uses:
- `name`, `type` (`Dungeon` or `Raid`)
- `mapID`
- `entrance` coords as percentage (`x`, `y`)
- `decorations`: `itemID`, `name`, `source`, and optional `dropRate`

## Warband Collection Detection
The addon checks housing/warband collection state for each row item and displays:
- A green check icon when collected
- A red cross icon when not collected
- A blizzard-blue tooltip status line on hover

## Notes
- Data included is a curated starter table and is designed to be easy to expand.
- For strict accuracy, replace rates and IDs with your own validated source list.
- See `COMPLIANCE.md` for addon-policy and API-scope notes.

## Static Profession Resources (Offline DB)
- Runtime web requests are not possible in WoW addons. Use an offline build step to compile recipe reagents into `StaticProfessionResources.lua`.
- The addon uses this local DB as fallback when scan/API data does not include resources for unknown professions/recipes.

Build command:

```bash
python3 tools/build_static_decor_catalog.py \
  --crawl-wowhead \
  --wowhead-gallery-url "https://www.wowhead.com/decor-gallery" \
  --max-pages 50 \
  --input-json /path/to/decor_export.json \
  --output-catalog wow-addon/DecorDrops/StaticDecorCatalog.lua \
  --output-prof wow-addon/DecorDrops/StaticProfessionResources.lua \
  --source wowhead-export
```

Supported JSON shapes:
- List of entries, or `{ "entries": [...] }`
- Entry keys: `itemID|itemId|craftedItemID|outputItemID`, `recipeID|recipeId|spellID|spellId`
- Reagent list keys: `resources|reagents|ingredients`
- Reagent keys: `itemID|itemId|reagentItemID|id`, `quantity|qty|count|amount|requiredQuantity`

Windows helper:
- Run `build_static_profession_resources.bat` from project root.
- It can run full decor-gallery crawl and/or use JSON input URL/file.

Icon handling:
- Do not scrape/store icon URLs.
- Addon resolves icons from the game client at runtime using item IDs (`C_Item.GetItemIconByID`).
