Check for and add trader assort unlocks for starting quests, not just completed

This commit is contained in:
Chomp 2023-01-28 12:01:59 +00:00
parent 09ac84a66e
commit 34fe602c9c
3 changed files with 147474 additions and 146822 deletions

File diff suppressed because it is too large Load Diff

View File

@ -30,11 +30,6 @@ namespace AssortGenerator.Common.Helpers
_assortUnlocks = new List<AssortUnlocks>();
foreach (var quest in GetQuestData().data)
{
if (quest._id == "5b478b1886f7744d1b23c57d")
{
var x = 1;
}
foreach (var reward in quest.rewards.Success)
{
if (string.Equals(reward.type, "assortmentunlock", System.StringComparison.OrdinalIgnoreCase))
@ -54,6 +49,25 @@ namespace AssortGenerator.Common.Helpers
);
}
}
foreach (var reward in quest.rewards.Started)
{
if (string.Equals(reward.type, "assortmentunlock", System.StringComparison.OrdinalIgnoreCase))
{
_assortUnlocks.Add(new AssortUnlocks
{
AssortUnlockId = reward.id,
ItemUnlockedId = reward.target,
ItemUnlockedTemplateId = reward.items[0]._tpl,
LoyaltyLevel = (int)reward.loyaltyLevel,
QuestId = quest._id,
QuestRewardId = reward.id,
TraderId = reward.traderId,
TraderType = TraderHelper.GetTraderTypeById(reward.traderId),
Criteria = "Success"
}
);
}
}
}
}

View File

@ -26,13 +26,17 @@ namespace AssortGenerator
{
// Get relevant trader dump
var assortDumpPath = traderAssortFilePaths.Find(x => x.Contains($"getTraderAssort.{trader.Value}"));
if (assortDumpPath == null)
{
assortDumpPath = traderAssortFilePaths.Find(x => x.Contains($"{trader.Value}") && x.Contains("getTraderAssort"));
}
// Convert input dump json into object
var json = File.ReadAllText(assortDumpPath);
var jsonObject = JsonDocument.Parse(json);
// Find root data node
var data = jsonObject.RootElement.GetProperty("data");
var data = jsonObject.RootElement;
// Find assort items node and parse into list
string itemsJson = data.GetProperty("items").ToString();