Skip to content

Commit cf8abec

Browse files
committed
Merge branch 'develop'
2 parents cd55ba7 + 8176f7d commit cf8abec

16 files changed

+279
-232
lines changed

Diff for: DataDefinitions/Body.cs

+3
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ public class Body
117117
// materials
118118
public List<MaterialPresence> materials;
119119

120+
// The reserve level
121+
public string reserves;
122+
120123
/// <summary>
121124
/// Convert gravity in m/s to g
122125
/// </summary>

Diff for: DataDefinitions/CommodityDefinitions.cs

+183-178
Large diffs are not rendered by default.

Diff for: EDDI/ChangeLog.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# CHANGE LOG
22

3+
### 2.4.0-b4
4+
* Core
5+
* Revised EDDI's methods for detecting in-game betas
6+
* Events
7+
* Fixed a bug that would cause the 'Ship transfer initiated' event to be silent
8+
* 'Community goal' event - refined the default script, it'll (probably) be coherent now :-)
9+
* Speech Responder
10+
* 'Community goal' event - fixed a bug that was causing EDDI to describe every goal twice
11+
* 'Ship transfer initiated' event - revised to include both the transfer cost and the time to arrival
12+
* Script changes
13+
* If you scan without a DSS, the 'Body Report' script no longer falsely claims that all bodies are unsuitable for landing
14+
* 'Module swapped event' - revised script to better handle swapping to an empty slot
15+
316
### 2.4.0-b3
417
* Core
518
* EDDI's version number is now shown in the application's title bar
@@ -62,7 +75,7 @@
6275
* Update 'Jumped' and 'Location' events to include system population, when present
6376
* Update 'Screenshot' event, now contains longitude & latitude, when appropriate
6477
* Update 'Ship sold' event, now contains a value for the system where the ship was sold
65-
* Update 'Shipyard transfer' event, now includes transfer time
78+
* Update 'Ship transfer initiated' event, now includes transfer time
6679
* Update 'Star scanned' event to add luminosity class property
6780
* Speech Responder
6881
* Add Spacialise() Cottle function. Details on how to use this are in the SpeechResponder documentation

Diff for: EDDI/EDDI.cs

+25-9
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,12 @@ private bool eventLocation(LocationEvent theEvent)
846846
CurrentStarSystem.z = theEvent.z;
847847
setSystemDistanceFromHome(CurrentStarSystem);
848848

