RatAttack: implemented new RATSIGNAL format

… also now stripping IRC formatting for my own sanity’s sake

fixes #111
This commit is contained in:
alterNERDtive 2021-05-02 16:01:57 +02:00
parent 68716bb45b
commit 7aaf8d62b1
4 changed files with 17 additions and 5 deletions

View file

@ -1,15 +1,23 @@
# devel
Changes to the RATSIGNAL produced by Swiftsqueak broke not only the parsing, but
also the default string used to detect them in AdiIRC. Youll need to listen to
`on *:TEXT:*RATSIGNAL*(??_SIGNAL):#fuelrats:` instead.
## EliteAttack 8.2.1
### Fixed
* No longer tries to auto-honk after a hyperdiction event.
* On-demand outdated station check works again. (#108)
## RatAttack 6.2.1
### Fixed
* Fixed RATSIGNAL parsing for new format. Needs adjusting your IRC client, see
above. IRC formatting will now be stripped before sending to VoiceAttack.
(#111)
* Fixed RATSIGNAL parsing for language strings that contain numbers (e.g.
“es-419”).
* Fixed RATSIGNAL parsing for “unknown system” (which contains a zero-width

View file

@ -21,7 +21,7 @@ This has two purposes:
For my AdiIRC, it looks like this (obviously change the path, please):
```adiirc
on *:TEXT:RATSIGNAL - CMDR*(??_SIGNAL):#fuelrats:{
on *:TEXT:*RATSIGNAL*(??_SIGNAL):#fuelrats:{
if ( $away ) {
/run -h "X:\path\to\VoiceAttack\Apps\alterNERDtive\RatAttack-cli.exe" " $+ $replace($1-,","") $+ " false
}

View file

@ -3,14 +3,20 @@
using System;
using System.IO;
using System.IO.Pipes;
using System.Text.RegularExpressions;
namespace RatAttack
{
class RatAttack_cli
{
static string stripIrcCodes(string message)
{
return Regex.Replace(message, @"[\x02\x11\x0F\x1D\x1E\x1F\x16]|\x03(\d\d?(,\d\d?)?)?", String.Empty);
}
static void Main(string[] args)
{
RatAttack.Ratsignal ratsignal = new RatAttack.Ratsignal(args[0], args.Length > 1 && args[1].ToLower() == "true");
RatAttack.Ratsignal ratsignal = new RatAttack.Ratsignal(stripIrcCodes(args[0]), args.Length > 1 && args[1].ToLower() == "true");
using (NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", "RatAttack", PipeDirection.Out))
{

View file

@ -18,9 +18,7 @@ namespace RatAttack
private static alterNERDtive.util.PipeServer<Ratsignal>? ratsignalPipe;
private static readonly Regex RatsignalRegex = new Regex(
// Yes. There is a zero-width space in “unknown system”. Probably
// just so it doesnt ping Mr. unknown in Fuelrats IRC m)
@"^RATSIGNAL - CMDR (?<cmdr>.+) - Reported System: (None|u\u200bnknown system|""(?<system>.+)""(\x0314)? \((?<systemInfo>([a-zA-Z0-9\s\(\)\-~]*([0-9,\.]+ LY (""[a-zA-Z\-]+"" of|from) [a-zA-Z0-9\s\*\-]+)?( \([a-zA-Z\s]+\))?|Not found in galaxy database|Invalid system name))\)(\x03)?(?<permit> \x037\(((?<permitName>.*) )?Permit Required\)\x03)?) - Platform: \x03(6|3|12)(?<platform>(PC|Xbox|Playstation))\x03 - O2: (\x034)?(?<oxygen>(NOT )?OK)\x03? - Language: (?<language>[a-zA-z0-9\x7f-\xff\-\(\)\s]+)( - IRC Nick (?<nick>[a-zA-Z0-9_\[\]\-]+))? \(\x02Case #(?<number>\d+)\x02\) \((PC|XB|PS)_SIGNAL\)\v*$"
@"^RATSIGNAL Case #(?<number>\d+) (?<platform>(PC|Xbox|Playstation))(?<oxygen> \(Code Red\))? CMDR (?<cmdr>.+) System: (None|u\u200bnknown system|""(?<system>.+)"" \((?<systemInfo>([a-zA-Z0-9\s\(\)\-~]*([0-9,\.]+ LY (""[a-zA-Z\-]+"" of|from) [a-zA-Z0-9\s\*\-]+)?( \([a-zA-Z\s]+\))?|Not found in galaxy database|Invalid system name))\)(?<permit> \(((?<permitName>.*) )?Permit Required\))?) Language: (?<language>[a-zA-z0-9\x7f-\xff\-\(\)\s]+)( Nick: (?<nick>[a-zA-Z0-9_\[\]\-]+))? \((PC|XB|PS)_SIGNAL\)\v*$"
);
private static VoiceAttackLog Log