Exemple #1
0
        public bool AcceptQuest(Quest quest)
        {
            lock (Quests)
            {
                if (!Quests.Any(i => i.Name == quest.Name))
                {
                    Quests.Add(quest);

                    return(true);
                }
            }

            return(false);
        }
        /// <summary>
        ///     Accepts the quest.
        /// </summary>
        /// <param name="lpQuest">The Quest to Accept.</param>
        /// <returns>
        ///     True if the quest was accepted, and the Aisling does not already have it accepted. Returns false if the Quest
        ///     has already been Accepted.
        /// </returns>
        /// <example>
        ///     <code>
        /// if (client.Aisling.AcceptQuest(quest))
        /// {
        /// //quest has been added to interpreter.
        /// }
        /// </code>
        /// </example>
        public bool AcceptQuest(Quest lpQuest)
        {
            lock (syncLock)
            {
                if (!Quests.Any(i => i.Name == lpQuest.Name))
                {
                    Quests.Add(lpQuest);

                    return(true);
                }
            }

            return(false);
        }
        public override void Initialize()
        {
            Quests.Clear();

            Quest quest = new ItemQuest(
                "Oh, its you. I can sense some latent power from you so let me assist. Head to your controls in the options menu and bind hotkeys to every entry there. The most important ones are Energy Charge, Transform, Power down and Transformation Menu.",
                ItemID.Wood, 1, 1,
                "Energy charge lets you charge your energy bar at the top of the screen. Transform lets you ascend into unlocked forms with power down being the opposite, there is also some more unique interactions with these keys, such as pressing charge and transform together to ascend to an alternative form, like ASSJ. Transformation menu lets you open a menu which lets you select which form to transform into alongside the masteries of those forms. The other hotkeys require unlocks to be used however, so look out for those.")
            {
                ModdedQuestReward = "KiBlastItem",
                QuestRewardAmount = 1
            };

            Quests.Add(quest);

            quest = new ItemQuest(
                "Ah, welcome back. If you don't mind, could you bring me 30 pieces of that gel-like substance those slimes hold, it'll help with my 'research'.",
                ItemID.Gel, 30, 1,
                "Thanks for your assistance, let me assist in your training for a bit, also take this extra money I had laying around.")
            {
                QuestReward       = ItemID.SilverCoin,
                QuestRewardAmount = 35
            };
            Quests.Add(quest);

            int[] antlions = { NPCID.Antlion };
            quest = new KillQuest(
                "Ah, " + player.name + ", are you ready for a bit of training? Head over to the desert and kill 5 of those weird spitting bugs.",
                antlions, "Antlion", 5, 1,
                "Good job, look how much stronger you are already! Here's some more money for your efforts.")
            {
                QuestReward       = ItemID.SilverCoin,
                QuestRewardAmount = 50
            };
            Quests.Add(quest);

            //Kill quest example

            /*int[] kingSlime = {NPCID.KingSlime};
             * quest = new KillQuest(
             *  "Ah," + player.name +
             *  "I could use some more of your help, I haven't been able to get to the other side of the ocean as this big slime keeps getting in my way once I get to the other beach, if you could take care of it for me then I'll certainly reward you.",
             *  kingSlime, "King Slime", 1, 1d,
             *  "I really appreciate you killing that thing for me, here's some extra boots that I found while exploring earlier.")
             * {
             *  QuestReward = ItemID.HermesBoots,
             *  QuestRewardAmount = 1
             * };
             * Quests.Add(quest);*/
        }
Exemple #4
0
        public bool AcceptQuest(Quest lpQuest)
        {
            lock (_syncLock)
            {
                if (Quests.All(i => i.Name != lpQuest.Name))
                {
                    Quests.Add(lpQuest);

                    return(true);
                }
            }

            return(false);
        }
