public override void HandleRPC(object[] arguments, PhotonMessageInfo sender)
        {
            PLPlayer player  = PLServer.GetPlayerForPhotonPlayer(sender.sender);
            string   name    = player.GetPlayerName();
            string   message = (string)arguments[0];

            Messaging.Echo(PLNetworkManager.Instance.LocalPlayer.GetPhotonPlayer(), $"[&%~[C{player.GetClassID()} {name} ]&%~] <color=#a0a0a0>whispers to you: {message}</color>");
        }
        public override void Execute(string arguments)
        {
            PhotonPlayer player = PLNetworkManager.Instance.LocalPlayer.GetPhotonPlayer();
            int          page   = 1;

            if (!string.IsNullOrWhiteSpace(arguments))
            {
                if (!int.TryParse(arguments, out page))
                {
                    if (arguments[0] == '/')
                    {
                        arguments = arguments.Substring(1);
                    }
                    Tuple <ChatCommand, PulsarMod> t = ChatCommandRouter.Instance.GetCommand(arguments);
                    if (t != null)
                    {
                        ChatCommand cmd  = t.Item1;
                        string      name = t.Item2 != null ? t.Item2.Name : "Pulsar Mod Loader";

                        Messaging.Echo(player, $"[&%~[C0 /{cmd.CommandAliases()[0]} ]&%~] - {cmd.Description()} <color=#ff6600ff>[{name}]</color>");
                        Messaging.Echo(player, $"Aliases: /{string.Join($", /", cmd.CommandAliases())}");
                        Messaging.Echo(player, $"Usage: {cmd.UsageExamples()[0]}");
                        for (int i = 1; i < cmd.UsageExamples().Length; i++)
                        {
                            Messaging.Echo(player, $"       {cmd.UsageExamples()[i]}");
                        }
                    }
                    else
                    {
                        Messaging.Echo(player, $"Command /{arguments} not found");
                    }
                    return;
                }
            }

            int commandsPerPage = (PLXMLOptionsIO.Instance.CurrentOptions.GetStringValueAsInt("ChatNumLines") * 5 + 10) - 2;
            IOrderedEnumerable <Tuple <ChatCommand, PulsarMod> > commands = ChatCommandRouter.Instance.GetCommands();
            int pages = Mathf.CeilToInt(commands.Count() / (float)commandsPerPage);

            page--; //Pages start from 1
            if (page < 0)
            {
                page = 0;
            }

            Messaging.Echo(player, pages == 1 && page == 0 ? "[&%~[C0 Command List: ]&%~] :" : $"[&%~[C0 Command List: ]&%~] Page {page + 1} : {pages}");
            for (int i = 0; i < commandsPerPage; i++)
            {
                int index = i + page * commandsPerPage;
                if (i + page * commandsPerPage >= commands.Count())
                {
                    break;
                }
                ChatCommand command = commands.ElementAt(index).Item1;
                Messaging.Echo(player, $"/{command.CommandAliases()[0]} - {command.Description()}");
            }
            Messaging.Echo(player, "Use [&%~[C2 /help <command> ]&%~] for details about a specific command");
        }
Ejemplo n.º 3
0
 static void Postfix(PLServer __instance, int inID)
 {
     if (PhotonNetwork.isMasterClient && ChatCommandRouter.Instance.getPublicCommandAliases().Length > 1)
     {
         PLPlayer player = __instance.GetPlayerFromPlayerID(inID);
         if (player != null && player.GetPhotonPlayer() != null)
         {
             Messaging.Echo(player, $"[&%~[C0 Welcome ]&%~] {player.GetPlayerName()}!");
             Messaging.Echo(player, "This game has some commands available.");
             Messaging.Echo(player, "Type [&%~[C2 !help ]&%~] for more information.");
         }
     }
 }
