Add helper functions to questhelper
This commit is contained in:
parent
52d2f769c1
commit
f4d2c20fca
@ -259,21 +259,21 @@ namespace AssortValidator.Common.Helpers
|
|||||||
{ "6179afd0bca27a099552e040", "Lost Contact"},
|
{ "6179afd0bca27a099552e040", "Lost Contact"},
|
||||||
{ "613708a7f8333a5d15594368", "Action Test"}
|
{ "613708a7f8333a5d15594368", "Action Test"}
|
||||||
};
|
};
|
||||||
private static QuestRoot _liveQuestData;
|
private static Dictionary<string, Quest> _liveQuestData;
|
||||||
|
|
||||||
public static QuestRoot GetLiveQuestData(string filename = "resp.client.quest.list")
|
public static Dictionary<string, Quest> GetQuestData(string filename = "resp.client.quest.list")
|
||||||
{
|
{
|
||||||
if (_liveQuestData == null)
|
if (_liveQuestData == null)
|
||||||
{
|
{
|
||||||
var questFilePath = InputFileHelper.GetInputFilePaths().FirstOrDefault(x => x.Contains(filename));
|
var questFilePath = InputFileHelper.GetInputFilePaths().FirstOrDefault(x => x.Contains(filename));
|
||||||
var questDataJson = File.ReadAllText(questFilePath);
|
var questDataJson = File.ReadAllText(questFilePath);
|
||||||
_liveQuestData = JsonSerializer.Deserialize<QuestRoot>(questDataJson);
|
_liveQuestData = JsonSerializer.Deserialize<Dictionary<string, Quest>>(questDataJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _liveQuestData;
|
return _liveQuestData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<QuestAssortUnlock> GetQuestAssortUnlocks(List<Quest> quests)
|
public static List<QuestAssortUnlock> GetQuestAssortUnlocks(IEnumerable<Quest> quests)
|
||||||
{
|
{
|
||||||
var results = new List<QuestAssortUnlock>();
|
var results = new List<QuestAssortUnlock>();
|
||||||
|
|
||||||
@ -283,12 +283,13 @@ namespace AssortValidator.Common.Helpers
|
|||||||
{
|
{
|
||||||
results.Add(new QuestAssortUnlock{
|
results.Add(new QuestAssortUnlock{
|
||||||
QuestId = quest._id,
|
QuestId = quest._id,
|
||||||
QuestName = QuestHelper.GetQuestNameById(quest._id),
|
QuestName = GetQuestNameById(quest._id),
|
||||||
TraderId = assortUnlockReward.traderId,
|
TraderId = assortUnlockReward.traderId,
|
||||||
TraderType = TraderHelper.GetTraderTypeById(assortUnlockReward.traderId),
|
TraderType = TraderHelper.GetTraderTypeById(assortUnlockReward.traderId),
|
||||||
AssortId = assortUnlockReward.items[0]._id,
|
AssortId = assortUnlockReward.items[0]._id,
|
||||||
AssortTemplateId = assortUnlockReward.items[0]._tpl,
|
AssortTemplateId = assortUnlockReward.items[0]._tpl,
|
||||||
LoyaltyLevel = assortUnlockReward.loyaltyLevel.GetValueOrDefault(0)
|
LoyaltyLevel = assortUnlockReward.loyaltyLevel.GetValueOrDefault(0),
|
||||||
|
QuestState = "success"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,6 +298,31 @@ namespace AssortValidator.Common.Helpers
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static QuestAssorts CreateQuestAssortsList(IEnumerable<QuestAssortUnlock> questAssortData)
|
||||||
|
{
|
||||||
|
var result = new QuestAssorts();
|
||||||
|
foreach (var questAssortUnlock in questAssortData)
|
||||||
|
{
|
||||||
|
result.success.Add(questAssortUnlock.AssortId, questAssortUnlock.QuestId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class QuestAssorts
|
||||||
|
{
|
||||||
|
public QuestAssorts()
|
||||||
|
{
|
||||||
|
started = new Dictionary<string, string>();
|
||||||
|
success = new Dictionary<string, string>();
|
||||||
|
fail = new Dictionary<string, string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<string, string> started { get; set; }
|
||||||
|
public Dictionary<string, string> success { get; set; }
|
||||||
|
public Dictionary<string, string> fail { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
private static string GetQuestNameById(string id)
|
private static string GetQuestNameById(string id)
|
||||||
{
|
{
|
||||||
if (questNames.ContainsKey(id))
|
if (questNames.ContainsKey(id))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user