public static void ModifyInstanceID(Player player, RecipeModsIID iidMod, WorldObject source, WorldObject target, WorldObject result) { var op = (ModifyOp)iidMod.Enum; var prop = (PropertyInstanceId)iidMod.Stat; var value = iidMod.Value; var sourceMod = GetSourceMod((SourceType)iidMod.Unknown1, player, source); switch (op) { case ModifyOp.SetValue: target.SetProperty(prop, value); break; case ModifyOp.CopyTarget: target.SetProperty(prop, sourceMod.GetProperty(prop) ?? 0); break; case ModifyOp.CopyCreate: result.SetProperty(prop, sourceMod.GetProperty(prop) ?? 0); break; default: log.Warn($"RecipeManager.ModifyInstanceID({source.Name}, {target.Name}): unhandled operation {op}"); break; } }
public void AddRecord(List <string> fields) { if (CurrentTable == Table.Recipe) { Recipe = new Recipe(); PopulateFields(Recipe, fields); } else if (CurrentTable == Table.RecipeRequirementsBool) { var record = new RecipeRequirementsBool(); PopulateFields(record, fields); Recipe.RecipeRequirementsBool.Add(record); } else if (CurrentTable == Table.RecipeRequirementsDID) { var record = new RecipeRequirementsDID(); PopulateFields(record, fields); Recipe.RecipeRequirementsDID.Add(record); } else if (CurrentTable == Table.RecipeRequirementsFloat) { var record = new RecipeRequirementsFloat(); PopulateFields(record, fields); Recipe.RecipeRequirementsFloat.Add(record); } else if (CurrentTable == Table.RecipeRequirementsIID) { var record = new RecipeRequirementsIID(); PopulateFields(record, fields); Recipe.RecipeRequirementsIID.Add(record); } else if (CurrentTable == Table.RecipeRequirementsInt) { var record = new RecipeRequirementsInt(); PopulateFields(record, fields); Recipe.RecipeRequirementsInt.Add(record); } else if (CurrentTable == Table.RecipeRequirementsString) { var record = new RecipeRequirementsString(); PopulateFields(record, fields); Recipe.RecipeRequirementsString.Add(record); } else if (CurrentTable == Table.RecipeMod) { CurrentRecipeMod = new RecipeMod(); PopulateFields(CurrentRecipeMod, fields); Recipe.RecipeMod.Add(CurrentRecipeMod); } else if (CurrentTable == Table.RecipeModsBool) { var record = new RecipeModsBool(); PopulateFields(record, fields); CurrentRecipeMod.RecipeModsBool.Add(record); } else if (CurrentTable == Table.RecipeModsDID) { var record = new RecipeModsDID(); PopulateFields(record, fields); CurrentRecipeMod.RecipeModsDID.Add(record); } else if (CurrentTable == Table.RecipeModsFloat) { var record = new RecipeModsFloat(); PopulateFields(record, fields); CurrentRecipeMod.RecipeModsFloat.Add(record); } else if (CurrentTable == Table.RecipeModsIID) { var record = new RecipeModsIID(); PopulateFields(record, fields); CurrentRecipeMod.RecipeModsIID.Add(record); } else if (CurrentTable == Table.RecipeModsInt) { var record = new RecipeModsInt(); PopulateFields(record, fields); CurrentRecipeMod.RecipeModsInt.Add(record); } else if (CurrentTable == Table.RecipeModsString) { var record = new RecipeModsString(); PopulateFields(record, fields); CurrentRecipeMod.RecipeModsString.Add(record); } else if (CurrentTable == Table.Cookbook) { var record = new CookBook(); PopulateFields(record, fields); Cookbooks.Add(record); record.Recipe = Recipe; } }