Ejemplo n.º 4
0
 public override void Execute(string arguments, int SenderID)
 {
     if (PhotonNetwork.isMasterClient)
     {
         if (arguments.ToLower() == "scomo")
         {
             Messaging.Echo(PhotonTargets.All, "<color=#ffff00>Scomo <Marketing></color> : I don't hold a teleporter mate.");
         }
         else
         {
             PLPlayer player = HelperMethods.GetPlayerFromPlayerID(SenderID);
             int      hubID  = PLEncounterManager.Instance.PlayerShip.MyTLI.SubHubID;
             player.photonView.RPC("NetworkTeleportToSubHub", PhotonTargets.All, new object[]
             {
                 hubID,
                 0
             });
         }
     }
 }
        public bool Execute(string bugDescription)
        {
            string baseDir = Environment.ExpandEnvironmentVariables(@"%localappdata%low\Leafy Games, LLC\PULSAR Lost Colony");

            Directory.CreateDirectory(baseDir);

            // Make sure output directory for ZIPs exists
            string outputDir = Path.Combine(baseDir, "reports");

            Directory.CreateDirectory(outputDir);

            // Recreate clean working directory to hold archive contents
            string workingDir = Path.Combine(baseDir, "temp");

            PrepWorkingDirectory(workingDir);

            // Collect bug description, debug log, and screenshot in working directory
            File.WriteAllText(Path.Combine(workingDir, "description.txt"), bugDescription);
            File.Copy(Path.Combine(baseDir, "output_log.txt"), Path.Combine(workingDir, "output_log.txt"), overwrite: true);
            ScreenCapture.CaptureScreenshot(Path.Combine(workingDir, "screenshot.png"));

            // Compress working directory into single archive file
            Thread.Sleep(1000); // Wait for disk activity to finish so we don't miss certain files (TODO: Better option?)
            string archivePath = Path.Combine(outputDir, CreateArchiveName());

            ArchiveDirectory(workingDir, archivePath);

            // Upload archive
            //string resultUrl = uploader.UploadFile(archivePath);
            Clipboard.Copy(archivePath);
            Messaging.Echo(PLNetworkManager.Instance.LocalPlayer.GetPhotonPlayer(), $"Bug Report zipped and file path copied to clipboard.");

            // Clean up working directory
            Directory.Delete(workingDir, recursive: true);

            return(false);
        }
Ejemplo n.º 6
0
        public override void Execute(string arguments)
        {
            string   arg1    = arguments.Split(' ')[0].ToLower();
            string   message = arguments.Substring(arg1.Length);
            PLPlayer player  = null;

            switch (arg1)
            {
            case "c":
            case "captain":
                player = PLServer.Instance.GetCachedFriendlyPlayerOfClass(0);
                break;

            case "p":
            case "pilot":
                player = PLServer.Instance.GetCachedFriendlyPlayerOfClass(1);
                break;

            case "s":
            case "scientist":
                player = PLServer.Instance.GetCachedFriendlyPlayerOfClass(2);
                break;

            case "w":
            case "weapons":
                player = PLServer.Instance.GetCachedFriendlyPlayerOfClass(3);
                break;

            case "e":
            case "engineer":
                player = PLServer.Instance.GetCachedFriendlyPlayerOfClass(4);
                break;

            default:
                foreach (PLPlayer p in PLServer.Instance.AllPlayers)
                {
                    if (p != null && p.GetPlayerName().ToLower().StartsWith(arg1))
                    {
                        player = p;
                        break;
                    }
                }
                break;
            }

            if (player != null)
            {
                if (!player.IsBot)
                {
                    Messaging.Echo(PLNetworkManager.Instance.LocalPlayer.GetPhotonPlayer(), $"<color=#a0a0a0>You whisper to</color> [&%~[C{player.GetClassID()} {player.GetPlayerName()} ]&%~]<color=#a0a0a0>: {message}</color>");
                    PrivateMessage.SendMessage(player.GetPhotonPlayer(), message);
                }
                else
                {
                    Messaging.Notification("Can't send messages to bots");
                }
            }
            else
            {
                Messaging.Notification("Could not find the specified player");
            }
        }
