示例#1
0
文件: Loader.cs 项目: blastboy/Client
        static void RunMaintenanceMode(Command command)
        {
            if (command.ContainsCommandArg("-installskin")) {
                // We are trying to install a new skin
                string skinPackagePath = command["-installskin"];
                if (!string.IsNullOrEmpty(skinPackagePath) && File.Exists(skinPackagePath)) {
                    bool installed = Skins.SkinManager.InstallSkin(skinPackagePath);
                    if (installed) {
                        System.Windows.Forms.MessageBox.Show("The skin has been installed!", "Installation completed!");
                    } else {
                        System.Windows.Forms.MessageBox.Show("The selected file is not a valid skin package.", "Invalid Package");
                    }
                }
            } else if (command.ContainsCommandArg("-createfileassociations")) {
                // Create associations for the skin loader
                RegistryKey RegKey = Registry.ClassesRoot.CreateSubKey(".pmdcpskn");
                RegKey.SetValue("", "PMDCP.Skin.Loader");
                RegKey.Close();

                RegKey = Registry.ClassesRoot.CreateSubKey("PMDCP.Skin.Loader");
                RegKey.SetValue("", "PMDCP Skin Package");
                RegKey.Close();

                RegKey = Registry.ClassesRoot.CreateSubKey("PMDCP.Skin.Loader" + "\\DefaultIcon");
                RegKey.SetValue("", @"C:\Program Files\Pokemon Mystery Dungeon Community Project\Client\pmdcpicon.ico" + "," + "0");
                RegKey.Close();

                RegKey = Registry.ClassesRoot.CreateSubKey("PMDCP.Skin.Loader" + "\\" + "Shell" + "\\" + "Open");
                RegKey = RegKey.CreateSubKey("Command");
                RegKey.SetValue("", "\"" + PMDCP.Core.Environment.StartupPath + "\" -installskin \"%1\"");
                RegKey.Close();
            }
        }
