Update questassort code to include assort unlocks by starting a quest

This commit is contained in:
Chomp 2023-01-28 13:42:56 +00:00
parent 34fe602c9c
commit 89f1b6e998
2 changed files with 76 additions and 63 deletions

View File

@ -63,7 +63,7 @@ namespace AssortGenerator.Common.Helpers
QuestRewardId = reward.id,
TraderId = reward.traderId,
TraderType = TraderHelper.GetTraderTypeById(reward.traderId),
Criteria = "Success"
Criteria = "Started"
}
);
}

View File

@ -207,24 +207,23 @@ namespace AssortGenerator
// Find assort unlocks
List<AssortUnlocks> assortUnlocks = QuestHelper.GetAssortUnlocks();
var assortItemsThatMatchBlackList = new List<string>(); // store items already matched here
// TODO: find out how the fuck the assort unlock is associated to the quest
foreach (var assortUnlock in assortUnlocks.Where(x => x.TraderType == trader))
{
if (assortUnlock.AssortUnlockId == "5ac653ed86f77405d4729344")
if (assortUnlock.ItemUnlockedTemplateId == "62a0a043cf4a99369e2624a5")
{
var x = 2;
}
// Get unlock items name
var assortItemName = ItemTemplateHelper.Items
.FirstOrDefault(x=> x.Key == assortUnlock.ItemUnlockedTemplateId).Value._name;
.FirstOrDefault(x => x.Key == assortUnlock.ItemUnlockedTemplateId).Value._name;
// TODO: handle started
// TODO: handle fail
// Handle quest success for now
if (assortUnlock.Criteria.ToLower() == "success")
{
//if (assortUnlock.Criteria.ToLower() == "success")
//{
//Find assorts that match the quest unlocks item template
List<Item> assortItemsThatMatch = assortRoot.items
.Where(x => x._tpl == assortUnlock.ItemUnlockedTemplateId && x.slotId == "hideout")
@ -288,18 +287,32 @@ namespace AssortGenerator
}
LoggingHelpers.LogSuccess($"{trader} item templateId: {assortUnlock.ItemUnlockedTemplateId} ({assortItemName}). questId: {assortUnlock.QuestId}. ADDING TO QUEST-ASSORT");
if (assortUnlock.Criteria == "Success")
{
result.success.Add(assortIdUnlockedByQuest, assortUnlock.QuestId);
}
if (assortUnlock.Criteria.ToLower() == "fail")
else if (assortUnlock.Criteria == "Started")
{
LoggingHelpers.LogError("Fail quest criteria not handled");
result.started.Add(assortIdUnlockedByQuest, assortUnlock.QuestId);
}
else
{
LoggingHelpers.LogError($"{assortUnlock.Criteria} quest criteria not handled");
}
if (assortUnlock.Criteria.ToLower() == "started")
{
LoggingHelpers.LogError("started quest criteria not handled");
}
//}
//if (assortUnlock.Criteria.ToLower() == "fail")
//{
// LoggingHelpers.LogError("Fail quest criteria not handled");
//}
//if (assortUnlock.Criteria.ToLower() == "started")
//{
// LoggingHelpers.LogError("started quest criteria not handled");
//}
}
return result;