Beispiel #1
0
        /// <summary>
        /// Attempts to start a chat dialog with the given <paramref name="npc"/>.
        /// </summary>
        /// <param name="npc">NPC to start the chat dialog with.</param>
        /// <returns>True if the dialog was started with the <paramref name="npc"/>; otherwise false.</returns>
        public bool StartChat(NPC npc)
        {
            // Check if the chat can be started
            if (!CanStartChat(npc))
            {
                return(false);
            }

            _chattingWith = npc;

            // Tell the client to open the dialog
            using (var pw = ServerPacket.StartChatDialog(npc.MapEntityIndex, ChatDialog.ID))
            {
                _user.Send(pw, ServerMessageType.GUI);
            }

            // Get the first page to use
            var initialPage = ChatDialog.GetInitialDialogItem();

            Debug.Assert(initialPage != null);
            _dialogItem = GetNextDialogPage(initialPage);

            // Tell the user which page to use
            NotifyUserOfNewPage();

            return(true);
        }