correct black market trade by properly setting StationOwner
This commit is contained in:
@@ -51,6 +51,12 @@ internal class LocationParser : TransactionParserPart {
|
||||
context.CurrentStation = entry.StationName;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(entry.StationFaction)) {
|
||||
context.StationOwner = entry.StationFaction;
|
||||
} else {
|
||||
context.StationOwner = null;
|
||||
}
|
||||
|
||||
if (!context.SystemFactions.ContainsKey(entry.StarSystem) &&
|
||||
entry.SystemFactions != null && entry.SystemFactions.Count > 0) {
|
||||
context.SystemFactions[entry.StarSystem] = entry.SystemFactions;
|
||||
@@ -108,7 +114,7 @@ internal class DockedParser : TransactionParserPart {
|
||||
context.SystemsByID.TryAdd(entry.SystemAddress.Value, entry.StarSystem);
|
||||
|
||||
if (!string.IsNullOrEmpty(entry.StationFaction)) {
|
||||
context.ControllingFaction = entry.StationFaction;
|
||||
context.StationOwner = entry.StationFaction;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(entry.StationName)) {
|
||||
@@ -274,8 +280,8 @@ internal class MissionCompletedParser : TransactionParserPart {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
Mission? mission = null;
|
||||
Location? accepted_location = null;
|
||||
Mission? mission;
|
||||
Location? accepted_location;
|
||||
string? target_faction_name = entry.Mission.TargetFaction;
|
||||
string? source_faction_name = entry.Mission.Faction;
|
||||
|
||||
@@ -384,9 +390,9 @@ internal class MissionCompletedParser : TransactionParserPart {
|
||||
|
||||
internal class MissionFailedParser : TransactionParserPart {
|
||||
public void Parse(Entry e, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) {
|
||||
Mission? mission = null;
|
||||
Location? accepted_location = null;
|
||||
string? accepted_system = null;
|
||||
Mission? mission;
|
||||
Location? accepted_location;
|
||||
string? accepted_system;
|
||||
|
||||
MissionFailedEntry? entry = e as MissionFailedEntry;
|
||||
if (entry == null) {
|
||||
@@ -444,10 +450,18 @@ internal class SellExplorationDataParser : TransactionParserPart {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
if (context.StationOwner == null) {
|
||||
transactions.AddIncomplete(
|
||||
new Cartographics(),
|
||||
"Could not discern the station owner for cartographics sell.",
|
||||
e);
|
||||
return;
|
||||
}
|
||||
|
||||
transactions.Add(new Cartographics(entry) {
|
||||
System = context.CurrentSystem,
|
||||
Station = context.CurrentStation,
|
||||
Faction = context.ControllingFaction,
|
||||
Faction = context.StationOwner,
|
||||
IsLegacy = context.IsLegacy,
|
||||
});
|
||||
}
|
||||
@@ -465,10 +479,18 @@ internal class SellOrganicDataParser : TransactionParserPart {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
if (context.StationOwner == null) {
|
||||
transactions.AddIncomplete(
|
||||
new OrganicData(),
|
||||
"Could not discern the station owner for organic data sell.",
|
||||
e);
|
||||
return;
|
||||
}
|
||||
|
||||
transactions.Add(new OrganicData(entry) {
|
||||
System = context.CurrentSystem,
|
||||
Station = context.CurrentStation,
|
||||
Faction = context.ControllingFaction,
|
||||
Faction = context.StationOwner,
|
||||
IsLegacy = context.IsLegacy,
|
||||
});
|
||||
}
|
||||
@@ -481,10 +503,18 @@ internal class MultiSellExplorationDataParser : TransactionParserPart {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
if (context.StationOwner == null) {
|
||||
transactions.AddIncomplete(
|
||||
new Cartographics(),
|
||||
"Could not discern the station owner for cartographics sell.",
|
||||
e);
|
||||
return;
|
||||
}
|
||||
|
||||
transactions.Add(new Cartographics(entry) {
|
||||
System = context.CurrentSystem,
|
||||
Station = context.CurrentStation,
|
||||
Faction = context.ControllingFaction,
|
||||
Faction = context.StationOwner,
|
||||
IsLegacy = context.IsLegacy,
|
||||
});
|
||||
}
|
||||
@@ -554,10 +584,18 @@ internal class SellMicroResourcesParser : TransactionParserPart {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
if (context.StationOwner == null) {
|
||||
transactions.AddIncomplete(
|
||||
new SellMicroResources(),
|
||||
"Could not discern the station owner for micro resources sell.",
|
||||
e);
|
||||
return;
|
||||
}
|
||||
|
||||
transactions.Add(new SellMicroResources(entry) {
|
||||
System = context.CurrentSystem,
|
||||
Station = context.CurrentStation,
|
||||
Faction = context.ControllingFaction,
|
||||
Faction = context.StationOwner,
|
||||
IsLegacy = context.IsLegacy,
|
||||
});
|
||||
}
|
||||
@@ -570,10 +608,18 @@ internal class SearchAndRescueParser : TransactionParserPart {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
if (context.StationOwner == null) {
|
||||
transactions.AddIncomplete(
|
||||
new OrganicData(),
|
||||
"Could not discern the station owner for S&R operations.",
|
||||
e);
|
||||
return;
|
||||
}
|
||||
|
||||
transactions.Add(new SearchAndRescue(entry) {
|
||||
Faction = context.ControllingFaction,
|
||||
Station = context.CurrentStation,
|
||||
System = context.CurrentSystem,
|
||||
Station = context.CurrentStation,
|
||||
Faction = context.StationOwner,
|
||||
IsLegacy = context.IsLegacy,
|
||||
});
|
||||
}
|
||||
@@ -586,12 +632,20 @@ internal class MarketBuyParser : TransactionParserPart {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
if (context.StationOwner == null) {
|
||||
transactions.AddIncomplete(
|
||||
new OrganicData(),
|
||||
"Could not discern the station owner for market buy.",
|
||||
e);
|
||||
return;
|
||||
}
|
||||
|
||||
context.BoughtCargo(entry.Type, entry.BuyPrice);
|
||||
|
||||
transactions.Add(new BuyCargo(entry) {
|
||||
Faction = context.ControllingFaction,
|
||||
Station = context.CurrentStation,
|
||||
System = context.CurrentSystem,
|
||||
Station = context.CurrentStation,
|
||||
Faction = context.StationOwner,
|
||||
IsLegacy = context.IsLegacy,
|
||||
});
|
||||
}
|
||||
@@ -601,6 +655,14 @@ internal class MarketSellParser : TransactionParserPart {
|
||||
public void Parse(Entry e, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) {
|
||||
long profit = 0;
|
||||
|
||||
if (context.StationOwner == null) {
|
||||
transactions.AddIncomplete(
|
||||
new OrganicData(),
|
||||
"Could not discern the station owner market sell.",
|
||||
e);
|
||||
return;
|
||||
}
|
||||
|
||||
MarketSellEntry? entry = e as MarketSellEntry;
|
||||
if (entry == null) {
|
||||
throw new NotImplementedException();
|
||||
@@ -616,9 +678,9 @@ internal class MarketSellParser : TransactionParserPart {
|
||||
}
|
||||
|
||||
transactions.Add(new SellCargo(entry) {
|
||||
Faction = context.ControllingFaction,
|
||||
Station = context.CurrentStation,
|
||||
System = context.CurrentSystem,
|
||||
Station = context.CurrentStation,
|
||||
Faction = context.StationOwner,
|
||||
Profit = profit,
|
||||
IsLegacy = context.IsLegacy,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user