Exemple #5
0
        public override void LoadFromResponse(string apiname, dynamic data)
        {
            base.LoadFromResponse(apiname, (object)data);


            //周期任務削除
            if (DateTimeHelper.IsCrossedDay(_prevTime, 5, 0, 0))
            {
                Quests.RemoveAll(q => q.Type == 2 || q.Type == 4 || q.Type == 5);
            }
            if (DateTimeHelper.IsCrossedWeek(_prevTime, DayOfWeek.Monday, 5, 0, 0))
            {
                Quests.RemoveAll(q => q.Type == 3);
            }
            if (DateTimeHelper.IsCrossedMonth(_prevTime, 1, 5, 0, 0))
            {
                Quests.RemoveAll(q => q.Type == 6);
            }


            Count = (int)RawData.api_count;

            if (RawData.api_list != null)                       //任務完遂時orページ遷移時 null になる

            {
                foreach (dynamic elem in RawData.api_list)
                {
                    if (!(elem is double))                                      //空欄は -1 になるため。

                    {
                        int id = (int)elem.api_no;
                        if (!Quests.ContainsKey(id))
                        {
                            var q = new QuestData();
                            q.LoadFromResponse(apiname, elem);
                            Quests.Add(q);
                        }
                        else
                        {
                            Quests[id].LoadFromResponse(apiname, elem);
                        }
                    }
                }
            }


            IsLoaded  = true;
            _prevTime = DateTime.Now;
        }
Exemple #6
0
 /// <summary>
 /// Добавить квест
 /// </summary>
 /// <param name="Name">Имя</param>
 /// <param name="Text">Текст результата выбора</param>
 /// <param name="ParentChild">Родительские элементы</param>
 /// <param name="ParentText">Текст в родительском элементе</param>
 /// <returns></returns>
 public Quest AddQuest(string Name, string Text, string[] ParentChild, string ParentText)
 {
     //Console.WriteLine(ContainsQuest(Name));
     if (!ContainsQuest(Name))
     {
         var tmp = new Quest(Name, Text, ParentChild, ParentText);
         Quests.Add(tmp);
         return(tmp);
     }
     else
     {
         var EQ = new Quest(Name, Text, ParentChild, ParentText);
         EditQuest(FromGetName(Name), EQ);
         return(EQ);
     }
 }
Exemple #7
0
        /// <summary>
        /// データテーブル
        /// </summary>
        private void InitializeQuestDataTable()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn()
            {
                DataType   = typeof(string),
                ColumnName = "id",
            });
            dataGridViewQuests.DataSource = dt;

            Quests.Add(null);
            Quests.Add(new DataQuest()
            {
                Id = 1
            });
        }
Exemple #8
0
        public override void Initialize()
        {
            Quests.Add(new HeritageQuestInfo(typeof(TheJoysOfLifeQuest), 1072787));
            Quests.Add(new HeritageQuestInfo(typeof(DefendingTheHerdQuest), 1072785));
            Quests.Add(new HeritageQuestInfo(typeof(CaretakerOfTheLandQuest), 1072783));
            Quests.Add(new HeritageQuestInfo(typeof(SeasonsQuest), 1072782));
            Quests.Add(new HeritageQuestInfo(typeof(TheBalanceOfNatureQuest), 1072786));
            Quests.Add(new HeritageQuestInfo(typeof(WisdomOfTheSphynxQuest), 1072784));

            Objectives.Add(1073998); // Blessings of Sosaria to you and merry met, friend.
            Objectives.Add(1073999); // I am glad for your company and wonder if you seek the heritage of your people?  I sense within you an elven bloodline -- the purity of which was lost when our brothers and sisters were exiled here in the Rupture.
            Objectives.Add(1074000); // If it is your desire to reclaim your place amongst the people, you must demonstrate that you understand and embrace the responsibilities expected of you as an elf.
            Objectives.Add(1074001); // The most basic lessons of our Sosaria are taught by her humblest children.  Seek Maul, the great bear, who understands instictively the seasons.

            Story.Add(1074004);      // You have carved a path in history, sought to understand the way from our sage companions.
            Story.Add(1074005);      // And now you have returned full circle to the place of your origin within the arms of Mother Sosaria. There is but one thing left to do if you truly wish to embrace your elven heritage.
            Story.Add(1074006);      // To be born once more an elf, you must strip of all worldly possessions. Nothing of man or beast much touch your skin.
            Story.Add(1074007);      // Then you may step forth into history.
        }
        public void Init(int ownerId, IEnumerable <DbCharacterQuest> quests)
        {
            _ownerId = ownerId;

            foreach (var x in quests)
            {
                if (!_definitionsPreloader.Quests.ContainsKey(x.QuestId))
                {
                    continue;
                }

                var q = new Quest(_definitionsPreloader.Quests[x.QuestId], x);
                Quests.Add(q);
            }

            foreach (var quest in Quests)
            {
                quest.QuestTimeElapsed += Quest_QuestTimeElapsed;
            }
        }