Ejemplo n.º 7
0
        public override void Execute(string arguments, int SenderID)
        {
            if (PLNetworkManager.Instance.LocalPlayer.GetPhotonPlayer().IsMasterClient)
            {
                IOrderedEnumerable <Tuple <PublicCommand, PulsarPlugin> > publicCommands = ChatCommandRouter.Instance.GetPublicCommands();

                if (publicCommands.Count() <= 1)
                {
                    return;
                }

                PLPlayer sender = PLServer.Instance.GetPlayerFromPlayerID(SenderID);
                int      page   = 1;
                if (!string.IsNullOrWhiteSpace(arguments))
                {
                    if (!int.TryParse(arguments, out page))
                    {
                        if (arguments[0] == '!')
                        {
                            arguments = arguments.Substring(1);
                        }
                        Tuple <PublicCommand, PulsarPlugin> t = ChatCommandRouter.Instance.GetPublicCommand(arguments);
                        if (t != null)
                        {
                            PublicCommand cmd  = t.Item1;
                            string        name = t.Item2 != null ? t.Item2.Name : "Pulsar Plugin Loader";

                            Messaging.Echo(sender, $"[&%~[C3 !{cmd.CommandAliases()[0]} ]&%~] - {cmd.Description()} <color=#ff6600ff>[{name}]</color>");
                            Messaging.Echo(sender, $"Aliases: !{string.Join($", !", cmd.CommandAliases())}");
                            Messaging.Echo(sender, $"Usage: {cmd.UsageExamples()[0]}");
                            for (int i = 1; i < cmd.UsageExamples().Length; i++)
                            {
                                Messaging.Echo(sender, $"       {cmd.UsageExamples()[i]}");
                            }
                        }
                        else
                        {
                            Messaging.Echo(sender, $"Command !{arguments} not found");
                        }
                        return;
                    }
                }

                int commandsPerPage = 13 /*(PLXMLOptionsIO.Instance.CurrentOptions.GetStringValueAsInt("ChatNumLines") * 5 + 10) - 2*/; //Minimum value
                int pages           = Mathf.CeilToInt(publicCommands.Count() / (float)commandsPerPage);

                page--; //Pages start from 1
                if (page < 0)
                {
                    page = 0;
                }

                string header = pages == 1 && page == 0 ? $"[&%~[C3 Available Commands: ]&%~]" : $"[&%~[C3 Available Commands: ]&%~] Page {page + 1} : {pages}";
                Messaging.Echo(sender, header);
                for (int i = 0; i < commandsPerPage; i++)
                {
                    int index = i + page * commandsPerPage;
                    if (i + page * commandsPerPage >= publicCommands.Count())
                    {
                        break;
                    }
                    PublicCommand command = publicCommands.ElementAt(index).Item1;
                    Messaging.Echo(sender, $"!{command.CommandAliases()[0]} - {command.Description()}");
                }
                Messaging.Echo(sender, "Use [&%~[C2 !help <command> ]&%~] for details about a specific command");
            }
        }
        public override void Execute(string arguments)
        {
            PhotonPlayer player = PLNetworkManager.Instance.LocalPlayer.GetPhotonPlayer();
            int          page   = 1;

            if (!string.IsNullOrWhiteSpace(arguments))
            {
                if (!int.TryParse(arguments, out page))
                {
                    PulsarMod mod = ModManager.Instance.GetMod(arguments);
                    if (mod == null)
                    {
                        foreach (PulsarMod p in ModManager.Instance.GetAllMods())
                        {
                            if (p.HarmonyIdentifier().ToLower() == arguments.ToLower())
                            {
                                mod = p;
                                break;
                            }
                        }
                    }
                    if (mod != null)
                    {
                        Messaging.Echo(player, $"[&%~[C4 {mod.Name} ]&%~] - {mod.ShortDescription}");
                        Messaging.Echo(player, $"Version: {mod.Version}");
                        if (!string.IsNullOrWhiteSpace(mod.LongDescription))
                        {
                            Messaging.Echo(player, mod.LongDescription);
                        }
                    }
                    else
                    {
                        Messaging.Echo(player, $"Mod {arguments} not found");
                    }
                    return;
                }
            }

            int modsPerPage = (PLXMLOptionsIO.Instance.CurrentOptions.GetStringValueAsInt("ChatNumLines") * 5 + 10) - 2;
            IOrderedEnumerable <PulsarMod> mods = ModManager.Instance.GetAllMods().OrderBy(t => t.Name);
            int pages = Mathf.CeilToInt(mods.Count() / (float)modsPerPage);

            page--; //Pages start from 1
            if (page < 0)
            {
                page = 0;
            }

            Messaging.Echo(player, pages == 1 && page == 0 ? "[&%~[C4 Mod List: ]&%~] :" : $"[&%~[C4 Mod List: ]&%~] Page {page + 1} : {pages}");
            for (int i = 0; i < modsPerPage; i++)
            {
                int index = i + page * modsPerPage;
                if (i + page * modsPerPage >= mods.Count())
                {
                    break;
                }
                PulsarMod mod = mods.ElementAt(index);
                Messaging.Echo(player, $"{mod.Name} - {mod.ShortDescription}");
            }
            Messaging.Echo(player, "Use [&%~[C2 /mod <mod> ]&%~] for details about a specific mod");
        }
Ejemplo n.º 9
0
 public override void Execute(string arguments)
 {
     Messaging.Echo(PLNetworkManager.Instance.LocalPlayer.GetPhotonPlayer(), $"Echo: {arguments}");
 }
Ejemplo n.º 10
0
 public static void Traitor()
 {
     Messaging.Echo(PhotonTargets.All, "Nice try. Your mutiny will never succeed. Now, into the airlock with you, traitorous scum!");
     //Messaging.ChatMessage(PhotonTargets.All, "Unauthorized Remote Intrusion Detected In Helm Control System. System Lockout In Effect.");
 }