Skip to content

Commit

Permalink
Refactor to remove redundant haulage mission tracking from cargo an…
Browse files Browse the repository at this point in the history
…d the Cargo Monitor.

Resolve #2610.
Added `sourcesystem`, `sourcebody`, `collected`, and `delivered`, properties to the mission object.
Removed `cargoHaulage` properties from the `cargo` object.
Removed the `HaulageDetails` custom function from the Speech Responder.
The `need` property of cargo is now calculated after resolvers have handled mission related cargo events (to minimize cross linking between monitors).
  • Loading branch information
Tkael committed Jul 29, 2024
1 parent 75091fd commit ed11f43
Show file tree
Hide file tree
Showing 26 changed files with 739 additions and 1,307 deletions.
648 changes: 117 additions & 531 deletions CargoMonitor/CargoMonitor.cs

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions CargoMonitor/ConfigurationWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
xmlns:local="clr-namespace:EddiCargoMonitor"
xmlns:resx="clr-namespace:EddiCargoMonitor.Properties"
xmlns:utility="clr-namespace:Utilities;assembly=Utilities"
xmlns:eddiDataDefinitions="clr-namespace:EddiDataDefinitions;assembly=EddiDataDefinitions"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="800">
<DockPanel LastChildFill="True" Background="#FFE5E5E5" Margin="0,5">
Expand Down Expand Up @@ -54,7 +55,7 @@
</Style>
</DataGridTextColumn.ElementStyle>
</utility:DataGridNumericColumn>
<utility:DataGridNumericColumn Header="{x:Static resx:CargoMonitor.header_haulage}" Width="80" Binding="{Binding Path=haulage, NotifyOnTargetUpdated=True, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, TargetNullValue={x:Static System:String.Empty}}">
<utility:DataGridNumericColumn Header="{x:Static resx:CargoMonitor.header_haulage}" Width="80" Binding="{Binding Path=(eddiDataDefinitions:Cargo.haulage), NotifyOnTargetUpdated=True, UpdateSourceTrigger=PropertyChanged, Mode=OneWay, TargetNullValue={x:Static System:String.Empty}}">
<DataGridTextColumn.HeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center" />
Expand All @@ -67,7 +68,7 @@
</Style>
</DataGridTextColumn.ElementStyle>
</utility:DataGridNumericColumn>
<utility:DataGridNumericColumn Header="{x:Static resx:CargoMonitor.header_stolen}" Width="80" Binding="{Binding Path=stolen, NotifyOnTargetUpdated=True, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, TargetNullValue={x:Static System:String.Empty}}">
<utility:DataGridNumericColumn Header="{x:Static resx:CargoMonitor.header_stolen}" Width="80" Binding="{Binding Path=(eddiDataDefinitions:Cargo.stolen), NotifyOnTargetUpdated=True, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, TargetNullValue={x:Static System:String.Empty}}">
<DataGridTextColumn.HeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center" />
Expand All @@ -80,7 +81,7 @@
</Style>
</DataGridTextColumn.ElementStyle>
</utility:DataGridNumericColumn>
<utility:DataGridNumericColumn Header="{x:Static resx:CargoMonitor.header_owned}" Width="80" Binding="{Binding Path=owned, NotifyOnTargetUpdated=True, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, TargetNullValue={x:Static System:String.Empty}}">
<utility:DataGridNumericColumn Header="{x:Static resx:CargoMonitor.header_owned}" Width="80" Binding="{Binding Path=(eddiDataDefinitions:Cargo.owned), NotifyOnTargetUpdated=True, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, TargetNullValue={x:Static System:String.Empty}}">
<DataGridTextColumn.HeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center" />
Expand All @@ -93,7 +94,7 @@
</Style>
</DataGridTextColumn.ElementStyle>
</utility:DataGridNumericColumn>
<utility:DataGridNumericColumn Header="{x:Static resx:CargoMonitor.header_need}" Width="80" Binding="{Binding Path=need, NotifyOnTargetUpdated=True, UpdateSourceTrigger=PropertyChanged, Mode=OneWay, TargetNullValue={x:Static System:String.Empty}}">
<utility:DataGridNumericColumn Header="{x:Static resx:CargoMonitor.header_need}" Width="80" Binding="{Binding Path=(eddiDataDefinitions:Cargo.need), NotifyOnTargetUpdated=True, UpdateSourceTrigger=PropertyChanged, Mode=OneWay, TargetNullValue={x:Static System:String.Empty}}">
<DataGridTextColumn.HeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center" />
Expand Down
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ Full details of the variables available for each noted event, and VoiceAttack in

## 4.1.0-b1
* Core
* Added `sourcesystem`, `sourcebody`, `collected`, and `delivered`, properties to the `mission` object.
* Removed `cargoHaulage` properties from the `cargo` object.
* The `need` property of `cargo` is now calculated after resolvers have handled events (to minimize cross linking between the Cargo and Mission Monitors).
* Commodities now have a `corrosive` boolean property
* Crime Monitor
* An interstellar bounty applies when fines or bounties for factions aligned with a superpower exceed 10,000 credits.
* Speech Responder
* Fixed a bug that could prevent variables set with `set` from being available in some contexts.
* Custom Functions
* `HaulageDetails` function has been removed.
* Scripts
* `Body scanned` updated to improve the context passed to child scripts.
* `Blueprint make report` updated to fix a typo (stray letter).
Expand Down
15 changes: 6 additions & 9 deletions CrimeMonitor/CrimeMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -665,13 +665,11 @@ private void handleMissionAbandonedEvent(MissionAbandonedEvent @event)

private bool _handleMissionAbandonedEvent(MissionAbandonedEvent @event)
{
bool update = false;

if (@event.fine > 0 && @event.missionid != null)
if (@event.fine > 0)
{
update = handleMissionFine(@event.timestamp, @event.missionid ?? 0, @event.fine);
return handleMissionFine(@event.timestamp, @event.missionid, @event.fine);
}
return update;
return false;
}

private void handleMissionFailedEvent(MissionFailedEvent @event)
Expand All @@ -688,11 +686,10 @@ private void handleMissionFailedEvent(MissionFailedEvent @event)

private bool _handleMissionFailedEvent(MissionFailedEvent @event)
{
bool update = false;

if (@event.fine > 0 && @event.missionid != null)
var update = false;
if (@event.fine > 0)
{
update = handleMissionFine(@event.timestamp, @event.missionid ?? 0, @event.fine);
update = handleMissionFine(@event.timestamp, @event.missionid, @event.fine);
}
return update;
}
Expand Down
Loading

0 comments on commit ed11f43

Please sign in to comment.