Skip to content

Commit b879b92

Browse files
committed
Refactor first footfall and organic value/bonus logic
Renamed Body.alreadyfootfalled to alreadyfirstfootfalled for clarity and updated its documentation. Revised footfalled timestamp logic to always record the first footfall by the current commander. Enhanced Organic with value and bonus properties, using actual event or definition data, and added firstFootfallRegistered logic for bonus calculation. Updated organic species definitions with real credit values. Improved [PublicAPI] annotations for better documentation and integration. Updated event handling and LocationMonitor to use new properties and logic. Resolves #2788.
1 parent 75d8d21 commit b879b92

10 files changed

Lines changed: 278 additions & 305 deletions

File tree

ChangeLog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ Full details of the variables available for each noted event, and VoiceAttack in
55
## 5.0.0
66
* Core
77
* Target framework updated to .Net 8.
8+
* The `Body` object boolean property `alreadyfootfalled` has been renamed to `alreadyfirstfootfalled` for clarity.
9+
* The `Body` object unix timestamp property `footfalled` has been revised to record your first footfall regardless of whether another commander had already set foot on the body.
10+
* The `Organic` object has been revised to include a credit `value` property (set whenever the species is identified and when organic data is sold).
11+
* The `Organic` object has been revised to include a credit `bonus` property (set when you have registered a first footfall on the body and when organic data is sold).
12+
* Events
13+
*
814
* VoiceAttack Responder
915
* (**BREAKING CHANGE**) Updated to target VoiceAttack 2.0.0+. VoiceAttack 1.X is no longer supported.
1016
* Under the hood, EDDI now runs as a separate process from VoiceAttack. Only the plugin component of EDDI runs within the VoiceAttack process. This should improve stability and performance for both EDDI and VoiceAttack.

DataDefinitions/Body.cs

Lines changed: 66 additions & 99 deletions
Large diffs are not rendered by default.

DataDefinitions/Organic.cs

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ namespace EddiDataDefinitions
66
{
77
public class Organic
88
{
9-
[ Utilities.PublicAPI ]
9+
[ Utilities.PublicAPI ("Genus details" ) ]
1010
public OrganicGenus genus { get; set; }
1111

12-
[Utilities.PublicAPI ]
12+
[Utilities.PublicAPI ("Species details" ) ]
1313
public OrganicSpecies species
1414
{
1515
get => _species;
@@ -21,7 +21,7 @@ public OrganicSpecies species
2121
}
2222
private OrganicSpecies _species;
2323

24-
[ Utilities.PublicAPI ]
24+
[ Utilities.PublicAPI ("Variant details" ) ]
2525
public OrganicVariant variant
2626
{
2727
get => _variant;
@@ -34,39 +34,35 @@ public OrganicVariant variant
3434
}
3535
private OrganicVariant _variant;
3636

37-
[ Utilities.PublicAPI]
37+
[ Utilities.PublicAPI("The invariant name of the organic")]
3838
public string invariantName => ConsolidatedName( _variant?.invariantName, _species?.invariantName, genus?.invariantName );
3939

40-
[Utilities.PublicAPI]
40+
[Utilities.PublicAPI("The localized name of the organic")]
4141
public string localizedName => ConsolidatedName( _variant?.localizedName, _species?.localizedName, genus?.localizedName );
4242

43-
[JsonIgnore, Utilities.PublicAPI( "The minimum value from all predictions of this genus." )]
44-
public long predictedMinimumValue => valueOverride ?? genusPredictedMinimumValue ?? 0;
45-
46-
[JsonIgnore, Utilities.PublicAPI( "The maximum value from all predictions of this genus." )]
47-
public long predictedMaximumValue => valueOverride ?? genusPredictedMaximumValue ?? 0;
48-
49-
[JsonProperty]
50-
internal long? genusPredictedMinimumValue = null;
43+
[Utilities.PublicAPI( "The minimum distance that you must travel before you can collect a fresh sample of this genus (if known)" ), JsonIgnore]
44+
public int? minimumDistanceMeters => genus?.minimumDistanceMeters;
5145

52-
[JsonProperty]
53-
internal long? genusPredictedMaximumValue = null;
46+
[Utilities.PublicAPI( "The base credit value, as awarded when selling organic data" )]
47+
public long? value => valueOverride ?? species?.value;
5448

55-
[JsonIgnore, Utilities.PublicAPI( "The minimum distance that you must travel before you can collect a fresh sample of this genus (if known)" )]
56-
public int? minimumDistanceMeters => genus?.minimumDistanceMeters;
49+
/// <summary>
50+
/// If true, apply a predicted bonus to the value of this organic (as presumably no other commander has sold this organic before).
51+
/// </summary>
52+
public bool firstFootfallRegistered { get; set; }
5753

5854
/// <summary>
5955
/// Overrides the credit values from definitions when an actual value is indicated (as by the `OrganicDataSold` event)
6056
/// </summary>
6157
public long? valueOverride { get; set; } = null;
6258

59+
[Utilities.PublicAPI( "The bonus credit value, as awarded when selling organic data. The bonus value is assumed to apply when a first footfall has been registered." )]
60+
public long? bonus => bonusOverride ?? (firstFootfallRegistered ? value * 4 : 0);
61+
6362
/// <summary>
64-
/// Sets the value from predictions, this could be the minimum value from several predicted species of the same genus.
63+
/// Overrides the bonus credit values from definitions when an actual value is indicated (as by the `OrganicDataSold` event)
6564
/// </summary>
66-
//public long? valuePredicted { get; set; }
67-
68-
[Utilities.PublicAPI( "The bonus credit value, as awarded when selling organic data" )]
69-
public decimal bonus { get; set; }
65+
public long? bonusOverride { get; set; } = null;
7066

7167
/// <summary>
7268
/// Populate the organic from variant data. Most preferred.
@@ -106,16 +102,6 @@ private string ConsolidatedName ( string variantName, string speciesName, string
106102
.Where( n => n != null ) );
107103
}
108104

109-
public void SetPredictedMinimumValue ( long? minimum )
110-
{
111-
genusPredictedMinimumValue = minimum;
112-
}
113-
114-
public void SetPredictedMaximumValue ( long? maximum )
115-
{
116-
genusPredictedMaximumValue = maximum;
117-
}
118-
119105
/// <summary> Get all the biological data, this should be done at the first sample </summary>
120106
[Utilities.PublicAPI]
121107
public static Organic Lookup ( long entryid, string variant )

0 commit comments

Comments
 (0)