Read missing questAssort prices data and insert into trader assort data
This commit is contained in:
parent
2abf70a978
commit
4cb12456b4
156
AssortGenerator.Common/Assets/missingTraderAssortPrices.json
Normal file
156
AssortGenerator.Common/Assets/missingTraderAssortPrices.json
Normal file
@ -0,0 +1,156 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
},
|
||||
"6491e72ff8040d427a3a5c26": {
|
||||
"questId": "64916da7ad4e722c106f2345",
|
||||
"itemTpl": "62e7e7bbe6da9612f743f1e0",
|
||||
"itemUpd": {
|
||||
"BuyRestrictionMax": 2,
|
||||
"StackObjectsCount": 50
|
||||
},
|
||||
"barterScheme": [
|
||||
{
|
||||
"count": 45607,
|
||||
"_tpl": "5449016a4bdc2d6f028b456f"
|
||||
}
|
||||
]
|
||||
},
|
||||
"6491e749ad4e722c106f2348": {
|
||||
"questId": "64916da7ad4e722c106f2345",
|
||||
"itemTpl": "5656eb674bdc2d35148b457c",
|
||||
"itemUpd": {
|
||||
"BuyRestrictionMax": 10,
|
||||
"StackObjectsCount": 60
|
||||
},
|
||||
"barterScheme": [
|
||||
{
|
||||
"count": 15120,
|
||||
"_tpl": "5449016a4bdc2d6f028b456f"
|
||||
}
|
||||
]
|
||||
},
|
||||
"6491e75a3feb0c6db85581c7": {
|
||||
"questId": "64916da7ad4e722c106f2345",
|
||||
"itemTpl": "6357c98711fb55120211f7e1",
|
||||
"itemUpd": {
|
||||
"BuyRestrictionMax": 2,
|
||||
"StackObjectsCount": 15
|
||||
},
|
||||
"barterScheme": [
|
||||
{
|
||||
"count": 55552,
|
||||
"_tpl": "5449016a4bdc2d6f028b456f"
|
||||
}
|
||||
]
|
||||
},
|
||||
"6491e7730509dd09725d7066": {
|
||||
"questId": "64916da7ad4e722c106f2345",
|
||||
"itemTpl": "5ede475b549eed7c6d5c18fb",
|
||||
"itemUpd": {
|
||||
"BuyRestrictionMax": 10,
|
||||
"StackObjectsCount": 60
|
||||
},
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -12,6 +12,9 @@
|
||||
<None Update="Assets\items.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\missingTraderAssortPrices.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,5 +1,6 @@
|
||||
using AssortGenerator.Models.Input;
|
||||
using AssortGenerator.Models.Other;
|
||||
using AssortGenerator.Models.Output;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@ -11,6 +12,7 @@ namespace AssortGenerator.Common.Helpers
|
||||
{
|
||||
private static QuestRoot _questData;
|
||||
private static List<AssortUnlocks> _assortUnlocks;
|
||||
private static Dictionary<string, MissingAssortPrice> _missingTraderQuestPrices;
|
||||
public static QuestRoot GetQuestData()
|
||||
{
|
||||
if (_questData == null)
|
||||
@ -105,5 +107,25 @@ namespace AssortGenerator.Common.Helpers
|
||||
|
||||
return _assortUnlocks;
|
||||
}
|
||||
|
||||
public static Dictionary<string, MissingAssortPrice> GetMissingTraderQuestPrices()
|
||||
{
|
||||
if (_missingTraderQuestPrices == null)
|
||||
{
|
||||
var questFilePath = InputFileHelper.GetInputFilePaths().FirstOrDefault(x => x.Contains("missingTraderAssortPrices"));
|
||||
var questDataJson = File.ReadAllText(questFilePath);
|
||||
_missingTraderQuestPrices = JsonSerializer.Deserialize<Dictionary<string, MissingAssortPrice>>(questDataJson);
|
||||
}
|
||||
|
||||
return _missingTraderQuestPrices;
|
||||
}
|
||||
|
||||
public class MissingAssortPrice
|
||||
{
|
||||
public string questId { get; set; }
|
||||
public string itemTpl { get; set; }
|
||||
public Upd itemUpd { get; set; }
|
||||
public List<BarterObject> barterScheme { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using static AssortGenerator.Common.Helpers.QuestHelper;
|
||||
|
||||
namespace AssortGenerator
|
||||
{
|
||||
@ -23,6 +24,7 @@ namespace AssortGenerator
|
||||
// Get trader assort files from assorts input folder
|
||||
var traderAssortFilePaths = InputFileHelper.GetInputFilePaths().Where(x => TraderHelper.GetTraders().Values.Any(x.Contains)).ToList();
|
||||
var finalisedQuestData = QuestHelper.GetFinalisedQuestData();
|
||||
var missingQuestAssortPrices = QuestHelper.GetMissingTraderQuestPrices();
|
||||
foreach (var trader in TraderHelper.GetTraders())
|
||||
{
|
||||
// Get relevant trader dump
|
||||
@ -53,7 +55,7 @@ namespace AssortGenerator
|
||||
var loyaltyLevelItemsJson = data.GetProperty("loyal_level_items").ToString();
|
||||
var loyaltyLevelItems = JsonSerializer.Deserialize<Dictionary<string, int>>(loyaltyLevelItemsJson);
|
||||
|
||||
WriteOutputFilesForTrader(trader, items, barterSchemeItems, loyaltyLevelItems, finalisedQuestData);
|
||||
WriteOutputFilesForTrader(trader, items, barterSchemeItems, loyaltyLevelItems, finalisedQuestData, missingQuestAssortPrices);
|
||||
}
|
||||
|
||||
JsonWriter.WriteJson(finalisedQuestData, "", Directory.GetCurrentDirectory(), "quests");
|
||||
@ -131,7 +133,9 @@ namespace AssortGenerator
|
||||
List<Item> items,
|
||||
Dictionary<string, List<List<BarterObject>>> barterSchemeItems,
|
||||
Dictionary<string, int> loyaltyLevelItems,
|
||||
Dictionary<string, Quest> finalisedQuestData)
|
||||
Dictionary<string, Quest> finalisedQuestData,
|
||||
Dictionary<string, MissingAssortPrice> missingQuestAssortPrices
|
||||
)
|
||||
{
|
||||
var workingPath = Directory.GetCurrentDirectory();
|
||||
|
||||
@ -150,7 +154,7 @@ namespace AssortGenerator
|
||||
var outputBaseFile = traderData.data.Find(x => x._id == trader.Value);
|
||||
|
||||
QuestAssort questAssort = GenerateQuestAssortForTrader(trader.Key, outputAssortFile, out List<AssortUnlocks> missingQuestAssorts);
|
||||
AttemptToAddMissingQuestAssorts(outputAssortFile, questAssort, missingQuestAssorts);
|
||||
AttemptToAddMissingQuestAssorts(outputAssortFile, questAssort, missingQuestAssorts, missingQuestAssortPrices);
|
||||
|
||||
JsonWriter.WriteJson(outputBaseFile, traderFolderPath, workingPath, "base");
|
||||
JsonWriter.WriteJson(outputAssortFile, traderFolderPath, workingPath, "assort");
|
||||
@ -165,7 +169,7 @@ namespace AssortGenerator
|
||||
}
|
||||
}
|
||||
|
||||
private static void AttemptToAddMissingQuestAssorts(AssortRoot outputAssortFile, QuestAssort questAssort, List<AssortUnlocks> missingQuestAssorts)
|
||||
private static void AttemptToAddMissingQuestAssorts(AssortRoot outputAssortFile, QuestAssort questAssort, List<AssortUnlocks> missingQuestAssorts, Dictionary<string, MissingAssortPrice> missingQuestAssortPrices)
|
||||
{
|
||||
// iterate over each missing assort
|
||||
foreach (var missingQuestAssort in missingQuestAssorts)
|
||||
@ -191,24 +195,33 @@ namespace AssortGenerator
|
||||
_tpl = missingQuestAssort.Items[0]._tpl,
|
||||
_id = missingQuestAssort.Items[0]._id,
|
||||
parentId = "hideout",
|
||||
slotId = "hideout",
|
||||
upd = new Upd
|
||||
{
|
||||
StackObjectsCount = 10
|
||||
}
|
||||
slotId = "hideout"
|
||||
};
|
||||
|
||||
var questAssortPriceData = missingQuestAssortPrices.TryGetValue(missingQuestAssort.AssortUnlockId, out var value);
|
||||
if (questAssortPriceData && value.itemTpl == missingQuestAssort.Items[0]._tpl)
|
||||
{
|
||||
item.upd = value.itemUpd;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.upd = new Upd() { StackObjectsCount = 10 };
|
||||
}
|
||||
|
||||
outputAssortFile.items.Add(item);
|
||||
|
||||
var barterItemListInner = new List<BarterObject>
|
||||
{
|
||||
// 10,000 Roubles
|
||||
new BarterObject() { _tpl = "5449016a4bdc2d6f028b456f", count = 25000 }
|
||||
};
|
||||
var barterItemListOuter = new List<List<BarterObject>>
|
||||
{
|
||||
barterItemListInner
|
||||
};
|
||||
var barterItemListInner = new List<BarterObject>();
|
||||
|
||||
if (questAssortPriceData && value.itemTpl == missingQuestAssort.Items[0]._tpl)
|
||||
{
|
||||
barterItemListInner.AddRange(value.barterScheme);
|
||||
}
|
||||
else
|
||||
{
|
||||
barterItemListInner.Add(new BarterObject() { _tpl = "5449016a4bdc2d6f028b456f", count = 25000 });
|
||||
}
|
||||
|
||||
var barterItemListOuter = new List<List<BarterObject>> { barterItemListInner };
|
||||
outputAssortFile.barter_scheme.Add(missingQuestAssort.Items[0]._id, barterItemListOuter);
|
||||
|
||||
outputAssortFile.loyal_level_items[missingQuestAssort.Items[0]._id] = missingQuestAssort.LoyaltyLevel;
|
||||
|
Loading…
x
Reference in New Issue
Block a user