mirror of
https://github.com/AsgardEternal/SquadJS.git
synced 2024-09-28 23:24:26 -05:00
a2348c6bd1
Attempt at more Robust Regex This regex searches for all the current information we get via the NewGame event, but with a few patterns that search deeper/different folder structures. Appears to work on all base game content and mods that I have tested, however, mods may capture garbage information inside of mapClassname. This will also fail if a modder puts no folders between the root of their project and their layers /mymod/mymap vs /mymod/afolder/mymap afolder would end up being the mapClassname. https://regex101.com/r/e0Ui0K/1
23 lines
542 B
JavaScript
23 lines
542 B
JavaScript
export default {
|
|
regex:
|
|
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogWorld: Bringing World \/([A-z]+)\/(?:Maps\/)?([A-z0-9-]+)\/(?:.+\/)?([A-z0-9-]+)(?:\.[A-z0-9-]+)/,
|
|
onMatch: (args, logParser) => {
|
|
if (args[5] === 'TransitionMap') {
|
|
return;
|
|
}
|
|
const data = {
|
|
...logParser.eventStore.WON,
|
|
raw: args[0],
|
|
time: args[1],
|
|
chainID: args[2],
|
|
dlc: args[3],
|
|
mapClassname: args[4],
|
|
layerClassname: args[5]
|
|
};
|
|
|
|
delete logParser.eventStore.WON;
|
|
|
|
logParser.emit('NEW_GAME', data);
|
|
}
|
|
};
|