Exemple #10
0
        public override void Initialize()
        {
            Quests.Add(new HeritageQuestInfo(typeof(IngenuityQuest), 1074350));
            Quests.Add(new HeritageQuestInfo(typeof(HeaveHoQuest), 1074351));
            Quests.Add(new HeritageQuestInfo(typeof(ResponsibilityQuest), 1074352));
            Quests.Add(new HeritageQuestInfo(typeof(AllSeasonAdventurerQuest), 1074353));

            Objectives.Add(1074403); // Greetings, traveler and welcome.
            Objectives.Add(1074404); // Perhaps you have heard of the service I offer?  Perhaps you wish to avail yourself of the opportunity I lay before you.
            Objectives.Add(1074405); // Elves and humans; we lived together once in peace.  Mighty relics that attest to our friendship remain, of course.  Yet, memories faded when the Gem was shattered and the world torn asunder.  Alone in The Heartwood, our elven brothers and sisters wondered what terrible evil had befallen Sosaria.
            Objectives.Add(1074406); // Violent change marked the sundering of our ties.  We are different -- elves and humans.  And yet we are much alike.  I can give an elf the chance to walk as a human upon Sosaria.  I can undertake the transformation.
            Objectives.Add(1074407); // But you must prove yourself to me.  Humans possess a strength of character and back.  Humans are quick-witted and able to pick up a smattering of nearly any talent.  Humans are tough both mentally and physically.  And of course, humans defend their own -- sometimes with their own lives.
            Objectives.Add(1074408); // Seek Sledge the Versatile and learn about human ingenuity and creativity.  Seek Patricus and demonstrate your integrity and strength.
            Objectives.Add(1074409); // Seek out a human in need and prove your worth as a defender of humanity.  Seek Belulah in Nu'Jelm and heartily challenge the elements in a display of toughness to rival any human.
            Objectives.Add(1074411); // Or turn away and embrace your heritage.  It matters not to me.

            Story.Add(1074004);      // You have carved a path in history, sought to understand the way from our sage companions.
            Story.Add(1074005);      // And now you have returned full circle to the place of your origin within the arms of Mother Sosaria. There is but one thing left to do if you truly wish to embrace your elven heritage.
            Story.Add(1074006);      // To be born once more an elf, you must strip of all worldly possessions. Nothing of man or beast much touch your skin.
            Story.Add(1074007);      // Then you may step forth into history.
        }
        public void Add(uint questId)
        {
            var template = QuestManager.Instance.GetTemplate(questId);

            if (template == null)
            {
                return;
            }
            var quest = new Quest(template);

            quest.Id     = Quests.Count + 1; // TODO временно, переделать
            quest.Status = QuestStatus.Progress;
            quest.Owner  = Owner;
            var res = quest.Start();

            if (res != 0)
            {
                Owner.SendPacket(new SCQuestContextStartedPacket(quest, res));
                Quests.Add(quest.TemplateId, quest);
            }
        }
        public void Load(MySqlConnection connection)
        {
            using (var command = connection.CreateCommand())
            {
                command.CommandText = "SELECT * FROM completed_quests WHERE `owner` = @owner";
                command.Parameters.AddWithValue("@owner", Owner.Id);
                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var quest = new CompletedQuest();
                        quest.Id   = reader.GetUInt16("id");
                        quest.Body = new BitArray((byte[])reader.GetValue("data"));
                        CompletedQuests.Add(quest.Id, quest);
                    }
                }
            }

            using (var command = connection.CreateCommand())
            {
                command.CommandText = "SELECT * FROM quests WHERE `owner` = @owner";
                command.Parameters.AddWithValue("@owner", Owner.Id);
                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var quest = new Quest();
                        quest.Id         = reader.GetUInt32("id");
                        quest.TemplateId = reader.GetUInt32("template_id");
                        quest.Status     = (QuestStatus)reader.GetByte("status");
                        quest.ReadData((byte[])reader.GetValue("data"));
                        quest.Owner    = Owner;
                        quest.Template = QuestManager.Instance.GetTemplate(quest.TemplateId);
                        quest.RecalcObjectives(false);
                        Quests.Add(quest.TemplateId, quest);
                    }
                }
            }
        }
