Inheritance: MonoBehaviour
Exemple #1
0
        public override void LoadFromRequest(string apiname, Dictionary <string, string> data)
        {
            base.LoadFromRequest(apiname, data);

            switch (apiname)
            {
            case "api_req_quest/clearitemget":
            {
                int id    = int.Parse(data["api_quest_id"]);
                var quest = Quests[id];

                Utility.Logger.Add(2, string.Format("任務『{0}』を達成しました。", quest.Name));

                Quests.Remove(id);
                Count--;
            }
            break;

            case "api_req_quest/stop":
                Quests[int.Parse(data["api_quest_id"])].State = 1;
                break;
            }

            QuestUpdated();
        }
Exemple #2
0
    public void SetupQuestHolder(Quests quest)
    {
        thisQuest         = quest; // Add quest to this questHolder.
        infoText.text     = quest.description;
        quantityText.text = quest.rewardValue.ToString();
        markBox.isOn      = quest.isDone;
        rewardIcon.sprite = quest.rewardSprite;

        if (quest.isDone && quest.isActive)
        {
            rewardBut.interactable = true;
        }
        else
        {
            rewardBut.interactable = false;
        }

        if (quest.name == "End")         // End Of the Quest TurnOff Toggle and button.
        {
            rewardBut.gameObject.SetActive(false);
            markBox.gameObject.SetActive(false);
            // Change Layout to a bigger value.
            LayoutElement layout = infoText.gameObject.GetComponent <LayoutElement> ();
            layout.minWidth       = 260f;
            layout.preferredWidth = 260f;
        }
    }
Exemple #3
0
        /// <summary>
        /// Saves the information from the provided quest wrapper into this config object.
        /// Also pulls global advanced options.
        /// </summary>
        /// <param name="questWrapper">The quest wrapper.</param>
        public void Save(QuestCollectionWrapper questWrapper)
        {
            if (questWrapper == null)
            {
                throw new ArgumentNullException(nameof(questWrapper));
            }

            DisplayMode              = AdvancedOptions.Instance.DisplayMode;
            AllowRankedVotes         = AdvancedOptions.Instance.AllowRankedVotes;
            IgnoreSpoilers           = AdvancedOptions.Instance.IgnoreSpoilers;
            TrimExtendedText         = AdvancedOptions.Instance.TrimExtendedText;
            GlobalSpoilers           = AdvancedOptions.Instance.GlobalSpoilers;
            DisableProxyVotes        = AdvancedOptions.Instance.DisableProxyVotes;
            ForcePinnedProxyVotes    = AdvancedOptions.Instance.ForcePinnedProxyVotes;
            ForbidVoteLabelPlanNames = AdvancedOptions.Instance.ForbidVoteLabelPlanNames;
            WhitespaceAndPunctuationIsSignificant = AdvancedOptions.Instance.WhitespaceAndPunctuationIsSignificant;
            DisplayPlansWithNoVotes = AdvancedOptions.Instance.DisplayPlansWithNoVotes;

            CurrentQuest = questWrapper.CurrentQuest;

            Quests.Clear();
            foreach (var quest in questWrapper.QuestCollection)
            {
                Quests.Add(quest);
            }
        }
Exemple #4
0
        private static bool GetLevelExitChallengeItem_Prefix(Quests __instance, ref InvItem __result)
        {
            GameController gc       = GameController.gameController;
            string         itemName = null;

            if (gc.challenges.Contains(cChallenge.UnpaidInternship))
            {
                itemName = gc.Choose(vItem.Banana, vItem.HamSandwich);
            }
            else if (gc.challenges.Contains(cChallenge.DoublePlyRewards))
            {
                itemName = gc.Choose(vItem.FreeItemVoucher, vItem.HiringVoucher);
            }

            if (itemName != null)
            {
                InvItem invItem = new InvItem()
                {
                    invItemName  = itemName,
                    invItemCount = 1
                };
                invItem.SetupDetails(false);
                __instance.questItemsGiven.Add(itemName);
                __result = invItem;
                return(false);
            }

            return(true);
        }
