Add log parser to extract game events from EQ logs#59
Closed
ajbtech wants to merge 1 commit into
Closed
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Implementation details
src/logparser.jsexports 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
nullfor unrecognized lines, chat lines, or malformed timestamps.src/xp.jsre-exports both functions to make them part of the public API.Checklist
npm testpassesnpm run lintpassesnpm run format:checkpassessrc/logparser.jsis pure (no DOM access); importable by browser and node:testhttps://claude.ai/code/session_014VNgwMpV6U6uhqZTrwfTWe