Exemple #13
0
    public override void GiveLife()
    {
        base.GiveLife();
        Name = "Clean Booga";

        TalkText.Add("Welcome to Booga's Welcome of Fate");

        Quests.Add(new Quest(Quest.QuestType.Slay, "Slay the Gators", "Clean Booga",
                             new List <string>()
        {
            "Hey, I need you to kill those Gators.", "There should be a lot on the right side.", "Compelete this quest and I'll reward you."
        },
                             new List <string>()
        {
            "Alright then, let me teach you some basics.", "Press the I key to open your inventory. You can equip items from here.",
            "You should equip the weapon in your inventory.", "While holding a weapon, press the X key to perform a basic attack", "Tap repeatedly to combo!"
        },
                             new List <string>()
        {
            "You are a f*****g retard.", "Do you not want to progress in this game?"
        },
                             new List <string>()
        {
            "Go kill the Gators then come back to me."
        },
                             new List <string>()
        {
            "Nice job!", "Here's your reward", "I have opened a new portal to the north",
            "Once you go in, you can never come back here", "Make sure you are prepared for the real world"
        },
                             "100 Gold / 50 Exp",
                             "Clean Booga wants me to slay the Gators around here.",
                             new List <QuestGoal>()
        {
            new QuestGoal(QuestGoal.ObjectiveType.Monster, 0, 5, "Slay 5 Gators")
        }));
    }
Exemple #14
0
        /// <summary>
        /// Saves the information from the provided quest wrapper into this config object.
        /// Also pulls global advanced options.
        /// </summary>
        /// <param name="quests">The collection of saved quests.</param>
        /// <param name="currentQuest">The currently selected quest.</param>
        /// <param name="options">The program configuration options.</param>
        public void Save(QuestCollection quests, string currentQuest, AdvancedOptions options)
        {
            if (quests == null)
            {
                throw new ArgumentNullException(nameof(quests));
            }

            Quests.Clear();
            foreach (var quest in quests)
            {
                Quests.Add(quest);
            }

            CurrentQuest = currentQuest;

            if (options != null)
            {
                DisplayMode             = options.DisplayMode;
                AllowUsersToUpdatePlans = options.AllowUsersToUpdatePlans;
                GlobalSpoilers          = options.GlobalSpoilers;
                DisplayPlansWithNoVotes = options.DisplayPlansWithNoVotes;
                DisableWebProxy         = options.DisableWebProxy;
            }
        }
