Пример #1
0
        public void NextDialog(Connection client)
        {
            Quest q    = Program.Server.GetQuest(client.CurrentQuestID);
            byte  step = client.Character.GetQuestStep(client.CurrentQuestID);
            byte  line = client.CurrentQuestLine;

            // Next line
            line++;

            QuestStep qs = q.GetStep(step);

            if (line < qs.LineCount)
            {
                QuestLine ql = qs.GetLine(line);
                client.SetCurrentQuest(_id, q.QuestID, line);
                bool lastLine = (line >= (qs.LineCount - 1));
                ql.SendToClient(client, !lastLine);

                if (lastLine)
                {
                    client.QuestDialogFinished(_id);
                }
            }
            else
            {
                client.SetCurrentQuest(_id, q.QuestID, 0);
            }
        }
Пример #2
0
        public void DoDialog(Connection client)
        {
            // Is the player working for me?
            Quest playerActiveQuest = client.Character.GetActiveQuestForNPC(_id);

            if (playerActiveQuest != null)
            {
                client.SetCurrentQuest(_id, playerActiveQuest.QuestID, 0);
                byte      step = client.Character.GetQuestStep(playerActiveQuest.QuestID);
                QuestLine ql   = playerActiveQuest.GetStep(step).GetLine(0);
                ql.SendToClient(client);
                client.SendPacket(new NPCDialogPacket(_gameID));
                return;
            }

            // Do I have something for the player?
            foreach (Quest q in _quests.Values)
            {
                if (!client.Character.HasActiveQuest(q.QuestID) && !client.Character.HasCompletedQuest(q.QuestID))
                {
                    if (q.PlayerMeetsRequirements(client.Character))
                    {
                        client.Character.ReceiveQuest(q);
                        client.SetCurrentQuest(_id, q.QuestID, 0);
                        QuestStep qs = q.GetStep(0);
                        qs.Activate(client);
                        QuestLine ql = qs.GetLine(0);
                        ql.SendToClient(client);
                        client.SendPacket(new NPCDialogPacket(_gameID));
                    }
                }
            }

            /*
             * // Am I selling something?
             * if (IsMerchant)
             * {
             *  // Show sell dialog
             * }
             *
             * // Just say hello
             * if (_defaultText != null)
             * {
             *  client.SendPacket(new NPCDialogPacket(_defaultText, _defaultIcon));
             * }
             */
        }