diff --git a/CHANGELOG.md b/CHANGELOG.md index 10f0e4e..a0d9ad0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# devel + +## Added + +* Support for race 4, On the Rocks + +----- + # 3.1.1 (2022-04-19) ## Fixed diff --git a/On the Rocks.asl b/On the Rocks.asl new file mode 100644 index 0000000..a320180 --- /dev/null +++ b/On the Rocks.asl @@ -0,0 +1,143 @@ +// Defines the process to monitor. We are not reading anything from the game’s memory, so it’s empty. +// We still need it though, LiveSplit will only run the auto splitter if the corresponding process is present. +// See https://github.com/LiveSplit/LiveSplit.AutoSplitters/blob/master/README.md#state-descriptors +state("EliteDangerous64") {} + +// Executes when LiveSplit (re-)loads the auto splitter. Does general setup tasks. +// See https://github.com/LiveSplit/LiveSplit.AutoSplitters/blob/master/README.md#script-startup +startup { + // Relevant journal entries + vars.journalReader = null; + vars.journalEntries = new List(9); + vars.journalEntries.Add( + new System.Text.RegularExpressions.Regex(@"\{ ""timestamp"":""(?.*)"", ""event"":""Undocked"", ""StationName"":""Rebuy Prospect"", ""StationType"":"".*"", ""MarketID"":\d+(, ""Taxi"":(true|false), ""Multicrew"":(true|false))? \}")); + System.Linq.Enumerable.Repeat(() => { + vars.journalEntries.Add( + new System.Text.RegularExpressions.Regex(@"\{ ""timestamp"":""(?.*)"", ""event"":""FSDJump""(, ""Taxi"":(true|false), ""Multicrew"":(true|false))?, ""StarSystem"":""(Andhrimi|Artemis|Felkan|Nu Tauri|Othime)"", ""SystemAddress"":\d+, .*\}")); + vars.journalEntries.Add( + new System.Text.RegularExpressions.Regex(@"\{ ""timestamp"":""(?.*)"", ""event"":""SupercruiseExit""(, ""Taxi"":(true|false), ""Multicrew"":(true|false))?, ""StarSystem"":""(Andhrimi|Artemis|Felkan|Nu Tauri|Othime)"", ""SystemAddress"":\d+, ""Body"":""(Big Pappa's Base|Freeholm|Jack's Town|Simbad's Refuge|Lone Rock)"", ""BodyID"":\d+, ""BodyType"":""Station"" \}")); + vars.journalEntries.Add( + new System.Text.RegularExpressions.Regex(@"\{ ""timestamp"":""(?.*)"", ""event"":""MarketSell"", ""MarketID"":\d+, ""Type"":"".*""(, ""Type_Localised"":"".*"")?, ""Count"":\d+, ""SellPrice"":\d+, ""TotalSale"":\d+, ""AvgPricePaid"":\d+ \}")); + }, 5); + vars.journalEntries.Add( + new System.Text.RegularExpressions.Regex(@"\{ ""timestamp"":""(?.*)"", ""event"":""FSDJump""(, ""Taxi"":(true|false), ""Multicrew"":(true|false))?, ""StarSystem"":""Fullerene C60"", ""SystemAddress"":4030566762835, .*\}")); + vars.journalEntries.Add( + new System.Text.RegularExpressions.Regex(@"\{ ""timestamp"":""(?.*)"", ""event"":""SupercruiseExit""(, ""Taxi"":(true|false), ""Multicrew"":(true|false))?, ""StarSystem"":""Fullerene C60"", ""SystemAddress"":4030566762835, ""Body"":""Rebuy Prospect"", ""BodyID"":\d+, ""BodyType"":""Station"" \}")); + vars.journalEntries.Add( + new System.Text.RegularExpressions.Regex(@"\{ ""timestamp"":""(?.*)"", ""event"":""Docked"", ""StationName"":""Rebuy Prospect"", ""StationType"":"".*""(, ""Taxi"":(true|false), ""Multicrew"":(true|false))?, ""StarSystem"":""Fullerene C60"", .*\}")); + + // Reset conditions + vars.resetConditions = new List(); + vars.resetConditions.Add( + new System.Text.RegularExpressions.Regex(@"\{ ""timestamp"":""(?.*)"", ""event"":""Repair"", .*\}")); + vars.resetConditions.Add( + new System.Text.RegularExpressions.Regex(@"\{ ""timestamp"":""(?.*)"", ""event"":""RepairAll"", ""Cost"":\d+ \}")); + vars.resetConditions.Add( + new System.Text.RegularExpressions.Regex(@"\{ ""timestamp"":""(?.*)"", ""event"":""RefuelAll"", ""Cost"":\d+, ""Amount"":\d+\.\d+ \}")); + vars.resetConditions.Add( + new System.Text.RegularExpressions.Regex(@"\{ ""timestamp"":""(?.*)"", ""event"":""RefuelPartial"", ""Cost"":\d+, ""Amount"":\d+\.\d+ \}")); + + // Journal file handling + vars.journalPath = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), + "Saved Games", + "Frontier Developments", + "Elite Dangerous" + ); + vars.currentJournal = "none"; + vars.updateJournalReader = (Action)delegate() { + FileInfo journalFile = new DirectoryInfo(vars.journalPath).GetFiles("journal.*.log").OrderByDescending(file => file.LastWriteTime).First(); + print("Current journal file: " + vars.currentJournal + ", latest journal file: " + journalFile.Name); + if (journalFile.Name != vars.currentJournal) { + vars.journalReader = new StreamReader(new FileStream(journalFile.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)); + vars.currentJournal = journalFile.Name; + } + }; + vars.updateJournalReader(); + vars.journalReader.ReadToEnd(); + + // Watch for new files + FileSystemWatcher journalWatcher = new FileSystemWatcher(vars.journalPath); + journalWatcher.Created += (object sender, FileSystemEventArgs eventArgs) => { + vars.updateJournalReader(); + }; + journalWatcher.EnableRaisingEvents = true; + + // Initialize split counter + vars.currentSplit = 0; +} + +// Executes when LiveSplit detects the game process (see “state” at the top of the file). +// In our case the journal and netlog files are unique to every execution of the game, so we need to prepare them here. +// We also need to check if file logging is enabled (the setting is not available in `startup`) and create/open our log file. +// See https://github.com/LiveSplit/LiveSplit.AutoSplitters/blob/master/README.md#script-initialization-game-start +init { +} + +// Executes as long as the game process is running, by default 60 times per second. +// Unless explicitly returning `false`, `start`, `split` and `reset` are executed right after. +// See https://github.com/LiveSplit/LiveSplit.AutoSplitters/blob/master/README.md#generic-update +update { + current.journalString = vars.journalReader.ReadToEnd(); +} + +// Executes every `update`. Starts the timer if the first journal event is detected. +// See https://github.com/LiveSplit/LiveSplit.AutoSplitters/blob/master/README.md#automatic-timer-start-1 +start { + bool start = false; + + if (vars.journalEntries[0].Match(current.journalString).Success) { + start = true; + vars.currentSplit = 1; + } + + return start; +} + +// Executes every `update`. Triggers a split if the journal event triggering the next split is detected. +// See https://github.com/LiveSplit/LiveSplit.AutoSplitters/blob/master/README.md#automatic-splits-1 +split { + bool split = false; + + if (!String.IsNullOrEmpty(current.journalString)) { + if (vars.journalEntries[vars.currentSplit].Match(current.journalString).Success) { + split = true; + vars.currentSplit++; + } + } + + return split; +} + +// Executes every `update`. Triggers a reset if a reset condition is met. +// See https://github.com/LiveSplit/LiveSplit.AutoSplitters/blob/master/README.md#automatic-resets-1 +reset { + bool reset = false; + + if (settings["autoReset"] && !String.IsNullOrEmpty(current.journalString)) { + foreach (System.Text.RegularExpressions.Regex condition in vars.resetConditions) + { + if (condition.Match(current.journalString).Success) { + reset = true; + } + } + } + + return reset; +} + +// Executes when the game process is shut down. +// In our case we’re going to close the files we opened in `init`. +// See https://github.com/LiveSplit/LiveSplit.AutoSplitters/blob/master/README.md#game-exit +exit { + vars.journalReader.Close(); +} + +// Executes when LiveScript shuts the auto splitter down, e.g. on reloading it. +// When reloading the splitter with the game running, LiveSplit does **not** execute `exit`, but it does execute `shutdown`. +// see https://github.com/LiveSplit/LiveSplit.AutoSplitters/blob/master/README.md#script-shutdown +shutdown { + if (vars.journalReader != null) { + vars.journalReader.Close(); + } +} diff --git a/On the Rocks.lsl b/On the Rocks.lsl new file mode 100644 index 0000000..f170eef --- /dev/null +++ b/On the Rocks.lsl @@ -0,0 +1,190 @@ + + + Vertical + 51 + 53 + 286 + 386 + -1 + -1 + + FFFFFFFF + FF0F0F0F + 00000000 + 03FFFFFF + 24FFFFFF + FF16A6FF + FF00CC36 + FF52CC73 + FFCC5C52 + FFCC1200 + FFD8AF1F + False + FFACACAC + FF7A7A7A + 00000000 + 80000000 + + + + True + True + True + True + SolidColor + + 1 + 0 + 1 + False + + + + LiveSplit.Title.dll + + 1.7.3 + True + True + False + False + False + False + + False + FFFFFFFF + FF2A2A2A + FF131313 + Vertical + True + False + False + True + 0 + + + + LiveSplit.Subsplits.dll + + 1.7 + FF3373F4 + FF153574 + 11 + 1 + 0 + True + False + True + 20 + Seconds + FFFFFFFF + FFFFFFFF + FFFFFFFF + False + FFFFFFFF + FFFFFFFF + FFFFFFFF + False + False + 24 + True + 6 + Vertical + 00FFFFFF + 01FFFFFF + Alternating + True + Tenths + True + False + FFFFFFFF + Current Comparison + Current Timing Method + False + True + True + False + False + False + False + Plain + True + True + True + True + Vertical + False + True + True + Tenths + True + True + Tenths + 8D000000 + 00FFFFFF + 2BFFFFFF + D8000000 + FFFFFFFF + FFFFFFFF + FF777777 + False + FFFFFFFF + + + 1.5 + +/- + Delta + Personal Best + Real Time + + + 1.5 + Time + SplitTime + Personal Best + Real Time + + + + + + LiveSplit.Timer.dll + + 1.5 + 69 + 225 + 1.23 + False + True + FFAAAAAA + 00000000 + FF222222 + Plain + False + Current Timing Method + 35 + + + + LiveSplit.PreviousSegment.dll + + 1.6 + FFFFFFFF + False + FF1C1C1C + FF0D0D0D + Vertical + Seconds + True + Personal Best + False + False + Tenths + + + + LiveSplit.ScriptableAutoSplit.dll + + + + + \ No newline at end of file diff --git a/On the Rocks.lss b/On the Rocks.lss new file mode 100644 index 0000000..1a1e774 --- /dev/null +++ b/On the Rocks.lss @@ -0,0 +1,75 @@ + + + + Elite Dangerous + On the Rocks + + + + + + + + + + + 00:00:00 + 0 + + + -Jump to first stop + + + -Drop at first stop + + + {First stop}Sell at first stop + + + -Jump to second stop + + + -Drop at second stop + + + {Second stop}Sell at second stop + + + -Jump to third stop + + + -Drop at third stop + + + {Third stop}Sell at third stop + + + -Jump to fourth stop + + + -Drop at fourth stop + + + {Fourth stop}Sell at fourth stop + + + -Jump to fifth stop + + + -Drop at fifth stop + + + {Fifth stop}Sell at fifth stop + + + -Jump to Fullerene C60 + + + -Drop at Rebuy Prospect + + + {Return to Rebuy Prospect}Dock at Rebuy Prospect + + + + \ No newline at end of file diff --git a/README.md b/README.md index 4d1380d..03d7be4 100644 --- a/README.md +++ b/README.md @@ -79,4 +79,17 @@ Interchange Hub, nor enforce the speed requirement. There is one settings: * `Automatically reset when refuelling or repairing`: Automatically reset when - you Refuel or repair, since that is against the rules. Disabled by default. \ No newline at end of file + you Refuel or repair, since that is against the rules. Disabled by default. + +### Race 4 – On the Rocks + +https://forums.frontier.co.uk/threads/the-buckyball-racing-club-presents-on-the-rocks-7th-15th-may-3307-magic-8-ball-championship-race-4.602955/ + +The AutoSplitter will start the timer once you undock from Rebuy Prospect. It +will **not** enforce selling 1t of beer mats (split will trigger at selling +_anything_), and **not** check if you’re buying water at Jack’s Town. + +Since the order in which you visit the race’s stops is up to you, the splits +do not have a specific order and instead just list the `n`th stop. + +There are no settings. \ No newline at end of file