Skip to content

feat(map-checker): warn about monsters and NPCs with no loot - #36

Merged
zoeyrose merged 1 commit into
mainfrom
feat/map-checker-monster-loot
Nov 26, 2026
Merged

zoeyrose merged 1 commit into
mainfrom
feat/map-checker-monster-loot

Conversation

@zoeyrose

Copy link
Copy Markdown
Member

Requested by Zoey · project thread

Summary

The Qt map checker now warns when a monster or NPC placed on a map has no loot. A monster has loot when:

  • its object or archetype sets randomitems to a real treasure list (none and empty don't count), or
  • its own inventory or its archetype's inventory holds at least one droppable item. Items that are sys_object, startequip, no_drop, event objects or quest containers don't count.

The check reuses checker_monster and only runs for objects on maps, not archetype definitions. The severity is warning. This goes with atrinik/classic#656, where non-player monsters always drop loot, and with the follow-up server change that drops fallback_loot (atrinik/content#283) and logs an error when a monster has none.

Current content

A full focused scan of a runtime build of atrinik/content@main currently reports 361 monsters/NPCs with no loot. They are mostly town NPCs: ant_red "removable" objects (47), mage_old, peasant, monk, priests, smiths and similar. These are warnings, so the scan's exit status doesn't change.

Validation

  • python3 -m unittest discover -s map-checker-qt/tests -v: 36 tests pass, including 8 new ones in tests/test_checker_loot.py.
  • python3 -W error -m compileall -q -f map-checker-qt
  • python3 dependencies.py sync followed by a full CLI scan of a locally built classic runtime, with the results above.
  • git diff --check

Generated by Claude Code

Flag map monsters that have neither a randomitems treasure list nor
droppable inventory items. The classic server falls back to generic
loot for these and logs an error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BPTYArGhoPqP7UdeUuUC5j
@zoeyrose zoeyrose self-assigned this Nov 26, 2026
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@zoeyrose
zoeyrose merged commit 21a2a51 into main Nov 26, 2026
6 checks passed
@zoeyrose
zoeyrose deleted the feat/map-checker-monster-loot branch November 26, 2026 00:24
zoeyrose added a commit to atrinik/classic that referenced this pull request Nov 26, 2026
<!-- claude-projects-attribution: {"github_login":"zoeyrose"} -->
_Requested by **Zoey** · [project
thread](https://claude.ai/code/project/chan_01GqFGRfVxfKgHRxSgL4g4qr?thread=cmsg_01GqFGRfVxfKgHRxSgL4g4qr38thrxw4CAaXppYJEuqoHr)_

## Summary

This follows #656. When a non-player monster is killed and carries
nothing that would drop, the server now generates the content
`fallback_loot` treasure list into its inventory before
`object_destruct()`, so every monster leaves something behind.

- "Droppable" follows `object_drop_inventory()`: items that are sys
objects, start equipment, no-drop, quest containers or runes don't
count.
- If the monster has **no `randomitems` at all**, the server logs
`LOG(ERROR, "Monster has no loot, dropping fallback loot: ...")`. That
points to a content problem. A monster whose treasure list just rolled
nothing gets the fallback without an error.
- Owned monsters (pets, golems, summons) and monsters flagged
`startequip` are skipped, so summoning stays unfarmable.
- If `fallback_loot` is missing, `treasure_list_find()` logs its usual
error and nothing is generated.

## Dependencies

Includes the v1.21.0 content lock bump from #658, which the
update-content automation opened. v1.21.0 is the first content release
with `fallback_loot` (atrinik/content#283).
Merge #658 first, or merge this alone, since it carries the same commit.
The map-checker counterpart is atrinik/tools#36.

## Tests

New tests in `server/src/tests/unit/server/attack.c`:

- `test_lootless_monster_drops_fallback_loot`: a monster with no
`randomitems` and no droppable inventory drops coins.
- `test_owned_monster_gets_no_fallback_loot`: an owned monster gets no
fallback loot.

CI runs the native build and tests (Server validation and Classic
validation are green). I couldn't build locally because the required
Clang 23 toolchain isn't available here.


---
_Generated by [Claude Code](https://claude.ai/code)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: atrinik-classic-dependency-updater[bot] <315991295+atrinik-classic-dependency-updater[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants