Add ability to insert level prereqs to quest + add prereq of level 50 to Collector
This commit is contained in:
parent
016a2343fa
commit
ed81b572f8
@ -84,7 +84,7 @@ namespace GenerateQuestFile
|
|||||||
AddQuestName(quest);
|
AddQuestName(quest);
|
||||||
|
|
||||||
var originalQuest = existingQuestData.FirstOrDefault(x => x.Key == quest.Key).Value;
|
var originalQuest = existingQuestData.FirstOrDefault(x => x.Key == quest.Key).Value;
|
||||||
|
|
||||||
if (originalQuest is null)
|
if (originalQuest is null)
|
||||||
{
|
{
|
||||||
LoggingHelpers.LogWarning($"Cant check for original start conditions. Unable to find original quest {quest.Key} {QuestHelper.GetQuestNameById(quest.Key)}, skipping.");
|
LoggingHelpers.LogWarning($"Cant check for original start conditions. Unable to find original quest {quest.Key} {QuestHelper.GetQuestNameById(quest.Key)}, skipping.");
|
||||||
@ -112,37 +112,65 @@ namespace GenerateQuestFile
|
|||||||
if (questRequirements is null || questRequirements.Count == 0)
|
if (questRequirements is null || questRequirements.Count == 0)
|
||||||
{
|
{
|
||||||
LoggingHelpers.LogWarning($"Quest requirement not found for : {quest.Value.QuestName}, skipping.");
|
LoggingHelpers.LogWarning($"Quest requirement not found for : {quest.Value.QuestName}, skipping.");
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var requirement in questRequirements)
|
foreach (var requirement in questRequirements)
|
||||||
{
|
{
|
||||||
// Does quest have requirement
|
if (requirement.PreReqType == PreRequisiteType.Quest)
|
||||||
if (!quest.Value.conditions.AvailableForStart.Any(x => x._parent == "Quest"
|
|
||||||
&& x._props.target.ToString() == requirement.Quest.Id))
|
|
||||||
{
|
{
|
||||||
LoggingHelpers.LogSuccess($"{quest.Value.QuestName} needs a prereq of quest {requirement.Quest.Name}, adding.");
|
// Does quest have requirement
|
||||||
quest.Value.conditions.AvailableForStart.Add(new AvailableFor
|
if (!quest.Value.conditions.AvailableForStart.Any(x => x._parent == "Quest"
|
||||||
|
&& x._props.target.ToString() == requirement.Quest.Id))
|
||||||
{
|
{
|
||||||
_parent = "Quest",
|
LoggingHelpers.LogSuccess($"{quest.Value.QuestName} needs a prereq of quest {requirement.Quest.Name}, adding.");
|
||||||
_props = new AvailableForProps
|
quest.Value.conditions.AvailableForStart.Add(new AvailableFor
|
||||||
{
|
{
|
||||||
id = Sha256(new DateTime().ToString()),
|
_parent = "Quest",
|
||||||
index = quest.Value.conditions.AvailableForStart.Count,
|
_props = new AvailableForProps
|
||||||
parentId = "",
|
{
|
||||||
status = GetQuestStatus(requirement.QuestStatus),
|
id = Sha256(new DateTime().ToString()),
|
||||||
target = requirement.Quest.Id,
|
index = quest.Value.conditions.AvailableForStart.Count,
|
||||||
visibilityConditions = new List<object>(),
|
parentId = "",
|
||||||
availableAfter = 0
|
status = GetQuestStatus(requirement.QuestStatus),
|
||||||
|
target = requirement.Quest.Id,
|
||||||
|
visibilityConditions = new List<object>(),
|
||||||
|
availableAfter = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (questRequirements != null)
|
||||||
|
{
|
||||||
|
LoggingHelpers.LogInfo($"{quest.Value.QuestName} already has prereq of quest {requirement.Quest.Name}, skipping.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (requirement.PreReqType == PreRequisiteType.Level)
|
||||||
{
|
{
|
||||||
if (questRequirements != null)
|
if (!quest.Value.conditions.AvailableForStart.Any(x => x._parent == "Level"
|
||||||
|
&& int.Parse((string)x._props.value) == requirement.Level))
|
||||||
{
|
{
|
||||||
LoggingHelpers.LogInfo($"{quest.Value.QuestName} already has prereq of quest {requirement.Quest.Name}, skipping.");
|
LoggingHelpers.LogSuccess($"{quest.Value.QuestName} needs a prereq of level {requirement.Level}, adding.");
|
||||||
|
quest.Value.conditions.AvailableForStart.Add(new AvailableFor
|
||||||
|
{
|
||||||
|
_parent = "Level",
|
||||||
|
_props = new AvailableForProps
|
||||||
|
{
|
||||||
|
id = Sha256(new DateTime().ToString()),
|
||||||
|
index = quest.Value.conditions.AvailableForStart.Count,
|
||||||
|
parentId = "",
|
||||||
|
dynamicLocale = false,
|
||||||
|
value = requirement.Level,
|
||||||
|
compareMethod = ">=",
|
||||||
|
visibilityConditions = new List<object>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,8 +194,8 @@ namespace GenerateQuestFile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// JsonWriter.WriteJson<QuestRoot>(output, "output", Directory.GetCurrentDirectory(), "questRequirements");
|
// JsonWriter.WriteJson<QuestRoot>(output, "output", Directory.GetCurrentDirectory(), "questRequirements");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OutputQuestRequirementsToConsole2(Dictionary<string, Quest> quests)
|
private static void OutputQuestRequirementsToConsole2(Dictionary<string, Quest> quests)
|
||||||
@ -230,7 +258,7 @@ namespace GenerateQuestFile
|
|||||||
// findInRaid
|
// findInRaid
|
||||||
foreach (var success in quest.Value.rewards.Success)
|
foreach (var success in quest.Value.rewards.Success)
|
||||||
{
|
{
|
||||||
if (string.Equals(success.type, "item", StringComparison.OrdinalIgnoreCase)
|
if (string.Equals(success.type, "item", StringComparison.OrdinalIgnoreCase)
|
||||||
&& success.findInRaid == null)
|
&& success.findInRaid == null)
|
||||||
{
|
{
|
||||||
success.findInRaid = true;
|
success.findInRaid = true;
|
||||||
@ -286,18 +314,18 @@ namespace GenerateQuestFile
|
|||||||
{
|
{
|
||||||
questRequirementToAdd._props.availableAfter = 0;
|
questRequirementToAdd._props.availableAfter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (questRequirementToAdd._props.visibilityConditions == null || !questRequirementToAdd._props.visibilityConditions.Any())
|
if (questRequirementToAdd._props.visibilityConditions == null || !questRequirementToAdd._props.visibilityConditions.Any())
|
||||||
{
|
{
|
||||||
questRequirementToAdd._props.visibilityConditions = new List<object>();
|
questRequirementToAdd._props.visibilityConditions = new List<object>();
|
||||||
}
|
}
|
||||||
|
|
||||||
questRequirementToAdd._props.index = questToUpdate.Value.conditions.AvailableForStart.Count;
|
questRequirementToAdd._props.index = questToUpdate.Value.conditions.AvailableForStart.Count;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Already exists, skip
|
// Already exists, skip
|
||||||
if(questToUpdate.Value.conditions.AvailableForStart
|
if (questToUpdate.Value.conditions.AvailableForStart
|
||||||
.Any(x => x._props.target?.ToString() == questRequirementToAdd._props.target?.ToString()
|
.Any(x => x._props.target?.ToString() == questRequirementToAdd._props.target?.ToString()
|
||||||
&& x._parent == questRequirementToAdd._parent))
|
&& x._parent == questRequirementToAdd._parent))
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,16 @@ namespace QuestValidator.Common.Helpers
|
|||||||
{
|
{
|
||||||
// TODO: add check if desired prereq is same id as quest, prevent it
|
// TODO: add check if desired prereq is same id as quest, prevent it
|
||||||
|
|
||||||
(PreRequisites ??= new List<PreRequisite>()).Add(new PreRequisite { Quest = GetQuestData(quest), QuestStatus = status });
|
(PreRequisites ??= new List<PreRequisite>()).Add(new PreRequisite { PreReqType = PreRequisiteType.Quest, Quest = GetQuestData(quest), QuestStatus = status });
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public QuestData AddPrerequisiteLevel(int level)
|
||||||
|
{
|
||||||
|
// TODO: add check if level prereq exits already, dont add
|
||||||
|
|
||||||
|
(PreRequisites ??= new List<PreRequisite>()).Add(new PreRequisite { PreReqType = PreRequisiteType.Level, Level = level });
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -23,8 +32,10 @@ namespace QuestValidator.Common.Helpers
|
|||||||
|
|
||||||
public class PreRequisite
|
public class PreRequisite
|
||||||
{
|
{
|
||||||
|
public PreRequisiteType PreReqType { get; set; }
|
||||||
public QuestStatus QuestStatus { get; set; }
|
public QuestStatus QuestStatus { get; set; }
|
||||||
public QuestData Quest { get; set; }
|
public QuestData Quest { get; set; }
|
||||||
|
public int Level { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly Dictionary<Quest, QuestData> questWithPreceedingQuestDict = new Dictionary<Quest, QuestData>
|
private static readonly Dictionary<Quest, QuestData> questWithPreceedingQuestDict = new Dictionary<Quest, QuestData>
|
||||||
@ -359,7 +370,8 @@ namespace QuestValidator.Common.Helpers
|
|||||||
.AddPrerequisiteQuest(Quest.ShakingUpTeller, QuestStatus.Success) },
|
.AddPrerequisiteQuest(Quest.ShakingUpTeller, QuestStatus.Success) },
|
||||||
{ Quest.Import, GetQuestData(Quest.Import)
|
{ Quest.Import, GetQuestData(Quest.Import)
|
||||||
.AddPrerequisiteQuest(Quest.FarmingP4, QuestStatus.Success) },
|
.AddPrerequisiteQuest(Quest.FarmingP4, QuestStatus.Success) },
|
||||||
{ Quest.Collector, GetQuestData(Quest.Collector) },
|
{ Quest.Collector, GetQuestData(Quest.Collector)
|
||||||
|
.AddPrerequisiteLevel(50)},
|
||||||
{ Quest.Introduction, GetQuestData(Quest.Introduction)
|
{ Quest.Introduction, GetQuestData(Quest.Introduction)
|
||||||
.AddPrerequisiteQuest(Quest.GunsmithP1, QuestStatus.Started)},
|
.AddPrerequisiteQuest(Quest.GunsmithP1, QuestStatus.Started)},
|
||||||
{ Quest.Acquaintance, GetQuestData(Quest.Acquaintance)
|
{ Quest.Acquaintance, GetQuestData(Quest.Acquaintance)
|
||||||
@ -687,7 +699,7 @@ namespace QuestValidator.Common.Helpers
|
|||||||
// .AddPrerequisiteQuest(Quest., QuestStatus.Success)}
|
// .AddPrerequisiteQuest(Quest., QuestStatus.Success)}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static QuestData GetQuestData(Quest quest)
|
private static QuestData GetQuestData(Quest quest)
|
||||||
{
|
{
|
||||||
return new QuestData
|
return new QuestData
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user