Exemplo n.º 1
0
        /// <summary>
        /// Interact with scholar.
        /// </summary>
        /// <param name="player"></param>
        /// <returns></returns>
        public override bool Interact(GamePlayer player)
        {
            if (!base.Interact(player))
            {
                return(false);
            }

            IList  quests    = QuestListToGive;
            int    count     = 0;
            string artifacts = string.Empty;

            if (quests.Count > 0)
            {
                lock (quests.SyncRoot)
                {
                    int numQuests = quests.Count;
                    foreach (ArtifactQuest quest in quests)
                    {
                        // if continuing a quest and on a step that requires input then
                        // let the quest handle the interaction
                        ArtifactQuest playerQuest = (ArtifactQuest)player.IsDoingQuest(quest.GetType());
                        if (playerQuest != null)
                        {
                            if (playerQuest.Interact(this, player))
                            {
                                return(true);
                            }
                        }

                        if (player.CanReceiveArtifact(quest.ArtifactId))
                        {
                            if (count > 0 && numQuests < quests.Count)
                            {
                                artifacts += (numQuests == 1) ? ", or " : ", ";
                            }

                            artifacts += string.Format("[{0}]", quest.ArtifactId);

                            ++count;
                        }

                        --numQuests;
                    }
                }
            }

            string intro = string.Empty;

            if (count == 0)
            {
                intro = "I have no artifacts available for your class";
            }
            else
            {
                intro = string.Format(
                    "Which artifact may I assist you with, {0}? {1} {2}",
                    player.CharacterClass.Name,
                    "I study the lore and magic of the following artifacts:",
                    artifacts);
            }

            intro += ".";

            SayTo(player, eChatLoc.CL_PopupWindow, intro);

            intro = string.Format(
                "{0}, did you find any of the stories that chronicle the powers of the {1} {2} ",
                player.Name,
                "artifacts? We can unlock the powers of these artifacts by studying the stories.",
                "I can take the story and unlock the artifact's magic.");

            SayTo(player, eChatLoc.CL_PopupWindow, intro);
            return(true);
        }