Update hoq quest trader assorts are handled

This commit is contained in:
Dev 2023-11-22 14:24:58 +00:00
parent 9c238c8eba
commit 7a3fb095c0
3 changed files with 403 additions and 434 deletions

View File

@ -6,8 +6,7 @@
"BuyRestrictionMax": 150,
"StackObjectsCount": 20000
},
"barterScheme": [
{
"barterScheme": [{
"count": 700,
"_tpl": "5449016a4bdc2d6f028b456f"
}
@ -20,20 +19,16 @@
"BuyRestrictionMax": 1,
"StackObjectsCount": 100
},
"barterScheme": [
{
"barterScheme": [{
"count": 15,
"_tpl": "5d0376a486f7747d8050965c"
},
{
}, {
"count": 10,
"_tpl": "57347c2e24597744902c94a1"
},
{
}, {
"count": 50,
"_tpl": "5c06782b86f77426df5407d2"
},
{
}, {
"count": 5,
"_tpl": "5c05300686f7746dce784e5d"
}
@ -46,24 +41,19 @@
"BuyRestrictionMax": 2,
"StackObjectsCount": 10
},
"barterScheme": [
{
"barterScheme": [{
"count": 20,
"_tpl": "6389c70ca33d8c4cdf4932c6"
},
{
}, {
"count": 10,
"_tpl": "5d03775b86f774203e7e0c4b"
},
{
}, {
"count": 12,
"_tpl": "590a386e86f77429692b27ab"
},
{
}, {
"count": 16,
"_tpl": "5c05308086f7746b2101e90b"
},
{
}, {
"count": 16,
"_tpl": "5c05300686f7746dce784e5d"
}
@ -76,8 +66,7 @@
"BuyRestrictionMax": 180,
"StackObjectsCount": 650000
},
"barterScheme": [
{
"barterScheme": [{
"count": 1099,
"_tpl": "5449016a4bdc2d6f028b456f"
}
@ -90,8 +79,7 @@
"BuyRestrictionMax": 3,
"StackObjectsCount": 200
},
"barterScheme": [
{
"barterScheme": [{
"count": 35000,
"_tpl": "5449016a4bdc2d6f028b456f"
}
@ -104,8 +92,7 @@
"BuyRestrictionMax": 5,
"StackObjectsCount": 200
},
"barterScheme": [
{
"barterScheme": [{
"count": 20000,
"_tpl": "5449016a4bdc2d6f028b456f"
}
@ -119,11 +106,10 @@
"BuyRestrictionMax": 2,
"StackObjectsCount": 50
},
"barterScheme": [
{
"barterScheme": [{
"count": 1,
"_tpl": "5c12613b86f7743bbe2c3f76"
},{
}, {
"count": 2,
"_tpl": "5d0379a886f77420407aa271"
}
@ -137,8 +123,7 @@
"BuyRestrictionMax": 10,
"StackObjectsCount": 60
},
"barterScheme": [
{
"barterScheme": [{
"count": 15120,
"_tpl": "5449016a4bdc2d6f028b456f"
}
@ -152,8 +137,7 @@
"BuyRestrictionMax": 2,
"StackObjectsCount": 200000
},
"barterScheme": [
{
"barterScheme": [{
"count": 55552,
"_tpl": "5449016a4bdc2d6f028b456f"
}
@ -167,8 +151,7 @@
"BuyRestrictionMax": 10,
"StackObjectsCount": 2000000
},
"barterScheme": [
{
"barterScheme": [{
"count": 12544,
"_tpl": "5449016a4bdc2d6f028b456f"
}
@ -181,8 +164,7 @@
"BuyRestrictionMax": 10,
"StackObjectsCount": 20
},
"barterScheme": [
{
"barterScheme": [{
"count": 3381,
"_tpl": "5449016a4bdc2d6f028b456f"
}
@ -195,8 +177,7 @@
"BuyRestrictionMax": 10,
"StackObjectsCount": 20
},
"barterScheme": [
{
"barterScheme": [{
"count": 45000,
"_tpl": "5449016a4bdc2d6f028b456f"
}
@ -209,8 +190,7 @@
"BuyRestrictionMax": 2,
"StackObjectsCount": 20
},
"barterScheme": [
{
"barterScheme": [{
"count": 115000,
"_tpl": "5449016a4bdc2d6f028b456f"
}
@ -223,8 +203,7 @@
"BuyRestrictionMax": 2,
"StackObjectsCount": 20
},
"barterScheme": [
{
"barterScheme": [{
"count": 80000,
"_tpl": "5449016a4bdc2d6f028b456f"
}
@ -237,12 +216,10 @@
"BuyRestrictionMax": 2,
"StackObjectsCount": 40000
},
"barterScheme": [
{
"barterScheme": [{
"count": 1,
"_tpl": "5d403f9186f7743cac3f229b"
},
{
}, {
"count": 1,
"_tpl": "62a0a0bb621468534a797ad5"
}
@ -256,8 +233,7 @@
"BuyRestrictionMax": 1,
"StackObjectsCount": 5
},
"barterScheme": [
{
"barterScheme": [{
"count": 301068,
"_tpl": "5449016a4bdc2d6f028b456f"
}
@ -271,8 +247,7 @@
"BuyRestrictionMax": 1,
"StackObjectsCount": 5
},
"barterScheme": [
{
"barterScheme": [{
"count": 1,
"_tpl": "5c010e350db83400232feec7"
}, {
@ -291,8 +266,7 @@
"itemUpd": {
"StackObjectsCount": 2000
},
"barterScheme": [
{
"barterScheme": [{
"count": 5,
"_tpl": "57513f07245977207e26a311"
}
@ -306,8 +280,7 @@
"BuyRestrictionMax": 1,
"StackObjectsCount": 100
},
"barterScheme": [
{
"barterScheme": [{
"count": 15,
"_tpl": "5d03784a86f774203e7e0c4d"
}, {
@ -330,8 +303,7 @@
"BuyRestrictionMax": 1,
"StackObjectsCount": 2000
},
"barterScheme": [
{
"barterScheme": [{
"count": 1,
"_tpl": "63fc44e2429a8a166c7f61e6"
}
@ -345,8 +317,7 @@
"BuyRestrictionMax": 1,
"StackObjectsCount": 100
},
"barterScheme": [
{
"barterScheme": [{
"count": 4,
"_tpl": "6389c6463485cf0eeb260715"
}
@ -360,8 +331,7 @@
"BuyRestrictionMax": 2,
"StackObjectsCount": 20000
},
"barterScheme": [
{
"barterScheme": [{
"count": 45607,
"_tpl": "5449016a4bdc2d6f028b456f"
}
@ -375,11 +345,27 @@
"BuyRestrictionMax": 5,
"StackObjectsCount": 250
},
"barterScheme": [
{
"barterScheme": [{
"count": 9000,
"_tpl": "5449016a4bdc2d6f028b456f"
}
]
},
"64f8c9a67d39ff0e7624cd69": {
"questName": "Gendarmerie Tickets Please",
"questId": "64e7b9a4aac4cd0a726562cb",
"itemTpl": "62e14904c2699c0ec93adc47",
"itemUpd": {
"BuyRestrictionMax": 4,
"StackObjectsCount": 20000
},
"barterScheme": [{
"count": 1,
"_tpl": "619cbfeb6b8a1b37a54eebfa"
}, {
"count": 1,
"_tpl": "619cbfccbedcde2f5b3f7bdd"
}
]
}
}

View File

@ -30,7 +30,7 @@ namespace AssortGenerator.Common.Helpers
{
var questFilePath = InputFileHelper.GetInputFilePaths().FirstOrDefault(x => x.Contains("quests.json"));
var questDataJson = File.ReadAllText(questFilePath);
var finalisedQuestData = JsonSerializer.Deserialize<Dictionary<string, Quest>> (questDataJson);
var finalisedQuestData = JsonSerializer.Deserialize<Dictionary<string, Quest>>(questDataJson);
var jsondoc = JsonDocument.Parse(questDataJson);
var root = jsondoc.RootElement;
@ -50,22 +50,14 @@ namespace AssortGenerator.Common.Helpers
return jsondoc;
}
public static List<AssortUnlocks> GetAssortUnlocks()
public static List<AssortUnlocks> GetAssortUnlocks(Dictionary<string, Quest> questData)
{
if (_assortUnlocks == null)
{
_assortUnlocks = new List<AssortUnlocks>();
foreach (var quest in GetQuestData().data)
foreach (var quest in questData.Values)
{
// debut
if (quest._id == "5936d90786f7742b1420ba5b")
{
var x = 2;
}
foreach (var reward in quest.rewards.Success)
{
if (string.Equals(reward.type, "assortmentunlock", System.StringComparison.OrdinalIgnoreCase))
foreach (var reward in quest.rewards.Success.Where(x => string.Equals(x.type, "assortmentunlock", System.StringComparison.OrdinalIgnoreCase)))
{
_assortUnlocks.Add(new AssortUnlocks
{
@ -82,10 +74,7 @@ namespace AssortGenerator.Common.Helpers
}
);
}
}
foreach (var reward in quest.rewards.Started)
{
if (string.Equals(reward.type, "assortmentunlock", System.StringComparison.OrdinalIgnoreCase))
foreach (var reward in quest.rewards.Started.Where(x => string.Equals(x.type, "assortmentunlock", System.StringComparison.OrdinalIgnoreCase)))
{
_assortUnlocks.Add(new AssortUnlocks
{
@ -104,7 +93,6 @@ namespace AssortGenerator.Common.Helpers
}
}
}
}
return _assortUnlocks;
}
@ -125,7 +113,7 @@ namespace AssortGenerator.Common.Helpers
{
public string questId { get; set; }
public string itemTpl { get; set; }
public List<Models.Output.Item> items { get;set;}
public List<Models.Output.Item> items { get; set; }
public Upd itemUpd { get; set; }
public List<BarterObject> barterScheme { get; set; }
}

View File

@ -299,7 +299,7 @@ namespace AssortGenerator
private static void UpdateQuestAssortUnlockIds(string traderId, QuestAssort traderQuestAssort, Dictionary<string, Quest> finalisedQuestData, AssortRoot traderAssortRoot)
{
var alreadyMatchedAssortIds = new List<string>();
var assortUnlocks = QuestHelper.GetAssortUnlocks().Where(x => x.TraderId == traderId);
var assortUnlocks = QuestHelper.GetAssortUnlocks(finalisedQuestData).Where(x => x.TraderId == traderId);
foreach (var assort in assortUnlocks)
{
// Find quest that matches quest assort key
@ -392,21 +392,16 @@ namespace AssortGenerator
missingQuestAssorts = new List<AssortUnlocks>();
var result = new QuestAssort();
var questData = QuestHelper.GetQuestData();
var questData = QuestHelper.GetFinalisedQuestData();
// Find assort unlocks
List<AssortUnlocks> assortUnlocks = QuestHelper.GetAssortUnlocks();
List<AssortUnlocks> assortUnlocks = QuestHelper.GetAssortUnlocks(questData);
// Store already matched items
var matchedAssortItemIds = new List<string>();
int unknownCount = 1;
foreach (var assortUnlock in assortUnlocks.Where(x => x.TraderType == trader))
{
if (assortUnlock.QuestId == "64f83bcdde58fc437700d8fa")
{
var x = 2;
}
// Get unlock item details
var assortItemDetailsDB = ItemTemplateHelper.Items.FirstOrDefault(x => x.Key == assortUnlock.ItemUnlockedTemplateId);
var ItemName = assortItemDetailsDB.Value._name;