Exemple #5
0
        public ActionResult DetailsReceiveThings(int?id, string action)
        {
            switch (action)
            {
            case "评价物品":
                ThingsQuests tq = db.ThingsQuests.Where(x => x.QuestId == id).FirstOrDefault();
                Things       t  = db.Things.Where(x => x.ThingId == tq.ThingId).FirstOrDefault();
                return(RedirectToAction("UploadComment", new { id = t.ThingId }));

            case "删除":
                Quests q = db.Quests.Where(x => x.QuestId == id).FirstOrDefault();
                db.Quests.Remove(q);

                Checks c = db.Checks.Where(x => x.CheckId == q.ReceiverId).FirstOrDefault();
                if (c != null)
                {
                    db.Checks.Remove(c);
                }
                Assess a = db.Assess.Where(x => x.UserId == q.ReceiverId).FirstOrDefault();
                a.CreditPoint    -= 2;
                a.CreditLevel     = CreditsCal.getLevel(a.CreditPoint.Value);
                db.Entry(a).State = EntityState.Modified;
                db.SaveChanges();
                break;

            case "返回到列表":
                return(RedirectToAction("SelectReceiveThings"));
            }

            return(RedirectToAction("SelectReceiveThings"));
        }
        public async Task <IActionResult> UpdateQuests([FromRoute] int id, [FromBody] Quests tblQuests)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tblQuests.QuestId)
            {
                return(BadRequest());
            }

            try
            {
                await questsService.Update(id, tblQuests);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblQuestsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #7
0
    void Update()
    {
        Quests Quests     = GameObject.Find("QuestSystem").GetComponent <Quests>();
        int    killAmount = Quests.killamount - Quests.killed;

        GetComponent <Text>().text = "To Kill: " + killAmount;
    }
Exemple #8
0
    /*public static void StartDialogWithQuest(string[] dialogArray, string[] nameArray, int questKey, string questsFullMessage, int questAmount)
     * {
     *      for (int t = 0; t < dialogArray.Length; t++)
     *      {
     *              activeDialog.Add(dialogArray[t]);
     *              speakerNames.Add(nameArray[t]);
     *      }
     *      if (!GameData.AddQuest(Quests.questsDict[questKey], questAmount))		//tries to add the quest, and if it's full it's gonna add the quest failed line to the dialog
     *      {
     *              activeDialog.Add(questsFullMessage);
     *      }
     *      dialogManager.dialogIndex = 0;
     *      dialogManager.dialogueText.Text = dialogArray[0];
     *      dialogManager.nameLabel.Text = nameArray[0];
     *      dialogManager.dialogPanel.Visible = true;
     * }*/

    public static void StartDialogWithQuest(string[] dialogArray, string[] nameArray, string questName, string questDesc, int questType, string targetNPCName, string questsFullMessage, int questAmount)
    {
        for (int t = 0; t < dialogArray.Length; t++)
        {
            activeDialog.Add(dialogArray[t]);
            speakerNames.Add(nameArray[t]);
        }

        Quests newQuest = new Quests();

        newQuest.questName        = questName;
        newQuest.questDescription = questDesc;
        newQuest.questType        = questType;
        newQuest.maxProgress      = questAmount;
        newQuest.targetNPCName    = targetNPCName;

        if (!GameData.AddQuest(newQuest, questAmount))               //tries to add the quest, and if it's full it's gonna add the quest failed line to the dialog
        {
            activeDialog.Add(questsFullMessage);
            speakerNames.Add(nameArray[0]);
        }
        dialogManager.dialogIndex         = 0;
        dialogManager.dialogueText.Text   = dialogArray[0];
        dialogManager.nameLabel.Text      = nameArray[0];
        dialogManager.dialogPanel.Visible = true;
    }
 public bool DeepEquals(DestinyMilestoneDefinition?other)
 {
     return(other is not null &&
            (DisplayProperties is not null ? DisplayProperties.DeepEquals(other.DisplayProperties) : other.DisplayProperties is null) &&
            DisplayPreference == other.DisplayPreference &&
            Image == other.Image &&
            MilestoneType == other.MilestoneType &&
            Recruitable == other.Recruitable &&
            FriendlyName == other.FriendlyName &&
            ShowInExplorer == other.ShowInExplorer &&
            ShowInMilestones == other.ShowInMilestones &&
            ExplorePrioritizesActivityImage == other.ExplorePrioritizesActivityImage &&
            HasPredictableDates == other.HasPredictableDates &&
            Quests.DeepEqualsDictionary(other.Quests) &&
            Rewards.DeepEqualsDictionary(other.Rewards) &&
            VendorsDisplayTitle == other.VendorsDisplayTitle &&
            Vendors.DeepEqualsList(other.Vendors) &&
            Values.DeepEqualsDictionary(other.Values) &&
            IsInGameMilestone == other.IsInGameMilestone &&
            Activities.DeepEqualsList(other.Activities) &&
            DefaultOrder == other.DefaultOrder &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
Exemple #10
0
        //-------------------------------------------------------------------------------
        public Quests AddQuest(Quests quest)
        {
            try
            {
                DbCommand command = _connection.CreateCommand();
                command.CommandText = "INSERT INTO Quests(Title, Description, Difficult, PictureSrc, Points, MuseumId, PrizesId) VALUES (@Title, @Description, @Difficult, @PictureSrc, @Points, @MuseumId, @PrizesId)";

                command.Parameters.Add(instance.GetParameter("Title", quest.Title, _factory));
                command.Parameters.Add(instance.GetParameter("Description", quest.Description, _factory));
                command.Parameters.Add(instance.GetParameter("Difficult", quest.Difficult, _factory));
                command.Parameters.Add(instance.GetParameter("PictureSrc", quest.PictureSrc, _factory));
                command.Parameters.Add(instance.GetParameter("Points", quest.Points, _factory));
                command.Parameters.Add(instance.GetParameter("MuseumId", quest.MuseumId, _factory));
                command.Parameters.Add(instance.GetParameter("PrizesId", quest.PrizesId, _factory));

                command.ExecuteNonQuery();

                quest.Id = instance.GetNewId("Quests", _connection);
                quests.Add(quest);
                return(quest);
            }
            catch (DbException)
            {
                return(null);
            }
        }
Exemple #11
0
        void UpdateQuestData(Quests quests, GameDifficulty difficulty)
        {
            var q = quests.ByDifficulty(difficulty);

            if (q == null)
            {
                return;
            }

            QuestDebugRow[,] rows = questRows[difficulty];

            foreach (var quest in q)
            {
                if (quest.Act <= 0 || quest.ActOrder <= 0)
                {
                    // cow king quest is set to act 0 act order 0 atm
                    continue;
                }

                try
                {
                    rows[quest.Act - 1, quest.ActOrder - 1].Update(quest);
                }
                catch (NullReferenceException)
                {
                }
            }
        }
Exemple #12
0
        //-------------------------------------------------------------------------------
        public Quests UpdateQuestById(int i, Quests quest)
        {
            try
            {
                DbCommand command = _factory.CreateCommand();

                command.CommandText = "UPDATE Quests SET Title = @Title, Description = @Description, Difficult = @Difficult, PictureSrc = @PictureSrc, Points = @Points, MuseumId = @MuseumId, PrizesId = @PrizesId";

                command.Parameters.Add(instance.GetParameter("Title", quest.Title, _factory));
                command.Parameters.Add(instance.GetParameter("Description", quest.Description, _factory));
                command.Parameters.Add(instance.GetParameter("Difficult", quest.Difficult, _factory));
                command.Parameters.Add(instance.GetParameter("PictureSrc", quest.PictureSrc, _factory));
                command.Parameters.Add(instance.GetParameter("Points", quest.Points, _factory));
                command.Parameters.Add(instance.GetParameter("MuseumId", quest.MuseumId, _factory));
                command.Parameters.Add(instance.GetParameter("PrizesId", quest.PrizesId, _factory));

                command.ExecuteNonQuery();

                quests[i].Description = quest.Description;
                quests[i].Difficult   = quest.Difficult;
                quests[i].MuseumId    = quest.MuseumId;
                quests[i].PictureSrc  = quest.PictureSrc;
                quests[i].Points      = quest.Points;
                quests[i].PrizesId    = quest.PrizesId;
                quests[i].Title       = quest.Title;

                return(quest);
            }
            catch (DbException)
            {
                return(null);
            }
        }
Exemple #13
0
        //-------------------------------------------------------------------------------
        public List <Quests> GetQuests(int MuseumId)
        {
            try
            {
                DbCommand command = _factory.CreateCommand();
                command.CommandText = "SELECT * FROM Quests WHERE MuseumId = @MuseumId";

                command.Parameters.Add(instance.GetParameter("MuseumId", MuseumId, _factory));

                DbDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    Quests quest = new Quests();

                    quest.Description = Convert.ToString(reader["Description"]);
                    quest.MuseumId    = Convert.ToInt32(reader["MuseumId"]);
                    quest.PictureSrc  = Convert.ToString(reader["PictureSrc"]);
                    quest.Points      = Convert.ToInt32(reader["Points"]);
                    quest.PrizesId    = Convert.ToInt32(reader["PrizesId"]);
                    quest.Title       = Convert.ToString(reader["Title"]);
                    quest.Difficult   = Convert.ToInt32(reader["Difficult"]);
                    quest.Id          = Convert.ToInt32(reader["Id"]);

                    quests.Add(quest);
                }

                return(quests);
            }
            catch (DbException)
            {
                return(null);
            }
        }
Exemple #14
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     //Debug.Log("At inn!!");
     if (collision.gameObject.tag == "Party")
     {
         PartyController partyController = collision.GetComponent <PartyController>();
         if (partyController.fatigue > 0)
         {
             partyController.fatigue -= 5 * Time.deltaTime;
         }
         if (partyController.Gold > 0)
         {
             partyController.Gold -= 0.5f * Time.deltaTime;
             Gold += 0.5f * Time.deltaTime;
         }
         if (Quests.Count > 0 && collision.GetComponent <PartyController>().Quests.Count == 0)
         {
             collision.GetComponent <PartyController>().Quests.Add(Quests[0]);
             Quests.Remove(Quests[0]);
             OnListChanged();
         }
         if (CharacterList.Characters.Count > 0 && collision.GetComponent <PartyController>().CharacterList.Characters.Count < 4)
         {
             collision.GetComponent <PartyController>().CharacterList.Characters.Add(CharacterList.Characters[0]);
             CharacterList.Characters[0].transform.parent = collision.transform;
             CharacterList.Characters.Remove(CharacterList.Characters[0]);
         }
     }
 }
Exemple #15
0
 // Start is called before the first frame update
 void Start()
 {
     Quests = GameObject.Find("Quests").GetComponent <Quests>();
     now    = DateTime.Now.ToString("yyyy-MM-dd");
     Whatday();
     MakeToday();
 }
        /// <summary>
        ///Saves all quests passed in parameter in the specified file as a JSON object
        /// </summary>
        /// <param name="jsonFile">The file that the quests will be saved in. The file is being overriden by the quests object.</param>
        /// <param name="quests">The quests object that will be saved.</param>
        public static void SaveAllQuestsToJSON(string jsonFile, Quests quests)
        {
            string path       = Application.dataPath + "/Scripts/QuestSystem/" + jsonFile;
            string questsJSON = JsonUtility.ToJson(quests);

            File.WriteAllText(path, questsJSON);
        }
Exemple #17
0
        /// <summary>
        /// Get Player Quests list
        /// </summary>
        /// <param name="playerId"></param>
        /// <returns></returns>
        public static Quests GetPlayerQuest(int playerId)
        {
            using (MySqlConnection connection = new MySqlConnection(connectionString))
            {
                connection.Open();
                Quests Quests = new Quests();

                using (MySqlCommand command = connection.CreateCommand())
                {
                    command.CommandText = "GAME_QUEST_GET";
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@in_PlayerId", playerId);

                    var reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            int questId = reader.GetInt32(1);
                            int questStep = reader.GetInt32(2);

                            Quests.AddQuest(questId, questStep);
                        }
                    }
                }
                connection.Close();
                return Quests;
            }
        }
