private static bool FinishItemSkillXp(ref object?item, Dictionary <string, object> contentTable, Dictionary <string, Json.Token> contentTypeTable, List <object> itemCollection, Json.Token lastItemType, List <string> knownFieldList, List <string> usedFieldList, string parsedFile, string parsedKey) { PgQuestRewardSkillXp NewItem = new PgQuestRewardSkillXp(); bool Result = true; if (contentTable.Count < 3) { Result = Program.ReportFailure(parsedFile, parsedKey, "Missing fields in Skill Xp reward"); } foreach (KeyValuePair <string, object> Entry in contentTable) { string Key = Entry.Key; object Value = Entry.Value; if (!knownFieldList.Contains(Key)) { Result = Program.ReportFailure($"Unknown field {Key}"); } else { usedFieldList.Add(Key); switch (Key) { case "T": break; case "Skill": Result = Inserter <PgSkill> .SetItemByKey((PgSkill valueSkill) => NewItem.Skill_Key = valueSkill.Key, Value); break; case "Xp": Result = SetIntProperty((int valueInt) => NewItem.RawXp = valueInt, Value); break; default: Result = Program.ReportFailure("Unexpected failure"); break; } } if (!Result) { break; } } if (Result) { item = NewItem; return(true); } else { return(false); } }
private bool FinishItem(PgQuestRewardCollection item, Dictionary <string, object> contentTable, Dictionary <string, Json.Token> contentTypeTable, List <object> itemCollection, Json.Token lastItemType, string parsedFile, string parsedKey) { foreach (KeyValuePair <string, object> Entry in contentTable) { string SkillKey = Entry.Key; object Value = Entry.Value; PgSkill ParsedSkill = null !; if (!Inserter <PgSkill> .SetItemByKey((PgSkill valueSkill) => ParsedSkill = valueSkill, SkillKey)) { return(false); } if (!(Value is int XpValue)) { return(Program.ReportFailure($"Value '{Value}' was expected to be an int")); } PgQuestRewardSkillXp NewReward = new PgQuestRewardSkillXp() { Skill_Key = ParsedSkill.Key, RawXp = XpValue }; item.Add(NewReward); } return(true); }