예제 #1
0
        private IPrompt <T> NextClarifyPrompt(T state, FieldStepState stepState, IRecognize <T> recognizer, out Ambiguous clarify)
        {
            IPrompt <T> prompter = null;

            clarify = null;
            foreach (var clarification in stepState.Clarifications)
            {
                if (clarification.Values.Length > 1)
                {
                    clarify = clarification;
                    break;
                }
            }
            if (clarify != null)
            {
                var field = new Field <T>("__clarify__", FieldRole.Value);
                field.Form = _field.Form;
                var template     = _field.Template(TemplateUsage.Clarify);
                var helpTemplate = _field.Template(template.AllowNumbers ? TemplateUsage.EnumOneNumberHelp : TemplateUsage.EnumManyNumberHelp);
                field.SetPrompt(new PromptAttribute(template));
                field.ReplaceTemplate(_field.Template(TemplateUsage.Clarify));
                field.ReplaceTemplate(helpTemplate);
                foreach (var value in clarify.Values)
                {
                    field.AddDescription(value, recognizer.ValueDescription(value));
                    field.AddTerms(value, recognizer.ValidInputs(value).ToArray());
                }
                var choiceRecognizer = new RecognizeEnumeration <T>(field);
                prompter = new Prompter <T>(template, _field.Form, choiceRecognizer);
            }
            return(prompter);
        }
예제 #2
0
 public TaskPresenter(ITaskRepo taskRepo, IInput input, IPrompt prompt, IFileHistoryRepo fileHistoryRepo)
 {
     _taskRepo = taskRepo;
     _input = input;
     _prompt = prompt;
     _fileHistoryRepo = fileHistoryRepo;
 }
예제 #3
0
        public CoffeeMachineController()
        {
            PrintWelcomeMessage();

            this._priceList = new CoffeeMenu();
            this._prompt    = new Prompt();
            this._order     = new Order(_priceList, _prompt);
        }
예제 #4
0
 public InstallDevMenu(string rootFilesPath, IPhone phone, IBcdInvokerFactory bcdInvokerFactory, IFileSystemOperations fileSystemOperations, IPrompt prompt)
 {
     this.rootFilesPath        = rootFilesPath;
     this.phone                = phone;
     this.bcdInvokerFactory    = bcdInvokerFactory;
     this.fileSystemOperations = fileSystemOperations;
     this.prompt               = prompt;
 }
예제 #5
0
 public void Abandon(ConversationAbandonedEventArgs details)
 {
     if (!abandoned)
     {
         abandoned     = true;
         currentPrompt = null;
         context.ForWhom.AbandonConversation(this);
     }
 }
예제 #6
0
 public void Begin()
 {
     if (currentPrompt == null)
     {
         abandoned     = false;
         currentPrompt = firstPrompt;
         context.ForWhom.BeginConversation(this);
     }
 }
예제 #7
0
 public Conversation(IPlugin plugin, IConversable forWhom, IPrompt firstPrompt, Dictionary <Object, Object> initialSessionData)
 {
     this.firstPrompt      = firstPrompt;
     this.context          = new ConversationContext(plugin, forWhom, initialSessionData);
     this.modal            = true;
     this.localEchoEnabled = true;
     this.prefix           = new NullConversationPrefix();
     this.cancellers       = new List <IConversationCanceller>();
 }
    /// <summary>
    /// Displays a prompt to the user.
    /// </summary>
    /// <typeparam name="T">The prompt result type.</typeparam>
    /// <param name="console">The console.</param>
    /// <param name="prompt">The prompt to display.</param>
    /// <returns>The prompt input result.</returns>
    public static T Prompt <T>(this IAnsiConsole console, IPrompt <T> prompt)
    {
        if (prompt is null)
        {
            throw new ArgumentNullException(nameof(prompt));
        }

        return(prompt.Show(console));
    }
예제 #9
0
        private void Prompt_OnCommandRequested(IPrompt prompt, PromptCommandAttribute cmd, string commandLine)
        {
            if (cmd.Command == "record stop")
            {
                return;
            }

            _record.WriteLine(commandLine);
        }
예제 #10
0
 public void AcquireInput(IPrompt prompt)
 {
     SourceFile = AddExtension(prompt.Prompt<string>("Enter the source filename (.bf)", PromptOptions.Required, validationMethod: x => !string.IsNullOrWhiteSpace(x)), ".bf");
     ProgrammeName = SourceFile.Substring(0, SourceFile.LastIndexOf('.'));
     DestinationFile = AddExtension(prompt.Prompt("Enter the destination filename (.cs)", PromptOptions.Optional, ProgrammeName + ".cs", validationMethod: x => !string.IsNullOrWhiteSpace(x)), ".cs");
     ExecutableFile = AddExtension(prompt.Prompt("Enter the destination executable (.exe)", PromptOptions.Optional, ProgrammeName + ".exe", validationMethod: x => !string.IsNullOrWhiteSpace(x)), ".exe");
     BufferSize = prompt.Prompt("Enter buffer size", PromptOptions.Optional, 2048);
     DotNetVersion = prompt.Prompt("Enter .NET version to compile with", PromptOptions.Optional, "4.0", "Version can be any of: 2.0, 3.5, 4.0", x => _dotNetFolders.ContainsKey(x));
 }
예제 #11
0
 public ConsoleJokeGenerator(IJokeService <CategoryQuery> jokeService,
                             INameService nameService,
                             IPrompt prompt,
                             IPrinter printer)
 {
     this.jokeService = jokeService;
     this.nameService = nameService;
     this.prompt      = prompt;
     this.printer     = printer;
 }
예제 #12
0
 public ConversationFactory(IPlugin plugin)
 {
     this.plugin        = plugin;
     isModal            = true;
     localEchoEnabled   = true;
     prefix             = new NullConversationPrefix();
     firstPrompt        = null;
     initialSessionData = new Dictionary <object, object>();
     playerOnlyMessage  = null;
     cancellers         = new List <IConversationCanceller>();
 }
예제 #13
0
        private PromptType GetPromptType(IPrompt prompt) //AuthPrompt GamePrompt
        {
            var attrs = prompt.GetType().GetCustomAttributes(true);

            if (attrs.Length == 0)
            {
                return(PromptType.None);
            }

            var att = (PromptAttribute)attrs[0];

            return(att.promptType);
        }
예제 #14
0
        public static IPrompt Create(Stream stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream", "A valid stream must be provided.");
            }

            XmlSerializer serializer = new XmlSerializer(typeof(UserPrompt));
            IPrompt       prompt     = (IPrompt)serializer.Deserialize(stream);

            stream.Dispose();
            return(prompt);
        }
예제 #15
0
        public SnapshotStore(
            IRepository <Uri> uriRepository,
            IRepository <int> intRepository,
            FastCdc fastCdc,
            string hashAlgorithmName,
            IPrompt prompt,
            IProbe probe,
            int parallelizeChunkThreshold)
        {
            _uriRepository             = uriRepository;
            _intRepository             = intRepository;
            _fastCdc                   = fastCdc;
            _hashAlgorithmName         = hashAlgorithmName;
            _probe                     = probe;
            _parallelizeChunkThreshold = parallelizeChunkThreshold;

            if (parallelizeChunkThreshold <= 0)
            {
                throw new ArgumentException(
                          "Value must be larger than zero",
                          nameof(parallelizeChunkThreshold));
            }

            _currentSnapshotId = FetchCurrentSnapshotId();

            if (_currentSnapshotId == null)
            {
                _salt       = AesGcmCrypto.GenerateSalt();
                _iterations = AesGcmCrypto.Iterations;
            }
            else
            {
                var snapshotReference = GetSnapshotReference(
                    _currentSnapshotId.Value);

                _salt       = snapshotReference.Salt;
                _iterations = snapshotReference.Iterations;
            }

            _key = new Lazy <byte[]>(() =>
            {
                var password = _currentSnapshotId == null
                    ? prompt.NewPassword()
                    : prompt.ExistingPassword();

                return(AesGcmCrypto.PasswordToKey(password, _salt, _iterations));
            });
        }