Exemple #18
0
    // Use this for initialization
    void Start()
    {
        TextAsset DataCountries = Resources.Load <TextAsset> ("DataCountries");

        countryArray = new string[] { "1", "2", "3", "4", "5" };
        string[] data = DataCountries.text.Split(new char[] { '\n' });

        //Debug.Log (data.Length);

        for (int i = 1; i < data.Length - 1; i++)
        {
            string[] row = data [i].Split(new char[] { ';' });

            Quests q = new Quests();
            int.TryParse(row [0], out q.id);

            q.country       = row [1];
            countryArray[i] = q.country.ToString();

            russia   = countryArray [1];
            china    = countryArray [2];
            mongolia = countryArray [3];
            japan    = countryArray [4];

            q.government = row [2];
            int.TryParse(row [3], out q.population);

            quests.Add(q);
        }

        foreach (Quests q in quests)
        {
            Debug.Log(q.country);
        }
    }
Exemple #19
0
        public void AddQuest(int id, BioQuest quest = null)
        {
            if (Quests == null)
            {
                Quests = InitCollection <KeyValuePair <int, BioQuest> >();
            }

            if (Quests.Any(pair => pair.Key == id))
            {
                return;
            }

            if (quest == null)
            {
                quest = new BioQuest();
            }

            quest.Goals     = InitCollection(quest.Goals);
            quest.PlotItems = InitCollection(quest.PlotItems);
            quest.Tasks     = InitCollection(quest.Tasks);

            var questPair = new KeyValuePair <int, BioQuest>(id, quest);

            Quests.Add(questPair);

            SelectedQuest = questPair;
        }