Exemple #15
0
        public override void LoadFromResponse(string apiname, dynamic data)
        {
            base.LoadFromResponse(apiname, (object)data);

            var progress = KCDatabase.Instance.QuestProgress;


            //周期任務削除
            if (DateTimeHelper.IsCrossedDay(progress.LastUpdateTime, 5, 0, 0))
            {
                progress.Progresses.RemoveAll(p => (p.QuestType == 1 || p.QuestID == 211 /* 空母3 */ || p.QuestID == 212 /* 輸送5 */ || p.QuestID == 311 /* 演習勝利7 */));
                Quests.RemoveAll(q => q.Type == 1 || q.QuestID == 211 /* 空母3 */ || q.QuestID == 212 /* 輸送5 */ || q.QuestID == 311 /* 演習勝利7 */);
            }
            if (DateTimeHelper.IsCrossedWeek(progress.LastUpdateTime, DayOfWeek.Monday, 5, 0, 0))
            {
                progress.Progresses.RemoveAll(p => p.QuestType == 2);
                Quests.RemoveAll(q => q.Type == 2);
            }
            if (DateTimeHelper.IsCrossedMonth(progress.LastUpdateTime, 1, 5, 0, 0))
            {
                progress.Progresses.RemoveAll(p => p.QuestType == 3);
                Quests.RemoveAll(q => q.Type == 3);
            }
            if (DateTimeHelper.IsCrossedQuarter(progress.LastUpdateTime, 0, 1, 5, 0, 0))
            {
                progress.Progresses.RemoveAll(p => p.QuestType == 5);
                Quests.RemoveAll(p => p.Type == 5);
            }
            for (int i = 1; i <= 12; i++)
            {
                if (DateTimeHelper.IsCrossedYear(progress.LastUpdateTime, i, 1, 5, 0, 0))
                {
                    progress.Progresses.RemoveAll(p => p.QuestType == 100 + i);
                    Quests.RemoveAll(p => p.LabelType == 100 + i);
                }
            }

            Count = (int)RawData.api_count;

            if (RawData.api_list != null)
            {               //任務完遂時orページ遷移時 null になる
                foreach (dynamic elem in RawData.api_list)
                {
                    if (!(elem is double))
                    {                           //空欄は -1 になるため。
                        int id = (int)elem.api_no;
                        if (!Quests.ContainsKey(id))
                        {
                            var q = new QuestData();
                            q.LoadFromResponse(apiname, elem);
                            Quests.Add(q);
                        }
                        else
                        {
                            Quests[id].LoadFromResponse(apiname, elem);
                        }
                    }
                }
            }


            IsLoaded = true;
        }