示例#2
0
        public static void ProcessCommand(string command, Enums.ChatChannel chatChannel)
        {
            if (string.IsNullOrEmpty(command))
            {
                return;
            }

            if (Players.PlayerManager.MyPlayer.TempMuteTimer > Globals.Tick)
            {
                return;
            }
            else if (Players.PlayerManager.MyPlayer.TalkTimer > Globals.Tick + 6000)
            {
                Players.PlayerManager.MyPlayer.TempMuteTimer = Globals.Tick + 8000;
                ExpKit.Modules.kitChat chat = (ExpKit.Modules.kitChat)Windows.WindowSwitcher.ExpKit.KitContainer.ModuleSwitcher.FindKitModule(Enums.ExpKitModules.Chat);
                chat.AppendChat("You stop to catch your breath.\n", new SdlDotNet.Widgets.CharRenderOptions(Color.Violet));
                return;
            }
            else if (Players.PlayerManager.MyPlayer.TalkTimer < Globals.Tick)
            {
                Players.PlayerManager.MyPlayer.TalkTimer = Globals.Tick + 3000;
            }
            else
            {
                Players.PlayerManager.MyPlayer.TalkTimer += 3000;
            }

            // Broadcast Message
            if ((command.StartsWith("'") || chatChannel == Enums.ChatChannel.Global) && (command.StartsWith("/") == false && command.StartsWith("!") == false && command.StartsWith("=") == false))
            {
                string message = command;
                if (command.StartsWith("'"))
                {
                    message = command.Substring(1);
                }
                else if (chatChannel == Enums.ChatChannel.Global)
                {
                    message = command;
                }
                Messenger.BroadcastMsg(message);
                return;
            }

            if (command.StartsWith("!"))
            {
                PMDCP.Core.Command com = PMDCP.Core.CommandProcessor.ParseCommand(command);
                if (com.CommandArgs.Count == 2)
                {
                    Messenger.PlayerMsg(com[0].Substring(1), com[1]);
                }
                return;
            }

            if (command.StartsWith("/edithouse"))
            {
                Messenger.SendPacket(TcpPacket.CreatePacket("requestedithouse"));
                return;
            }

            if (command.StartsWith("/refresh"))
            {
                Messenger.SendRefresh();
                return;
            }

            //if (command.StartsWith("/ping")) {
            //    Messenger.SendPing();
            //    return;
            //}

            if (Ranks.IsAllowed(Players.PlayerManager.MyPlayer, Enums.Rank.Monitor))
            {
                // Global Message
                if (command.StartsWith("/announce"))
                {
                    Messenger.GlobalMsg(command.Substring(9));
                    return;
                }

                // Admin Message
                if ((command.StartsWith("=") || chatChannel == Enums.ChatChannel.Staff) && (command.StartsWith("/") == false))
                {
                    string message = command;
                    if (command.StartsWith("="))
                    {
                        message = command.Substring(1);
                    }
                    else if (chatChannel == Enums.ChatChannel.Staff)
                    {
                        message = command;
                    }
                    Messenger.AdminMsg(message);
                    return;
                }
            }

            if (Ranks.IsAllowed(Players.PlayerManager.MyPlayer, Enums.Rank.Mapper))
            {
                // Map Editor
                if (command.StartsWith("/editmap"))
                {
                    Messenger.SendPacket(TcpPacket.CreatePacket("requesteditmap"));
                    return;
                }
            }
            if (Ranks.IsAllowed(Players.PlayerManager.MyPlayer, Enums.Rank.Monitor))
            {
                if (command.StartsWith("/loc"))
                {
                    Logic.Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.DisplayLocation = !Logic.Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.DisplayLocation;
                    return;
                }
            }

            if (command.StartsWith("/ping"))
            {
                IO.Options.Ping = !IO.Options.Ping;
                return;
            }

            if (command.StartsWith("/fps"))
            {
                IO.Options.FPS = !IO.Options.FPS;
                return;
            }



            if (Ranks.IsAllowed(Players.PlayerManager.MyPlayer, Enums.Rank.Scriptor))
            {
                if (command == "/editscript")
                {
                    bool syntaxFileExists = System.IO.File.Exists(IO.Paths.StartupPath + "Script/CSharp.syn");
                    Messenger.SendPacket(TcpPacket.CreatePacket("requesteditscript", syntaxFileExists.ToIntString()));
                }
            }

#if DEBUG
            // Just a small test of the music player
            if (Ranks.IsAllowed(Players.PlayerManager.MyPlayer, Enums.Rank.Scriptor))
            {
                if (command == "/test")
                {
                    // TODO: Re-enabletest command
                    //Music.Music.AudioPlayer.RunTest();
                }
            }
#endif

            // Test for scripted commands
            if (command.StartsWith("/"))
            {
                //for (int i = 0; i < MaxInfo.MaxEmoticons; i++)
                //{
                //    if (Emotions.EmotionHelper.Emotions[i].Command != "/" && Emotions.EmotionHelper.Emotions[i].Command == command)
                //    {
                //        Messenger.SendPacket(TcpPacket.CreatePacket("checkemoticons", i.ToString()));
                //    }
                //}
                Messenger.SendPacket(TcpPacket.CreatePacket("checkcommands", command));
                return;
            }

            if (chatChannel == Enums.ChatChannel.Local)
            {
                Messenger.SendMapMsg(command);
            }
            else if (chatChannel == Enums.ChatChannel.Guild)
            {
                Messenger.SendPacket(TcpPacket.CreatePacket("checkcommands", "/g " + command));
            }
        }
示例#3
0
文件: Loader.cs 项目: blastboy/Client
        static bool IsRunningUnderMaintenanceMode(Command command)
        {
            if (command.ContainsCommandArg("-installskin")) {
                return true;
            } else if (command.ContainsCommandArg("-createfileassociations")) {
                return true;
            }

            return false;
        }