Exemple #20
0
    public override void _Process(float delta)
    {
        if (canBeTalkedTo && !isBeingTalkedTo && Input.IsActionJustPressed("Continue") && !GameData.isPlayerTalking)
        {
            bool questDone = false;
            for (int q = 0; q < GameData.activeQuests.Length; q++)
            {
                Quests quest = GameData.activeQuests[q];
                if (quest.askerName == NPCName && quest.progress == quest.maxProgress)
                {
                    questDone = true;
                    break;
                }
            }

            if (!questDone)
            {
                DialogueManager.StartDialogWithQuest(dialogue, speakerNames, questName, questDescription, questType, targetNPCName, NPCName, questsFullMessage, questObjectiveAmount);
                isBeingTalkedTo          = true;
                GameData.isPlayerTalking = true;
            }
            if (questDone && !questRewardGiven)
            {
                int itemType = Item.GetItemType(playerRewardItemName);
                DialogueManager.StartDialogWithReward(questDoneDialog, questDoneNames, inventoryFullMessage, playerRewardMoney, itemType, playerRewardItemStack);
                isBeingTalkedTo          = true;
                GameData.isPlayerTalking = true;
            }
        }
    }
Exemple #21
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.
        }
Exemple #22
0
 public bool DeepEquals(DestinyMilestoneDefinition other)
 {
     return(other != null &&
            Activities.DeepEqualsReadOnlyCollections(other.Activities) &&
            DefaultOrder == other.DefaultOrder &&
            DisplayProperties.DeepEquals(other.DisplayProperties) &&
            ExplorePrioritizesActivityImage == other.ExplorePrioritizesActivityImage &&
            FriendlyName == other.FriendlyName &&
            HasPredictableDates == other.HasPredictableDates &&
            Image == other.Image &&
            IsInGameMilestone == other.IsInGameMilestone &&
            MilestoneType == other.MilestoneType &&
            Quests.DeepEqualsReadOnlyDictionaryWithDefinitionKeyAndSimpleValue(other.Quests) &&
            Recruitable == other.Recruitable &&
            Rewards.DeepEqualsReadOnlyDictionaryWithSimpleKeyAndEquatableValue(other.Rewards) &&
            ShowInExplorer == other.ShowInExplorer &&
            ShowInMilestones == other.ShowInMilestones &&
            Vendors.DeepEqualsReadOnlyCollections(other.Vendors) &&
            VendorsDisplayTitle == other.VendorsDisplayTitle &&
            Values.DeepEqualsReadOnlyDictionaryWithSimpleKeyAndEquatableValue(other.Values) &&
            Blacklisted == other.Blacklisted &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
Exemple #23
0
        public void CheckingAchievement()
        {
            for (var i = 0; i < Quests.Count(); i++)
            {
                if (Quests[i].Difference == true)
                {
                    //Diaplay achievement a message. In case of different Monster

                    var exceptDuplicateList = Kills.Select(x => x.Name).Distinct().ToList();

                    if (exceptDuplicateList.Count() == Quests[i].Kill && Quests[i].Complete == false)
                    {
                        DisplayAchieveMessage(i);
                    }
                }
                else
                {
                    //Diaplay achievement a message. In case of Any Monster
                    if (Kills.Count() == Quests[i].Kill && Quests[i].Complete == false)
                    {
                        DisplayAchieveMessage(i);
                    }
                }
            }
        }
 protected override void UpdateLabels(Character player, Quests quests, Game game)
 {
     UpdateLabel("name", player.Name);
     UpdateLabel("hc_sc", player.IsHardcore ? "HARDCORE" : "SOFTCORE");
     UpdateLabel("exp_classic", player.IsExpansion ? "EXPANSION" : "CLASSIC");
     UpdateLabel("playersx", game.PlayersX);
     UpdateLabel("seed", game.Seed);
     UpdateLabel("deaths", player.Deaths);
     UpdateLabel("runs", (int)game.GameCount);
     UpdateLabel("chars", (int)game.CharCount);
     UpdateLabel("gold", player.Gold + player.GoldStash);
     UpdateLabel("mf", player.MagicFind);
     UpdateLabel("monstergold", player.MonsterGold);
     UpdateLabel("atd", player.AttackerSelfDamage);
     UpdateLabel("lvl", player.Level);
     UpdateLabel("str", player.Strength);
     UpdateLabel("vit", player.Vitality);
     UpdateLabel("dex", player.Dexterity);
     UpdateLabel("ene", player.Energy);
     UpdateLabel("ias", realFrwIas ? player.RealIAS() : player.IncreasedAttackSpeed);
     UpdateLabel("frw", realFrwIas ? player.RealFRW() : player.FasterRunWalk);
     UpdateLabel("fcr", player.FasterCastRate);
     UpdateLabel("fhr", player.FasterHitRecovery);
     UpdateLabel("cold", player.ColdResist);
     UpdateLabel("ligh", player.LightningResist);
     UpdateLabel("pois", player.PoisonResist);
     UpdateLabel("fire", player.FireResist);
     UpdateLabel("norm", $@"{quests.ProgressByDifficulty(GameDifficulty.Normal) * 100:0}");
     UpdateLabel("nm", $@"{quests.ProgressByDifficulty(GameDifficulty.Nightmare) * 100:0}");
     UpdateLabel("hell", $@"{quests.ProgressByDifficulty(GameDifficulty.Hell) * 100:0}");
 }
    void Start()
    {
        quests          = GetComponent <Quests>();
        defAffraidCount = affraidCount;
        patrol          = GetComponent <FriendPatrol>();
        momDino         = GetComponentInParent <EnemyController>();
        animator        = GetComponent <Animator>();
        target          = PlayerManager.instance.player.transform;
        agent           = GetComponent <NavMeshAgent>();
        combat          = GetComponent <CharacterCombat>();

        // agent.Warp(PlayerManager.instance.startPos.position);

        playerState = GameObject.Find("PlayerState");
        if (playerState != null)
        {
            quests.currentQuest = playerState.GetComponent <Player>().currentQuest;
            if (quests.currentQuest > 0)
            {
                agent.Warp(playerState.GetComponent <Player>().startPosition);
                patrol.SetOnQuest();
                onQuest = true;
                quest.gameObject.SetActive(false);
                goHome        = true;
                patrol.goHome = true;
            }
        }
    }
Exemple #26
0
 private void ActivateQuestPanels()
 {
     for (int i = 0; i < QuestsPaneles.GetLength(0); i++)
     {
         QuestsPaneles[i].transform.GetChild(2).GetComponent <Text>().text = Quests.GetQuestConditionText(0) + "\n" + Quests.GetProgressText(i);
         if (Quests.IsQuestInProgress(i))
         {
             QuestsPaneles[i].transform.GetChild(3).GetComponent <Slider>().value = Quests.GetProgress(i);    // progressBar
         }
         else if (Quests.IsQuestCompletedAndNeedGetPrize(i))
         {
             QuestsPaneles[i].transform.GetChild(3).gameObject.SetActive(false);     // progressBar
             QuestsPaneles[i].transform.GetChild(4).gameObject.SetActive(true);      // Get Prize panel
             QuestsPaneles[i].transform.GetChild(4).GetChild(0).GetChild(0).GetComponent <Text>().text = Quests.GetQuestPrizeText(i);
         }
         else if (Quests.IsQuestCompleted(i))
         {
             QuestsPaneles[i].transform.GetChild(0).gameObject.SetActive(true);     // background Completed
             QuestsPaneles[i].transform.GetChild(1).gameObject.SetActive(false);    // background Progressing
             QuestsPaneles[i].transform.GetChild(3).gameObject.SetActive(false);    // progressBar
             QuestsPaneles[i].transform.GetChild(4).gameObject.SetActive(false);    // Get Prize panel
             QuestsPaneles[i].transform.GetChild(5).gameObject.SetActive(true);     // Image Completed
         }
     }
 }
Exemple #27
0
    public static void StartDialogWithQuest(string[] dialogArray, string[] nameArray, string questName, string questDesc, int questType, string targetNPCName, string providerName, string questsFullMessage, int questMaxProgress)
    {
        dialogManager.InitializeDialogArrays(dialogArray, nameArray, Style_Paper);
        dialogManager.ResetDialogUI(dialogArray[0], nameArray[0]);

        for (int q = 0; q < GameData.activeQuests.Length; q++)               //This is so that upon loading, the array has object values while will be modified on save, and it's above all else since it has to happen
        {
            Quests.emptyQuest                  = new Quests();
            Quests.emptyQuest.questName        = "None";
            Quests.emptyQuest.questDescription = "No quest here";
            GameData.activeQuests[q]           = Quests.emptyQuest;
        }

        Quests newQuest = new Quests();

        newQuest.questName        = questName;
        newQuest.questDescription = questDesc;
        newQuest.questType        = questType;
        newQuest.progress         = 0;
        newQuest.maxProgress      = questMaxProgress;
        newQuest.targetNPCName    = targetNPCName;
        newQuest.askerName        = providerName;

        if (!Quests.AddQuest(newQuest))               //tries to add the quest, and if it's full it's gonna add the quest failed line to the dialog
        {
            activeDialog.Add(questsFullMessage);
            speakerNames.Add(nameArray[0]);
        }
    }
        private void UpdateQuest(Quests quests)
        {
            var viewList = quests.All
                           .Select(x => new QuestViewModel(x))
                           .Distinct(x => x.Id)
                           .ToList();

            try
            {             // QuestTracker 어디서 문제가 생길지 모름
                questTracker.AllQuests.ForEach(x =>
                {
                    var y = viewList.Where(z => z.Id == x.Id).FirstOrDefault();
                    if (y == null)
                    {
                        return;
                    }

                    y.QuestProgressValue = x.GetProgress();
                    y.QuestProgressText  = x.GetProgressText();
                });
            }
            catch { }

            this.OriginalQuests = viewList.ToArray();
            this.IsEmpty        = quests.IsEmpty;
            this.IsUntaken      = quests.IsUntaken;

            // Quests 멤버는 필터 적용된걸 get으로 반환해서 문제가 있음
            _badge = OriginalQuests.Count(x => x.QuestProgressValue == 100);
            this.UpdateBadge();
        }
Exemple #29
0
        public async Task <IActionResult> Edit(int id, [Bind("QuestId,Title,Reward,Description,Extra")] Quests quests)
        {
            if (id != quests.QuestId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(quests);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!QuestsExists(quests.QuestId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(quests));
        }
        public static void SaveQuest_OnCommand(CommandEventArgs e)
        {
            Mobile m = e.Mobile;

            if (e.Length == 0 || e.Length > 2)
            {
                m.SendMessage("Syntax: SaveQuest <id> [saveEnabled=true]");
                return;
            }

            Type index = AssemblyHandler.FindTypeByName(e.GetString(0));

            if (index == null || !Quests.TryGetValue(index, out MLQuest quest))
            {
                m.SendMessage("Invalid quest type name.");
                return;
            }

            bool enable = e.Length == 2 ? e.GetBoolean(1) : true;

            quest.SaveEnabled = enable;
            m.SendMessage("Serialization for quest {0} is now {1}.", quest.GetType().Name, enable ? "enabled" : "disabled");

            if (AutoGenerateNew && !enable)
            {
                m.SendMessage(
                    "Please note that automatic generation of new quests is ON. This quest will be regenerated on the next server start.");
            }
        }
        public void Add(uint questId)
        {
            if (Quests.ContainsKey(questId))
            {
                _log.Warn("Duplicate add quest {0}", questId);
                return;
            }

            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;
            Quests.Add(quest.TemplateId, quest);

            var res = quest.Start();

            if (res == 0)
            {
                Quests.Remove(quest.TemplateId);
            }
            else
            {
                Owner.SendPacket(new SCQuestContextStartedPacket(quest, res));
            }
        }
Exemple #32
0
        /// <summary>
        /// Add or Update player Quests 
        /// </summary>
        /// <param name="player"></param>
        public static void SavePlayerQuest(Player player, bool update = true)
        {
            using (MySqlConnection connection = new MySqlConnection(connectionString))
            {
                connection.Open();
                Quests Quests = new Quests();

                if (!update)
                {
                    foreach (var Quest in Quests.Values)
                    {
                        using (MySqlCommand command = connection.CreateCommand())
                        {
                            command.CommandText = "GAME_QUEST_ADD";
                            command.CommandType = System.Data.CommandType.StoredProcedure;
                            command.Parameters.AddWithValue("@in_PlayerId", player.PlayerId);
                            command.Parameters.AddWithValue("@in_QuestId", Quest.Key);
                            command.Parameters.AddWithValue("@in_QuestStep", Quest.Value);
                            command.ExecuteNonQuery();
                        }
                    }
                }
                else
                {
                    foreach (var ability in Quests.Values)
                    {
                        using (MySqlCommand command = connection.CreateCommand())
                        {
                            command.CommandText = "GAME_QUEST_UPDATE";
                            command.CommandType = System.Data.CommandType.StoredProcedure;
                            command.Parameters.AddWithValue("@in_PlayerId", player.PlayerId);
                            command.Parameters.AddWithValue("@in_QuestId", ability.Key);
                            command.Parameters.AddWithValue("@in_QuestStep", ability.Value);
                            command.ExecuteNonQuery();
                        }
                    }
                }
                connection.Close();
            }
        }
Exemple #33
0
    public void investigate()
    {
        /*		rightSideMessage = "island coords: " + (int)islandScript.xCoord + " " + (int)islandScript.zCoord + "\n" +
            "my coords: " + (int)xCoord + " " + (int)zCoord;*/

        CameraScript cScript;
        cScript = (CameraScript)FindObjectOfType(typeof(CameraScript));
        int questCount = cScript.questList.Count;
        int randomQuestNumber = Random.Range (0, questCount); //for ints
        currentQuest = cScript.questList[randomQuestNumber];

        questGUIOn = true;

        //quest stuff
    }
Exemple #34
0
    // Use this for initialization
    void Start()
    {
        if (instance != null) {
            return;
        }
        instance = this;

        NetworkAPI.RegisterExtensionMessageHandler ("ao.QUEST_OFFER", _HandleQuestOfferResponse);
        NetworkAPI.RegisterExtensionMessageHandler ("ao.QUEST_LOG_INFO", _HandleQuestLogInfo);
        NetworkAPI.RegisterExtensionMessageHandler ("ao.QUEST_STATE_INFO", _HandleQuestStateInfo);
        NetworkAPI.RegisterExtensionMessageHandler ("ao.QUEST_PROGRESS", _HandleQuestProgressInfo);
        NetworkAPI.RegisterExtensionMessageHandler ("ao.REMOVE_QUEST_RESP", _HandleRemoveQuestResponse);
    }
Exemple #35
0
    void generateQuests()
    {
        //create a list of quests from the events file.
        TextAsset file = (TextAsset)Resources.Load ("events", typeof(TextAsset));
        string questsText = file.text;
        int propertyCount = 0;
        string currentQuestProperty = "";
        Quests currentQuest = new Quests();
        int totalQuestCount=0;

        foreach( char c in questsText ) {
            if ( propertyCount < 75){ //if 70 properties added, then new event must be added to list
                if ( c == '~') {
                    if (propertyCount == 1){
                        currentQuest = new Quests();
                        currentQuest.eventName = currentQuestProperty; }
                    if (propertyCount == 2){ currentQuest.eventText = currentQuestProperty; }
                    if (propertyCount == 3){ currentQuest.optionText1 = currentQuestProperty; }
                    if (propertyCount == 4){ currentQuest.successText1 = currentQuestProperty; }
                    if (propertyCount == 5){ currentQuest.failText1 = currentQuestProperty; }
                    if (propertyCount == 6){ currentQuest.odds1 = System.Convert.ToInt32(currentQuestProperty) ; }
                    if (propertyCount == 7){ currentQuest.oddsWit1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 8){ currentQuest.oddsMorale1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 9){ currentQuest.oddsNotoriety1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 10){ currentQuest.oddsCharisma1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 11){ currentQuest.oddsEvil1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 12){ currentQuest.oddsCrew1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 13){ currentQuest.oddsIntegrity1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 14){ currentQuest.oddsAle1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 15){ currentQuest.oddsGunpowder1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 16){ currentQuest.oddsCoins1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 17){ currentQuest.successWit1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 18){ currentQuest.successMorale1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 19){ currentQuest.successNotoriety1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 20){ currentQuest.successCharisma1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 21){ currentQuest.successEvil1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 22){ currentQuest.successCrew1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 23){ currentQuest.successIntegrity1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 24){ currentQuest.successAle1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 25){ currentQuest.successGunpowder1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 26){ currentQuest.successCoins1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 27){ currentQuest.failureWit1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 28){ currentQuest.failureMorale1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 29){ currentQuest.failureNotoriety1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 30){ currentQuest.failureCharisma1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 31){ currentQuest.failureEvil1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 32){ currentQuest.failureCrew1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 33){ currentQuest.failureIntegrity1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 34){ currentQuest.failureAle1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 35){ currentQuest.failureGunpowder1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 36){ currentQuest.failureCoins1 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 37){
                        //currentQuestProperty == "true"
                        if (currentQuestProperty == "True" ) {currentQuest.makeFight1 = true;}
                        else currentQuest.makeFight1 = false;
                    }
                    if (propertyCount == 38){ currentQuest.fightDifficulty1 = currentQuestProperty; }

                    //change below
                    if (propertyCount == 39){ currentQuest.optionText2 = currentQuestProperty; }
                    if (propertyCount == 40){ currentQuest.successText2 = currentQuestProperty; }
                    if (propertyCount == 41){ currentQuest.failText2 = currentQuestProperty; }
                    if (propertyCount == 42){ currentQuest.odds2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 43){ currentQuest.oddsWit2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 44){ currentQuest.oddsMorale2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 45){ currentQuest.oddsNotoriety2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 46){ currentQuest.oddsCharisma2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 47){ currentQuest.oddsEvil2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 48){ currentQuest.oddsCrew2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 49){ currentQuest.oddsIntegrity2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 50){ currentQuest.oddsAle2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 51){ currentQuest.oddsGunpowder2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 52){ currentQuest.oddsCoins2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 53){ currentQuest.successWit2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 54){ currentQuest.successMorale2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 55){ currentQuest.successNotoriety2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 56){ currentQuest.successCharisma2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 57){ currentQuest.successEvil2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 58){ currentQuest.successCrew2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 59){ currentQuest.successIntegrity2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 60){ currentQuest.successAle2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 61){ currentQuest.successGunpowder2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 62){ currentQuest.successCoins2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 63){ currentQuest.failureWit2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 64){ currentQuest.failureMorale2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 65){ currentQuest.failureNotoriety2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 66){ currentQuest.failureCharisma2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 67){ currentQuest.failureEvil2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 68){ currentQuest.failureCrew2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 69){ currentQuest.failureIntegrity2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 70){ currentQuest.failureAle2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 71){ currentQuest.failureGunpowder2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 72){ currentQuest.failureCoins2 = System.Convert.ToInt32( currentQuestProperty) ; }
                    if (propertyCount == 73){
                        //currentQuestProperty == "true"
                        if (currentQuestProperty == "True" ) {currentQuest.makeFight2 = true;}
                        else currentQuest.makeFight2 = false; }
                    if (propertyCount == 74){ currentQuest.fightDifficulty2 = currentQuestProperty; }

                    currentQuestProperty=" "; //clear the property
                    propertyCount++;

                } else {
                    //append character to string
                    currentQuestProperty = currentQuestProperty + c;
                    if (c == '^'){ //ignore text before semicolon
                        currentQuestProperty = "";
                    }
                }
            }

            if (propertyCount == 75){
                //currentQuest holds a fully populated quest, lets add it to the list!
                totalQuestCount++;
                Debug.Log ("ADDING A QUEST No. " + totalQuestCount + " with eventname " + currentQuest.eventName);
                questList.Add (currentQuest);
                propertyCount = 1;

                if (propertyCount == 0) propertyCount++;
            }
        }
    }