Created modhelper class and updated examples to make use of it
This commit is contained in:
@@ -3,6 +3,7 @@ using Core.Models.Eft.Common.Tables;
|
||||
using Core.Models.Spt.Config;
|
||||
using Core.Models.Spt.Server;
|
||||
using Core.Utils;
|
||||
using Core.Utils.Cloners;
|
||||
|
||||
namespace _13._1AddTraderWithDynamicAssorts
|
||||
{
|
||||
@@ -34,18 +35,14 @@ namespace _13._1AddTraderWithDynamicAssorts
|
||||
* @param tables database
|
||||
* @param jsonUtil json utility class
|
||||
*/
|
||||
public void AddTraderToDb(TraderBase traderDetailsToAdd, DatabaseTables tables, JsonUtil jsonUtil, object assortJson)
|
||||
public void AddTraderToDb(TraderBase traderDetailsToAdd, DatabaseTables tables, ICloner cloner, TraderAssort assort)
|
||||
{
|
||||
// Create trader data ready to add to database
|
||||
var traderDataToAdd = new Trader
|
||||
{
|
||||
Assort =
|
||||
jsonUtil.Deserialize<TraderAssort>(
|
||||
jsonUtil.Serialize(assortJson)), // Deserialise/serialise creates a copy of the json
|
||||
Base =
|
||||
jsonUtil.Deserialize<TraderBase>(
|
||||
jsonUtil.Serialize(traderDetailsToAdd)), // Deserialise/serialise creates a copy of the json
|
||||
QuestAssort = new Dictionary<string, Dictionary<string, string>> // questassort is empty as trader has no assorts unlocked by quests
|
||||
Assort = cloner.Clone(assort),
|
||||
Base = cloner.Clone(traderDetailsToAdd),
|
||||
QuestAssort = new Dictionary<string, Dictionary<string, string>> // quest assort is empty as trader has no assorts unlocked by quests
|
||||
{
|
||||
{ "Started", new Dictionary<string, string>() },
|
||||
{ "Success", new Dictionary<string, string>() },
|
||||
|
||||
Reference in New Issue
Block a user