849+
// Update the system population from the journal
850+
if (theEvent.population != null)
851+
{
852+
CurrentStarSystem.population = theEvent.population;
853+
}
854+
849855
if (theEvent.docked == true)
850856
{
851857
// In this case body === station
@@ -1028,15 +1034,20 @@ private bool eventFSDEngaged(FSDEngagedEvent @event)
10281034

10291035
private bool eventFileHeader(FileHeaderEvent @event)
10301036
{
1031-
// If we don't recognise the build number then assume we're in beta
1032-
if (ProductionBuilds.Contains(@event.build))
1033-
{
1034-
inBeta = false;
1035-
}
1036-
else
1037-
{
1038-
inBeta = true;
1039-
}
1037+
// Test whether we're in beta by checking the filename, version described by the header,
1038+
// and certain version / build combinations
1039+
inBeta =
1040+
(
1041+
@event.filename.Contains("Beta") ||
1042+
@event.version.Contains("Beta") ||
1043+
(
1044+
@event.version.Contains("2.2") &&
1045+
(
1046+
@event.build.Contains("r121645/r0") ||
1047+
@event.build.Contains("r129516/r0")
1048+
)
1049+
)
1050+
);
10401051
Logging.Info(inBeta ? "On beta" : "On live");
10411052
EliteConfiguration config = EliteConfiguration.FromFile();
10421053
config.Beta = inBeta;
@@ -1065,6 +1076,10 @@ private bool eventJumped(JumpedEvent theEvent)
10651076
CurrentStarSystem.government = theEvent.government;
10661077
CurrentStarSystem.security = theEvent.security;
10671078
CurrentStarSystem.updatedat = (long)theEvent.timestamp.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
1079+
if (theEvent.population != null)
1080+
{
1081+
CurrentStarSystem.population = theEvent.population;
1082+
}
10681083

10691084
CurrentStarSystem.visits++;
10701085
// We don't update lastvisit because we do that when we leave
@@ -1335,6 +1350,7 @@ private bool eventBodyScanned(BodyScannedEvent theEvent)
13351350
{
13361351
body.materials.Add(new MaterialPresence(presence.definition, presence.percentage));
13371352
}
1353+
body.reserves = theEvent.reserves;
13381354
body.rings = theEvent.rings;
13391355

13401356
Logging.Debug("Saving data for scanned body " + theEvent.name);

Diff for: Events/FileHeaderEvent.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class FileHeaderEvent : Event
1212
{
1313
public const string NAME = "File Header";
1414
public const string DESCRIPTION = "Triggered when the file header is read";
15-
public const string SAMPLE = @"{""timestamp"":""2016-06-10T14:31:00Z"", ""event"":""FileHeader"", ""part"":1, ""gameversion"":""2.2"", ""build"":""r131487/r0 "" }";
15+
public const string SAMPLE = @"{""timestamp"":""2017-09-04T00:20:48Z"", ""event"":""Fileheader"", ""part"":1, ""language"":""English\\UK"", ""gameversion"":""2.4 (Beta 4)"", ""build"":""r153766/r0 "" }";
1616
public static Dictionary<string, string> VARIABLES = new Dictionary<string, string>();
1717

1818
static FileHeaderEvent()
@@ -27,8 +27,11 @@ static FileHeaderEvent()
2727
[JsonProperty("build")]
2828
public string build { get; private set; }
2929

30-
public FileHeaderEvent(DateTime timestamp, string version, string build) : base(timestamp, NAME)
30+
public string filename { get; private set; }
31+
32+
public FileHeaderEvent(DateTime timestamp, string filename, string version, string build) : base(timestamp, NAME)
3133
{
34+
this.filename = filename;
3235
this.version = version;
3336
this.build = build;
3437
}

Diff for: Installer.iss

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "EDDI"
5-
#define MyAppVersion "2.4.0-b3"
5+
#define MyAppVersion "2.4.0-b4"
66
#define MyAppPublisher "Elite Dangerous Community Developers (EDCD)"
77
#define MyAppURL "https://github.com/EDCD/EDDI/"
88
#define MyAppExeName "EDDI.exe"

Diff for: JournalMonitor/JournalMonitor.cs

+18-16
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ public class JournalMonitor : LogMonitor, EDDIMonitor
1919
{
2020
private static Regex JsonRegex = new Regex(@"^{.*}$");
2121

22-
public JournalMonitor() : base(GetSavedGamesDir(), @"^Journal.*\.[0-9\.]+\.log$", result => ForwardJournalEntry(result, EDDI.Instance.eventHandler)) { }
22+
public JournalMonitor() : base(GetSavedGamesDir(), @"^Journal.*\.[0-9\.]+\.log$", result =>
23+
ForwardJournalEntry(result, EDDI.Instance.eventHandler)) { }
2324

2425
public static void ForwardJournalEntry(string line, Action<Event> callback)
2526
{
@@ -742,10 +743,8 @@ public static List<Event> ParseJournalEntry(string line)
742743

743744
string system = getString(data, "System");
744745
decimal distance = getDecimal(data, "Distance");
745-
data.TryGetValue("TransferPrice", out val);
746-
long price = (long)val;
747-
data.TryGetValue("TransferTime", out val);
748-
long time = (long)val;
746+
long? price = getOptionalLong(data, "TransferPrice");
747+
long? time = getOptionalLong(data, "TransferTime");
749748

750749
events.Add(new ShipTransferInitiatedEvent(timestamp, ship, shipId, system, distance, price, time) { raw = line });
751750
}
@@ -898,7 +897,7 @@ public static List<Event> ParseJournalEntry(string line)
898897
data.TryGetValue("ServerId", out val);
899898
long serverId = (long)val;
900899

901-
events.Add(new ModuleSoldRemoteEvent(timestamp, ship, shipId, storageSlot, serverId, module, price) { raw = line });
900+
events.Add(new ModuleSoldFromStorage(timestamp, ship, shipId, storageSlot, serverId, module, price) { raw = line });
902901
}
903902
handled = true;
904903
break;
@@ -1907,9 +1906,9 @@ public static List<Event> ParseJournalEntry(string line)
19071906
goaldata.TryGetValue("TierReached", out val);
19081907
tier.Add((string)val);
19091908
tierreward.Add(getOptionalLong(goaldata, "Bonus"));
1910-
1911-
events.Add(new CommunityGoalEvent(timestamp, cgid, name, system, station, expiry, iscomplete, total, contribution, contributors, percentileband, topranksize, toprank, tier, tierreward) { raw = line });
19121909
}
1910+
1911+
events.Add(new CommunityGoalEvent(timestamp, cgid, name, system, station, expiry, iscomplete, total, contribution, contributors, percentileband, topranksize, toprank, tier, tierreward) { raw = line });
19131912
handled = true;
19141913
break;
19151914
}
@@ -2377,9 +2376,11 @@ public static List<Event> ParseJournalEntry(string line)
23772376
}
23782377
case "Fileheader":
23792378
{
2379+
string filename = journalFileName;
23802380
string version = getString(data, "gameversion");
23812381
string build = getString(data, "build").Replace(" ", "");
2382-
events.Add(new FileHeaderEvent(timestamp, version, build) { raw = line });
2382+
2383+
events.Add(new FileHeaderEvent(timestamp, filename, version, build) { raw = line });
23832384
handled = true;
23842385
break;
23852386
}
@@ -2738,13 +2739,14 @@ private static bool getBool(string key, object val)
27382739
private static bool? getOptionalBool(IDictionary<string, object> data, string key)
27392740
{
27402741
object val;
2741-
data.TryGetValue(key, out val);
2742-
return getOptionalBool(key, val);
2743-
}
2744-
2745-
private static bool? getOptionalBool(string key, object val)
2746-
{
2747-
return (bool?)val;
2742+
if (data.TryGetValue(key, out val))
2743+
{
2744+
return val as bool?;
2745+
}
2746+
else
2747+
{
2748+
return null;
2749+
}
27482750
}
27492751