예제 #16
0
        private void Initialize(IPrompt prompt)
        {
            Name   = prompt.Name;
            Prompt = prompt;

            m_StateCreated = new QState(ActivePrompt_Created);
            m_StateShowing = new QState(ActivePrompt_Showing);
            m_StateShown   = new QState(ActivePrompt_Shown);
            m_StateClosing = new QState(ActivePrompt_Closing);
            m_StateClosed  = new QState(ActivePrompt_Closed);
            m_StateFaulted = new QState(ActivePrompt_Faulted);

            Prompt.Closed   += new EventHandler <PromptEventArgs>(Prompt_Closed);
            Prompt.Continue += new EventHandler <PromptEventArgs>(Prompt_Continue);
            Prompt.Error    += new EventHandler <PromptErrorEventArgs>(Prompt_Error);
        }
예제 #17
0
 public void OutputNextPrompt()
 {
     if (currentPrompt == null)
     {
         Abandon(new ConversationAbandonedEventArgs(this));
     }
     else
     {
         context.ForWhom.SendRawMessage(prefix.GetPrefix(context) + currentPrompt.GetPromptText(context));
         if (!currentPrompt.BlocksForInput(context))
         {
             currentPrompt = currentPrompt.AcceptInput(context, null);
             OutputNextPrompt();
         }
     }
 }
예제 #18
0
        private void SessionPacket(Session s, string arg)
        {
            IPrompt           prompt = (IPrompt)s.tag;
            AdapterResultType result = prompt.Dispatch(s, arg);

            if (result == AdapterResultType.Next)
            {
                switch (GetPromptType(prompt))
                {
                case PromptType.Auth:
                    s.tag = new GamePrompt(owner, zone, s);
                    break;

                case PromptType.Game:
                    break;
                }
            }
        }
예제 #19
0
            private static void Create(IPrompt prompt)
            {
                if (prompt == null)
                {
                    throw new ArgumentNullException("prompt", "A valid prompt must be provided.");
                }
                if ((string.IsNullOrEmpty(prompt.Name) || manager.activePrompts.ContainsKey(prompt.Name)))
                {
                    throw new ArgumentNullException("prompt.Name", "An ActivePrompt must have a valid, unique name.");
                }

                manager.activePrompts.Add(prompt.Name, new ActivePrompt(prompt));
                manager.activePrompts[prompt.Name].Start(manager.priority++);

                ActivePrompt aPrompt = manager.activePrompts[prompt.Name];

                while ((!aPrompt.IsInState(aPrompt.m_StateFaulted)) && (!aPrompt.IsInState(aPrompt.m_StateCreated)))
                {
                    System.Threading.Thread.Sleep(1);
                }
            }
예제 #20
0
 public Prompt(IPrompt prompt, string left, string middle = null, string right = null, string file = null, bool autoCloes = true)
 {
     this.prompt = prompt;
     this.left   = left;
     this.middle = middle;
     this.right  = right;
     this.file   = file;
     SetStyle(ControlStyles.Selectable, false);
     SetStyle(
         ControlStyles.UserPaint |
         ControlStyles.AllPaintingInWmPaint |
         ControlStyles.OptimizedDoubleBuffer |
         ControlStyles.ResizeRedraw |
         ControlStyles.DoubleBuffer, true);
     UpdateStyles();
     InitializeComponent();
     this.autoCloes = autoCloes;
     if (string.IsNullOrEmpty(file))
     {
         CanPenetrate();
     }
 }
예제 #21
0
        public void AcceptInput(string input)
        {
            if (currentPrompt != null)
            {
                if (localEchoEnabled)
                {
                    context.ForWhom.SendRawMessage(prefix.GetPrefix(context) + input);
                }

                foreach (IConversationCanceller canceller in cancellers)
                {
                    if (canceller.CancelBasedOnInput(context, input))
                    {
                        Abandon(new ConversationAbandonedEventArgs(this, canceller));
                        return;
                    }
                }

                currentPrompt = currentPrompt.AcceptInput(context, input);
                OutputNextPrompt();
            }
        }
예제 #22
0
 public void Enter(IPrompt roomSettingPrompt)
 {
 }
 public DisplayMarkdown(string path, IPrompt dialog)
 {
     this.path   = path;
     this.dialog = dialog;
 }
예제 #24
0
 public Coffee(CoffeeMenu priceList, IPrompt prompt)
 {
     this._priceList = priceList;
     this._prompt    = prompt;
 }
