add new objectives if entries does not match existing ones
This commit is contained in:
parent
6dda7cfde4
commit
068a2102b9
@ -34,6 +34,7 @@ namespace EliteBGS.BGS {
|
||||
e.Is(Events.MissionAccepted) ||
|
||||
e.Is(Events.Docked) ||
|
||||
e.Is(Events.FSDJump) ||
|
||||
e.Is(Events.Location) ||
|
||||
e.Is(Events.MultiSellExplorationData) ||
|
||||
e.Is(Events.SellMicroResources) ||
|
||||
e.Is(Events.RedeemVoucher) ||
|
||||
@ -73,6 +74,18 @@ namespace EliteBGS.BGS {
|
||||
*/
|
||||
current_system = (e as FSDJumpEntry).StarSystem;
|
||||
controlling_faction = (e as FSDJumpEntry).SystemFaction;
|
||||
} else if (e.Is(Events.Location)) {
|
||||
/* Get current system, faction name and station from Location message
|
||||
*/
|
||||
LocationEntry location = e as LocationEntry;
|
||||
|
||||
current_system = location.StarSystem;
|
||||
if (!string.IsNullOrEmpty(location.SystemFaction)) {
|
||||
controlling_faction = location.SystemFaction;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(location.StationName)) {
|
||||
current_station = location.StationName;
|
||||
}
|
||||
} else if (e.Is(Events.MissionCompleted)) {
|
||||
var completed = e as MissionCompletedEntry;
|
||||
entry = new MissionCompleted(completed) { System = current_system, Station = current_station };
|
||||
@ -145,20 +158,24 @@ namespace EliteBGS.BGS {
|
||||
.Where(x => x.Matches(entry) > 0)
|
||||
.OrderBy(x => x.Matches(entry))
|
||||
;
|
||||
if (matches == null || matches.Count() <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Then select the one that matches the most.
|
||||
*/
|
||||
var objective = matches
|
||||
.OrderBy(x => x.Matches(entry))
|
||||
.Reverse()
|
||||
.First()
|
||||
;
|
||||
|
||||
if (objective == null) {
|
||||
continue;
|
||||
Objective objective = null;
|
||||
if (matches != null && matches.Count() > 0) {
|
||||
/* Then select the one that matches the most.
|
||||
*/
|
||||
objective = matches
|
||||
.OrderBy(x => x.Matches(entry))
|
||||
.Reverse()
|
||||
.First()
|
||||
;
|
||||
} else {
|
||||
/* create a new objective if we don't have one */
|
||||
objective = new Objective() {
|
||||
Station = entry.Station,
|
||||
Faction = entry.Faction,
|
||||
System = entry.System,
|
||||
};
|
||||
objectives.Add(objective);
|
||||
}
|
||||
|
||||
LogEntry existing = null;
|
||||
|
Loading…
Reference in New Issue
Block a user