Exemple #1
0
        public static bool TryLoadQuest(string[] lines, out Models.Quest result)
        {
            try
            {
                result = JsonConvert.DeserializeObject <Models.Quest>(string.Join("\n", lines));

                return(true);
            }
            catch
            {
                result = null;
                return(false);
            }
        }
Exemple #2
0
        /// <summary>
        /// Converts ACE -> GDLE quest
        /// </summary>
        public static bool TryConvert(Quest input, out Models.Quest result)
        {
            result     = new Models.Quest();
            result.key = input.Name;

            var quest = new Models.QuestValue();

            quest.fullname  = input.Message;
            quest.mindelta  = (int)input.MinDelta;
            quest.maxsolves = input.MaxSolves;

            result.value = quest;

            return(true);
        }
Exemple #3
0
        public static bool TryLoadQuest(string file, out Models.Quest result)
        {
            try
            {
                var fileText = File.ReadAllText(file);

                result = JsonConvert.DeserializeObject <Models.Quest>(fileText);

                return(true);
            }
            catch
            {
                result = null;
                return(false);
            }
        }
Exemple #4
0
        public static bool TryConvert(Models.Quest input, out Database.Models.World.Quest result)
        {
            try
            {
                result = new Database.Models.World.Quest();

                //result.Id // This is an Auto Increment field in the ACE schema

                result.Name = input.Key;

                result.MinDelta  = (input.Value.MinDelta <= 0) ? 0 : (uint)input.Value.MinDelta; // the jsons have values of -1 here sometimes
                result.MaxSolves = input.Value.MaxSolves;
                result.Message   = input.Value.FullName;

                return(true);
            }
            catch
            {
                result = null;
                return(false);
            }
        }
Exemple #5
0
        /// <summary>
        /// Converts GDLE -> ACE quest
        /// </summary>
        public static bool TryConvert(Models.Quest input, out Quest result)
        {
            try
            {
                result = new Quest();

                //result.Id // This is an Auto Increment field in the ACE schema

                result.Name = input.key;

                // FIXME: db schema should be int
                result.MinDelta  = (uint)input.value.mindelta;
                result.MaxSolves = input.value.maxsolves;
                result.Message   = input.value.fullname;

                return(true);
            }
            catch
            {
                result = null;
                return(false);
            }
        }