From ab29fc609408a2e1feca2c402a405a7f9a6e6a91 Mon Sep 17 00:00:00 2001 From: T'kael Date: Sun, 23 Jun 2024 13:44:43 -0700 Subject: [PATCH] Further fixes for `Loadout` parsing exceptions that appear to have been impacting fuel level updates from the Status Monitor. --- ChangeLog.md | 2 ++ ShipMonitor/ShipMonitor.cs | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 39dbabf641..83079fd614 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,6 +3,8 @@ Full details of the variables available for each noted event, and VoiceAttack integrations, are available in the individual [event pages](https://github.com/EDCD/EDDI/wiki/Events). ## 4.0.4-b4 + * Core + * Further fixes for `Loadout` parsing exceptions that appear to have been impacting fuel level updates from the Status Monitor. * Cargo Monitor * Fixed a crash that could occur when viewing the Cargo Monitor while it contains cargo. diff --git a/ShipMonitor/ShipMonitor.cs b/ShipMonitor/ShipMonitor.cs index 7ce5ead3d2..32f0495d12 100644 --- a/ShipMonitor/ShipMonitor.cs +++ b/ShipMonitor/ShipMonitor.cs @@ -461,7 +461,7 @@ private Ship ParseShipLoadoutEvent(ShipLoadoutEvent @event) { // Obtain the ship to which this loadout refers Logging.Debug("Current Ship Id is: " + currentShipId + ", Loadout Ship Id is " + @event.shipid); - Ship ship = GetShip(@event.shipid); + var ship = GetShip(@event.shipid); if (ship == null) { @@ -474,13 +474,16 @@ private Ship ParseShipLoadoutEvent(ShipLoadoutEvent @event) // Save a copy of the raw event so that we can send it to other 3rd party apps ship.raw = @event.raw; - // Update model (in case it was solely from the edname), name, ident & paintjob if required - ship.model = ship.model.ToLowerInvariant() == ship.EDName.ToLowerInvariant() ? @event.ship : ship.model; + // Update model (in case it was solely from the edname), name, ident, and paintjob if required + ship.model = @event.shipDefinition.model ?? @event.ship ?? @event.edModel; setShipName(ship, @event.shipname); setShipIdent(ship, @event.shipident); ship.paintjob = @event.paintjob; ship.hot = @event.hot; + // Augment with template values + ship.Augment(); + // Write ship value, if given by the loadout event if (@event.value != null) {