forked from chomp/ChompQuestVerifier
- Get the next index for quest props based on the previous index, instead of the count, to avoid duplicate indexes
- Include counter ID comparison for condition copy, so we don't copy the wrong ID for counters
This commit is contained in:
parent
d259bf3fb9
commit
71d3768749
@ -136,7 +136,7 @@ namespace GenerateQuestFile
|
||||
_props = new AvailableForProps
|
||||
{
|
||||
id = Sha256(hashData),
|
||||
index = quest.Value.conditions.AvailableForStart.Count,
|
||||
index = GetNextIndex(quest.Value.conditions.AvailableForStart.LastOrDefault()?._props?.index),
|
||||
parentId = "",
|
||||
status = GetQuestStatus(requirement.QuestStatus),
|
||||
target = requirement.Quest.Id,
|
||||
@ -178,7 +178,7 @@ namespace GenerateQuestFile
|
||||
_props = new AvailableForProps
|
||||
{
|
||||
id = Sha256(hashData),
|
||||
index = quest.Value.conditions.AvailableForStart.Count,
|
||||
index = GetNextIndex(quest.Value.conditions.AvailableForStart.LastOrDefault()?._props?.index),
|
||||
parentId = "",
|
||||
dynamicLocale = false,
|
||||
value = requirement.Level,
|
||||
@ -372,7 +372,8 @@ namespace GenerateQuestFile
|
||||
var originalCondition = originalConditions.FirstOrDefault(
|
||||
x => x._parent == condition._parent &&
|
||||
x._props.index == condition._props.index &&
|
||||
StripAllWhitespace(x._props.target?.ToString()) == StripAllWhitespace(condition._props.target?.ToString())
|
||||
StripAllWhitespace(x._props.target?.ToString()) == StripAllWhitespace(condition._props.target?.ToString()) &&
|
||||
x._props.counter?.id == condition._props.counter?.id
|
||||
);
|
||||
|
||||
if (originalCondition == null)
|
||||
@ -423,7 +424,7 @@ namespace GenerateQuestFile
|
||||
questRequirementToAdd._props.visibilityConditions = new List<object>();
|
||||
}
|
||||
|
||||
questRequirementToAdd._props.index = questToUpdate.Value.conditions.AvailableForStart.Count;
|
||||
questRequirementToAdd._props.index = GetNextIndex(questToUpdate.Value.conditions.AvailableForStart.LastOrDefault()?._props?.index);
|
||||
|
||||
}
|
||||
|
||||
@ -494,5 +495,15 @@ namespace GenerateQuestFile
|
||||
|
||||
return missingQuestsToReturn;
|
||||
}
|
||||
|
||||
private static int GetNextIndex(int? previousIndex)
|
||||
{
|
||||
if (previousIndex == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return previousIndex.Value + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ namespace QuestValidator.Models
|
||||
public class Counter
|
||||
{
|
||||
public string id { get; set; }
|
||||
public object conditions { get; set; }
|
||||
}
|
||||
|
||||
public class AvailableFor
|
||||
@ -79,7 +80,7 @@ namespace QuestValidator.Models
|
||||
|
||||
public class AvailableForProps
|
||||
{
|
||||
public object counter { get; set;}
|
||||
public Counter counter { get; set;}
|
||||
public int? dogtagLevel { get; set; }
|
||||
public string id { get; set; }
|
||||
public int? index { get; set; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user