From 7a3fb095c0941e8f81451d0aea2a86e46ddc1c64 Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 22 Nov 2023 14:24:58 +0000 Subject: [PATCH] Update hoq quest trader assorts are handled --- .../Assets/missingTraderAssortPrices.json | 754 +++++++++--------- AssortGenerator.Common/Helpers/QuestHelper.cs | 72 +- AssortGenerator/Program.cs | 11 +- 3 files changed, 403 insertions(+), 434 deletions(-) diff --git a/AssortGenerator.Common/Assets/missingTraderAssortPrices.json b/AssortGenerator.Common/Assets/missingTraderAssortPrices.json index 4ba1427..0ee014c 100644 --- a/AssortGenerator.Common/Assets/missingTraderAssortPrices.json +++ b/AssortGenerator.Common/Assets/missingTraderAssortPrices.json @@ -1,385 +1,371 @@ { - "647723a2ed3a9d1ca43cbfec": { - "questId": "647710905320c660d91c15a5", - "itemTpl": "5efb0da7a29a85116f6ea05f", - "itemUpd": { - "BuyRestrictionMax": 150, - "StackObjectsCount": 20000 - }, - "barterScheme": [ - { - "count": 700, - "_tpl": "5449016a4bdc2d6f028b456f" - } - ] - }, - "63a235b6f194393ecf632fa3": { - "questId": "63966fbeea19ac7ed845db2e", - "itemTpl": "6389c7750ef44505c87f5996", - "itemUpd": { - "BuyRestrictionMax": 1, - "StackObjectsCount": 100 - }, - "barterScheme": [ - { - "count": 15, - "_tpl": "5d0376a486f7747d8050965c" - }, - { - "count": 10, - "_tpl": "57347c2e24597744902c94a1" - }, - { - "count": 50, - "_tpl": "5c06782b86f77426df5407d2" - }, - { - "count": 5, - "_tpl": "5c05300686f7746dce784e5d" - } - ] - }, - "63a2359ef194393ecf632fa2": { - "questId": "63967028c4a91c5cb76abd81", - "itemTpl": "6389c85357baa773a825b356", - "itemUpd": { - "BuyRestrictionMax": 2, - "StackObjectsCount": 10 - }, - "barterScheme": [ - { - "count": 20, - "_tpl": "6389c70ca33d8c4cdf4932c6" - }, - { - "count": 10, - "_tpl": "5d03775b86f774203e7e0c4b" - }, - { - "count": 12, - "_tpl": "590a386e86f77429692b27ab" - }, - { - "count": 16, - "_tpl": "5c05308086f7746b2101e90b" - }, - { - "count": 16, - "_tpl": "5c05300686f7746dce784e5d" - } - ] - }, - "64764dc585699632555ed176": { - "questId": "64764abcd125ab430a14ccb5", - "itemTpl": "59e0d99486f7744a32234762", - "itemUpd": { - "BuyRestrictionMax": 180, - "StackObjectsCount": 650000 - }, - "barterScheme": [ - { - "count": 1099, - "_tpl": "5449016a4bdc2d6f028b456f" - } - ] - }, - "5ac6699186f77403de1f5cf1": { - "questId": "597a0f5686f774273b74f676", - "itemTpl": "5aa7e4a4e5b5b000137b76f2", - "itemUpd": { - "BuyRestrictionMax": 3, - "StackObjectsCount": 200 - }, - "barterScheme": [ - { - "count": 35000, - "_tpl": "5449016a4bdc2d6f028b456f" - } - ] - }, - "64bf9e93f2dec80e000e69e8": { - "questId": "64b907bd55f4156df8007d14", - "itemTpl": "63a0b2eabea67a6d93009e52", - "itemUpd": { - "BuyRestrictionMax": 5, - "StackObjectsCount": 200 - }, - "barterScheme": [ - { - "count": 20000, - "_tpl": "5449016a4bdc2d6f028b456f" - } - ] - }, - "63a9f74ac31b00242d28a9c8": { - "questname": "Best Job in the World", - "questId": "63a9ae24009ffc6a551631a5", - "itemTpl": "62e7e7bbe6da9612f743f1e0", - "itemUpd": { - "BuyRestrictionMax": 2, - "StackObjectsCount": 50 - }, - "barterScheme": [ - { - "count": 1, - "_tpl": "5c12613b86f7743bbe2c3f76" - },{ - "count": 2, - "_tpl": "5d0379a886f77420407aa271" - } - ] - }, - "63a9f750009ffc6a551631d0": { - "questname": "Best Job in the World", - "questId": "63a9ae24009ffc6a551631a5", - "itemTpl": "5656eb674bdc2d35148b457c", - "itemUpd": { - "BuyRestrictionMax": 10, - "StackObjectsCount": 60 - }, - "barterScheme": [ - { - "count": 15120, - "_tpl": "5449016a4bdc2d6f028b456f" - } - ] - }, - "6491e75a3feb0c6db85581c7": { - "questName": "Failed Setup", - "questId": "64916da7ad4e722c106f2345", - "itemTpl": "6357c98711fb55120211f7e1", - "itemUpd": { - "BuyRestrictionMax": 2, - "StackObjectsCount": 200000 - }, - "barterScheme": [ - { - "count": 55552, - "_tpl": "5449016a4bdc2d6f028b456f" - } - ] - }, - "6491e7730509dd09725d7066": { - "questName": "Failed Setup", - "questId": "64916da7ad4e722c106f2345", - "itemTpl": "5ede475b549eed7c6d5c18fb", - "itemUpd": { - "BuyRestrictionMax": 10, - "StackObjectsCount": 2000000 - }, - "barterScheme": [ - { - "count": 12544, - "_tpl": "5449016a4bdc2d6f028b456f" - } - ] - }, - "62a703ea4de19a4c3422ea67": { - "questId": "", - "itemTpl": "5e85a9f4add9fe03027d9bf1", - "itemUpd": { - "BuyRestrictionMax": 10, - "StackObjectsCount": 20 - }, - "barterScheme": [ - { - "count": 3381, - "_tpl": "5449016a4bdc2d6f028b456f" - } - ] - }, - "649b182a49f5fa538c64e4fb": { - "questId": "649af47d717cb30e7e4b5e26", - "itemTpl": "5b2388675acfc4771e1be0be", - "itemUpd": { - "BuyRestrictionMax": 10, - "StackObjectsCount": 20 - }, - "barterScheme": [ - { - "count": 45000, - "_tpl": "5449016a4bdc2d6f028b456f" - } - ] - }, - "649b18300329282a376bda05": { - "questId": "649af47d717cb30e7e4b5e26", - "itemTpl": "618ba27d9008e4636a67f61d", - "itemUpd": { - "BuyRestrictionMax": 2, - "StackObjectsCount": 20 - }, - "barterScheme": [ - { - "count": 115000, - "_tpl": "5449016a4bdc2d6f028b456f" - } - ] - }, - "649b1836fb67e3338f540ce5": { - "questId": "649af47d717cb30e7e4b5e26", - "itemTpl": "5b3b99475acfc432ff4dcbee", - "itemUpd": { - "BuyRestrictionMax": 2, - "StackObjectsCount": 20 - }, - "barterScheme": [ - { - "count": 80000, - "_tpl": "5449016a4bdc2d6f028b456f" - } - ] - }, - "64bd432d6de7c555ad051726": { - "questId": "64b907a85e9b86ab7a08cf0d", - "itemTpl": "5ac4cd105acfc40016339859", - "itemUpd": { - "BuyRestrictionMax": 2, - "StackObjectsCount": 40000 - }, - "barterScheme": [ - { - "count": 1, - "_tpl": "5d403f9186f7743cac3f229b" - }, - { - "count": 1, - "_tpl": "62a0a0bb621468534a797ad5" - } - ] - }, - "600306ee63625014312be3bb": { - "questName": "Hunter", - "questId": "649af47d717cb30e7e4b5e26", - "itemTpl": "5fc22d7c187fea44d52eda44", - "itemUpd": { - "BuyRestrictionMax": 1, - "StackObjectsCount": 5 - }, - "barterScheme": [ - { - "count": 301068, - "_tpl": "5449016a4bdc2d6f028b456f" - } - ] - }, - "63a9d1a4009ffc6a551631b6": { - "questName": "Slaughterhouse", - "questId": "63a9b36cc31b00242d28a99f", - "itemTpl": "63920105a83e15700a00f168", - "itemUpd": { - "BuyRestrictionMax": 1, - "StackObjectsCount": 5 - }, - "barterScheme": [ - { - "count": 1, - "_tpl": "5c010e350db83400232feec7" - }, { - "count": 1, - "_tpl": "5bffdc370db834001d23eca8" - }, { - "count": 1, - "_tpl": "5bffe7930db834001b734a39" - } - ] - }, - "64f8cd7133ff7561c87643f1": { - "questName": "Ambulances Again", - "questId": "64f3176921045e77405d63b5", - "itemTpl": "5c0e530286f7747fa1419862", - "itemUpd": { - "StackObjectsCount": 2000 - }, - "barterScheme": [ - { - "count": 5, - "_tpl": "57513f07245977207e26a311" - } - ] - }, - "63a2350cd6d4651e53602b02": { - "questName": "Following the Bread Crumbs", - "questId": "639670029113f06a7c3b2377", - "itemTpl": "6389c7f115805221fb410466", - "itemUpd": { - "BuyRestrictionMax": 1, - "StackObjectsCount": 100 - }, - "barterScheme": [ - { - "count": 15, - "_tpl": "5d03784a86f774203e7e0c4d" - }, { - "count": 50, - "_tpl": "5c06779c86f77426e00dd782" - }, { - "count": 10, - "_tpl": "590a3efd86f77437d351a25b" - }, { - "count": 8, - "_tpl": "5c052f6886f7746b1e3db148" - } - ] - }, - "64f8d0b1c8626c7d46040668": { - "questName": "Huntsman Path Big Game", - "questId": "64e7b971f9d6fa49d6769b44", - "itemTpl": "63fc44e2429a8a166c7f61e6", - "itemUpd": { - "BuyRestrictionMax": 1, - "StackObjectsCount": 2000 - }, - "barterScheme": [ - { - "count": 1, - "_tpl": "63fc44e2429a8a166c7f61e6" - } - ] - }, - "64f8c9f67e981f7f0110d507": { - "questName": "Gendarmerie - Mall Cop", - "questId": "64e7b99017ab941a6f7bf9d7", - "itemTpl": "59f98b4986f7746f546d2cef", - "itemUpd": { - "BuyRestrictionMax": 1, - "StackObjectsCount": 100 - }, - "barterScheme": [ - { - "count": 4, - "_tpl": "6389c6463485cf0eeb260715" - } - ] - }, - "6491e72ff8040d427a3a5c26": { - "questName": "Failed Setup", - "questId": "64916da7ad4e722c106f2345", - "itemTpl": "62e7e7bbe6da9612f743f1e0", - "itemUpd": { - "BuyRestrictionMax": 2, - "StackObjectsCount": 20000 - }, - "barterScheme": [ - { - "count": 45607, - "_tpl": "5449016a4bdc2d6f028b456f" - } - ] - }, - "6491e749ad4e722c106f2348": { - "questName": "Failed Setup", - "questId": "64916da7ad4e722c106f2345", - "itemTpl": "5656eb674bdc2d35148b457c", - "itemUpd": { - "BuyRestrictionMax": 5, - "StackObjectsCount": 250 - }, - "barterScheme": [ - { - "count": 9000, - "_tpl": "5449016a4bdc2d6f028b456f" - } - ] - } -} \ No newline at end of file + "647723a2ed3a9d1ca43cbfec": { + "questId": "647710905320c660d91c15a5", + "itemTpl": "5efb0da7a29a85116f6ea05f", + "itemUpd": { + "BuyRestrictionMax": 150, + "StackObjectsCount": 20000 + }, + "barterScheme": [{ + "count": 700, + "_tpl": "5449016a4bdc2d6f028b456f" + } + ] + }, + "63a235b6f194393ecf632fa3": { + "questId": "63966fbeea19ac7ed845db2e", + "itemTpl": "6389c7750ef44505c87f5996", + "itemUpd": { + "BuyRestrictionMax": 1, + "StackObjectsCount": 100 + }, + "barterScheme": [{ + "count": 15, + "_tpl": "5d0376a486f7747d8050965c" + }, { + "count": 10, + "_tpl": "57347c2e24597744902c94a1" + }, { + "count": 50, + "_tpl": "5c06782b86f77426df5407d2" + }, { + "count": 5, + "_tpl": "5c05300686f7746dce784e5d" + } + ] + }, + "63a2359ef194393ecf632fa2": { + "questId": "63967028c4a91c5cb76abd81", + "itemTpl": "6389c85357baa773a825b356", + "itemUpd": { + "BuyRestrictionMax": 2, + "StackObjectsCount": 10 + }, + "barterScheme": [{ + "count": 20, + "_tpl": "6389c70ca33d8c4cdf4932c6" + }, { + "count": 10, + "_tpl": "5d03775b86f774203e7e0c4b" + }, { + "count": 12, + "_tpl": "590a386e86f77429692b27ab" + }, { + "count": 16, + "_tpl": "5c05308086f7746b2101e90b" + }, { + "count": 16, + "_tpl": "5c05300686f7746dce784e5d" + } + ] + }, + "64764dc585699632555ed176": { + "questId": "64764abcd125ab430a14ccb5", + "itemTpl": "59e0d99486f7744a32234762", + "itemUpd": { + "BuyRestrictionMax": 180, + "StackObjectsCount": 650000 + }, + "barterScheme": [{ + "count": 1099, + "_tpl": "5449016a4bdc2d6f028b456f" + } + ] + }, + "5ac6699186f77403de1f5cf1": { + "questId": "597a0f5686f774273b74f676", + "itemTpl": "5aa7e4a4e5b5b000137b76f2", + "itemUpd": { + "BuyRestrictionMax": 3, + "StackObjectsCount": 200 + }, + "barterScheme": [{ + "count": 35000, + "_tpl": "5449016a4bdc2d6f028b456f" + } + ] + }, + "64bf9e93f2dec80e000e69e8": { + "questId": "64b907bd55f4156df8007d14", + "itemTpl": "63a0b2eabea67a6d93009e52", + "itemUpd": { + "BuyRestrictionMax": 5, + "StackObjectsCount": 200 + }, + "barterScheme": [{ + "count": 20000, + "_tpl": "5449016a4bdc2d6f028b456f" + } + ] + }, + "63a9f74ac31b00242d28a9c8": { + "questname": "Best Job in the World", + "questId": "63a9ae24009ffc6a551631a5", + "itemTpl": "62e7e7bbe6da9612f743f1e0", + "itemUpd": { + "BuyRestrictionMax": 2, + "StackObjectsCount": 50 + }, + "barterScheme": [{ + "count": 1, + "_tpl": "5c12613b86f7743bbe2c3f76" + }, { + "count": 2, + "_tpl": "5d0379a886f77420407aa271" + } + ] + }, + "63a9f750009ffc6a551631d0": { + "questname": "Best Job in the World", + "questId": "63a9ae24009ffc6a551631a5", + "itemTpl": "5656eb674bdc2d35148b457c", + "itemUpd": { + "BuyRestrictionMax": 10, + "StackObjectsCount": 60 + }, + "barterScheme": [{ + "count": 15120, + "_tpl": "5449016a4bdc2d6f028b456f" + } + ] + }, + "6491e75a3feb0c6db85581c7": { + "questName": "Failed Setup", + "questId": "64916da7ad4e722c106f2345", + "itemTpl": "6357c98711fb55120211f7e1", + "itemUpd": { + "BuyRestrictionMax": 2, + "StackObjectsCount": 200000 + }, + "barterScheme": [{ + "count": 55552, + "_tpl": "5449016a4bdc2d6f028b456f" + } + ] + }, + "6491e7730509dd09725d7066": { + "questName": "Failed Setup", + "questId": "64916da7ad4e722c106f2345", + "itemTpl": "5ede475b549eed7c6d5c18fb", + "itemUpd": { + "BuyRestrictionMax": 10, + "StackObjectsCount": 2000000 + }, + "barterScheme": [{ + "count": 12544, + "_tpl": "5449016a4bdc2d6f028b456f" + } + ] + }, + "62a703ea4de19a4c3422ea67": { + "questId": "", + "itemTpl": "5e85a9f4add9fe03027d9bf1", + "itemUpd": { + "BuyRestrictionMax": 10, + "StackObjectsCount": 20 + }, + "barterScheme": [{ + "count": 3381, + "_tpl": "5449016a4bdc2d6f028b456f" + } + ] + }, + "649b182a49f5fa538c64e4fb": { + "questId": "649af47d717cb30e7e4b5e26", + "itemTpl": "5b2388675acfc4771e1be0be", + "itemUpd": { + "BuyRestrictionMax": 10, + "StackObjectsCount": 20 + }, + "barterScheme": [{ + "count": 45000, + "_tpl": "5449016a4bdc2d6f028b456f" + } + ] + }, + "649b18300329282a376bda05": { + "questId": "649af47d717cb30e7e4b5e26", + "itemTpl": "618ba27d9008e4636a67f61d", + "itemUpd": { + "BuyRestrictionMax": 2, + "StackObjectsCount": 20 + }, + "barterScheme": [{ + "count": 115000, + "_tpl": "5449016a4bdc2d6f028b456f" + } + ] + }, + "649b1836fb67e3338f540ce5": { + "questId": "649af47d717cb30e7e4b5e26", + "itemTpl": "5b3b99475acfc432ff4dcbee", + "itemUpd": { + "BuyRestrictionMax": 2, + "StackObjectsCount": 20 + }, + "barterScheme": [{ + "count": 80000, + "_tpl": "5449016a4bdc2d6f028b456f" + } + ] + }, + "64bd432d6de7c555ad051726": { + "questId": "64b907a85e9b86ab7a08cf0d", + "itemTpl": "5ac4cd105acfc40016339859", + "itemUpd": { + "BuyRestrictionMax": 2, + "StackObjectsCount": 40000 + }, + "barterScheme": [{ + "count": 1, + "_tpl": "5d403f9186f7743cac3f229b" + }, { + "count": 1, + "_tpl": "62a0a0bb621468534a797ad5" + } + ] + }, + "600306ee63625014312be3bb": { + "questName": "Hunter", + "questId": "649af47d717cb30e7e4b5e26", + "itemTpl": "5fc22d7c187fea44d52eda44", + "itemUpd": { + "BuyRestrictionMax": 1, + "StackObjectsCount": 5 + }, + "barterScheme": [{ + "count": 301068, + "_tpl": "5449016a4bdc2d6f028b456f" + } + ] + }, + "63a9d1a4009ffc6a551631b6": { + "questName": "Slaughterhouse", + "questId": "63a9b36cc31b00242d28a99f", + "itemTpl": "63920105a83e15700a00f168", + "itemUpd": { + "BuyRestrictionMax": 1, + "StackObjectsCount": 5 + }, + "barterScheme": [{ + "count": 1, + "_tpl": "5c010e350db83400232feec7" + }, { + "count": 1, + "_tpl": "5bffdc370db834001d23eca8" + }, { + "count": 1, + "_tpl": "5bffe7930db834001b734a39" + } + ] + }, + "64f8cd7133ff7561c87643f1": { + "questName": "Ambulances Again", + "questId": "64f3176921045e77405d63b5", + "itemTpl": "5c0e530286f7747fa1419862", + "itemUpd": { + "StackObjectsCount": 2000 + }, + "barterScheme": [{ + "count": 5, + "_tpl": "57513f07245977207e26a311" + } + ] + }, + "63a2350cd6d4651e53602b02": { + "questName": "Following the Bread Crumbs", + "questId": "639670029113f06a7c3b2377", + "itemTpl": "6389c7f115805221fb410466", + "itemUpd": { + "BuyRestrictionMax": 1, + "StackObjectsCount": 100 + }, + "barterScheme": [{ + "count": 15, + "_tpl": "5d03784a86f774203e7e0c4d" + }, { + "count": 50, + "_tpl": "5c06779c86f77426e00dd782" + }, { + "count": 10, + "_tpl": "590a3efd86f77437d351a25b" + }, { + "count": 8, + "_tpl": "5c052f6886f7746b1e3db148" + } + ] + }, + "64f8d0b1c8626c7d46040668": { + "questName": "Huntsman Path Big Game", + "questId": "64e7b971f9d6fa49d6769b44", + "itemTpl": "63fc44e2429a8a166c7f61e6", + "itemUpd": { + "BuyRestrictionMax": 1, + "StackObjectsCount": 2000 + }, + "barterScheme": [{ + "count": 1, + "_tpl": "63fc44e2429a8a166c7f61e6" + } + ] + }, + "64f8c9f67e981f7f0110d507": { + "questName": "Gendarmerie - Mall Cop", + "questId": "64e7b99017ab941a6f7bf9d7", + "itemTpl": "59f98b4986f7746f546d2cef", + "itemUpd": { + "BuyRestrictionMax": 1, + "StackObjectsCount": 100 + }, + "barterScheme": [{ + "count": 4, + "_tpl": "6389c6463485cf0eeb260715" + } + ] + }, + "6491e72ff8040d427a3a5c26": { + "questName": "Failed Setup", + "questId": "64916da7ad4e722c106f2345", + "itemTpl": "62e7e7bbe6da9612f743f1e0", + "itemUpd": { + "BuyRestrictionMax": 2, + "StackObjectsCount": 20000 + }, + "barterScheme": [{ + "count": 45607, + "_tpl": "5449016a4bdc2d6f028b456f" + } + ] + }, + "6491e749ad4e722c106f2348": { + "questName": "Failed Setup", + "questId": "64916da7ad4e722c106f2345", + "itemTpl": "5656eb674bdc2d35148b457c", + "itemUpd": { + "BuyRestrictionMax": 5, + "StackObjectsCount": 250 + }, + "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" + } + ] + } +} diff --git a/AssortGenerator.Common/Helpers/QuestHelper.cs b/AssortGenerator.Common/Helpers/QuestHelper.cs index e5ee6a9..6169396 100644 --- a/AssortGenerator.Common/Helpers/QuestHelper.cs +++ b/AssortGenerator.Common/Helpers/QuestHelper.cs @@ -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> (questDataJson); + var finalisedQuestData = JsonSerializer.Deserialize>(questDataJson); var jsondoc = JsonDocument.Parse(questDataJson); var root = jsondoc.RootElement; @@ -50,58 +50,46 @@ namespace AssortGenerator.Common.Helpers return jsondoc; } - public static List GetAssortUnlocks() + public static List GetAssortUnlocks(Dictionary questData) { if (_assortUnlocks == null) { _assortUnlocks = new List(); - foreach (var quest in GetQuestData().data) + foreach (var quest in questData.Values) { - // debut - if (quest._id == "5936d90786f7742b1420ba5b") + foreach (var reward in quest.rewards.Success.Where(x => string.Equals(x.type, "assortmentunlock", System.StringComparison.OrdinalIgnoreCase))) { - var x = 2; - } - - foreach (var reward in quest.rewards.Success) - { - if (string.Equals(reward.type, "assortmentunlock", System.StringComparison.OrdinalIgnoreCase)) + _assortUnlocks.Add(new AssortUnlocks { - _assortUnlocks.Add(new AssortUnlocks - { - AssortUnlockId = reward.id, - ItemUnlockedId = reward.target, - ItemUnlockedTemplateId = reward.items[0]._tpl, - LoyaltyLevel = (int)reward.loyaltyLevel, - QuestId = quest._id, - QuestRewardId = reward.id, - TraderId = reward.traderId, - TraderType = TraderHelper.GetTraderTypeById(reward.traderId), - Criteria = "Success", - Items = reward.items - } - ); + AssortUnlockId = reward.id, + ItemUnlockedId = reward.target, + ItemUnlockedTemplateId = reward.items[0]._tpl, + LoyaltyLevel = (int)reward.loyaltyLevel, + QuestId = quest._id, + QuestRewardId = reward.id, + TraderId = reward.traderId, + TraderType = TraderHelper.GetTraderTypeById(reward.traderId), + Criteria = "Success", + Items = reward.items } + ); } - foreach (var reward in quest.rewards.Started) + foreach (var reward in quest.rewards.Started.Where(x => string.Equals(x.type, "assortmentunlock", System.StringComparison.OrdinalIgnoreCase))) { - if (string.Equals(reward.type, "assortmentunlock", System.StringComparison.OrdinalIgnoreCase)) + _assortUnlocks.Add(new AssortUnlocks { - _assortUnlocks.Add(new AssortUnlocks - { - AssortUnlockId = reward.id, - ItemUnlockedId = reward.target, - ItemUnlockedTemplateId = reward.items[0]._tpl, - LoyaltyLevel = (int)reward.loyaltyLevel, - QuestId = quest._id, - QuestRewardId = reward.id, - TraderId = reward.traderId, - TraderType = TraderHelper.GetTraderTypeById(reward.traderId), - Criteria = "Started", - Items = reward.items - } - ); + AssortUnlockId = reward.id, + ItemUnlockedId = reward.target, + ItemUnlockedTemplateId = reward.items[0]._tpl, + LoyaltyLevel = (int)reward.loyaltyLevel, + QuestId = quest._id, + QuestRewardId = reward.id, + TraderId = reward.traderId, + TraderType = TraderHelper.GetTraderTypeById(reward.traderId), + Criteria = "Started", + Items = reward.items } + ); } } } @@ -125,7 +113,7 @@ namespace AssortGenerator.Common.Helpers { public string questId { get; set; } public string itemTpl { get; set; } - public List items { get;set;} + public List items { get; set; } public Upd itemUpd { get; set; } public List barterScheme { get; set; } } diff --git a/AssortGenerator/Program.cs b/AssortGenerator/Program.cs index f7d5473..21bb85c 100644 --- a/AssortGenerator/Program.cs +++ b/AssortGenerator/Program.cs @@ -299,7 +299,7 @@ namespace AssortGenerator private static void UpdateQuestAssortUnlockIds(string traderId, QuestAssort traderQuestAssort, Dictionary finalisedQuestData, AssortRoot traderAssortRoot) { var alreadyMatchedAssortIds = new List(); - 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(); var result = new QuestAssort(); - var questData = QuestHelper.GetQuestData(); + var questData = QuestHelper.GetFinalisedQuestData(); // Find assort unlocks - List assortUnlocks = QuestHelper.GetAssortUnlocks(); + List assortUnlocks = QuestHelper.GetAssortUnlocks(questData); // Store already matched items var matchedAssortItemIds = new List(); 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;