Exemple #16
0
        public override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("EditorID", false, out subEle))
            {
                if (EditorID == null)
                {
                    EditorID = new SimpleSubrecord <String>();
                }

                EditorID.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ObjectBounds", false, out subEle))
            {
                if (ObjectBounds == null)
                {
                    ObjectBounds = new ObjectBounds();
                }

                ObjectBounds.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Name", false, out subEle))
            {
                if (Name == null)
                {
                    Name = new SimpleSubrecord <String>();
                }

                Name.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Model", false, out subEle))
            {
                if (Model == null)
                {
                    Model = new Model();
                }

                Model.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Icon/Large", false, out subEle))
            {
                if (LargeIcon == null)
                {
                    LargeIcon = new SimpleSubrecord <String>();
                }

                LargeIcon.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Icon/Small", false, out subEle))
            {
                if (SmallIcon == null)
                {
                    SmallIcon = new SimpleSubrecord <String>();
                }

                SmallIcon.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("PickUpSound", false, out subEle))
            {
                if (PickUpSound == null)
                {
                    PickUpSound = new RecordReference();
                }

                PickUpSound.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("DropSound", false, out subEle))
            {
                if (DropSound == null)
                {
                    DropSound = new RecordReference();
                }

                DropSound.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Type", false, out subEle))
            {
                if (Type == null)
                {
                    Type = new SimpleSubrecord <NoteType>();
                }

                Type.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Quests", false, out subEle))
            {
                if (Quests == null)
                {
                    Quests = new List <RecordReference>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RecordReference tempONAM = new RecordReference();
                    tempONAM.ReadXML(e, master);
                    Quests.Add(tempONAM);
                }
            }
            if (ele.TryPathTo("Image", false, out subEle))
            {
                if (Image == null)
                {
                    Image = new SimpleSubrecord <String>();
                }

                Image.ReadXML(subEle, master);
            }

            ReadEntryDataXML(ele, master);
            if (ele.TryPathTo("Audio", false, out subEle))
            {
                if (Audio == null)
                {
                    Audio = new RecordReference();
                }

                Audio.ReadXML(subEle, master);
            }
        }
Exemple #17
0
        public override void ReadData(ESPReader reader, long dataEnd)
        {
            while (reader.BaseStream.Position < dataEnd)
            {
                string subTag = reader.PeekTag();

                switch (subTag)
                {
                case "EDID":
                    if (EditorID == null)
                    {
                        EditorID = new SimpleSubrecord <String>();
                    }

                    EditorID.ReadBinary(reader);
                    break;

                case "OBND":
                    if (ObjectBounds == null)
                    {
                        ObjectBounds = new ObjectBounds();
                    }

                    ObjectBounds.ReadBinary(reader);
                    break;

                case "FULL":
                    if (Name == null)
                    {
                        Name = new SimpleSubrecord <String>();
                    }

                    Name.ReadBinary(reader);
                    break;

                case "MODL":
                    if (Model == null)
                    {
                        Model = new Model();
                    }

                    Model.ReadBinary(reader);
                    break;

                case "ICON":
                    if (LargeIcon == null)
                    {
                        LargeIcon = new SimpleSubrecord <String>();
                    }

                    LargeIcon.ReadBinary(reader);
                    break;

                case "MICO":
                    if (SmallIcon == null)
                    {
                        SmallIcon = new SimpleSubrecord <String>();
                    }

                    SmallIcon.ReadBinary(reader);
                    break;

                case "YNAM":
                    if (PickUpSound == null)
                    {
                        PickUpSound = new RecordReference();
                    }

                    PickUpSound.ReadBinary(reader);
                    break;

                case "ZNAM":
                    if (DropSound == null)
                    {
                        DropSound = new RecordReference();
                    }

                    DropSound.ReadBinary(reader);
                    break;

                case "DATA":
                    if (Type == null)
                    {
                        Type = new SimpleSubrecord <NoteType>();
                    }

                    Type.ReadBinary(reader);
                    break;

                case "ONAM":
                    if (Quests == null)
                    {
                        Quests = new List <RecordReference>();
                    }

                    RecordReference tempONAM = new RecordReference();
                    tempONAM.ReadBinary(reader);
                    Quests.Add(tempONAM);
                    break;

                case "XNAM":
                    if (Image == null)
                    {
                        Image = new SimpleSubrecord <String>();
                    }

                    Image.ReadBinary(reader);
                    break;

                case "TNAM":
                    ReadEntryData(reader);
                    break;

                case "SNAM":
                    if (Audio == null)
                    {
                        Audio = new RecordReference();
                    }

                    Audio.ReadBinary(reader);
                    break;

                default:
                    throw new Exception();
                }
            }
        }
Exemple #18
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        //Debug.Log("Start");

        //reading the saved quests first
        PlayerData data = SaveSystem.LoadData();

        // get the last time quests were assigned
        QuestsAssignedTime = data.questsAssignedTime;
        //Debug.Log(QuestsAssignedTime);

        //NewQuests();

        // If no quests were assigned before
        if (QuestsAssignedTime == 0)
        {
            NewQuests();
        }
        else
        {
            //Debug.Log("Quests already assigned");
            // Check if it's time to assign new quests
            ulong timeDiff = ((ulong)DateTime.Now.Ticks - QuestsAssignedTime);
            ulong m        = timeDiff / TimeSpan.TicksPerMillisecond;
            // Convert the time in seconds
            float secondsLeft = (float)(msTimeToWait - m) / 1000.0f;
            //Debug.Log("Assigning new quests in: " + secondsLeft);
            // Assign new quests if it's a new day
            if (secondsLeft < 0)
            {
                Invoke("NewQuests", 1);
            }
            // Load the existing quests if there are any
            else
            {
                // Verify that there are active quests
                if (data.activeQuests != null)
                {
                    //Debug.Log("Quests active");
                    QuestSaving[] savedQuests = data.activeQuests;
                    //Debug.Log(savedQuests.Length);

                    for (int i = 0; i < savedQuests.Length; i++)
                    {
                        //Debug.Log("saved quests: " + savedQuests[i].QuestName);
                        Quests.Add((Quest)quests.AddComponent(System.Type.GetType(savedQuests[i].QuestName)));
                        Quests[i].Goals = savedQuests[i].Goals;
                        questsAssigned++;
                    }
                    Invoke("UpdateQuests", 1f);
                }
            }
        }

        // Quests.Clear();
    }
Exemple #19
0
 /// <summary>
 /// Добавить квест
 /// </summary>
 /// <param name="quest">Квест</param>
 /// <returns></returns>
 public Quest AddQuest(Quest quest)
 {
     Quests.Add(quest);
     return(quest);
 }
Exemple #20
0
 public void Add(Quest quest)
 {
     Quests.Add(quest);
 }
Exemple #21
0
        public override void LoadFromResponse(string apiname, dynamic data)
        {
            base.LoadFromResponse(apiname, (object)data);

            var progress = KCDatabase.Instance.QuestProgress;


            //周期任務削除
            if (DateTimeHelper.IsCrossedDay(progress.LastUpdateTime, 5, 0, 0))
            {
                // 注: 311 = 精鋭艦隊演習; マンスリーだがデイリーで進捗リセット
                progress.Progresses.RemoveAll(p => {
                    var q = Quests[p.QuestID];
                    return(q != null && (q.Type == 2 || q.Type == 4 || q.Type == 5 || q.QuestID == 311));
                });
                Quests.RemoveAll(q => q.Type == 2 || q.Type == 4 || q.Type == 5 || q.QuestID == 311);
            }
            if (DateTimeHelper.IsCrossedWeek(progress.LastUpdateTime, DayOfWeek.Monday, 5, 0, 0))
            {
                progress.Progresses.RemoveAll(p => {
                    var q = Quests[p.QuestID];
                    return(q != null && (q.Type == 3));
                });
                Quests.RemoveAll(q => q.Type == 3);
            }
            if (DateTimeHelper.IsCrossedMonth(progress.LastUpdateTime, 1, 5, 0, 0))
            {
                progress.Progresses.RemoveAll(p => {
                    var q = Quests[p.QuestID];
                    return(q != null && (q.Type == 6));
                });
                Quests.RemoveAll(q => q.Type == 6);
            }


            Count = (int)RawData.api_count;

            if (RawData.api_list != null)                       //任務完遂時orページ遷移時 null になる

            {
                foreach (dynamic elem in RawData.api_list)
                {
                    if (!(elem is double))                                      //空欄は -1 になるため。

                    {
                        int id = (int)elem.api_no;
                        if (!Quests.ContainsKey(id))
                        {
                            var q = new QuestData();
                            q.LoadFromResponse(apiname, elem);
                            Quests.Add(q);
                        }
                        else
                        {
                            Quests[id].LoadFromResponse(apiname, elem);
                        }
                    }
                }
            }


            IsLoaded = true;
        }
Exemple #22
0
 public void addQuest(Quest quest)
 {
     Quests.Add(quest);
 }