Пример #1
0
        public void Operate(Packet inPacket, Character talker)
        {
            NpcScript script = talker.NpcSession;

            if (script == null)
            {
                return;
            }

            DialogType type = (DialogType)inPacket.ReadByte();

            if (type != script.LastSentType)
            {
                return;
            }

            byte selection = inPacket.ReadByte();

            switch (type)
            {
            case DialogType.Normal:
            {
                switch (selection)
                {
                case 0:

                    script.SetResponse(false);

                    break;

                case 1:

                    script.SetResponse(true);

                    break;

                default:

                    script.Stop();

                    break;
                }
            }
            break;

            case DialogType.YesNo:
            {
                switch (selection)
                {
                case 0:

                    script.SetResponse(false);

                    break;

                case 1:

                    script.SetResponse(true);

                    break;

                default:

                    script.Stop();

                    break;
                }
            }
            break;

            case DialogType.GetText:
            {
                switch (selection)
                {
                case 0:

                    script.Stop();

                    break;

                case 1:

                    //script.StringAnswer = inPacket.ReadString();
                    script.Run();

                    break;

                default:

                    script.Stop();

                    break;
                }
            }
            break;

            case DialogType.Menu:
            case DialogType.Question:
            {
                switch (selection)
                {
                case 0:

                    script.Stop();

                    break;

                case 1:

                    script.SetSelection(inPacket.ReadByte());

                    break;

                default:

                    script.Stop();

                    break;
                }
            }
            break;
            }
        }