More work on questAssort generation
This commit is contained in:
parent
d7f32db3f1
commit
86e687e859
@ -40,7 +40,7 @@ class Program
|
|||||||
AssortMerger.ListDuplicatesInMergedAssorts(flatAssorts);
|
AssortMerger.ListDuplicatesInMergedAssorts(flatAssorts);
|
||||||
|
|
||||||
Assort unflattenedAssorts = AssortFlattener.UnFlatten(flatAssorts);
|
Assort unflattenedAssorts = AssortFlattener.UnFlatten(flatAssorts);
|
||||||
//JsonWriter.WriteJson(unflattenedAssorts, traderId, Directory.GetCurrentDirectory(), "assort");
|
JsonWriter.WriteJson(unflattenedAssorts, traderId, Directory.GetCurrentDirectory(), "assort");
|
||||||
|
|
||||||
var questAssorts = QuestHelper.CreateQuestAssortsList(trader.Key, traderQuestAssortUnlocks, flatAssorts);
|
var questAssorts = QuestHelper.CreateQuestAssortsList(trader.Key, traderQuestAssortUnlocks, flatAssorts);
|
||||||
LogQuestUnlocks(questAssorts, unflattenedAssorts);
|
LogQuestUnlocks(questAssorts, unflattenedAssorts);
|
||||||
|
@ -42,6 +42,15 @@ namespace AssortValidator.Common.Helpers
|
|||||||
new QuestAssortMapping { QuestType = QuestEnum.Bullshit, ItemTplId = "606587252535c57a13424cfd", Trader = Trader.Skier, Level = 3, IsMoneyBarter = true }} //mutant mk47
|
new QuestAssortMapping { QuestType = QuestEnum.Bullshit, ItemTplId = "606587252535c57a13424cfd", Trader = Trader.Skier, Level = 3, IsMoneyBarter = true }} //mutant mk47
|
||||||
|
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"5d25e4ca86f77409dd5cdf2c",
|
||||||
|
new List<QuestAssortMapping>
|
||||||
|
{ new QuestAssortMapping { QuestType= QuestEnum.HuntingTrip, ItemTplId= "5bfea6e90db834001b7347f3", Level = 3, IsMoneyBarter = true, Trader= Trader.Jaeger, SubItemCount = 4},
|
||||||
|
new QuestAssortMapping { QuestType= QuestEnum.HuntingTrip, ItemTplId= "5bfea6e90db834001b7347f3", Level = 3, IsMoneyBarter = true, Trader= Trader.Jaeger, SubItemCount = 5},
|
||||||
|
new QuestAssortMapping { QuestType= QuestEnum.HuntingTrip, ItemTplId= "5bfea6e90db834001b7347f3", Level = 4, IsMoneyBarter = true, Trader= Trader.Jaeger, SubItemCount = 10},
|
||||||
|
new QuestAssortMapping { QuestType= QuestEnum.HuntingTrip, ItemTplId= "5bfea6e90db834001b7347f3", Level = 4, IsMoneyBarter = true, Trader= Trader.Jaeger, SubItemCount = 13},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -60,6 +69,6 @@ namespace AssortValidator.Common.Helpers
|
|||||||
public int Level { get; set; }
|
public int Level { get; set; }
|
||||||
public CurrencyEnum? CurrencyTypeId { get; set; }
|
public CurrencyEnum? CurrencyTypeId { get; set; }
|
||||||
|
|
||||||
public int SubItemCount { get; set; }
|
public int? SubItemCount { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,6 @@ namespace AssortValidator.Common.Helpers
|
|||||||
|
|
||||||
if (associatedAssort is null || !associatedAssort.Any())
|
if (associatedAssort is null || !associatedAssort.Any())
|
||||||
{
|
{
|
||||||
//throw new System.Exception($"no assort found for quest {questAssortUnlock.QuestName}");
|
|
||||||
result.success.Add($"MISSING{count}", questAssortUnlock.QuestId);
|
result.success.Add($"MISSING{count}", questAssortUnlock.QuestId);
|
||||||
count++;
|
count++;
|
||||||
continue;
|
continue;
|
||||||
@ -348,14 +347,14 @@ namespace AssortValidator.Common.Helpers
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// multiple found, time to use hand-made data from QuestAssortMappingHelper
|
// multiple found, use hand-made data from QuestAssortMappingHelper
|
||||||
if (associatedAssort.Count() > 1)
|
if (associatedAssort.Count() > 1)
|
||||||
{
|
{
|
||||||
var matchingAssort = GetMatchingAssortUsingManualMapping(trader, associatedAssort, questAssortUnlock);
|
var matchingAssort = GetMatchingAssortUsingManualMapping(trader, associatedAssort, questAssortUnlock);
|
||||||
|
|
||||||
if (matchingAssort.Count == 1)
|
if (matchingAssort.Count == 1)
|
||||||
{
|
{
|
||||||
result.success.Add(associatedAssort.FirstOrDefault().AssortId, questAssortUnlock.QuestId);
|
result.success.Add(matchingAssort.Single().AssortId, questAssortUnlock.QuestId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,13 +374,31 @@ namespace AssortValidator.Common.Helpers
|
|||||||
private static List<FlatAssort> GetMatchingAssortUsingManualMapping(Trader trader, IEnumerable<FlatAssort> possibleAssorts, QuestAssortUnlock questToFindAssortFor)
|
private static List<FlatAssort> GetMatchingAssortUsingManualMapping(Trader trader, IEnumerable<FlatAssort> possibleAssorts, QuestAssortUnlock questToFindAssortFor)
|
||||||
{
|
{
|
||||||
var results = new List<FlatAssort>();
|
var results = new List<FlatAssort>();
|
||||||
|
|
||||||
List<QuestAssortMapping> manualAssortMappings = QuestAssortMappingHelper.GetQuestAssortMappingDetails(questToFindAssortFor.QuestId);
|
List<QuestAssortMapping> manualAssortMappings = QuestAssortMappingHelper.GetQuestAssortMappingDetails(questToFindAssortFor.QuestId);
|
||||||
var singleMapping = manualAssortMappings.Single(x => x.Trader == trader && x.ItemTplId == questToFindAssortFor.AssortTemplateId && x.Level == questToFindAssortFor.LoyaltyLevel);
|
var mappings = manualAssortMappings.Where(x => x.Trader == trader
|
||||||
|
&& x.ItemTplId == questToFindAssortFor.AssortTemplateId
|
||||||
|
&& x.Level == questToFindAssortFor.LoyaltyLevel).ToList();
|
||||||
|
QuestAssortMapping singleMapping;
|
||||||
|
if (mappings.Count != 1)
|
||||||
|
{
|
||||||
|
// last resort, find by sub item count
|
||||||
|
singleMapping = mappings.Single(x => (x.SubItemCount ?? 0) == questToFindAssortFor.AssortItems.Count - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
singleMapping = mappings[0];
|
||||||
|
}
|
||||||
|
|
||||||
results = possibleAssorts.Where(x => x.IsMoney == singleMapping.IsMoneyBarter
|
results = possibleAssorts.Where(x => x.IsMoney == singleMapping.IsMoneyBarter
|
||||||
&& trader == singleMapping.Trader
|
&& trader == singleMapping.Trader
|
||||||
&& x.Level == singleMapping.Level
|
&& x.Level == singleMapping.Level
|
||||||
&& x.RawItem._tpl == singleMapping.ItemTplId
|
&& x.RawItem._tpl == singleMapping.ItemTplId).ToList();
|
||||||
).ToList();
|
|
||||||
|
if (results.Any(x => x.AssortId == "61e0a291033bdc459438c2b7"))
|
||||||
|
{
|
||||||
|
var x = 2;
|
||||||
|
}
|
||||||
|
|
||||||
if (results.Count > 1)
|
if (results.Count > 1)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user