Format Style Fixes
This commit is contained in:
@@ -30,12 +30,11 @@ public class HideoutCraftQuestIdGenerator(
|
||||
"67093210d514d26f8408612b", // Old event quest production "TG-Vi-24 true vaccine"
|
||||
];
|
||||
|
||||
private static readonly Dictionary<MongoId, MongoId> _forcedQuestToProductionAssociations =
|
||||
new()
|
||||
{
|
||||
// KEY = PRODUCTION, VALUE = QUEST
|
||||
{ new MongoId("63a571802116d261d2336cd1"), new MongoId("625d6ffaf7308432be1d44c5") }, // Network Provider - Part 2)
|
||||
};
|
||||
private static readonly Dictionary<MongoId, MongoId> _forcedQuestToProductionAssociations = new()
|
||||
{
|
||||
// KEY = PRODUCTION, VALUE = QUEST
|
||||
{ new MongoId("63a571802116d261d2336cd1"), new MongoId("625d6ffaf7308432be1d44c5") }, // Network Provider - Part 2)
|
||||
};
|
||||
|
||||
private readonly Dictionary<MongoId, MongoId> _questProductionMap = new();
|
||||
private readonly List<QuestProductionOutput> _questProductionOutputList = [];
|
||||
@@ -50,14 +49,10 @@ public class HideoutCraftQuestIdGenerator(
|
||||
|
||||
// Figure out our source and target directories
|
||||
var projectDir = Directory.GetParent("./").Parent.Parent.Parent.Parent.Parent;
|
||||
const string productionPath =
|
||||
"Libraries\\SPTarkov.Server.Assets\\SPT_Data\\database\\hideout\\production.json";
|
||||
const string productionPath = "Libraries\\SPTarkov.Server.Assets\\SPT_Data\\database\\hideout\\production.json";
|
||||
var productionFilePath = Path.Combine(projectDir.FullName, productionPath);
|
||||
|
||||
var updatedProductionJson = _jsonUtil.Serialize(
|
||||
_databaseServer.GetTables().Hideout.Production,
|
||||
true
|
||||
);
|
||||
var updatedProductionJson = _jsonUtil.Serialize(_databaseServer.GetTables().Hideout.Production, true);
|
||||
await _fileUtil.WriteFileAsync(productionFilePath, updatedProductionJson);
|
||||
}
|
||||
|
||||
@@ -66,9 +61,7 @@ public class HideoutCraftQuestIdGenerator(
|
||||
{
|
||||
foreach (var (questId, quest) in _databaseServer.GetTables().Templates.Quests)
|
||||
{
|
||||
var combinedRewards = CombineRewards(quest.Rewards)
|
||||
.Where(x => x.Type == RewardType.ProductionScheme)
|
||||
.ToList();
|
||||
var combinedRewards = CombineRewards(quest.Rewards).Where(x => x.Type == RewardType.ProductionScheme).ToList();
|
||||
foreach (var reward in combinedRewards)
|
||||
{
|
||||
// Assume all productions only output a single item template
|
||||
@@ -85,10 +78,7 @@ public class HideoutCraftQuestIdGenerator(
|
||||
{
|
||||
if (item.Template != output.ItemTemplate)
|
||||
{
|
||||
_logger.Error(
|
||||
$"Production scheme has multiple output items. "
|
||||
+ $"{output.ItemTemplate} != {item.Template}"
|
||||
);
|
||||
_logger.Error($"Production scheme has multiple output items. " + $"{output.ItemTemplate} != {item.Template}");
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -114,9 +104,7 @@ public class HideoutCraftQuestIdGenerator(
|
||||
}
|
||||
|
||||
// Look for a 'quest completion' requirement
|
||||
var questCompleteRequirements = production
|
||||
.Requirements.Where(req => req.Type == "QuestComplete")
|
||||
.ToList();
|
||||
var questCompleteRequirements = production.Requirements.Where(req => req.Type == "QuestComplete").ToList();
|
||||
if (questCompleteRequirements.Count == 0)
|
||||
{
|
||||
// Production has no quest requirement
|
||||
@@ -125,21 +113,14 @@ public class HideoutCraftQuestIdGenerator(
|
||||
|
||||
if (questCompleteRequirements.Count > 1)
|
||||
{
|
||||
_logger.Error(
|
||||
$"Error, prodId: {production.Id} contains multiple QuestComplete requirements"
|
||||
);
|
||||
_logger.Error($"Error, prodId: {production.Id} contains multiple QuestComplete requirements");
|
||||
|
||||
// Production has no multiple quest requirements
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check for forced ids
|
||||
if (
|
||||
_forcedQuestToProductionAssociations.TryGetValue(
|
||||
production.Id,
|
||||
out var associatedQuestIdToComplete
|
||||
)
|
||||
)
|
||||
if (_forcedQuestToProductionAssociations.TryGetValue(production.Id, out var associatedQuestIdToComplete))
|
||||
{
|
||||
var enLocale = _databaseServer.GetTables().Locales.Global["en"].Value;
|
||||
var questName = enLocale[$"{associatedQuestIdToComplete} name"];
|
||||
@@ -154,20 +135,11 @@ public class HideoutCraftQuestIdGenerator(
|
||||
|
||||
// Try to find the quest that matches this production
|
||||
var questProductionOutputs = _questProductionOutputList
|
||||
.Where(output =>
|
||||
output.ItemTemplate == production.EndProduct
|
||||
&& output.Quantity == production.Count
|
||||
)
|
||||
.Where(output => output.ItemTemplate == production.EndProduct && output.Quantity == production.Count)
|
||||
.ToList();
|
||||
|
||||
// Make sure we found valid data
|
||||
if (
|
||||
!IsValidQuestProduction(
|
||||
production,
|
||||
questProductionOutputs,
|
||||
questCompleteRequirements[0]
|
||||
)
|
||||
)
|
||||
if (!IsValidQuestProduction(production, questProductionOutputs, questCompleteRequirements[0]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -205,10 +177,7 @@ public class HideoutCraftQuestIdGenerator(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
questComplete.QuestId is not null
|
||||
&& questComplete.QuestId != questProductionOutputs[0].QuestId
|
||||
)
|
||||
if (questComplete.QuestId is not null && questComplete.QuestId != questProductionOutputs[0].QuestId)
|
||||
{
|
||||
_logger.Error(
|
||||
$"Error: Multiple productions match quest. EndProduct: {production.EndProduct} with quantity {production.Count}, existing quest: {questComplete.QuestId} {questProductionOutputs[0].QuestName}"
|
||||
|
||||
@@ -18,9 +18,7 @@ public class HideoutCraftQuestIdGeneratorLauncher
|
||||
serviceCollection.AddSingleton(WebApplication.CreateBuilder());
|
||||
serviceCollection.AddSingleton<IReadOnlyList<SptMod>>([]);
|
||||
var diHandler = new DependencyInjectionHandler(serviceCollection);
|
||||
diHandler.AddInjectableTypesFromTypeAssembly(
|
||||
typeof(HideoutCraftQuestIdGeneratorLauncher)
|
||||
);
|
||||
diHandler.AddInjectableTypesFromTypeAssembly(typeof(HideoutCraftQuestIdGeneratorLauncher));
|
||||
diHandler.AddInjectableTypesFromTypeAssembly(typeof(App));
|
||||
diHandler.InjectAll();
|
||||
var serviceProvider = serviceCollection.BuildServiceProvider();
|
||||
|
||||
@@ -15,12 +15,7 @@ public class SptBasicLogger<T> : ISptLogger<T>
|
||||
categoryName = typeof(T).Name;
|
||||
}
|
||||
|
||||
public void LogWithColor(
|
||||
string data,
|
||||
LogTextColor? textColor = null,
|
||||
LogBackgroundColor? backgroundColor = null,
|
||||
Exception? ex = null
|
||||
)
|
||||
public void LogWithColor(string data, LogTextColor? textColor = null, LogBackgroundColor? backgroundColor = null, Exception? ex = null)
|
||||
{
|
||||
Console.WriteLine($"{categoryName}: {data}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user