diff --git a/Events/CargoTransferEvent.cs b/Events/CargoTransferEvent.cs new file mode 100644 index 0000000000..b739f3c434 --- /dev/null +++ b/Events/CargoTransferEvent.cs @@ -0,0 +1,36 @@ +using EddiDataDefinitions; +using System; +using System.Collections.Generic; +using Utilities; + +namespace EddiEvents +{ + [PublicAPI] + public class CargoTransferEvent : Event + { + public const string NAME = "Cargo transfer"; + public const string DESCRIPTION = "Triggered when transferring commodities between your ship, SRV, or carrier"; + public static readonly string[] SAMPLES = + { + @"{ ""timestamp"":""2023-06-09T09:18:40Z"", ""event"":""CargoTransfer"", ""Transfers"":[ { ""Type"":""thargoidgeneratortissuesample"", ""Type_Localised"":""Caustic Tissue Sample"", ""Count"":2, ""Direction"":""tocarrier"" }, { ""Type"":""drones"", ""Type_Localised"":""Limpet"", ""Count"":12, ""Direction"":""toship"" } ] }", + @"{ ""timestamp"":""2023-05-22T08:36:19Z"", ""event"":""CargoTransfer"", ""Transfers"":[ { ""Type"":""radiationbaffle"", ""Type_Localised"":""Radiation Baffle"", ""Count"":46, ""Direction"":""tocarrier"" }, { ""Type"":""metaalloys"", ""Type_Localised"":""Meta-Alloys"", ""Count"":16, ""Direction"":""toship"" }, { ""Type"":""neofabricinsulation"", ""Type_Localised"":""Neofabric Insulation"", ""Count"":12, ""Direction"":""toship"" } ] }", + @"{ ""timestamp"":""2022-08-20T22:11:41Z"", ""event"":""CargoTransfer"", ""Transfers"":[ { ""Type"":""unknownartifact3"", ""Type_Localised"":""Thargoid Link"", ""Count"":1, ""Direction"":""toship"" }, { ""Type"":""ancientrelic"", ""Type_Localised"":""Guardian Relic"", ""Count"":3, ""Direction"":""toship"" }, { ""Type"":""unknowntechnologysamples"", ""Type_Localised"":""Thargoid Technology Samples"", ""Count"":1, ""Direction"":""tosrv"" } ] }" + }; + + [PublicAPI("The commodities and amounts being transferred to your ship")] + public List toship { get; private set; } + + [PublicAPI( "The commodities and amounts being transferred to your SRV" )] + public List tosrv { get; private set; } + + [PublicAPI( "The commodities and amounts being transferred to your carrier" )] + public List tocarrier { get; private set; } + + public CargoTransferEvent ( DateTime timestamp, List toShip, List toSRV, List toCarrier ) : base(timestamp, NAME) + { + this.toship = toShip; + this.tosrv = toSRV; + this.tocarrier = toCarrier; + } + } +} diff --git a/JournalMonitor/JournalMonitor.cs b/JournalMonitor/JournalMonitor.cs index 9c81c71368..672c573fea 100644 --- a/JournalMonitor/JournalMonitor.cs +++ b/JournalMonitor/JournalMonitor.cs @@ -7,6 +7,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; @@ -20,13 +21,18 @@ namespace EddiJournalMonitor { public class JournalMonitor : LogMonitor, IEddiMonitor { - private static readonly Regex JsonRegex = new Regex( @"^{.*}$", RegexOptions.Singleline ); - public JournalMonitor () : base( GetSavedGamesDir(), @"^Journal.*\.[0-9\.]+\.log$", ( result, isLogLoadEvent ) => ForwardJournalEntries( result.ToList(), EDDI.Instance.enqueueEvent, isLogLoadEvent ) ) { } + private static readonly Regex JsonRegex = new Regex( @"^{.*}$", RegexOptions.Singleline ); + + /// + /// Holds a delayed event until we see an event of the type specified + /// + private static readonly ConcurrentDictionary DelayedEventHolder = new ConcurrentDictionary(); + private enum ShipyardType { [UsedImplicitly] ShipsHere, [UsedImplicitly] ShipsRemote } private static readonly Dictionary carrierJumpCancellationTokenSources = @@ -40,6 +46,15 @@ private static void ForwardJournalEntries ( IList lines, Action c var events = ParseJournalEntries(lines, isLogLoadEventBatch); + // Append any delayed events + foreach ( var @event in events.ToList() ) + { + if ( DelayedEventHolder.TryGetValue( @event.type, out var delayedEvent ) ) + { + events.Add( delayedEvent ); + } + } + // Enqueue events for processing events.ForEach(callback); } @@ -104,7 +119,7 @@ public static List ParseJournalEntries(IList lines, bool fromLogL return events; } - public static List ParseJournalEntry(string line, bool fromLogLoad = false) + public static List ParseJournalEntry(string line, bool fromLogLoad = false, bool fromSpeechResponderTest = false ) { List events = new List(); try @@ -5023,6 +5038,56 @@ MicroResource GetResource( IDictionary resourceData ) } handled = true; break; + case "CargoTransfer": // Could use for cargo transfers between ship and fleet carrier; the `Cargo` event already keeps ship and SRV cargo up to date. + { + var toShip = new List(); + var toSRV = new List(); + var toCarrier = new List(); + if ( data.TryGetValue("Transfers", out var transfersVal) ) + { + var transfersArray = JArray.FromObject( transfersVal ); + foreach ( var transfer in transfersArray ) + { + var direction = transfer[ "Direction" ].ToString(); + var count = (int)transfer[ "Count" ]; + var commodity = CommodityDefinition.FromEDName( transfer[ "Type" ].ToString() ); + commodity.fallbackLocalizedName = transfer[ "Type_Localised" ]?.ToString(); + + // Objects may have a `MissionID` but the legalstatus is not identified so we rtat these items + // as CommodityAmount objects and use the `Cargo` event to update the CargoMonitor. + + var commodityAmount = new CommodityAmount( commodity, count ); + if ( direction.Equals( "toship", StringComparison.InvariantCultureIgnoreCase ) ) + { + toShip.Add( commodityAmount ); + } + else if ( direction.Equals( "tosrv", StringComparison.InvariantCultureIgnoreCase ) ) + { + toSRV.Add( commodityAmount ); + } + else if ( direction.Equals( "tocarrier", StringComparison.InvariantCultureIgnoreCase ) ) + { + toCarrier.Add( commodityAmount ); + } + else + { + throw new ArgumentException( "Unhandled CargoTransfer `Direction`." ); + } + } + } + + var cargoTransferEvent = new CargoTransferEvent( timestamp, toShip, toSRV, toCarrier ) { raw = line, fromLoad = fromLogLoad }; + if ( fromSpeechResponderTest ) + { + events.Add( cargoTransferEvent ); + } + else + { + DelayedEventHolder[ CargoEvent.NAME ] = cargoTransferEvent; + } + } + handled = true; + break; // we silently ignore these, but forward them to the responders case "CodexDiscovery": @@ -5036,7 +5101,6 @@ MicroResource GetResource( IDictionary resourceData ) // Low priority (for now) case "BuyWeapon": case "CarrierTradeOrder": // Implement when we are ready to handle fleet carrier cargo. - case "CargoTransfer": // Could use for cargo transfers between ship and fleet carrier; the `Cargo` event already keeps ship and SRV cargo up to date. case "CarrierModulePack": case "CarrierShipPack": case "ClearImpound": // Sample: { "timestamp":"2022-10-20T18:01:17Z", "event":"ClearImpound", "ShipType":"asp", "ShipType_Localised":"Asp Explorer", "ShipID":34, "ShipMarketID":3705689344, "MarketID":3705689344 } diff --git a/SpeechResponder/EddiSpeechResponder.csproj b/SpeechResponder/EddiSpeechResponder.csproj index 98cc02c6b6..557c72291a 100644 --- a/SpeechResponder/EddiSpeechResponder.csproj +++ b/SpeechResponder/EddiSpeechResponder.csproj @@ -41,37 +41,37 @@ - PreserveNewest + Always - PreserveNewest + Always - PreserveNewest + Always - PreserveNewest + Always - PreserveNewest + Always - PreserveNewest + Always - PreserveNewest + Always - PreserveNewest + Always - PreserveNewest + Always - PreserveNewest + Always - PreserveNewest + Always PreserveNewest diff --git a/SpeechResponder/SpeechResponder.cs b/SpeechResponder/SpeechResponder.cs index 1d3d7c45d1..f49556d167 100644 --- a/SpeechResponder/SpeechResponder.cs +++ b/SpeechResponder/SpeechResponder.cs @@ -194,7 +194,7 @@ public void TestScript(string scriptName, Dictionary scripts) else if (sample is string s) { // It's a string so a journal entry. Parse it - sampleEvents = JournalMonitor.ParseJournalEntry(s); + sampleEvents = JournalMonitor.ParseJournalEntry(s, false, true); } else if (sample is Event e) { diff --git a/SpeechResponder/eddi.cs.json b/SpeechResponder/eddi.cs.json index e07c34c845..fec83d4bab 100644 --- a/SpeechResponder/eddi.cs.json +++ b/SpeechResponder/eddi.cs.json @@ -254,6 +254,15 @@ "name": "Cargo scoop", "description": "Triggered when you deploy or retract your cargo scoop" }, + "Cargo transfer": { + "enabled": true, + "priority": 3, + "responder": true, + "script": "{_ Set up a simple function to create descriptions for each transferred commodity }\r\n\r\n{set parseItem(cargo) to:\r\n {if cargo.amount = 1: \r\n {set tonnes to \" tonne \"}\r\n |else: \r\n {set tonnes to \" tonnes \"}\r\n }\r\n {set item to cat(cargo.amount, tonnes, \" of \", cargo.commodity)}\r\n {return item}\r\n}\r\n\r\n{_ Generate lists of transfer descriptions for each of the possible locations }\r\n\r\n{if len(event.toship) > 0:\r\n {set toShip to []}\r\n {for cargo in event.toship:\r\n {set toShip to cat(toShip, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tocarrier) > 0:\r\n {set toCarrier to []}\r\n {for cargo in event.tocarrier:\r\n {set toCarrier to cat(toCarrier, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tosrv) > 0:\r\n {set toSRV to []}\r\n {for cargo in event.tosrv:\r\n {set toSRV to cat(toSRV, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{_ Begin speaking }\r\n\r\nYou have transferred\r\n\r\n{if len(toShip) > 0:\r\n {List(toShip)} to {OneOf(ShipName(), \"your ship\")}\r\n}\r\n\r\n{if len(toCarrier) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toCarrier)} to {OneOf(carrier.name, \"your carrier\")}\r\n}\r\n\r\n{if len(toSRV) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toSRV)} to your SRV\r\n}.\r\n", + "default": true, + "name": "Cargo transfer", + "description": "Triggered when transferring commodities between your ship, SRV, or carrier" + }, "Cargo wingupdate": { "enabled": true, "priority": 3, diff --git a/SpeechResponder/eddi.de.json b/SpeechResponder/eddi.de.json index 41a0555462..33b77d1a2d 100644 --- a/SpeechResponder/eddi.de.json +++ b/SpeechResponder/eddi.de.json @@ -254,6 +254,15 @@ "name": "Cargo scoop", "description": "Triggered when you deploy or retract your cargo scoop" }, + "Cargo transfer": { + "enabled": true, + "priority": 3, + "responder": true, + "script": "{_ Set up a simple function to create descriptions for each transferred commodity }\r\n\r\n{set parseItem(cargo) to:\r\n {if cargo.amount = 1: \r\n {set tonnes to \" tonne \"}\r\n |else: \r\n {set tonnes to \" tonnes \"}\r\n }\r\n {set item to cat(cargo.amount, tonnes, \" of \", cargo.commodity)}\r\n {return item}\r\n}\r\n\r\n{_ Generate lists of transfer descriptions for each of the possible locations }\r\n\r\n{if len(event.toship) > 0:\r\n {set toShip to []}\r\n {for cargo in event.toship:\r\n {set toShip to cat(toShip, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tocarrier) > 0:\r\n {set toCarrier to []}\r\n {for cargo in event.tocarrier:\r\n {set toCarrier to cat(toCarrier, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tosrv) > 0:\r\n {set toSRV to []}\r\n {for cargo in event.tosrv:\r\n {set toSRV to cat(toSRV, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{_ Begin speaking }\r\n\r\nYou have transferred\r\n\r\n{if len(toShip) > 0:\r\n {List(toShip)} to {OneOf(ShipName(), \"your ship\")}\r\n}\r\n\r\n{if len(toCarrier) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toCarrier)} to {OneOf(carrier.name, \"your carrier\")}\r\n}\r\n\r\n{if len(toSRV) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toSRV)} to your SRV\r\n}.\r\n", + "default": true, + "name": "Cargo transfer", + "description": "Triggered when transferring commodities between your ship, SRV, or carrier" + }, "Cargo wingupdate": { "enabled": true, "priority": 3, diff --git a/SpeechResponder/eddi.es.json b/SpeechResponder/eddi.es.json index 84b67d34b1..4124f4c6b6 100644 --- a/SpeechResponder/eddi.es.json +++ b/SpeechResponder/eddi.es.json @@ -241,6 +241,15 @@ "name": "Cargo scoop", "description": "Triggered when you deploy or retract your cargo scoop" }, + "Cargo transfer": { + "enabled": true, + "priority": 3, + "responder": true, + "script": "{_ Set up a simple function to create descriptions for each transferred commodity }\r\n\r\n{set parseItem(cargo) to:\r\n {if cargo.amount = 1: \r\n {set tonnes to \" tonne \"}\r\n |else: \r\n {set tonnes to \" tonnes \"}\r\n }\r\n {set item to cat(cargo.amount, tonnes, \" of \", cargo.commodity)}\r\n {return item}\r\n}\r\n\r\n{_ Generate lists of transfer descriptions for each of the possible locations }\r\n\r\n{if len(event.toship) > 0:\r\n {set toShip to []}\r\n {for cargo in event.toship:\r\n {set toShip to cat(toShip, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tocarrier) > 0:\r\n {set toCarrier to []}\r\n {for cargo in event.tocarrier:\r\n {set toCarrier to cat(toCarrier, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tosrv) > 0:\r\n {set toSRV to []}\r\n {for cargo in event.tosrv:\r\n {set toSRV to cat(toSRV, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{_ Begin speaking }\r\n\r\nYou have transferred\r\n\r\n{if len(toShip) > 0:\r\n {List(toShip)} to {OneOf(ShipName(), \"your ship\")}\r\n}\r\n\r\n{if len(toCarrier) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toCarrier)} to {OneOf(carrier.name, \"your carrier\")}\r\n}\r\n\r\n{if len(toSRV) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toSRV)} to your SRV\r\n}.\r\n", + "default": true, + "name": "Cargo transfer", + "description": "Triggered when transferring commodities between your ship, SRV, or carrier" + }, "Cargo wingupdate": { "enabled": true, "priority": 3, diff --git a/SpeechResponder/eddi.fr.json b/SpeechResponder/eddi.fr.json index f528a0ab2e..fef9e1d1fb 100644 --- a/SpeechResponder/eddi.fr.json +++ b/SpeechResponder/eddi.fr.json @@ -254,6 +254,15 @@ "name": "Cargo scoop", "description": "Triggered when you deploy or retract your cargo scoop" }, + "Cargo transfer": { + "enabled": true, + "priority": 3, + "responder": true, + "script": "{_ Set up a simple function to create descriptions for each transferred commodity }\r\n\r\n{set parseItem(cargo) to:\r\n {if cargo.amount = 1: \r\n {set tonnes to \" tonne \"}\r\n |else: \r\n {set tonnes to \" tonnes \"}\r\n }\r\n {set item to cat(cargo.amount, tonnes, \" of \", cargo.commodity)}\r\n {return item}\r\n}\r\n\r\n{_ Generate lists of transfer descriptions for each of the possible locations }\r\n\r\n{if len(event.toship) > 0:\r\n {set toShip to []}\r\n {for cargo in event.toship:\r\n {set toShip to cat(toShip, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tocarrier) > 0:\r\n {set toCarrier to []}\r\n {for cargo in event.tocarrier:\r\n {set toCarrier to cat(toCarrier, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tosrv) > 0:\r\n {set toSRV to []}\r\n {for cargo in event.tosrv:\r\n {set toSRV to cat(toSRV, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{_ Begin speaking }\r\n\r\nYou have transferred\r\n\r\n{if len(toShip) > 0:\r\n {List(toShip)} to {OneOf(ShipName(), \"your ship\")}\r\n}\r\n\r\n{if len(toCarrier) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toCarrier)} to {OneOf(carrier.name, \"your carrier\")}\r\n}\r\n\r\n{if len(toSRV) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toSRV)} to your SRV\r\n}.\r\n", + "default": true, + "name": "Cargo transfer", + "description": "Triggered when transferring commodities between your ship, SRV, or carrier" + }, "Cargo wingupdate": { "enabled": true, "priority": 3, diff --git a/SpeechResponder/eddi.hu.json b/SpeechResponder/eddi.hu.json index 381ae637e3..a8666c7572 100644 --- a/SpeechResponder/eddi.hu.json +++ b/SpeechResponder/eddi.hu.json @@ -254,6 +254,15 @@ "name": "Cargo scoop", "description": "Triggered when you deploy or retract your cargo scoop" }, + "Cargo transfer": { + "enabled": true, + "priority": 3, + "responder": true, + "script": "{_ Set up a simple function to create descriptions for each transferred commodity }\r\n\r\n{set parseItem(cargo) to:\r\n {if cargo.amount = 1: \r\n {set tonnes to \" tonne \"}\r\n |else: \r\n {set tonnes to \" tonnes \"}\r\n }\r\n {set item to cat(cargo.amount, tonnes, \" of \", cargo.commodity)}\r\n {return item}\r\n}\r\n\r\n{_ Generate lists of transfer descriptions for each of the possible locations }\r\n\r\n{if len(event.toship) > 0:\r\n {set toShip to []}\r\n {for cargo in event.toship:\r\n {set toShip to cat(toShip, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tocarrier) > 0:\r\n {set toCarrier to []}\r\n {for cargo in event.tocarrier:\r\n {set toCarrier to cat(toCarrier, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tosrv) > 0:\r\n {set toSRV to []}\r\n {for cargo in event.tosrv:\r\n {set toSRV to cat(toSRV, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{_ Begin speaking }\r\n\r\nYou have transferred\r\n\r\n{if len(toShip) > 0:\r\n {List(toShip)} to {OneOf(ShipName(), \"your ship\")}\r\n}\r\n\r\n{if len(toCarrier) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toCarrier)} to {OneOf(carrier.name, \"your carrier\")}\r\n}\r\n\r\n{if len(toSRV) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toSRV)} to your SRV\r\n}.\r\n", + "default": true, + "name": "Cargo transfer", + "description": "Triggered when transferring commodities between your ship, SRV, or carrier" + }, "Cargo wingupdate": { "enabled": true, "priority": 3, diff --git a/SpeechResponder/eddi.it.json b/SpeechResponder/eddi.it.json index 381ae637e3..a8666c7572 100644 --- a/SpeechResponder/eddi.it.json +++ b/SpeechResponder/eddi.it.json @@ -254,6 +254,15 @@ "name": "Cargo scoop", "description": "Triggered when you deploy or retract your cargo scoop" }, + "Cargo transfer": { + "enabled": true, + "priority": 3, + "responder": true, + "script": "{_ Set up a simple function to create descriptions for each transferred commodity }\r\n\r\n{set parseItem(cargo) to:\r\n {if cargo.amount = 1: \r\n {set tonnes to \" tonne \"}\r\n |else: \r\n {set tonnes to \" tonnes \"}\r\n }\r\n {set item to cat(cargo.amount, tonnes, \" of \", cargo.commodity)}\r\n {return item}\r\n}\r\n\r\n{_ Generate lists of transfer descriptions for each of the possible locations }\r\n\r\n{if len(event.toship) > 0:\r\n {set toShip to []}\r\n {for cargo in event.toship:\r\n {set toShip to cat(toShip, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tocarrier) > 0:\r\n {set toCarrier to []}\r\n {for cargo in event.tocarrier:\r\n {set toCarrier to cat(toCarrier, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tosrv) > 0:\r\n {set toSRV to []}\r\n {for cargo in event.tosrv:\r\n {set toSRV to cat(toSRV, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{_ Begin speaking }\r\n\r\nYou have transferred\r\n\r\n{if len(toShip) > 0:\r\n {List(toShip)} to {OneOf(ShipName(), \"your ship\")}\r\n}\r\n\r\n{if len(toCarrier) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toCarrier)} to {OneOf(carrier.name, \"your carrier\")}\r\n}\r\n\r\n{if len(toSRV) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toSRV)} to your SRV\r\n}.\r\n", + "default": true, + "name": "Cargo transfer", + "description": "Triggered when transferring commodities between your ship, SRV, or carrier" + }, "Cargo wingupdate": { "enabled": true, "priority": 3, diff --git a/SpeechResponder/eddi.ja.json b/SpeechResponder/eddi.ja.json index 381ae637e3..a8666c7572 100644 --- a/SpeechResponder/eddi.ja.json +++ b/SpeechResponder/eddi.ja.json @@ -254,6 +254,15 @@ "name": "Cargo scoop", "description": "Triggered when you deploy or retract your cargo scoop" }, + "Cargo transfer": { + "enabled": true, + "priority": 3, + "responder": true, + "script": "{_ Set up a simple function to create descriptions for each transferred commodity }\r\n\r\n{set parseItem(cargo) to:\r\n {if cargo.amount = 1: \r\n {set tonnes to \" tonne \"}\r\n |else: \r\n {set tonnes to \" tonnes \"}\r\n }\r\n {set item to cat(cargo.amount, tonnes, \" of \", cargo.commodity)}\r\n {return item}\r\n}\r\n\r\n{_ Generate lists of transfer descriptions for each of the possible locations }\r\n\r\n{if len(event.toship) > 0:\r\n {set toShip to []}\r\n {for cargo in event.toship:\r\n {set toShip to cat(toShip, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tocarrier) > 0:\r\n {set toCarrier to []}\r\n {for cargo in event.tocarrier:\r\n {set toCarrier to cat(toCarrier, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tosrv) > 0:\r\n {set toSRV to []}\r\n {for cargo in event.tosrv:\r\n {set toSRV to cat(toSRV, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{_ Begin speaking }\r\n\r\nYou have transferred\r\n\r\n{if len(toShip) > 0:\r\n {List(toShip)} to {OneOf(ShipName(), \"your ship\")}\r\n}\r\n\r\n{if len(toCarrier) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toCarrier)} to {OneOf(carrier.name, \"your carrier\")}\r\n}\r\n\r\n{if len(toSRV) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toSRV)} to your SRV\r\n}.\r\n", + "default": true, + "name": "Cargo transfer", + "description": "Triggered when transferring commodities between your ship, SRV, or carrier" + }, "Cargo wingupdate": { "enabled": true, "priority": 3, diff --git a/SpeechResponder/eddi.json b/SpeechResponder/eddi.json index c7f7e42152..764eff0f39 100644 --- a/SpeechResponder/eddi.json +++ b/SpeechResponder/eddi.json @@ -254,6 +254,15 @@ "name": "Cargo scoop", "description": "Triggered when you deploy or retract your cargo scoop" }, + "Cargo transfer": { + "enabled": true, + "priority": 3, + "responder": true, + "script": "{_ Set up a simple function to create descriptions for each transferred commodity }\r\n\r\n{set parseItem(cargo) to:\r\n {if cargo.amount = 1: \r\n {set tonnes to \" tonne \"}\r\n |else: \r\n {set tonnes to \" tonnes \"}\r\n }\r\n {set item to cat(cargo.amount, tonnes, \" of \", cargo.commodity)}\r\n {return item}\r\n}\r\n\r\n{_ Generate lists of transfer descriptions for each of the possible locations }\r\n\r\n{if len(event.toship) > 0:\r\n {set toShip to []}\r\n {for cargo in event.toship:\r\n {set toShip to cat(toShip, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tocarrier) > 0:\r\n {set toCarrier to []}\r\n {for cargo in event.tocarrier:\r\n {set toCarrier to cat(toCarrier, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tosrv) > 0:\r\n {set toSRV to []}\r\n {for cargo in event.tosrv:\r\n {set toSRV to cat(toSRV, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{_ Begin speaking }\r\n\r\nYou have transferred\r\n\r\n{if len(toShip) > 0:\r\n {List(toShip)} to {OneOf(ShipName(), \"your ship\")}\r\n}\r\n\r\n{if len(toCarrier) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toCarrier)} to {OneOf(carrier.name, \"your carrier\")}\r\n}\r\n\r\n{if len(toSRV) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toSRV)} to your SRV\r\n}.\r\n", + "default": true, + "name": "Cargo transfer", + "description": "Triggered when transferring commodities between your ship, SRV, or carrier" + }, "Cargo wingupdate": { "enabled": true, "priority": 3, diff --git a/SpeechResponder/eddi.pt-BR.json b/SpeechResponder/eddi.pt-BR.json index 877e6a584d..218ceb3573 100644 --- a/SpeechResponder/eddi.pt-BR.json +++ b/SpeechResponder/eddi.pt-BR.json @@ -262,6 +262,15 @@ "description": "Triggered when you deploy or retract your cargo scoop", "default": true }, + "Cargo transfer": { + "enabled": true, + "priority": 3, + "responder": true, + "script": "{_ Set up a simple function to create descriptions for each transferred commodity }\r\n\r\n{set parseItem(cargo) to:\r\n {if cargo.amount = 1: \r\n {set tonnes to \" tonne \"}\r\n |else: \r\n {set tonnes to \" tonnes \"}\r\n }\r\n {set item to cat(cargo.amount, tonnes, \" of \", cargo.commodity)}\r\n {return item}\r\n}\r\n\r\n{_ Generate lists of transfer descriptions for each of the possible locations }\r\n\r\n{if len(event.toship) > 0:\r\n {set toShip to []}\r\n {for cargo in event.toship:\r\n {set toShip to cat(toShip, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tocarrier) > 0:\r\n {set toCarrier to []}\r\n {for cargo in event.tocarrier:\r\n {set toCarrier to cat(toCarrier, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tosrv) > 0:\r\n {set toSRV to []}\r\n {for cargo in event.tosrv:\r\n {set toSRV to cat(toSRV, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{_ Begin speaking }\r\n\r\nYou have transferred\r\n\r\n{if len(toShip) > 0:\r\n {List(toShip)} to {OneOf(ShipName(), \"your ship\")}\r\n}\r\n\r\n{if len(toCarrier) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toCarrier)} to {OneOf(carrier.name, \"your carrier\")}\r\n}\r\n\r\n{if len(toSRV) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toSRV)} to your SRV\r\n}.\r\n", + "default": true, + "name": "Cargo transfer", + "description": "Triggered when transferring commodities between your ship, SRV, or carrier" + }, "Cargo wingupdate": { "enabled": true, "priority": 3, diff --git a/SpeechResponder/eddi.ru.json b/SpeechResponder/eddi.ru.json index 381ae637e3..a8666c7572 100644 --- a/SpeechResponder/eddi.ru.json +++ b/SpeechResponder/eddi.ru.json @@ -254,6 +254,15 @@ "name": "Cargo scoop", "description": "Triggered when you deploy or retract your cargo scoop" }, + "Cargo transfer": { + "enabled": true, + "priority": 3, + "responder": true, + "script": "{_ Set up a simple function to create descriptions for each transferred commodity }\r\n\r\n{set parseItem(cargo) to:\r\n {if cargo.amount = 1: \r\n {set tonnes to \" tonne \"}\r\n |else: \r\n {set tonnes to \" tonnes \"}\r\n }\r\n {set item to cat(cargo.amount, tonnes, \" of \", cargo.commodity)}\r\n {return item}\r\n}\r\n\r\n{_ Generate lists of transfer descriptions for each of the possible locations }\r\n\r\n{if len(event.toship) > 0:\r\n {set toShip to []}\r\n {for cargo in event.toship:\r\n {set toShip to cat(toShip, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tocarrier) > 0:\r\n {set toCarrier to []}\r\n {for cargo in event.tocarrier:\r\n {set toCarrier to cat(toCarrier, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{if len(event.tosrv) > 0:\r\n {set toSRV to []}\r\n {for cargo in event.tosrv:\r\n {set toSRV to cat(toSRV, [parseItem(cargo)])}\r\n }\r\n}\r\n\r\n{_ Begin speaking }\r\n\r\nYou have transferred\r\n\r\n{if len(toShip) > 0:\r\n {List(toShip)} to {OneOf(ShipName(), \"your ship\")}\r\n}\r\n\r\n{if len(toCarrier) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toCarrier)} to {OneOf(carrier.name, \"your carrier\")}\r\n}\r\n\r\n{if len(toSRV) > 0:\r\n {if len(toShip) > 0: and }\r\n {List(toSRV)} to your SRV\r\n}.\r\n", + "default": true, + "name": "Cargo transfer", + "description": "Triggered when transferring commodities between your ship, SRV, or carrier" + }, "Cargo wingupdate": { "enabled": true, "priority": 3,