-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrote, simplified and increased the robustness of the Brickadia out…
…put parsing mechanism. Breaking API changes.
- Loading branch information
Showing
11 changed files
with
160 additions
and
272 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class BaseParser { | ||
// returns null OR | ||
// if something useful was parsed, something that varies per parser | ||
parse(generator, line) { | ||
throw new Error('Not implemented!'); | ||
} | ||
} | ||
|
||
module.exports = BaseParser; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const BaseParser = require('./baseparser.js'); | ||
|
||
const Player = require('../data/player.js'); | ||
/* | ||
This line is related to player joins: | ||
[2019.09.14-18.34.41:930][443]LogChat: n: hello | ||
*/ | ||
|
||
class ChatParser extends BaseParser { | ||
parse(generator, line) { | ||
if(generator !== 'LogChat') | ||
return null; | ||
|
||
const [username, ...messageParts] = line.split(': '); | ||
const message = messageParts.join(': '); | ||
return [username, message]; | ||
} | ||
} | ||
|
||
module.exports = ChatParser; |
Oops, something went wrong.