Add ability to insert level prereqs to quest + add prereq of level 50 to Collector
This commit is contained in:
parent
016a2343fa
commit
ed81b572f8
@ -112,37 +112,65 @@ namespace GenerateQuestFile
|
||||
if (questRequirements is null || questRequirements.Count == 0)
|
||||
{
|
||||
LoggingHelpers.LogWarning($"Quest requirement not found for : {quest.Value.QuestName}, skipping.");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (var requirement in questRequirements)
|
||||
{
|
||||
// Does quest have requirement
|
||||
if (!quest.Value.conditions.AvailableForStart.Any(x => x._parent == "Quest"
|
||||
&& x._props.target.ToString() == requirement.Quest.Id))
|
||||
if (requirement.PreReqType == PreRequisiteType.Quest)
|
||||
{
|
||||
LoggingHelpers.LogSuccess($"{quest.Value.QuestName} needs a prereq of quest {requirement.Quest.Name}, adding.");
|
||||
quest.Value.conditions.AvailableForStart.Add(new AvailableFor
|
||||
// Does quest have requirement
|
||||
if (!quest.Value.conditions.AvailableForStart.Any(x => x._parent == "Quest"
|
||||
&& x._props.target.ToString() == requirement.Quest.Id))
|
||||
{
|
||||
_parent = "Quest",
|
||||
_props = new AvailableForProps
|
||||
LoggingHelpers.LogSuccess($"{quest.Value.QuestName} needs a prereq of quest {requirement.Quest.Name}, adding.");
|
||||
quest.Value.conditions.AvailableForStart.Add(new AvailableFor
|
||||
{
|
||||
id = Sha256(new DateTime().ToString()),
|
||||
index = quest.Value.conditions.AvailableForStart.Count,
|
||||
parentId = "",
|
||||
status = GetQuestStatus(requirement.QuestStatus),
|
||||
target = requirement.Quest.Id,
|
||||
visibilityConditions = new List<object>(),
|
||||
availableAfter = 0
|
||||
_parent = "Quest",
|
||||
_props = new AvailableForProps
|
||||
{
|
||||
id = Sha256(new DateTime().ToString()),
|
||||
index = quest.Value.conditions.AvailableForStart.Count,
|
||||
parentId = "",
|
||||
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>()
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -167,7 +195,7 @@ 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)
|
||||
@ -297,7 +325,7 @@ namespace GenerateQuestFile
|
||||
}
|
||||
|
||||
// Already exists, skip
|
||||
if(questToUpdate.Value.conditions.AvailableForStart
|
||||
if (questToUpdate.Value.conditions.AvailableForStart
|
||||
.Any(x => x._props.target?.ToString() == questRequirementToAdd._props.target?.ToString()
|
||||
&& 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
|
||||
|
||||
(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;
|
||||
}
|
||||
@ -23,8 +32,10 @@ namespace QuestValidator.Common.Helpers
|
||||
|
||||
public class PreRequisite
|
||||
{
|
||||
public PreRequisiteType PreReqType { get; set; }
|
||||
public QuestStatus QuestStatus { get; set; }
|
||||
public QuestData Quest { get; set; }
|
||||
public int Level { get; set; }
|
||||
}
|
||||
|
||||
private static readonly Dictionary<Quest, QuestData> questWithPreceedingQuestDict = new Dictionary<Quest, QuestData>
|
||||
@ -359,7 +370,8 @@ namespace QuestValidator.Common.Helpers
|
||||
.AddPrerequisiteQuest(Quest.ShakingUpTeller, QuestStatus.Success) },
|
||||
{ Quest.Import, GetQuestData(Quest.Import)
|
||||
.AddPrerequisiteQuest(Quest.FarmingP4, QuestStatus.Success) },
|
||||
{ Quest.Collector, GetQuestData(Quest.Collector) },
|
||||
{ Quest.Collector, GetQuestData(Quest.Collector)
|
||||
.AddPrerequisiteLevel(50)},
|
||||
{ Quest.Introduction, GetQuestData(Quest.Introduction)
|
||||
.AddPrerequisiteQuest(Quest.GunsmithP1, QuestStatus.Started)},
|
||||
{ Quest.Acquaintance, GetQuestData(Quest.Acquaintance)
|
||||
@ -687,7 +699,7 @@ namespace QuestValidator.Common.Helpers
|
||||
// .AddPrerequisiteQuest(Quest., QuestStatus.Success)}
|
||||
};
|
||||
|
||||
private static QuestData GetQuestData(Quest quest)
|
||||
private static QuestData GetQuestData(Quest quest)
|
||||
{
|
||||
return new QuestData
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user