Update models to match new bsg structure
This commit is contained in:
parent
2a10b22de4
commit
713f1ce51c
@ -125,26 +125,23 @@ namespace GenerateQuestFile
|
|||||||
if (requirement.PreReqType == PreRequisiteType.Quest)
|
if (requirement.PreReqType == PreRequisiteType.Quest)
|
||||||
{
|
{
|
||||||
// Does quest have requirement
|
// Does quest have requirement
|
||||||
if (!quest.Value.conditions.AvailableForStart.Any(x => x._parent == "Quest"
|
if (!quest.Value.conditions.AvailableForStart.Any(x => x.conditionType == "Quest"
|
||||||
&& x._props.target.ToString() == requirement.Quest.Id))
|
&& x.target.ToString() == requirement.Quest.Id))
|
||||||
{
|
{
|
||||||
LoggingHelpers.LogSuccess($"{quest.Value.QuestName} needs a prereq of quest {requirement.Quest.Name}, adding.");
|
LoggingHelpers.LogSuccess($"{quest.Value.QuestName} needs a prereq of quest {requirement.Quest.Name}, adding.");
|
||||||
|
|
||||||
string hashData = quest.Value._id + requirement.Quest.Id;
|
string hashData = quest.Value._id + requirement.Quest.Id;
|
||||||
quest.Value.conditions.AvailableForStart.Add(new AvailableFor
|
quest.Value.conditions.AvailableForStart.Add(new AvailableFor
|
||||||
{
|
{
|
||||||
_parent = "Quest",
|
conditionType = "Quest",
|
||||||
_props = new AvailableForProps
|
|
||||||
{
|
|
||||||
id = Sha256(hashData),
|
id = Sha256(hashData),
|
||||||
index = GetNextIndex(quest.Value.conditions.AvailableForStart.LastOrDefault()?._props?.index),
|
index = GetNextIndex(quest.Value.conditions.AvailableForStart.LastOrDefault()?.index),
|
||||||
parentId = "",
|
parentId = "",
|
||||||
status = GetQuestStatus(requirement.QuestStatus),
|
status = GetQuestStatus(requirement.QuestStatus),
|
||||||
target = requirement.Quest.Id,
|
target = requirement.Quest.Id,
|
||||||
visibilityConditions = new List<object>(),
|
visibilityConditions = new List<object>(),
|
||||||
availableAfter = 0
|
availableAfter = 0
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -159,7 +156,7 @@ namespace GenerateQuestFile
|
|||||||
if (requirement.PreReqType == PreRequisiteType.RemoveQuest)
|
if (requirement.PreReqType == PreRequisiteType.RemoveQuest)
|
||||||
{
|
{
|
||||||
if (quest.Value.conditions.AvailableForStart.RemoveAll(x =>
|
if (quest.Value.conditions.AvailableForStart.RemoveAll(x =>
|
||||||
x._parent == "Quest" && x._props.target.ToString() == requirement.Quest.Id) > 0)
|
x.conditionType == "Quest" && x.target.ToString() == requirement.Quest.Id) > 0)
|
||||||
{
|
{
|
||||||
LoggingHelpers.LogSuccess($"{quest.Value.QuestName} required {requirement.Quest.Name}, removing.");
|
LoggingHelpers.LogSuccess($"{quest.Value.QuestName} required {requirement.Quest.Name}, removing.");
|
||||||
}
|
}
|
||||||
@ -167,33 +164,30 @@ namespace GenerateQuestFile
|
|||||||
|
|
||||||
if (requirement.PreReqType == PreRequisiteType.Level)
|
if (requirement.PreReqType == PreRequisiteType.Level)
|
||||||
{
|
{
|
||||||
if (!quest.Value.conditions.AvailableForStart.Any(x => x._parent == "Level"
|
if (!quest.Value.conditions.AvailableForStart.Any(x => x.conditionType == "Level"
|
||||||
&& int.Parse(x._props.value.ToString()) == requirement.Level))
|
&& int.Parse(x.value.ToString()) == requirement.Level))
|
||||||
{
|
{
|
||||||
LoggingHelpers.LogSuccess($"{quest.Value.QuestName} needs a prereq of level {requirement.Level}, adding.");
|
LoggingHelpers.LogSuccess($"{quest.Value.QuestName} needs a prereq of level {requirement.Level}, adding.");
|
||||||
|
|
||||||
string hashData = quest.Value._id + "Level";
|
string hashData = quest.Value._id + "Level";
|
||||||
quest.Value.conditions.AvailableForStart.Add(new AvailableFor
|
quest.Value.conditions.AvailableForStart.Add(new AvailableFor
|
||||||
{
|
{
|
||||||
_parent = "Level",
|
conditionType = "Level",
|
||||||
_props = new AvailableForProps
|
|
||||||
{
|
|
||||||
id = Sha256(hashData),
|
id = Sha256(hashData),
|
||||||
index = GetNextIndex(quest.Value.conditions.AvailableForStart.LastOrDefault()?._props?.index),
|
index = GetNextIndex(quest.Value.conditions.AvailableForStart.LastOrDefault()?.index),
|
||||||
parentId = "",
|
parentId = "",
|
||||||
dynamicLocale = false,
|
dynamicLocale = false,
|
||||||
value = requirement.Level,
|
value = requirement.Level,
|
||||||
compareMethod = ">=",
|
compareMethod = ">=",
|
||||||
visibilityConditions = new List<object>()
|
visibilityConditions = new List<object>()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requirement.PreReqType == PreRequisiteType.RemoveLevel)
|
if (requirement.PreReqType == PreRequisiteType.RemoveLevel)
|
||||||
{
|
{
|
||||||
if (quest.Value.conditions.AvailableForStart.RemoveAll(x => x._parent == "Level") > 0)
|
if (quest.Value.conditions.AvailableForStart.RemoveAll(x => x.conditionType == "Level") > 0)
|
||||||
{
|
{
|
||||||
LoggingHelpers.LogSuccess($"{quest.Value.QuestName} required level {requirement.Level}, removing.");
|
LoggingHelpers.LogSuccess($"{quest.Value.QuestName} required level {requirement.Level}, removing.");
|
||||||
}
|
}
|
||||||
@ -216,12 +210,12 @@ namespace GenerateQuestFile
|
|||||||
var output = new List<string>();
|
var output = new List<string>();
|
||||||
foreach (var quest in quests)
|
foreach (var quest in quests)
|
||||||
{
|
{
|
||||||
var questConditions = quest.conditions.AvailableForStart.Where(x => x._parent == "Quest");
|
var questConditions = quest.conditions.AvailableForStart.Where(x => x.conditionType == "Quest");
|
||||||
if (questConditions != null)
|
if (questConditions != null)
|
||||||
{
|
{
|
||||||
foreach (var questCondition in questConditions)
|
foreach (var questCondition in questConditions)
|
||||||
{
|
{
|
||||||
var x = questCondition._props.target.ToString();
|
var x = questCondition.target.ToString();
|
||||||
Console.WriteLine($"{QuestHelper.GetQuestNameById(quest._id)} needs {QuestHelper.GetQuestNameById(x)}");
|
Console.WriteLine($"{QuestHelper.GetQuestNameById(quest._id)} needs {QuestHelper.GetQuestNameById(x)}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -235,12 +229,12 @@ namespace GenerateQuestFile
|
|||||||
var output = new List<string>();
|
var output = new List<string>();
|
||||||
foreach (var quest in quests)
|
foreach (var quest in quests)
|
||||||
{
|
{
|
||||||
var questConditions = quest.Value.conditions.AvailableForStart.Where(x => x._parent == "Quest");
|
var questConditions = quest.Value.conditions.AvailableForStart.Where(x => x.conditionType == "Quest");
|
||||||
if (questConditions != null)
|
if (questConditions != null)
|
||||||
{
|
{
|
||||||
foreach (var questCondition in questConditions)
|
foreach (var questCondition in questConditions)
|
||||||
{
|
{
|
||||||
var x = questCondition._props.target.ToString();
|
var x = questCondition.target.ToString();
|
||||||
Console.WriteLine($"{QuestHelper.GetQuestNameById(quest.Value._id)} needs {QuestHelper.GetQuestNameById(x)}");
|
Console.WriteLine($"{QuestHelper.GetQuestNameById(quest.Value._id)} needs {QuestHelper.GetQuestNameById(x)}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -376,19 +370,19 @@ namespace GenerateQuestFile
|
|||||||
foreach (var condition in conditions)
|
foreach (var condition in conditions)
|
||||||
{
|
{
|
||||||
var originalCondition = originalConditions.FirstOrDefault(
|
var originalCondition = originalConditions.FirstOrDefault(
|
||||||
x => x._parent == condition._parent &&
|
x => x.conditionType == condition.conditionType &&
|
||||||
x._props.index == condition._props.index &&
|
x.index == condition.index &&
|
||||||
StripAllWhitespace(x._props.target?.ToString()) == StripAllWhitespace(condition._props.target?.ToString()) &&
|
StripAllWhitespace(x.target?.ToString()) == StripAllWhitespace(condition.target?.ToString()) &&
|
||||||
x._props.counter?.id == condition._props.counter?.id
|
x.counter?.id == condition.counter?.id
|
||||||
);
|
);
|
||||||
|
|
||||||
if (originalCondition == null)
|
if (originalCondition == null)
|
||||||
{
|
{
|
||||||
LoggingHelpers.LogWarning($"Unable to find matching original condition for {condition._parent}-{StripAllWhitespace(condition._props.target?.ToString())}. Skipping.");
|
LoggingHelpers.LogWarning($"Unable to find matching original condition for {condition.conditionType}-{StripAllWhitespace(condition.target?.ToString())}. Skipping.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
condition._props.id = originalCondition._props.id;
|
condition.id = originalCondition.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,33 +405,33 @@ namespace GenerateQuestFile
|
|||||||
// continue;
|
// continue;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (questToUpdate.Value.conditions.AvailableForStart.Any(x => string.Equals(x._parent, "quest", StringComparison.CurrentCultureIgnoreCase)))
|
if (questToUpdate.Value.conditions.AvailableForStart.Any(x => string.Equals(x.conditionType, "quest", StringComparison.CurrentCultureIgnoreCase)))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (questRequirementToAdd._parent == "Quest")
|
if (questRequirementToAdd.conditionType == "Quest")
|
||||||
{
|
{
|
||||||
LoggingHelpers.LogInfo($"Quest {questToUpdate.Value.QuestName} missing AvailableForStart quest requirement, adding prereq of {questRequirementToAdd._props.target} {QuestHelper.GetQuestNameById(questRequirementToAdd._props.target?.ToString())}");
|
LoggingHelpers.LogInfo($"Quest {questToUpdate.Value.QuestName} missing AvailableForStart quest requirement, adding prereq of {questRequirementToAdd.target} {QuestHelper.GetQuestNameById(questRequirementToAdd.target?.ToString())}");
|
||||||
|
|
||||||
if (!questRequirementToAdd._props.availableAfter.HasValue)
|
if (!questRequirementToAdd.availableAfter.HasValue)
|
||||||
{
|
{
|
||||||
questRequirementToAdd._props.availableAfter = 0;
|
questRequirementToAdd.availableAfter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (questRequirementToAdd._props.visibilityConditions == null || !questRequirementToAdd._props.visibilityConditions.Any())
|
if (questRequirementToAdd.visibilityConditions == null || !questRequirementToAdd.visibilityConditions.Any())
|
||||||
{
|
{
|
||||||
questRequirementToAdd._props.visibilityConditions = new List<object>();
|
questRequirementToAdd.visibilityConditions = new List<object>();
|
||||||
}
|
}
|
||||||
|
|
||||||
questRequirementToAdd._props.index = GetNextIndex(questToUpdate.Value.conditions.AvailableForStart.LastOrDefault()?._props?.index);
|
questRequirementToAdd.index = GetNextIndex(questToUpdate.Value.conditions.AvailableForStart.LastOrDefault()?.index);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.target?.ToString() == questRequirementToAdd.target?.ToString()
|
||||||
&& x._parent == questRequirementToAdd._parent))
|
&& x.conditionType == questRequirementToAdd.conditionType))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -445,9 +439,9 @@ namespace GenerateQuestFile
|
|||||||
questToUpdate.Value.conditions.AvailableForStart.Add(questRequirementToAdd);
|
questToUpdate.Value.conditions.AvailableForStart.Add(questRequirementToAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (questToUpdate.Value.conditions.AvailableForStart.Count(x => x._parent == "Quest") > 1)
|
if (questToUpdate.Value.conditions.AvailableForStart.Count(x => x.conditionType == "Quest") > 1)
|
||||||
{
|
{
|
||||||
LoggingHelpers.LogWarning($"Quest {questToUpdate.Value.QuestName} has {questToUpdate.Value.conditions.AvailableForStart.Count(x => x._parent == "Quest")} quest prereqs, is this correct?");
|
LoggingHelpers.LogWarning($"Quest {questToUpdate.Value.QuestName} has {questToUpdate.Value.conditions.AvailableForStart.Count(x => x.conditionType == "Quest")} quest prereqs, is this correct?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace QuestValidator.Models
|
|||||||
public string acceptPlayerMessage { get;set;}
|
public string acceptPlayerMessage { get;set;}
|
||||||
public string changeQuestMessageText { get;set;}
|
public string changeQuestMessageText { get;set;}
|
||||||
public string completePlayerMessage { get; set; }
|
public string completePlayerMessage { get; set; }
|
||||||
public Conditions conditions { get; set; }
|
public QuestConditions conditions { get; set; }
|
||||||
public string description { get;set;}
|
public string description { get;set;}
|
||||||
public string failMessageText { get; set; }
|
public string failMessageText { get; set; }
|
||||||
public string name { get; set; }
|
public string name { get; set; }
|
||||||
@ -35,36 +35,16 @@ namespace QuestValidator.Models
|
|||||||
public string successMessageText { get; set; }
|
public string successMessageText { get; set; }
|
||||||
public string templateId { get; set; }
|
public string templateId { get; set; }
|
||||||
public Rewards rewards { get; set; }
|
public Rewards rewards { get; set; }
|
||||||
|
|
||||||
public string? side { get; set; }
|
public string? side { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Conditions
|
public class QuestConditions
|
||||||
{
|
{
|
||||||
public string _parent { get; set; }
|
|
||||||
public ConditionProps _props { get; set; }
|
|
||||||
public List<AvailableFor> AvailableForFinish { get; set; }
|
public List<AvailableFor> AvailableForFinish { get; set; }
|
||||||
public List<AvailableFor> AvailableForStart { get; set; }
|
public List<AvailableFor> AvailableForStart { get; set; }
|
||||||
public List<AvailableFor> Fail { get; set; }
|
public List<AvailableFor> Fail { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ConditionProps
|
|
||||||
{
|
|
||||||
public string compareMethod { get; set; }
|
|
||||||
public string id { get; set; }
|
|
||||||
public object target { get; set; }
|
|
||||||
public string value { get; set; }
|
|
||||||
public Counter counter { get; set; }
|
|
||||||
public int index { get; set; }
|
|
||||||
public string parentId { get; set; }
|
|
||||||
public string type { get; set; }
|
|
||||||
public int? dogtagLevel { get; set; }
|
|
||||||
public object maxDurability { get; set; }
|
|
||||||
public int? minDurability { get; set; }
|
|
||||||
public List<object> visibilityConditions { get; set; }
|
|
||||||
public List<int> status { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Counter
|
public class Counter
|
||||||
{
|
{
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
@ -73,15 +53,51 @@ namespace QuestValidator.Models
|
|||||||
|
|
||||||
public class AvailableFor
|
public class AvailableFor
|
||||||
{
|
{
|
||||||
public string _parent { get; set; }
|
public string conditionType { get; set; }
|
||||||
public AvailableForProps _props { get; set; }
|
public Counter counter { get; set; }
|
||||||
public bool dynamicLocale { get;set;}
|
public object dogtagLevel { get; set; }
|
||||||
|
public string id { get; set; }
|
||||||
|
public int? index { get; set; }
|
||||||
|
public object maxDurability { get; set; }
|
||||||
|
public object minDurability { get; set; }
|
||||||
|
public string parentId { get; set; }
|
||||||
|
public bool? resetOnSessionEnd { get; set; }
|
||||||
|
public bool? isEncoded { get; set; }
|
||||||
|
public bool? onlyFoundInRaid { get; set; }
|
||||||
|
public bool? oneSessionOnly { get; set; }
|
||||||
|
public bool dynamicLocale { get; set; }
|
||||||
|
public object? plantTime { get; set; }
|
||||||
|
public string zoneId { get; set; }
|
||||||
|
public object target { get; set; }
|
||||||
|
public string type { get; set; }
|
||||||
|
public bool? countInRaid { get; set; }
|
||||||
|
public object status { get; set; }
|
||||||
|
public bool? unknown { get; set; }
|
||||||
|
public bool? doNotResetIfCounterCompleted { get; set; }
|
||||||
|
public object value { get; set; }
|
||||||
|
public int? availableAfter { get; set; }
|
||||||
|
public int? dispersion { get; set; }
|
||||||
|
public string compareMethod { get; set; }
|
||||||
|
public List<object> visibilityConditions { get; set; }
|
||||||
|
public SkillCondition baseAccuracy { get; set; }
|
||||||
|
public SkillCondition durability { get; set; }
|
||||||
|
public SkillCondition effectiveDistance { get; set; }
|
||||||
|
public SkillCondition emptyTacticalSlot { get; set; }
|
||||||
|
public SkillCondition ergonomics { get; set; }
|
||||||
|
public SkillCondition height { get; set; }
|
||||||
|
public SkillCondition magazineCapacity { get; set; }
|
||||||
|
public SkillCondition muzzleVelocity { get; set; }
|
||||||
|
public SkillCondition recoil { get; set; }
|
||||||
|
public SkillCondition weight { get; set; }
|
||||||
|
public SkillCondition width { get; set; }
|
||||||
|
public object containsItems { get; set; }
|
||||||
|
public object hasItemFromCategory { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AvailableForProps
|
public class AvailableForProps
|
||||||
{
|
{
|
||||||
public Counter counter { get; set;}
|
public Counter counter { get; set;}
|
||||||
public int? dogtagLevel { get; set; }
|
public object dogtagLevel { get; set; }
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
public int? index { get; set; }
|
public int? index { get; set; }
|
||||||
public object maxDurability { get; set; }
|
public object maxDurability { get; set; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user