forked from chomp/ChompQuestVerifier
reorder functions
Add checking of rewards:success data Added checking of AssortmentUnlock items in rewards:success
This commit is contained in:
parent
bc0824e0f5
commit
b898acf1ea
@ -2,6 +2,7 @@
|
||||
using QuestValidator.Common;
|
||||
using QuestValidator.Common.Helpers;
|
||||
using QuestValidator.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@ -26,9 +27,9 @@ namespace QuestValidator
|
||||
var quest = item.Value;
|
||||
LogQuestDetails(quest);
|
||||
|
||||
// get live quest
|
||||
// Get live quest
|
||||
var relatedLiveQuest = liveQuestData.data.FirstOrDefault(x => x._id == quest._id);
|
||||
if (!ItemExists(relatedLiveQuest, "live quest. Live dump too old ?", 0))
|
||||
if (!ItemExists(relatedLiveQuest, "live quest. Live dump too old ?"))
|
||||
{
|
||||
LoggingHelpers.LogInfo("");
|
||||
continue;
|
||||
@ -38,6 +39,8 @@ namespace QuestValidator
|
||||
|
||||
CheckSuccessRewardItems(quest, relatedLiveQuest);
|
||||
|
||||
CheckStartedRewardItems(quest, relatedLiveQuest);
|
||||
|
||||
CheckAvailableForFinishConditionItems(quest, relatedLiveQuest);
|
||||
|
||||
LoggingHelpers.LogInfo("");
|
||||
@ -46,21 +49,31 @@ namespace QuestValidator
|
||||
}
|
||||
}
|
||||
|
||||
private static void CheckAvailableForFinishConditionItems(Models.Quest quest, Models.Quest relatedLiveQuest)
|
||||
private static void CheckRootItemValues(Models.Quest quest, Models.Quest relatedLiveQuest)
|
||||
{
|
||||
foreach (var availableForFinishItem in quest.conditions.AvailableForFinish)
|
||||
{
|
||||
Models.AvailableFor liveFinishItem = relatedLiveQuest.conditions.AvailableForFinish.Find(x => x._props.id == availableForFinishItem._props.id);
|
||||
if (!ItemExists(liveFinishItem, "AvailableForFinish item", availableForFinishItem._props.index.Value))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
CheckValuesMatch(availableForFinishItem._props.parentId, liveFinishItem._props.parentId, "AvailableForFinish parentId mismatch", availableForFinishItem._props.id);
|
||||
// Check image id matches
|
||||
CheckValuesMatch(quest.image.Substring(0, quest.image.Length - 3), relatedLiveQuest?.image.Substring(0, relatedLiveQuest.image.Length - 3), "item path mismatch");
|
||||
|
||||
// check reset on session end
|
||||
CheckValuesMatch(availableForFinishItem._props.resetOnSessionEnd, liveFinishItem._props.resetOnSessionEnd, "AvailableForFinish resetOnSessionEnd value mismatch", availableForFinishItem._props.id);
|
||||
// Check started reward count matches
|
||||
CheckValuesMatch(quest.rewards.Started.Count, relatedLiveQuest.rewards.Started.Count, "Started item count mismatch");
|
||||
|
||||
}
|
||||
// Check success reward count matches
|
||||
CheckValuesMatch(quest.rewards.Success.Count, relatedLiveQuest.rewards.Success.Count, "success item count mismatch");
|
||||
|
||||
// Check Fail reward count matches
|
||||
CheckValuesMatch(quest.rewards.Fail.Count, relatedLiveQuest.rewards.Fail.Count, "fail item count mismatch");
|
||||
|
||||
// Check min level matches
|
||||
CheckValuesMatch(quest.min_level, relatedLiveQuest.min_level, "min level value mismatch");
|
||||
|
||||
// Check location matches
|
||||
CheckValuesMatch(quest.location, relatedLiveQuest.location, "location value mismatch");
|
||||
|
||||
// Check traderid matches
|
||||
CheckValuesMatch(quest.traderId, relatedLiveQuest.traderId, "traderid value mismatch");
|
||||
|
||||
// Check type matches
|
||||
CheckValuesMatch(quest.type, relatedLiveQuest.type, "quest type value mismatch");
|
||||
}
|
||||
|
||||
private static void CheckSuccessRewardItems(Models.Quest quest, Models.Quest relatedLiveQuest)
|
||||
@ -130,35 +143,91 @@ namespace QuestValidator
|
||||
// check target value matches
|
||||
CheckValuesMatch(questSuccessRewardItem.target, relatedLiveRewardItem.target, "trader target value mismatch");
|
||||
}
|
||||
|
||||
foreach (var questSuccessRewardItem in quest.rewards.Success.Where(x => x.type == "AssortmentUnlock"))
|
||||
{
|
||||
var relatedLiveRewardItem = liveQuestSuccessRewardItems.FirstOrDefault(x => x.target == questSuccessRewardItem.target && x.type == "AssortmentUnlock");
|
||||
if (!ItemExists(relatedLiveRewardItem, "TraderStanding success reward item", questSuccessRewardItem.index))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check loyalty level
|
||||
CheckValuesMatch(questSuccessRewardItem.loyaltyLevel.Value, relatedLiveRewardItem.loyaltyLevel.Value, "loyalty level value mismatch", questSuccessRewardItem.id);
|
||||
|
||||
// Check traderId
|
||||
CheckValuesMatch(questSuccessRewardItem.traderId, relatedLiveRewardItem.traderId, "traderId value mismatch", questSuccessRewardItem.id);
|
||||
|
||||
// check target equals items[0].id
|
||||
CheckValuesMatch(questSuccessRewardItem.target, relatedLiveRewardItem.items[0]._id, "target value does not match items[0].id mismatch", questSuccessRewardItem.id);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CheckRootItemValues(Models.Quest quest, Models.Quest relatedLiveQuest)
|
||||
private static void CheckStartedRewardItems(Models.Quest quest, Models.Quest relatedLiveQuest)
|
||||
{
|
||||
// Check image id matches
|
||||
CheckValuesMatch(quest.image.Substring(0, quest.image.Length - 3), relatedLiveQuest?.image.Substring(0, relatedLiveQuest.image.Length - 3), "item path mismatch");
|
||||
var liveQuestStartedRewardItems = relatedLiveQuest.rewards.Started;
|
||||
|
||||
// Check started reward count matches
|
||||
CheckValuesMatch(quest.rewards.Started.Count, relatedLiveQuest.rewards.Started.Count, "Started item count mismatch");
|
||||
foreach (var questSuccessRewardItem in quest.rewards.Started.Where(x => x.type == "Item"))
|
||||
{
|
||||
var errorMessage = string.Empty;
|
||||
// Get live reward item by index and type
|
||||
var relatedLiveRewardItem = liveQuestStartedRewardItems.Find(x => x.index == questSuccessRewardItem.index && x.type == "Item");
|
||||
if (relatedLiveRewardItem == null)
|
||||
{
|
||||
// Get live reward item by templateId and type as we cant find it by index
|
||||
relatedLiveRewardItem = liveQuestStartedRewardItems.Find(x => x.items != null && x.items[0]?._tpl == questSuccessRewardItem.items[0]?._tpl && x.type == "Item");
|
||||
if (relatedLiveRewardItem == null)
|
||||
{
|
||||
LoggingHelpers.LogError($"ERROR unable to find started reward item in live quest data by index: ({questSuccessRewardItem.index}) OR template id: {questSuccessRewardItem.items[0]._tpl}");
|
||||
LoggingHelpers.LogError($"ERROR Skipping quest started item: {questSuccessRewardItem.id}");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Check success reward count matches
|
||||
CheckValuesMatch(quest.rewards.Success.Count, relatedLiveQuest.rewards.Success.Count, "success item count mismatch");
|
||||
// Ensure target matches the objects items[0].id value
|
||||
if (questSuccessRewardItem.items[0]?._id != questSuccessRewardItem.target)
|
||||
{
|
||||
LoggingHelpers.LogWarning($"WARNING target does not match first item: {questSuccessRewardItem.target}, expected {questSuccessRewardItem.items[0]?._id}");
|
||||
}
|
||||
|
||||
// Check Fail reward count matches
|
||||
CheckValuesMatch(quest.rewards.Fail.Count, relatedLiveQuest.rewards.Fail.Count, "fail item count mismatch");
|
||||
// Check template ids match
|
||||
CheckValuesMatch(questSuccessRewardItem.items[0]._tpl, relatedLiveRewardItem.items[0]._tpl, "mismatch for template id", questSuccessRewardItem.items[0]._id, true);
|
||||
|
||||
// Check min level matches
|
||||
CheckValuesMatch(quest.min_level, relatedLiveQuest.min_level, "min level value mismatch");
|
||||
// Check value values match
|
||||
CheckValuesMatch(questSuccessRewardItem.value, relatedLiveRewardItem.value, "mismatch for success item reward value", questSuccessRewardItem.id);
|
||||
|
||||
// Check location matches
|
||||
CheckValuesMatch(quest.location, relatedLiveQuest.location, "location value mismatch");
|
||||
// Check item stack count
|
||||
if (questSuccessRewardItem.items[0] != null && questSuccessRewardItem.items[0].upd != null)
|
||||
{
|
||||
CheckValuesMatch(questSuccessRewardItem.items[0].upd.StackObjectsCount, relatedLiveRewardItem.items[0].upd.StackObjectsCount, "mismatch for StackObjectsCount", questSuccessRewardItem.items[0]._id);
|
||||
}
|
||||
}
|
||||
|
||||
// Check traderid matches
|
||||
CheckValuesMatch(quest.traderId, relatedLiveQuest.traderId, "traderid value mismatch");
|
||||
|
||||
// Check type matches
|
||||
CheckValuesMatch(quest.type, relatedLiveQuest.type, "quest type value mismatch");
|
||||
}
|
||||
|
||||
private static void CheckAvailableForFinishConditionItems(Models.Quest quest, Models.Quest relatedLiveQuest)
|
||||
{
|
||||
foreach (var availableForFinishItem in quest.conditions.AvailableForFinish)
|
||||
{
|
||||
Models.AvailableFor liveFinishItem = relatedLiveQuest.conditions.AvailableForFinish.Find(x => x._props.id == availableForFinishItem._props.id);
|
||||
if (!ItemExists(liveFinishItem, "AvailableForFinish item", availableForFinishItem._props.index.Value))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check parentId
|
||||
CheckValuesMatch(availableForFinishItem._props.parentId, liveFinishItem._props.parentId, "AvailableForFinish parentId mismatch", availableForFinishItem._props.id);
|
||||
|
||||
// check AvailableForFinish resetOnSessionEnd
|
||||
CheckValuesMatch(availableForFinishItem._props.resetOnSessionEnd, liveFinishItem._props.resetOnSessionEnd, "AvailableForFinish resetOnSessionEnd value mismatch", availableForFinishItem._props.id);
|
||||
|
||||
// check AvailableForFinish target
|
||||
CheckValuesMatch(Convert.ToString(availableForFinishItem._props.target), Convert.ToString(liveFinishItem._props.target), "AvailableForFinish target value mismatch", availableForFinishItem._props.id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void LogQuestDetails(Models.Quest quest)
|
||||
{
|
||||
var questName = QuestHelper.GetQuestNameById(quest._id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user