27502752
private static string getString(IDictionary<string, object> data, string key)

Diff for: JournalMonitor/LogMonitor.cs

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class LogMonitor
1616
public string Directory;
1717
public Regex Filter;
1818
public Action<string> Callback;
19+
public static string journalFileName = null;
1920

2021
// Keep track of status
2122
private bool running;
@@ -56,6 +57,7 @@ public void start()
5657
{
5758
lastSize = fileInfo.Length;
5859
lastName = fileInfo.Name;
60+
journalFileName = lastName;
5961

6062
// Elite-specific: start off by grabbing the first line so that we know if we're in beta or live
6163
using (FileStream fs = new FileStream(fileInfo.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
@@ -79,9 +81,11 @@ public void start()
7981
{
8082
lastName = fileInfo == null ? null : fileInfo.Name;
8183
lastSize = 0;
84+
journalFileName = fileInfo.Name;
8285
}
8386
else
8487
{
88+
journalFileName = fileInfo.Name;
8589
long thisSize = fileInfo.Length;
8690
long seekPos = 0;
8791
int readLen = 0;

Diff for: ShipMonitor/EddiShipMonitor.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<Reference Include="WindowsBase" />
6767
</ItemGroup>
6868
<ItemGroup>
69-
<Compile Include="ModuleSoldRemoteEvent.cs" />
69+
<Compile Include="ModuleSoldFromStorageEvent.cs" />
7070
<Compile Include="ModulesStored.cs" />
7171
<Compile Include="ModulePurchasedEvent.cs" />
7272
<Compile Include="ModuleRetrievedEvent.cs" />

Diff for: ShipMonitor/ModuleSoldRemoteEvent.cs renamed to ShipMonitor/ModuleSoldFromStorageEvent.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
namespace EddiShipMonitor
1111
{
12-
public class ModuleSoldRemoteEvent : Event
12+
public class ModuleSoldFromStorage : Event
1313
{
14-
public const string NAME = "Module sold remote";
15-
public const string DESCRIPTION = "Triggered when selling a module in storage at another station";
14+
public const string NAME = "Module sold from storage";
15+
public const string DESCRIPTION = "Triggered when selling a module from storage";
1616
public const string SAMPLE = "{ \"timestamp\":\"2017-09-20T02:28:37Z\", \"event\":\"ModuleSellRemote\", \"StorageSlot\":10, \"SellItem\":\"$int_fueltank_size4_class3_name;\", \"SellItem_Localised\":\"Fuel Tank\", \"ServerId\":128064349, \"SellPrice\":24116, \"Ship\":\"diamondbackxl\", \"ShipID\":38 }";
1717
public static Dictionary<string, string> VARIABLES = new Dictionary<string, string>();
1818

19-
static ModuleSoldRemoteEvent()
19+
static ModuleSoldFromStorage()
2020
{
2121
VARIABLES.Add("ship", "The ship from which the module was sold");
2222
VARIABLES.Add("shipid", "The ID of the ship from which the module was sold");
@@ -33,7 +33,7 @@ static ModuleSoldRemoteEvent()
3333
public Module module { get; private set; }
3434
public long price { get; private set; }
3535

36-
public ModuleSoldRemoteEvent(DateTime timestamp, string ship, int? shipid, int storageslot, long serverid, Module module, long price) : base(timestamp, NAME)
36+
public ModuleSoldFromStorage(DateTime timestamp, string ship, int? shipid, int storageslot, long serverid, Module module, long price) : base(timestamp, NAME)
3737
{
3838
this.ship = ship;
3939
this.shipid = shipid;

Diff for: ShipMonitor/ShipMonitor.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ public void PreHandle(Event @event)
169169
{
170170
handleModuleSoldEvent((ModuleSoldEvent)@event);
171171
}
172-
else if (@event is ModuleSoldRemoteEvent)
172+
else if (@event is ModuleSoldFromStorage)
173173
{
174-
handleModuleSoldRemoteEvent((ModuleSoldRemoteEvent)@event);
174+
handleModuleSoldFromStorageEvent((ModuleSoldFromStorage)@event);
175175
}
176176
else if (@event is ModuleStoredEvent)
177177
{
@@ -545,7 +545,7 @@ private void handleModuleSoldEvent(ModuleSoldEvent @event)
545545
RemoveModule((int)@event.shipid, @event.slot);
546546
}
547547

548-
private void handleModuleSoldRemoteEvent(ModuleSoldRemoteEvent @event)
548+
private void handleModuleSoldFromStorageEvent(ModuleSoldFromStorage @event)
549549
{
550550
// We don't do anything here as the ship object is unaffected
551551
}

Diff for: ShipMonitor/ShipTransferInitiatedEvent.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class ShipTransferInitiatedEvent : Event
1414
public const string NAME = "Ship transfer initiated";
1515
public const string DESCRIPTION = "Triggered when you initiate a ship transfer";
1616
public const string SAMPLE = "{\"timestamp\":\"2016-06-10T14:32:03Z\",\"event\":\"ShipyardTransfer\",\"ShipType\":\"Adder\",\"ShipID\":1,\"System\":\"Eranin\",\"Distance\":85.639145,\"TransferPrice\":580,\"TransferTime\":600}";
17+
//public const string SAMPLE = "{ \"timestamp\":\"2017-09-24T12:31:38Z\", \"event\":\"ShipyardTransfer\", \"ShipType\":\"Asp\", \"ShipID\":2, \"System\":\"CD-34 9020\", \"Distance\":145.314835, \"TransferPrice\":127713 }";
1718
public static Dictionary<string, string> VARIABLES = new Dictionary<string, string>();
1819

1920
static ShipTransferInitiatedEvent()
@@ -39,12 +40,12 @@ static ShipTransferInitiatedEvent()
3940
public decimal distance { get; private set; }
4041

4142
[JsonProperty("price")]
42-
public long price { get; private set; }
43+
public long? price { get; private set; }
4344

4445
[JsonProperty("time")]
45-
public long time { get; private set; }
46+
public long? time { get; private set; }
4647

47-
public ShipTransferInitiatedEvent(DateTime timestamp, string ship, int? shipid, string system, decimal distance, long price, long time) : base(timestamp, NAME)
48+
public ShipTransferInitiatedEvent(DateTime timestamp, string ship, int? shipid, string system, decimal distance, long? price, long? time) : base(timestamp, NAME)
4849
{
4950
this.ship = ship;
5051
this.shipid = shipid;

0 commit comments

Comments
 (0)