Example #1
0
 public static void Notification(string message, PLPlayer recipient = null, int subjectPlayerId = 0, int durationMs = 6000, bool addToShipLog = false)
 {
     if (recipient == null && PLNetworkManager.Instance != null)
     {
         recipient = PLNetworkManager.Instance.LocalPlayer;
     }
     Notification(message, recipient.GetPhotonPlayer(), subjectPlayerId, durationMs, addToShipLog);
 }
 public static void ChatMessage(PLPlayer recipient, string message, int sendingPlayerId = -1)
 {
     if (sendingPlayerId == -1)
     {
         sendingPlayerId = PLNetworkManager.Instance.LocalPlayerID;
     }
     ChatMessage(recipient.GetPhotonPlayer(), message, sendingPlayerId);
 }
Example #3
0
        public static void Echo(PLPlayer recipient, string message)
        {
            if (recipient == null || message == null)
            {
                AntiNullReferenceException($"{(recipient == null ? "recipent: null" : "recipent: PLPlayer")}, {(message == null ? "message: null" : $"message: \"{message}\"")}");
                return;
            }

            Echo(recipient.GetPhotonPlayer(), message);
        }
Example #4
0
        public static void Centerprint(string message, PLPlayer recipient, string tag = "msg", Color color = new Color(), EWarningType type = EWarningType.E_NORMAL)
        {
            if (recipient == null || message == null || tag == null)
            {
                AntiNullReferenceException($"{(recipient == null ? "recipent: null" : "recipent: PLPlayer")}, {(message == null ? "message: null" : $"message: \"{message}\"")}, ..., {(tag == null ? "tag: null" : $"tag: \"{tag}\"")}");
                return;
            }

            Centerprint(message, recipient.GetPhotonPlayer(), tag, color, type);
        }
Example #5
0
 public static void ChatMessage(PLPlayer recipient, string message, int sendingPlayerId = -1)
 {
     if (recipient == null || message == null)
     {
         AntiNullReferenceException($"{(recipient == null ? "recipent: null" : "recipent: PLPlayer")}, {(message == null ? "message: null" : $"message: \"{message}\"")}, sendingPlayerId: {sendingPlayerId}");
         return;
     }
     if (sendingPlayerId == -1)
     {
         sendingPlayerId = PLNetworkManager.Instance.LocalPlayerID;
     }
     ChatMessage(recipient.GetPhotonPlayer(), message, sendingPlayerId);
 }
Example #6
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.");
         }
     }
 }
Example #7
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");
            }
        }
 public static void Centerprint(string message, PLPlayer recipient, string tag = "msg", Color color = new Color(), EWarningType type = EWarningType.E_NORMAL)
 {
     Centerprint(message, recipient.GetPhotonPlayer(), tag, color, type);
 }
 public static void Echo(PLPlayer recipient, string message)
 {
     Echo(recipient.GetPhotonPlayer(), message);
 }