Exemple #1
0
        private static bool ParseAreaEvent(PgQuestObjectiveRequirementAreaEventOff newItem, object value, string parsedFile, string parsedKey)
        {
            if (!ParserQuestRequirement.ParseAreaEvent(value, parsedFile, parsedKey, out MapAreaName AreaName))
            {
                return(false);
            }

            newItem.AreaName = AreaName;
            return(true);
        }
Exemple #2
0
        private static bool FinishItemAreaEventOff(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)
        {
            PgQuestObjectiveRequirementAreaEventOff NewItem = new PgQuestObjectiveRequirementAreaEventOff();

            bool Result = true;

            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 "AreaEvent":
                        Result = ParseAreaEvent(NewItem, Value, parsedFile, parsedKey);
                        break;

                    default:
                        Result = Program.ReportFailure("Unexpected failure");
                        break;
                    }
                }

                if (!Result)
                {
                    break;
                }
            }

            if (Result)
            {
                item = NewItem;
                return(true);
            }
            else
            {
                return(false);
            }
        }