예제 #25
0
파일: Engine.cs 프로젝트: Skinny1001/PlayUO
        public static void Main(string[] Args)
        {
            int num3;
            m_IniPath = Path.Combine(Application.StartupPath, "Data/Config/Client.ini");
            ParseArgs(Args);
            m_FileManager = new Client.FileManager();
            if (m_FileManager.Error)
            {
                m_FileManager = null;
                GC.Collect();
            }
            else
            {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Engine.Exception_Unhandled);
                long frequency = 0L;
                QueryPerformanceFrequency(ref frequency);
                double num2 = frequency;
                m_QPF = num2 / 1000.0;
                WantDirectory("Data/Config/");
                Debug.Trace("Entered Main()");
                Debug.Block("Environment");
                Debug.Trace("Operating System = '{0}'", Environment.OSVersion);
                Debug.Trace(".NET Framework   = '{0}'", Environment.Version);
                Debug.Trace("Base Directory   = '{0}'", m_FileManager.BasePath(""));
                Debug.Trace("Data Directory   = '{0}'", m_FileManager.ResolveMUL(""));
                Debug.EndBlock();
                Debug.Try("Setting up interop communications");
                Interop.Comm = new ExposerInterop();
                Debug.EndTry();
                Debug.Try("Initializing Strings");
                Strings.Initialize();
                Debug.EndTry();
                Benchmark benchmark = new Benchmark(6);
                Debug.Trace("Benchmarks: {0} resolution", "low");
                benchmark = null;
                m_Timers = new ArrayList();
                m_Plugins = new ArrayList();
                m_WalkTimeout = new ArrayList();
                m_Journal = new ArrayList();
                m_Doors = new ArrayList();
                m_Pings = new Queue();
                m_LoadQueue = new Queue();
                m_MapLoadQueue = new Queue();
                WantDirectory("Data/Logs/");
                Debug.Block("Main()");
                if (m_OverrideServHost != null)
                {
                    NewConfig.ServerHost = m_OverrideServHost;
                }
                if (m_OverrideServPort != -1)
                {
                    NewConfig.ServerPort = m_OverrideServPort;
                }
                switch (NewConfig.GameSize.ToLower().Trim())
                {
                    case "320x240":
                        GameWidth = 320;
                        GameHeight = 240;
                        num3 = 3;
                        goto Label_02E0;

                    case "640x480":
                        GameWidth = 640;
                        GameHeight = 480;
                        num3 = 5;
                        goto Label_02E0;

                    case "800x600":
                        GameWidth = 800;
                        GameHeight = 600;
                        num3 = 7;
                        goto Label_02E0;

                    case "1024x768":
                        GameWidth = 0x400;
                        GameHeight = 0x300;
                        num3 = 7;
                        goto Label_02E0;

                    case "1280x1024":
                        GameWidth = 0x500;
                        GameHeight = 0x400;
                        num3 = 9;
                        goto Label_02E0;

                    case "1600x1200":
                        GameWidth = 0x640;
                        GameHeight = 0x4b0;
                        num3 = 11;
                        goto Label_02E0;
                }
                MessageBox.Show(string.Format("A invalid game size of '{0}' was specified in Client.cfg. Valid sizes are: '320x240' '640x480' '800x600' '1024x768' '1280x1024' '1600x1200'", NewConfig.GameSize));
            }
            return;
            Label_02E0:;
            string[] strArray = NewConfig.ScreenSize.ToLower().Trim().Split(new char[] { 'x' });
            int num4 = -1;
            int num5 = -1;
            if (strArray.Length == 2)
            {
                num4 = num5 = 0;
                try
                {
                    num4 = int.Parse(strArray[0]);
                    num5 = int.Parse(strArray[1]);
                }
                catch
                {
                }
            }
            if ((num4 >= 320) && (num5 >= 240))
            {
                ScreenWidth = num4;
                ScreenHeight = num5;
            }
            else
            {
                MessageBox.Show(string.Format("A invalid screen size of '{0}' was specified in Client.cfg. Make sure the value is formatted correctly ('<Width>x<Height>'), and that it is 320x240 or higher.", NewConfig.ScreenSize));
            }
            GameX = (ScreenWidth - GameWidth) / 2;
            GameY = (ScreenHeight - GameHeight) / 2;
            Renderer.blockWidth = num3;
            Renderer.blockHeight = num3;
            Renderer.cellWidth = num3 << 3;
            Renderer.cellHeight = num3 << 3;
            m_ClickTimer = new Timer(new OnTick(Engine.ClickTimer_OnTick), SystemInformation.DoubleClickTime);
            Debug.Try("Initializing Display");
            m_Display = new Display();
            if (NewConfig.FullScreen)
            {
                m_Display.FormBorderStyle = FormBorderStyle.None;
                m_Display.WindowState = FormWindowState.Maximized;
            }
            m_Display.ClientSize = new Size(ScreenWidth, ScreenHeight);
            m_Display.KeyPreview = true;
            m_Display.Show();
            Debug.EndTry();
            Application.DoEvents();
            Debug.Block("Initializing DirectX");
            InitDX();
            Debug.EndBlock();
            m_Loading = true;
            m_Ingame = false;
            DrawNow();
            Benchmark benchmark2 = new Benchmark(7);
            benchmark2.Start();
            Debug.TimeBlock("Initializing Animations");
            m_Animations = new Animations();
            Debug.EndBlock();
            m_Font = new Font[10];
            m_UniFont = new UnicodeFont[3];
            Debug.TimeBlock("Initializing Gumps");
            m_Gumps = new Gumps();
            Debug.EndBlock();
            m_DefaultFont = GetUniFont(3);
            m_DefaultHue = Hues.Load(0x3b2);
            Renderer.SetText("");
            Debug.TimeBlock("Initializing Plugins");
            FindPlugins();
            Debug.EndBlock();
            Macros.Load();
            LoadParticles();
            Renderer.SetAlphaEnable(true);
            Renderer.SetFilterEnable(false);
            Renderer.AlphaTestEnable = true;
            Renderer.SetTexture(m_Halo);
            try
            {
                m_Device.ValidateDevice();
            }
            catch (Exception exception)
            {
                m_Halo.Dispose();
                m_Halo = Hues.Default.GetGump(0x71);
                m_Rain.Dispose();
                m_Rain = Texture.Empty;
                m_SkillUp.Dispose();
                m_SkillUp = Hues.Default.GetGump(0x983);
                m_SkillDown.Dispose();
                m_SkillDown = Hues.Default.GetGump(0x985);
                m_SkillLocked.Dispose();
                m_SkillLocked = Hues.Default.GetGump(0x82c);
                m_Slider.Dispose();
                m_Slider = Hues.Default.GetGump(0x845);
                for (int i = 0; i < m_Snow.Length; i++)
                {
                    m_Snow[i].Dispose();
                    m_Snow[i] = Texture.Empty;
                }
                for (int j = 0; j < m_Edge.Length; j++)
                {
                    m_Edge[j].Dispose();
                    m_Edge[j] = Texture.Empty;
                }
                Debug.Trace("ValidateDevice() failed on 32-bit textures");
                Debug.Error(exception);
            }
            Renderer.SetTexture(null);
            Renderer.SetAlphaEnable(false);
            m_Effects = new Client.Effects();
            m_Loading = false;
            Point point = m_Display.PointToClient(Cursor.Position);
            m_EventOk = true;
            MouseMove(m_Display, new MouseEventArgs(Control.MouseButtons, 0, point.X, point.Y, 0));
            Network.CheckCache();
            ShowAcctLogin();
            MouseMoveQueue();
            m_EventOk = false;
            DrawNow();
            benchmark2.StopNoLog();
            Debug.Trace("Total -> {0}", Benchmark.Format(benchmark2.Elapsed));
            m_MoveDelay = new TimeDelay(0f);
            m_LastOverCheck = new TimeDelay(0.1f);
            m_NewFrame = new TimeDelay(0.05f);
            m_SleepMode = new TimeDelay(7.5f);
            m_EventOk = true;
            PlayRandomMidi();
            bool flag = false;
            new Timer(new OnTick(Engine.Evict_OnTick), 0x9c4).Start(false);
            Animations.StartLoading();
            Unlock();
            DateTime now = DateTime.Now;
            int num10 = Ticks + 0x1388;
            bool extendProtocol = NewConfig.ExtendProtocol;
            while (!exiting)
            {
                m_SetTicks = false;
                int ticks = Ticks;
                Macros.Slice();
                if (Gumps.Invalidated)
                {
                    if (m_LastMouseArgs != null)
                    {
                        MouseMove(m_Display, m_LastMouseArgs);
                    }
                    Gumps.Invalidated = false;
                }
                if (m_MouseMoved)
                {
                    MouseMoveQueue();
                }
                if (m_NewFrame.ElapsedReset())
                {
                    Renderer.m_Frames++;
                    m_Redraw = false;
                    Renderer.Draw();
                }
                else if ((m_Redraw || m_PumpFPS) || (m_Quake || (amMoving && IsMoving())))
                {
                    m_Redraw = false;
                    Renderer.Draw();
                }
                if ((extendProtocol && m_Ingame) && ((Party.State == PartyState.Joined) && (DateTime.Now >= now)))
                {
                    now = DateTime.Now + TimeSpan.FromSeconds(0.5);
                    for (int k = 0; k < Party.Members.Length; k++)
                    {
                        Mobile mobile = Party.Members[k];
                        if (((mobile != null) && !mobile.Player) && !mobile.Visible)
                        {
                            Network.Send(new PPE_QueryPartyLocs());
                            break;
                        }
                    }
                }
                Thread.Sleep(1);
                if (GetQueueStatus(0xff) != 0)
                {
                    Application.DoEvents();
                }
                UOAM.Slice();
                if (!Network.Slice())
                {
                    flag = true;
                    break;
                }
                Network.Flush();
                TickTimers();
                if (amMoving && m_Ingame)
                {
                    DoWalk(movingDir, false);
                }
                if (m_LoadQueue.Count > 0)
                {
                    for (int m = 0; (m_LoadQueue.Count > 0) && (m < 6); m++)
                    {
                        ((ILoader) m_LoadQueue.Dequeue()).Load();
                    }
                }
                if (m_MapLoadQueue.Count > 0)
                {
                    Preload((Worker) m_MapLoadQueue.Dequeue());
                }
            }
            NewConfig.Save();
            SaveJournal();
            Thread.Sleep(5);
            if ((m_Display != null) && !m_Display.IsDisposed)
            {
                m_Display.Hide();
            }
            Thread.Sleep(5);
            Application.DoEvents();
            Thread.Sleep(5);
            Application.DoEvents();
            m_Animations.Dispose();
            if (m_ItemArt != null)
            {
                m_ItemArt.Dispose();
            }
            if (m_LandArt != null)
            {
                m_LandArt.Dispose();
            }
            if (m_TextureArt != null)
            {
                m_TextureArt.Dispose();
            }
            m_Gumps.Dispose();
            if (m_Sounds != null)
            {
                m_Sounds.Dispose();
            }
            if (m_Multis != null)
            {
                m_Multis.Dispose();
            }
            m_FileManager.Dispose();
            Cursor.Dispose();
            Music.Dispose();
            Hues.Dispose();
            GRadar.Dispose();
            if (m_Plugins != null)
            {
                m_Plugins.Clear();
                m_Plugins = null;
            }
            if (m_Rain != null)
            {
                m_Rain.Dispose();
                m_Rain = null;
            }
            if (m_Slider != null)
            {
                m_Slider.Dispose();
                m_Slider = null;
            }
            if (m_SkillUp != null)
            {
                m_SkillUp.Dispose();
                m_SkillUp = null;
            }
            if (m_SkillDown != null)
            {
                m_SkillDown.Dispose();
                m_SkillDown = null;
            }
            if (m_SkillLocked != null)
            {
                m_SkillLocked.Dispose();
                m_SkillLocked = null;
            }
            if (m_Snow != null)
            {
                for (int n = 0; n < 12; n++)
                {
                    if (m_Snow[n] != null)
                    {
                        m_Snow[n].Dispose();
                        m_Snow[n] = null;
                    }
                }
                m_Snow = null;
            }
            if (m_Edge != null)
            {
                for (int num13 = 0; num13 < 8; num13++)
                {
                    if (m_Edge[num13] != null)
                    {
                        m_Edge[num13].Dispose();
                        m_Edge[num13] = null;
                    }
                }
                m_Edge = null;
            }
            if (m_WinScrolls != null)
            {
                for (int num14 = 0; num14 < m_WinScrolls.Length; num14++)
                {
                    if (m_WinScrolls[num14] != null)
                    {
                        m_WinScrolls[num14].Dispose();
                        m_WinScrolls[num14] = null;
                    }
                }
                m_WinScrolls = null;
            }
            if (m_Halo != null)
            {
                m_Halo.Dispose();
                m_Halo = null;
            }
            if (m_Friend != null)
            {
                m_Friend.Dispose();
                m_Friend = null;
            }
            if (m_FormX != null)
            {
                m_FormX.Dispose();
                m_FormX = null;
            }
            if (m_TargetImage != null)
            {
                m_TargetImage.Dispose();
                m_TargetImage = null;
            }
            if (m_TargetCursorImage != null)
            {
                m_TargetCursorImage.Dispose();
                m_TargetCursorImage = null;
            }
            if (m_Font != null)
            {
                for (int num15 = 0; num15 < 10; num15++)
                {
                    if (m_Font[num15] != null)
                    {
                        m_Font[num15].Dispose();
                        m_Font[num15] = null;
                    }
                }
                m_Font = null;
            }
            if (m_UniFont != null)
            {
                int length = m_UniFont.Length;
                for (int num17 = 0; num17 < length; num17++)
                {
                    if (m_UniFont[num17] != null)
                    {
                        m_UniFont[num17].Dispose();
                        m_UniFont[num17] = null;
                    }
                }
                m_UniFont = null;
            }
            if (m_MidiTable != null)
            {
                m_MidiTable.Dispose();
                m_MidiTable = null;
            }
            if (m_ContainerBoundsTable != null)
            {
                m_ContainerBoundsTable.Dispose();
                m_ContainerBoundsTable = null;
            }
            Texture.DisposeAll();
            Debug.EndBlock();
            if (flag)
            {
                Debug.Trace("Network error caused termination");
            }
            Network.DumpBuffer();
            Network.Close();
            Debug.Dispose();
            Strings.Dispose();
            m_LoadQueue = null;
            m_MapLoadQueue = null;
            m_DefaultFont = null;
            m_DefaultHue = null;
            m_Display = null;
            m_Encoder = null;
            m_Effects = null;
            m_Skills = null;
            m_Features = null;
            m_Animations = null;
            m_LandArt = null;
            m_TextureArt = null;
            m_ItemArt = null;
            m_Gumps = null;
            m_Sounds = null;
            m_Multis = null;
            m_FileManager = null;
            m_Display = null;
            m_Font = null;
            m_UniFont = null;
            m_Device = null;
            m_CharacterNames = null;
            m_MoveDelay = null;
            m_Text = null;
            m_Font = null;
            m_UniFont = null;
            m_NewFrame = null;
            m_SleepMode = null;
            m_Timers = null;
            m_Plugins = null;
            m_SkillsGump = null;
            m_JournalGump = null;
            m_Journal = null;
            m_FileManager = null;
            m_Encoder = null;
            m_DefaultFont = null;
            m_DefaultHue = null;
            m_LastTarget = null;
            m_Random = null;
            m_WalkStack = null;
            m_Prompt = null;
            m_IniPath = null;
            m_Pings = null;
            m_PingTimer = null;
            m_MultiList = null;
            m_WalkTimeout = null;
            m_Servers = null;
            m_AllNames = null;
            m_Doors = null;
            m_LastOverCheck = null;
            m_LastMouseArgs = null;
            m_LastAttacker = null;
            Renderer.m_VertexPool = null;
            try
            {
                Process currentProcess = Process.GetCurrentProcess();
                currentProcess.Kill();
                currentProcess.WaitForExit();
            }
            catch
            {
            }
        }
