Skip to content

feat(combat_stats) record every hunt to SQLite and query it in-game - #2466

Merged
mrhoribu merged 1 commit into
elanthia-online:masterfrom
Nisugi:combat_stats
Sep 12, 2026
Merged

mrhoribu merged 1 commit into
elanthia-online:masterfrom
Nisugi:combat_stats

Conversation

@Nisugi

@Nisugi Nisugi commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

combat_stats: record every hunt to SQLite and query it in-game

Adds combat_stats.lic, a script that subscribes to the Lich combat observer feed, persists it through Lich::Gemstone::Combat::Recorder, and answers questions about your hunting from inside the game.

Requires Lich 5.21.1. The script reads schema the recorder gained in elanthia-online/lich-5#1600 (attacks.ours, flares.ours, creatures.kill_credit, parent_confidence = 'unbound', the session-finished hook). It declares required: Lich >= 5.21.1 and calls Script.require_lich_version! before loading the recorder, so an older Lich gets the standard "too old" notice instead of a load error. Please hold the merge until 5.21.1 is released.

What it records

One SQLite database per character at <DATA_DIR>/<game>/<character>/combat_stats.db, seven tables: sessions, creatures, attacks, resolutions, flares, hits, statuses. A session is a hunt: it opens on the first combat event and closes after five minutes without one, timestamped at the last event so town time never pads a hunt. Ownership (ours vs. a nearby player's, a reactive flare vs. a creature's weapon proc), kill credit, and spawn-tree lineage are all decided by the recorder at write time; the script only reads.

What it reports

Everything is typed as cstats ... and every report is one aligned mono block with clickable links, so you can drill from a hunt to a creature to a single swing without typing ids.

  • cstats / cstats sessions / cstats last N / cstats all: hunt summaries, kills and assists, damage dealt and taken, creature mix
  • cstats creature <noun|id>: one creature's life, wound map, and every attack that touched it grouped by spawn tree
  • cstats attack <name> and attack detail: per-ability attempts, hits, crits, fatals, and a full breakdown of one swing including its flares and echoes
  • cstats flare <name>: proc rate, hit rate, crit rank and location distribution, reactive flares on inbound attacks
  • cstats defenses, cstats hp, cstats accuracy, cstats aim, cstats ttk, cstats blind, cstats control, cstats compare: defensive readings, HP estimates from solo kills, aimed vs. unaimed accuracy, kill efficiency, blind and control coverage, side-by-side hunt comparison
  • cstats recent: the last N attacks, newest first

A one-line "hunt N over [report]" notice prints whenever a session closes.

Notes for reviewers

  • The script never writes to the database. It opens it read-only for every report.
  • Links run through ;eq so clicks don't print exec chatter.
  • RuboCop clean under the lich-5 config.

🤖 Generated with Claude Code

This scripts is the link that records your hunts to a database for querying.
Various reports included, more to be added.
@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 0beb0753-a3a4-4d4f-a067-01d8af370ee6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mrhoribu
mrhoribu merged commit 9f381e5 into elanthia-online:master Sep 12, 2026
4 checks passed
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