Skip to content

Add log parser to extract game events from EQ logs#59

Closed
ajbtech wants to merge 1 commit into
mainfrom
claude/optimistic-fermi-2KqKQ
Closed

Add log parser to extract game events from EQ logs#59
ajbtech wants to merge 1 commit into
mainfrom
claude/optimistic-fermi-2KqKQ

Conversation

@ajbtech

@ajbtech ajbtech commented May 31, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a pure log parser module (src/logparser.js) that extracts typed game events from EverQuest log lines. The parser recognizes level-up and kill events while filtering out chat-channel messages (tells, says, shouts, guild, group, auction, OOC) to avoid false positives when players quote log text in chat.

This enables downstream features like XP tracking from log files without mistaking quoted event text for real events.

Type of change

  • New feature
  • Docs / tooling

Implementation details

src/logparser.js exports two functions:

  • isChat(content) — Detects if post-timestamp content is a chat-channel message using regex patterns for all chat types (tell, say, shout, guild, group, auction, OOC).
  • parseLine(line) — Parses a full log line: validates timestamp format, filters chat lines, then extracts level-up events (You have gained a level! Welcome to level N!) and kill events (self-kills and named-player kills).

Returns null for unrecognized lines, chat lines, or malformed timestamps.

src/xp.js re-exports both functions to make them part of the public API.

Checklist

  • Added comprehensive golden-value tests covering all chat types, real events, and edge cases (206 lines, 20 test cases)
  • npm test passes
  • npm run lint passes
  • npm run format:check passes
  • src/logparser.js is pure (no DOM access); importable by browser and node:test

https://claude.ai/code/session_014VNgwMpV6U6uhqZTrwfTWe

Chat channels (tell, say, shout, ooc, guild, group, auction) can contain
player-pasted log text. parseLine() checks the post-timestamp content
against anchored chat-channel patterns before attempting any event match,
so a tell like "MyChar -> TheirChar: You have gained a level!" returns null
instead of a spurious level_up event.

Exports parseLine and isChat from xp.js barrel. 38 golden-value tests cover
all 14 chat patterns (7 channels × self/other) plus real level-up and kill
events.

https://claude.ai/code/session_014VNgwMpV6U6uhqZTrwfTWe
@ajbtech ajbtech closed this May 31, 2026
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