コード例 #1
0
ファイル: Util.cs プロジェクト: Ailtop/RustDocuments
        public static void SendDeathNotification(BasePlayer player, BaseEntity killer)
        {
            BasePlayer basePlayer;
            string     value;
            string     text;

            if ((object)(basePlayer = killer as BasePlayer) != null && basePlayer.GetType() == typeof(BasePlayer))
            {
                value = basePlayer.UserIDString;
                text  = basePlayer.displayName;
            }
            else
            {
                value = "";
                text  = killer.ShortPrefabName;
            }
            if (!(player == null) && !string.IsNullOrEmpty(text))
            {
                Dictionary <string, string> serverPairingData = GetServerPairingData();
                serverPairingData.Add("type", "death");
                serverPairingData.Add("targetId", value);
                serverPairingData.Add("targetName", text.Truncate(128));
                NotificationList.SendNotificationTo(player.userID, NotificationChannel.PlayerDied, "You were killed by " + text, ConVar.Server.hostname, serverPairingData);
            }
        }
コード例 #2
0
ファイル: Util.cs プロジェクト: Ailtop/RustDocuments
 public static Task <NotificationSendResult> SendPairNotification(string type, BasePlayer player, string title, string message, Dictionary <string, string> data)
 {
     if (App.port < 0)
     {
         return(Task.FromResult(NotificationSendResult.Disabled));
     }
     if (!Server.CanSendPairingNotification(player.userID))
     {
         return(Task.FromResult(NotificationSendResult.RateLimited));
     }
     if (data == null)
     {
         data = GetPlayerPairingData(player);
     }
     data.Add("type", type);
     return(NotificationList.SendNotificationTo(player.userID, NotificationChannel.Pairing, title, message, data));
 }
コード例 #3
0
ファイル: Util.cs プロジェクト: Ailtop/RustDocuments
        public static void SendNotification(this RelationshipManager.PlayerTeam team, NotificationChannel channel, string title, string body, Dictionary <string, string> data, ulong ignorePlayer = 0uL)
        {
            List <ulong> obj = Facepunch.Pool.GetList <ulong>();

            foreach (ulong member in team.members)
            {
                if (member != ignorePlayer)
                {
                    BasePlayer basePlayer = RelationshipManager.FindByID(member);
                    if (basePlayer == null || basePlayer.net?.connection == null)
                    {
                        obj.Add(member);
                    }
                }
            }
            NotificationList.SendNotificationTo(obj, channel, title, body, data);
            Facepunch.Pool.FreeList(ref obj);
        }