예제 #26
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="promptInit">Prompt</param>
 public Bootstrapper(IPrompt promptInit)
 {
     _prompt = promptInit;
 }
예제 #27
0
 public void AddPromptToQueue(IPrompt prompt)
 {
     _arkeCall.Logger.Debug($"Adding prompt to queue, queue size: {_promptQueue.Count}", _arkeCall.LogData);
     _promptQueue.Enqueue(prompt);
 }
예제 #28
0
 public OptionSelector(IPrompt userPrompt, IOptionParser optionParser)
 {
     _userPrompt = userPrompt;
     _parser     = optionParser;
 }
예제 #29
0
파일: Engine.cs 프로젝트: Skinny1001/PlayUO
        public static void commandEntered(string cmd)
        {
            if ((cmd.Length > 0) && !m_SayMacro)
            {
                m_LastCommand = cmd;
            }
            if (m_Prompt != null)
            {
                m_Prompt.OnReturn(cmd);
                m_Prompt = null;
            }
            else
            {
                cmd = cmd.Trim();
                if (cmd.Length > 0)
                {
                    int count = m_Plugins.Count;
                    for (int i = 0; i < count; i++)
                    {
                        Plugin plugin = (Plugin) m_Plugins[i];
                        if (plugin.OnCommandEntered(cmd))
                        {
                            return;
                        }
                    }
                    if (cmd.StartsWith("--") && UOAM.Connected)
                    {
                        UOAM.Chat(cmd.Substring(2));
                    }
                    else if (!cmd.StartsWith("/"))
                    {
                        if (!cmd.StartsWith(". "))
                        {
                            Network.Send(new PUnicodeSpeech(cmd));
                        }
                        else
                        {
                            object obj2;
                            string[] strArray = cmd.Substring(". ".Length).Split(new char[] { ' ' });
                            if (((strArray.Length > 0) && ((obj2 = strArray[0].ToLower()) != null)) && ((obj2 = <PrivateImplementationDetails>.$$method0x60008d2-1[obj2]) != null))
                            {
                                switch (((int) obj2))
                                {
                                    case 0:
                                    {
                                        Gump g = Gumps.FindGumpByGUID("Volume");
                                        if (g != null)
                                        {
                                            Gumps.Destroy(g);
                                            break;
                                        }
                                        Gumps.Desktop.Children.Add(new GVolumeControl());
                                        break;
                                    }
                                    case 1:
                                    {
                                        int num4 = 0;
                                        try
                                        {
                                            if (strArray.Length > 1)
                                            {
                                                num4 = Convert.ToInt32(strArray[1]);
                                            }
                                        }
                                        catch
                                        {
                                            num4 = 0;
                                        }
                                        if (num4 < 1)
                                        {
                                            AddTextMessage("Usage: DefaultRegs <amount>");
                                        }
                                        else
                                        {
                                            World.CharData.DefaultRegs = num4;
                                            AddTextMessage(string.Format("Default reagent amount changed to {0}.", num4));
                                        }
                                        break;
                                    }
                                    case 2:
                                    {
                                        bool flag = !World.CharData.AlwaysRun;
                                        if ((strArray.Length <= 1) || !(strArray[0].ToLower() == "on"))
                                        {
                                            if ((strArray.Length > 1) && (strArray[0].ToLower() == "off"))
                                            {
                                                flag = false;
                                            }
                                        }
                                        else
                                        {
                                            flag = true;
                                        }
                                        World.CharData.AlwaysRun = flag;
                                        return;
                                    }
                                    case 3:
                                        TargetHandler = new SetRegBagTargetHandler();
                                        AddTextMessage("Target your destination reagent container.");
                                        break;

                                    case 4:
                                        TargetHandler = new SetRegStockTargetHandler();
                                        AddTextMessage("Target your source reagent container.");
                                        break;

                                    case 5:
                                    {
                                        int num5 = 0;
                                        foreach (Mobile mobile2 in World.Mobiles.Values)
                                        {
                                            if ((World.InRange(mobile2) && mobile2.Visible) && mobile2.m_IsFactionGuard)
                                            {
                                                mobile2.QueryStats();
                                                mobile2.OpenStatus(false);
                                                if (mobile2.StatusBar != null)
                                                {
                                                    mobile2.StatusBar.Gump.X = (GameX + 10) + ((num5 / 6) * (mobile2.StatusBar.Gump.Width + 10));
                                                    mobile2.StatusBar.Gump.Y = (GameY + 10) + ((num5 % 6) * (mobile2.StatusBar.Gump.Height + 10));
                                                    num5++;
                                                }
                                            }
                                        }
                                        break;
                                    }
                                    case 6:
                                    {
                                        Mobile player = World.Player;
                                        if (player != null)
                                        {
                                            for (int j = 0; j < Multis.Items.Count; j++)
                                            {
                                                Item item = (Item) Multis.Items[j];
                                                if (item.InWorld && item.IsMulti)
                                                {
                                                    CustomMultiEntry customMulti = CustomMultiLoader.GetCustomMulti(item.Serial, item.Revision);
                                                    Multi m = null;
                                                    if (customMulti != null)
                                                    {
                                                        m = customMulti.Multi;
                                                    }
                                                    if (m == null)
                                                    {
                                                        m = item.Multi;
                                                    }
                                                    if ((m != null) && Multis.IsInMulti(item, m, player.X, player.Y, player.Z))
                                                    {
                                                        ArrayList dataStore = GetDataStore();
                                                        foreach (Mobile mobile4 in World.Mobiles.Values)
                                                        {
                                                            switch (mobile4.Notoriety)
                                                            {
                                                                case Notoriety.Attackable:
                                                                case Notoriety.Criminal:
                                                                case Notoriety.Enemy:
                                                                case Notoriety.Murderer:
                                                                    if ((((mobile4 != player) && !mobile4.Flags[MobileFlag.YellowHits]) && (!mobile4.m_IsFriend && mobile4.Visible)) && World.InRange(mobile4))
                                                                    {
                                                                        int xReal = mobile4.XReal;
                                                                        int yReal = mobile4.YReal;
                                                                        int zReal = mobile4.ZReal;
                                                                        if (Multis.RunUO_IsInside(item, m, xReal, yReal, zReal))
                                                                        {
                                                                            dataStore.Add(mobile4);
                                                                        }
                                                                    }
                                                                    break;
                                                            }
                                                        }
                                                        if (dataStore.Count > 0)
                                                        {
                                                            dataStore.Sort(TargetSorter.Comparer);
                                                            Mobile mobile5 = (Mobile) dataStore[0];
                                                            Network.Send(new PUnicodeSpeech("; i ban thee"));
                                                            Network.Send(new PTarget_Spoof(0, -559038737, ServerTargetFlags.None, mobile5.Serial, mobile5.X, mobile5.Y, mobile5.Z, mobile5.Body));
                                                            PacketHandlers.m_CancelTarget = true;
                                                        }
                                                        ReleaseDataStore(dataStore);
                                                        break;
                                                    }
                                                }
                                            }
                                            break;
                                        }
                                        break;
                                    }
                                    case 7:
                                    {
                                        if (strArray.Length != 2)
                                        {
                                            break;
                                        }
                                        int level = m_Multis.m_Level;
                                        switch (strArray[1].ToLower())
                                        {
                                            case "0":
                                            case "5":
                                            case "off":
                                                level = 5;
                                                break;

                                            case "1":
                                                level = 1;
                                                break;

                                            case "2":
                                                level = 2;
                                                break;

                                            case "3":
                                                level = 3;
                                                break;

                                            case "4":
                                                level = 4;
                                                break;

                                            case "up":
                                                level++;
                                                break;

                                            case "down":
                                                level--;
                                                break;
                                        }
                                        if (level > 5)
                                        {
                                            level = 5;
                                        }
                                        else if (level < 1)
                                        {
                                            level = 1;
                                        }
                                        if (m_Multis.m_Level != level)
                                        {
                                            m_Multis.m_Level = level;
                                            Map.Invalidate();
                                        }
                                        return;
                                    }
                                    case 8:
                                    {
                                        int defaultRegs = World.CharData.DefaultRegs;
                                        try
                                        {
                                            if (strArray.Length > 1)
                                            {
                                                defaultRegs = Convert.ToInt32(strArray[1]);
                                            }
                                        }
                                        catch
                                        {
                                            defaultRegs = World.CharData.DefaultRegs;
                                        }
                                        Item stock = World.CharData.Stock;
                                        Item regBag = World.CharData.RegBag;
                                        if ((stock != null) && (regBag != null))
                                        {
                                            MakeRegsTargetHandler.Transfer(stock, regBag, defaultRegs);
                                        }
                                        else
                                        {
                                            TargetHandler = new MakeRegsTargetHandler(defaultRegs, stock, regBag);
                                            if (stock == null)
                                            {
                                                AddTextMessage("Target your source reagent container.");
                                            }
                                            else
                                            {
                                                AddTextMessage("Target your destination reagent container.");
                                            }
                                        }
                                        break;
                                    }
                                    case 9:
                                        if (m_QamList.Count <= 0)
                                        {
                                            AddTextMessage("There are no item movements currently queued.");
                                            break;
                                        }
                                        m_QamList.Clear();
                                        if (m_QamTimer != null)
                                        {
                                            m_QamTimer.Stop();
                                        }
                                        m_QamTimer = null;
                                        AddTextMessage("The item movement queue has been cleared.");
                                        break;

                                    case 10:
                                        TargetHandler = new FriendTargetHandler();
                                        AddTextMessage("Target the player to toggle friendship status.", DefaultFont, Hues.Load(0x59));
                                        break;

                                    case 11:
                                        World.CharData.AutoPickup = !World.CharData.AutoPickup;
                                        AddTextMessage(World.CharData.AutoPickup ? "You like good stuff." : "You hate things.");
                                        break;

                                    case 12:
                                        World.CharData.Archery = !World.CharData.Archery;
                                        AddTextMessage(World.CharData.Archery ? "You are an archer." : "You aren't an archer.");
                                        break;

                                    case 13:
                                        World.CharData.LootGold = !World.CharData.LootGold;
                                        AddTextMessage(World.CharData.LootGold ? "You like gold." : "You hate gold.");
                                        break;

                                    case 14:
                                    {
                                        Mobile mob = World.Player;
                                        if (mob != null)
                                        {
                                            string mobilePath = Macros.GetMobilePath(mob);
                                            string path = FileManager.BasePath(string.Format("Data/Plugins/Macros/{0}.txt", mobilePath));
                                            string str8 = "Macros";
                                            string str9 = FileManager.BasePath(string.Format("Data/Plugins/Macros/{0}.txt", str8));
                                            if (GMacroEditorForm.IsOpen)
                                            {
                                                AddTextMessage("Close the macro editor before running this command.");
                                            }
                                            else if (File.Exists(path))
                                            {
                                                AddTextMessage("Macro definitions unique to your character were already found.");
                                            }
                                            else if (!File.Exists(str9))
                                            {
                                                AddTextMessage("No default macro definnitions were found.");
                                            }
                                            else
                                            {
                                                File.Copy(str9, path);
                                                Macros.Load();
                                                AddTextMessage("Default macro definitions have been copied. Any macro changes you make will now be unique to this character.");
                                            }
                                            break;
                                        }
                                        break;
                                    }
                                    case 15:
                                        TargetHandler = new NullTargetHandler();
                                        break;

                                    case 0x10:
                                    {
                                        Mobile p = World.Player;
                                        if (p != null)
                                        {
                                            bool flag2 = false;
                                            foreach (Mobile mobile8 in World.Mobiles.Values)
                                            {
                                                if (mobile8.InSquareRange(p, 8) && ((mobile8.Body == 400) || (mobile8.Body == 0x191)))
                                                {
                                                    Item item4 = mobile8.FindEquip(Layer.Shoes);
                                                    if (((item4 != null) && (item4.Hue == 0)) && (((item4.ID == 0x1711) || (item4.ID == 0x170b)) || (item4.ID == 0x170c)))
                                                    {
                                                        item4 = mobile8.FindEquip(Layer.TwoHanded);
                                                        if (((item4 != null) && (item4.Hue == 0)) && (((item4.ID == 0xe89) || (item4.ID == 0xe8a)) || ((item4.ID == 0xe81) || (item4.ID == 0xe82))))
                                                        {
                                                            m_ContextQueue = 0x17d7;
                                                            m_BuyHorse = mobile8;
                                                            Network.Send(new PPopupRequest(mobile8));
                                                            mobile8.AddTextMessage("Vendor", "Buying horse.", DefaultFont, Hues.Load(0x59), false);
                                                            flag2 = true;
                                                            break;
                                                        }
                                                    }
                                                }
                                            }
                                            if (!flag2)
                                            {
                                                AddTextMessage("Vendor not found.", DefaultFont, Hues.Load(0x26));
                                            }
                                            return;
                                        }
                                        break;
                                    }
                                    case 0x11:
                                    {
                                        Item item5 = World.FindItem(new PlayerDistanceValidator(new ItemIDValidator(new int[] { 0xf6c }), 1));
                                        if (item5 != null)
                                        {
                                            item5.Use();
                                            item5.AddTextMessage("Moongate", "Using.", DefaultFont, Hues.Load(0x59), false);
                                            break;
                                        }
                                        AddTextMessage("Moongate not found.", DefaultFont, Hues.Load(0x26));
                                        break;
                                    }
                                    case 0x12:
                                    {
                                        Gump drag = Gumps.Drag;
                                        if (!(drag is GDraggedItem))
                                        {
                                            m_LeapFrog = null;
                                            AddTextMessage("You are not holding an item. Leapfrog cleared.");
                                            break;
                                        }
                                        m_LeapFrog = ((GDraggedItem) drag).Item;
                                        AddTextMessage("Item set.");
                                        break;
                                    }
                                    case 0x13:
                                    {
                                        IItemValidator check = new PlayerDistanceValidator(new ItemIDValidator(new int[] { 0x2006 }), 2);
                                        Item[] itemArray = World.FindItems(check);
                                        ArrayList list2 = new ArrayList();
                                        AosAppraiser instance = LootAppraiser.Instance;
                                        for (int k = 0; k < itemArray.Length; k++)
                                        {
                                            Item item6 = itemArray[k];
                                            if ((item6.LastTextHue == null) || ((item6.LastTextHue.HueID() & 0x7fff) != 0x59))
                                            {
                                                AosAppraiser.m_BlueCorpse = false;
                                                ArrayList items = item6.Items;
                                                for (int n = 0; n < items.Count; n++)
                                                {
                                                    Item item7 = (Item) items[n];
                                                    Appraisal appraisal = instance.Appraise(item7);
                                                    if (appraisal != null)
                                                    {
                                                        list2.Add(appraisal);
                                                    }
                                                }
                                            }
                                        }
                                        if (list2.Count > 0)
                                        {
                                            list2.Sort();
                                            Appraisal appraisal2 = (Appraisal) list2[0];
                                            Item item8 = appraisal2.Item;
                                            ObjectPropertyList propertyList = item8.PropertyList;
                                            string text = null;
                                            if (propertyList.Properties.Length > 0)
                                            {
                                                text = propertyList.Properties[0].Text;
                                            }
                                            if ((text == null) || (text == ""))
                                            {
                                                text = Localization.GetString(0xf9060 + (item8.ID & 0x3fff));
                                            }
                                            string str11 = string.Format("Looting {0}.", text);
                                            if (list2.Count > 1)
                                            {
                                                str11 = string.Format("{0} There are {1} other valued item{2} to loot.", str11, list2.Count - 1, (list2.Count == 2) ? "" : "s");
                                            }
                                            AddTextMessage(str11, DefaultFont, Hues.Load(0x35));
                                            Mobile mobile9 = World.Player;
                                            if (mobile9 != null)
                                            {
                                                Network.Send(new PPickupItem(item8, item8.Amount));
                                                Network.Send(new PDropItem(item8.Serial, -1, -1, 0, mobile9.Serial));
                                            }
                                        }
                                        else
                                        {
                                            AddTextMessage("Nothing was found to loot.", DefaultFont, Hues.Load(0x22));
                                        }
                                        break;
                                    }
                                    case 20:
                                    {
                                        IItemValidator validator2 = new PlayerDistanceValidator(new ItemIDValidator(new int[] { 0x2006 }), 2);
                                        Item[] itemArray2 = World.FindItems(validator2);
                                        ArrayList list5 = new ArrayList();
                                        AosAppraiser appraiser2 = LootAppraiser.Instance;
                                        for (int num14 = 0; num14 < itemArray2.Length; num14++)
                                        {
                                            Item item9 = itemArray2[num14];
                                            if ((item9.LastTextHue != null) && ((item9.LastTextHue.HueID() & 0x7fff) == 0x59))
                                            {
                                                AosAppraiser.m_BlueCorpse = true;
                                            }
                                            else
                                            {
                                                AosAppraiser.m_BlueCorpse = false;
                                            }
                                            ArrayList list6 = item9.Items;
                                            for (int num15 = 0; num15 < list6.Count; num15++)
                                            {
                                                Item item10 = (Item) list6[num15];
                                                Appraisal appraisal3 = appraiser2.Appraise(item10);
                                                if ((appraisal3 != null) && !appraisal3.IsWorthless)
                                                {
                                                    list5.Add(appraisal3);
                                                }
                                            }
                                        }
                                        if (list5.Count > 0)
                                        {
                                            list5.Sort();
                                            Appraisal appraisal4 = (Appraisal) list5[0];
                                            Item item11 = appraisal4.Item;
                                            ObjectPropertyList list7 = item11.PropertyList;
                                            string str12 = null;
                                            if (list7.Properties.Length > 0)
                                            {
                                                str12 = list7.Properties[0].Text;
                                            }
                                            if ((str12 == null) || (str12 == ""))
                                            {
                                                str12 = Localization.GetString(0xf9060 + (item11.ID & 0x3fff));
                                            }
                                            string str13 = string.Format("Looting {0}.", str12);
                                            if (list5.Count > 1)
                                            {
                                                str13 = string.Format("{0} There are {1} other valued item{2} to loot.", str13, list5.Count - 1, (list5.Count == 2) ? "" : "s");
                                            }
                                            AddTextMessage(str13, DefaultFont, Hues.Load(0x35));
                                            Mobile mobile10 = World.Player;
                                            if (mobile10 != null)
                                            {
                                                Network.Send(new PPickupItem(item11, item11.Amount));
                                                Network.Send(new PDropItem(item11.Serial, -1, -1, 0, mobile10.Serial));
                                            }
                                        }
                                        else
                                        {
                                            AddTextMessage("Nothing was found to loot.", DefaultFont, Hues.Load(0x22));
                                        }
                                        break;
                                    }
                                    case 0x15:
                                    {
                                        IPAddress address;
                                        int num16;
                                        if (strArray.Length != 5)
                                        {
                                            AddTextMessage("Usage: uoam <name> <password> <address> <port>");
                                            break;
                                        }
                                        string username = strArray[1];
                                        string password = strArray[2];
                                        try
                                        {
                                            address = IPAddress.Parse(strArray[3]);
                                            num16 = Convert.ToInt32(strArray[4]);
                                        }
                                        catch
                                        {
                                            AddTextMessage("Usage: uoam <name> <password> <address> <port>");
                                            break;
                                        }
                                        UOAM.Connect(username, password, address, num16);
                                        break;
                                    }
                                    case 0x16:
                                    {
                                        MapPackage cache = Map.GetCache();
                                        if (cache.cells != null)
                                        {
                                            Mobile mobile11 = World.Player;
                                            if (mobile11 != null)
                                            {
                                                int num17 = mobile11.X - cache.CellX;
                                                int num18 = mobile11.Y - cache.CellY;
                                                if (((num17 >= 0) && (num17 < cache.cells.GetLength(0))) && ((num18 >= 0) && (num18 < cache.cells.GetLength(1))))
                                                {
                                                    ArrayList list8 = cache.cells[num17, num18];
                                                    if (list8 != null)
                                                    {
                                                        if (list8.Count <= 0)
                                                        {
                                                            AddTextMessage("Nothing there.");
                                                            break;
                                                        }
                                                        ICell cell = (ICell) list8[list8.Count - 1];
                                                        if (!(cell is MobileCell))
                                                        {
                                                            if (cell is DynamicItem)
                                                            {
                                                                Target(((DynamicItem) cell).m_Item);
                                                            }
                                                            else if (cell is StaticItem)
                                                            {
                                                                Target(new StaticTarget(mobile11.X, mobile11.Y, ((StaticItem) cell).m_Z, ((StaticItem) cell).m_RealID, ((StaticItem) cell).m_RealID, ((StaticItem) cell).m_Hue));
                                                            }
                                                            else if (cell is LandTile)
                                                            {
                                                                Target(new LandTarget(mobile11.X, mobile11.Y, ((LandTile) cell).m_Z));
                                                            }
                                                            break;
                                                        }
                                                        Target(((MobileCell) cell).m_Mobile);
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    }
                                    case 0x17:
                                        m_AlternateFont = !m_AlternateFont;
                                        AddTextMessage(string.Format("Alternate font is now {0}.", m_AlternateFont ? "on" : "off"));
                                        break;

                                    case 0x18:
                                    {
                                        bool flag3 = !m_Sounds.Enabled;
                                        try
                                        {
                                            flag3 = strArray[1].ToLower() != "off";
                                        }
                                        catch
                                        {
                                            flag3 = !m_Sounds.Enabled;
                                        }
                                        m_Sounds.Enabled = flag3;
                                        AddTextMessage(string.Format("Sounds are now {0}.", flag3 ? "on" : "off"));
                                        break;
                                    }
                                    case 0x19:
                                    {
                                        bool flag4 = !World.CharData.QueueTargets;
                                        try
                                        {
                                            flag4 = strArray[1].ToLower() != "off";
                                        }
                                        catch
                                        {
                                            flag4 = !World.CharData.QueueTargets;
                                        }
                                        World.CharData.QueueTargets = flag4;
                                        AddTextMessage(string.Format("Target queueing is now {0}.", flag4 ? "on" : "off"));
                                        break;
                                    }
                                    case 0x1a:
                                    {
                                        IEnumerator enumerator = World.Mobiles.Values.GetEnumerator();
                                        int num19 = 0;
                                        while (enumerator.MoveNext())
                                        {
                                            Mobile current = (Mobile) enumerator.Current;
                                            if (((current.Visible && (current.Notoriety == Notoriety.Murderer)) && (!current.Human && !current.Ghost)) && World.InRange(current))
                                            {
                                                Timer timer = new Timer(new OnTick(Engine.DelayedPackets_OnTick), num19++ * 0x4e2, 1);
                                                timer.SetTag("Packets", new Packet[] { new PAttackRequest(current) });
                                                timer.Start(false);
                                            }
                                        }
                                        break;
                                    }
                                    case 0x1b:
                                        TargetHandler = new MoveTargetHandler();
                                        AddTextMessage("Target one of the items to move.");
                                        break;

                                    case 0x1c:
                                        TargetHandler = new OverrideHueTargetHandler(0x489, "Inflame request canceled.");
                                        AddTextMessage("Target an item.");
                                        break;

                                    case 0x1d:
                                        TargetHandler = new OverrideHueTargetHandler(-1, "Douse request canceled.");
                                        AddTextMessage("Target an item.");
                                        break;

                                    case 30:
                                    {
                                        NotoQueryType on = (NotoQueryType) ((1 + World.CharData.NotoQuery) % 3);
                                        try
                                        {
                                            switch (strArray[1].ToLower())
                                            {
                                                case "on":
                                                    on = NotoQueryType.On;
                                                    break;

                                                case "off":
                                                    on = NotoQueryType.Off;
                                                    break;

                                                case "smart":
                                                    on = NotoQueryType.Smart;
                                                    break;
                                            }
                                        }
                                        catch
                                        {
                                        }
                                        World.CharData.NotoQuery = on;
                                        AddTextMessage(string.Format("Notoriety query is now {0}.", on.ToString().ToLower()));
                                        break;
                                    }
                                    case 0x1f:
                                        Network.Send(new PWrestleDisarm());
                                        break;

                                    case 0x20:
                                        Network.Send(new PWrestleStun());
                                        break;

                                    case 0x21:
                                    {
                                        bool flag5 = !GFader.Fade;
                                        try
                                        {
                                            flag5 = strArray[1].ToLower() != "off";
                                        }
                                        catch
                                        {
                                            flag5 = !GFader.Fade;
                                        }
                                        GFader.Fade = flag5;
                                        AddTextMessage(string.Format("Interface fading is now {0}.", flag5 ? "on" : "off"));
                                        break;
                                    }
                                    case 0x22:
                                        TargetHandler = new DragToBagTargetHandler(false);
                                        AddTextMessage("Target one of the items to move.");
                                        break;

                                    case 0x23:
                                        TargetHandler = new DragToBagTargetHandler(true);
                                        AddTextMessage("Target one of the items to click and move.");
                                        break;

                                    case 0x24:
                                    {
                                        int xOffset = 0;
                                        int yOffset = 0;
                                        if ((strArray.Length == 3) || (strArray.Length == 1))
                                        {
                                            if (strArray.Length == 3)
                                            {
                                                try
                                                {
                                                    xOffset = Convert.ToInt32(strArray[1]);
                                                }
                                                catch
                                                {
                                                }
                                                try
                                                {
                                                    yOffset = Convert.ToInt32(strArray[2]);
                                                }
                                                catch
                                                {
                                                }
                                            }
                                            TargetHandler = new BringToTargetHandler(xOffset, yOffset);
                                            AddTextMessage("Target the destination item.");
                                        }
                                        else
                                        {
                                            AddTextMessage("Format: bringto [x y]");
                                        }
                                        break;
                                    }
                                    case 0x25:
                                        Ignore();
                                        break;

                                    case 0x26:
                                        TargetHandler = new RemoveTargetHandler();
                                        AddTextMessage("Remove what?");
                                        break;

                                    case 0x27:
                                        TargetHandler = new StackTargetHandler();
                                        AddTextMessage("Target the destination item.");
                                        break;

                                    case 40:
                                        TargetHandler = new RegDropTargetHandler();
                                        AddTextMessage("Target the destination container.");
                                        break;

                                    case 0x29:
                                        TargetHandler = new TurnTargetHandler();
                                        AddTextMessage("Turn to where?");
                                        break;

                                    case 0x2a:
                                    {
                                        bool flag6 = !NewConfig.SmoothWalk;
                                        try
                                        {
                                            flag6 = strArray[1].ToLower() != "off";
                                        }
                                        catch
                                        {
                                            flag6 = !NewConfig.SmoothWalk;
                                        }
                                        NewConfig.SmoothWalk = flag6;
                                        AddTextMessage(string.Format("Smooth walking is now {0}.", flag6 ? "on" : "off"));
                                        break;
                                    }
                                    case 0x2b:
                                    {
                                        int num22 = 100;
                                        try
                                        {
                                            num22 = Convert.ToInt32(cmd.Split(new char[] { ' ' })[1]);
                                        }
                                        catch
                                        {
                                            num22 = 100;
                                        }
                                        Timer timer2 = new Timer(new OnTick(Engine.TimeRefresh_OnTick), 1, 1);
                                        timer2.SetTag("Frames", num22);
                                        timer2.Start(false);
                                        break;
                                    }
                                    case 0x2c:
                                    {
                                        string str16 = null;
                                        try
                                        {
                                            str16 = strArray[1];
                                        }
                                        catch
                                        {
                                            AddTextMessage("Format: music <on | off | stop>");
                                            break;
                                        }
                                        switch (str16.ToLower())
                                        {
                                            case "on":
                                                NewConfig.PlayMusic = true;
                                                return;

                                            case "off":
                                                NewConfig.PlayMusic = false;
                                                Music.Stop();
                                                return;

                                            case "stop":
                                                Music.Stop();
                                                return;
                                        }
                                        AddTextMessage("Format: music <on | off | stop>");
                                        break;
                                    }
                                    case 0x2d:
                                        TargetHandler = new TraceTargetHandler();
                                        AddTextMessage("Target the dynamic item or mobile to trace.");
                                        break;

                                    case 0x2e:
                                        TargetHandler = new ExportTargetHandler();
                                        AddTextMessage("Target the first location of a bounding box.");
                                        break;

                                    case 0x2f:
                                    {
                                        if (!GMPrivs)
                                        {
                                            AddTextMessage("You do not have access to this command.");
                                            break;
                                        }
                                        string str17 = null;
                                        try
                                        {
                                            str17 = strArray[1];
                                        }
                                        catch
                                        {
                                            AddTextMessage("Format: ack <number>");
                                            break;
                                        }
                                        try
                                        {
                                            m_WalkAckSync = Convert.ToInt32(str17);
                                        }
                                        catch
                                        {
                                            AddTextMessage("Format: ack <number>");
                                            break;
                                        }
                                        AddTextMessage(string.Format("Maximum outstanding walk requests: {0}", m_WalkAckSync));
                                        break;
                                    }
                                    case 0x30:
                                    {
                                        if (!GMPrivs)
                                        {
                                            AddTextMessage("You do not have access to this command.");
                                            break;
                                        }
                                        string str18 = null;
                                        try
                                        {
                                            str18 = strArray[1];
                                        }
                                        catch
                                        {
                                            AddTextMessage("Format: runspeed <number>");
                                            break;
                                        }
                                        try
                                        {
                                            m_RunSpeed = ((float) Convert.ToInt32(str18)) / 1000f;
                                        }
                                        catch
                                        {
                                            AddTextMessage("Format: runspeed <number>");
                                            break;
                                        }
                                        AddTextMessage(string.Format("Run speed set to: {0} seconds", m_RunSpeed));
                                        break;
                                    }
                                    case 0x31:
                                    {
                                        if (!GMPrivs)
                                        {
                                            AddTextMessage("You do not have access to this command.");
                                            break;
                                        }
                                        string str19 = null;
                                        try
                                        {
                                            str19 = strArray[1];
                                        }
                                        catch
                                        {
                                            AddTextMessage("Format: walkspeed <number>");
                                            break;
                                        }
                                        try
                                        {
                                            m_WalkSpeed = ((float) Convert.ToInt32(str19)) / 1000f;
                                        }
                                        catch
                                        {
                                            AddTextMessage("Format: walkspeed <number>");
                                            break;
                                        }
                                        AddTextMessage(string.Format("Walk speed set to: {0} seconds", m_WalkSpeed));
                                        break;
                                    }
                                    case 50:
                                    {
                                        if (!GMPrivs)
                                        {
                                            AddTextMessage("You do not have access to this command.");
                                            break;
                                        }
                                        string str20 = null;
                                        try
                                        {
                                            str20 = strArray[1];
                                        }
                                        catch
                                        {
                                        }
                                        if (str20 == "on")
                                        {
                                            m_Weather = true;
                                            AddTextMessage("Weather turned on.");
                                        }
                                        else if (str20 == "off")
                                        {
                                            m_Weather = false;
                                            PacketHandlers.ClearWeather();
                                            AddTextMessage("Weather turned off.");
                                        }
                                        else
                                        {
                                            m_Weather = !m_Weather;
                                            if (!m_Weather)
                                            {
                                                PacketHandlers.ClearWeather();
                                            }
                                            AddTextMessage(string.Format("Weather turned {0}.", m_Weather ? "on" : "off"));
                                        }
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        switch (Party.State)
                        {
                            case PartyState.Alone:
                                if (!cmd.ToLower().StartsWith("/add"))
                                {
                                    AddTextMessage(string.Format("Note to self: {0}", cmd.Substring(1)), DefaultFont, Hues.Load(0x3b2));
                                    break;
                                }
                                Network.Send(new PParty_AddMember());
                                break;

                            case PartyState.Joining:
                            {
                                string str2 = cmd.ToLower();
                                if (!str2.StartsWith("/accept"))
                                {
                                    if (str2.StartsWith("/decline"))
                                    {
                                        Network.Send(new PParty_Decline(Party.Leader));
                                    }
                                    else
                                    {
                                        AddTextMessage("Use '/accept' or '/decline'.", DefaultFont, Hues.Load(0x3b2));
                                    }
                                    break;
                                }
                                Network.Send(new PParty_Accept(Party.Leader));
                                break;
                            }
                            case PartyState.Joined:
                            {
                                string str3 = cmd.ToLower();
                                if (!Party.IsLeader || !str3.StartsWith("/add"))
                                {
                                    if (Party.IsLeader && str3.StartsWith("/rem"))
                                    {
                                        Network.Send(new PParty_RemoveMember());
                                    }
                                    else if (str3.StartsWith("/quit"))
                                    {
                                        Network.Send(new PParty_Quit());
                                    }
                                    else if (str3.StartsWith("/loot on"))
                                    {
                                        Network.Send(new PParty_SetCanLoot(true));
                                    }
                                    else if (str3.StartsWith("/loot off"))
                                    {
                                        Network.Send(new PParty_SetCanLoot(false));
                                    }
                                    else if (str3.StartsWith("/loot"))
                                    {
                                        AddTextMessage("Use '/loot on' or '/loot off'.");
                                    }
                                    else if (Party.Members.Length > 1)
                                    {
                                        if ((cmd.Length >= 2) && char.IsDigit(cmd, 1))
                                        {
                                            try
                                            {
                                                int index = Convert.ToInt32(cmd.Substring(1, 1)) - 1;
                                                if ((index >= 0) && (index < Party.Members.Length))
                                                {
                                                    if (index == Party.Index)
                                                    {
                                                        AddTextMessage(string.Format("Note to self: {0}", cmd.Substring(2)), DefaultFont, Hues.Load(0x3b2));
                                                    }
                                                    else
                                                    {
                                                        string str4;
                                                        Mobile mobile = World.Player;
                                                        if (((mobile == null) || ((str4 = mobile.Name) == null)) || ((str4 = str4.Trim()).Length <= 0))
                                                        {
                                                            str4 = "You";
                                                        }
                                                        AddTextMessage(string.Format("<{0}> {1}", str4, cmd.Substring(2)), DefaultFont, Hues.Load(World.CharData.WhisperHue));
                                                        Network.Send(new PParty_PrivateMessage(Party.Members[index], cmd.Substring(2)));
                                                    }
                                                    break;
                                                }
                                            }
                                            catch
                                            {
                                            }
                                        }
                                        Network.Send(new PParty_PublicMessage(cmd.Substring(1)));
                                    }
                                    else
                                    {
                                        AddTextMessage(string.Format("Note to self: {0}", cmd.Substring(1)), DefaultFont, Hues.Load(0x3b2));
                                    }
                                    break;
                                }
                                Network.Send(new PParty_AddMember());
                                break;
                            }
                        }
                    }
                }
            }
        }
예제 #30
0
 public ShowLicense(string path, IPrompt dialog)
 {
     this.path   = path;
     this.dialog = dialog;
 }
예제 #31
0
 public Order(CoffeeMenu priceList, IPrompt prompt)
 {
     this._priceList = priceList;
     this._prompt    = prompt;
     this._newCoffee = new Coffee(priceList, prompt);
 }
 public PromptController(IPrompt prompt, ICategories getcategory, IUserService userService)
 {
     _userService = userService ?? throw new ArgumentNullException(nameof(userService));
     _prompt      = prompt ?? throw new ArgumentNullException(nameof(prompt));
     _getcategory = getcategory ?? throw new ArgumentNullException(nameof(getcategory));
 }
예제 #33
0
 public Conversation(IPlugin plugin, IConversable forWhom, IPrompt firstPrompt)
     : this(plugin, forWhom, firstPrompt, new Dictionary <object, object>())
 {
 }
예제 #34
0
 public EnvironmentPrompt(IPrompt prompt)
 {
     _prompt = prompt;
 }