Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QuestPerformerStatusHelper"/> class.
        /// </summary>
        /// <param name="owner">The quest performer that this object will track the quest status of.</param>
        public QuestPerformerStatusHelper(User owner) : base(owner)
        {
            _questKillCounter = new QuestPerformerKillCounter(owner);

            // Send the initial quest status
            var completed = CompletedQuests.Select(x => x.QuestID);
            var active    = ActiveQuests.Select(x => x.QuestID);

            using (var pw = ServerPacket.QuestInfo(x => UserQuestInformation.WriteQuestInfo(x, completed, active)))
            {
                Owner.Send(pw, ServerMessageType.GUI);
            }
        }
Beispiel #2
0
        /// <summary>
        /// When overridden in the derived class, allows for additional handling of the
        /// <see cref="QuestPerformerStatusHelper{TCharacter}.QuestCanceled"/> event without creating an event hook.
        /// </summary>
        /// <param name="quest">The quest that was canceled.</param>
        protected override void OnQuestCanceled(IQuest <User> quest)
        {
            base.OnQuestCanceled(quest);

            using (var pw = ServerPacket.QuestInfo(x => UserQuestInformation.WriteRemoveActiveQuest(x, quest.QuestID)))
            {
                Owner.Send(pw, ServerMessageType.GUI);
            }

            Owner.Send(GameMessage.QuestCanceled, ServerMessageType.GUI);

            _worldStats.AddQuestCancel(Owner, quest.QuestID);
            EventCounterManager.Quest.Increment(quest.QuestID, QuestEventCounterType.Canceled);
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UserInfo"/> class.
        /// </summary>
        /// <param name="socket">The socket.</param>
        /// <exception cref="ArgumentNullException"><paramref name="socket" /> is <c>null</c>.</exception>
        public UserInfo(INetworkSender socket)
        {
            if (socket == null)
            {
                throw new ArgumentNullException("socket");
            }

            _socket = socket;

            // Create the collections for tracking if quest requirements statuses
            _hasStartQuestRequirements  = new HasQuestRequirementsTracker(SendHasQuestStartRequirements);
            _hasFinishQuestRequirements = new HasQuestRequirementsTracker(SendHasQuestFinishRequirements);

            // Create some other stuff
            _inventory = new Inventory(socket);
            _questInfo = new UserQuestInformationExtended(this);
        }