Exemplo n.º 1
0
        /// <summary>
        /// Starts a quest. Yep. That's it.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="id"></param>
        public void StartQuest(MabiPC character, uint id)
        {
            // This would prevent restarting of quests.
            //if (this.HasQuest(client, id))
            //{
            //    Logger.Warning("Trying to start quest '{0}' for '{1}' twice.", id, client.Character.Name);
            //    return;
            //}

            // Remove quest if it's aleady there and not completed,
            // or it will be shown twice till next relog.
            var exiQuest = character.GetQuestOrNull(id);
            if (exiQuest != null && exiQuest.State < MabiQuestState.Complete)
                WorldManager.Instance.CreatureCompletesQuest(character, character.Quests[id], false);

            // Check here, before we add a quest that doesn't even exist.
            if (!MabiData.QuestDb.Exists(id))
            {
                Logger.Warning("Quest '{0}' does not exist.", id);
                return;
            }

            var quest = new MabiQuest(id);
            character.Quests[id] = quest;

            // Owl
            WorldManager.Instance.Broadcast(new MabiPacket(Op.QuestOwlNew, character.Id).PutLong(quest.Id), SendTargets.Range, character);

            // Quest item (required to complete quests)
            Send.ItemInfo(character.Client, character, quest.QuestItem);

            // Quest info
            Send.QuestNew(character, quest);
        }
Exemplo n.º 2
0
        public override bool Met(MabiPC character)
        {
            var quest = character.GetQuestOrNull(this.Id);
            if (quest == null || quest.State != MabiQuestState.Complete)
                return false;

            return true;
        }