示例#1
0
文件: Ping.cs 项目: direwolf420/Pings
        public Ping(Player player, PingType pingType, bool notify)
        {
            PlayerUUID = PingsPlayer.GetUUIDFromPlayer(player);
            PingType   = pingType;

            DecayTimer = DecayDuration = 60 * ServerConfig.Instance.PingDuration;             //TODO config

            Notify = notify;

            TileSize = new Point16(1, 1);

            Text = string.Empty;
        }
示例#2
0
        public static void CalculateUUIDForLocalPlayer(bool shortHash = true)
        {
            PingsPlayer pingsPlayer = Main.LocalPlayer.GetModPlayer <PingsPlayer>();

            if (pingsPlayer.UUID == string.Empty)
            {
                int    hash = Math.Abs(Main.ActivePlayerFileData.Path.GetHashCode() ^ Main.ActivePlayerFileData.IsCloudSave.GetHashCode());
                string uuid = Main.clientUUID + "_" + hash;

                int n = 4;
                if (shortHash && uuid.Length > n * 2)
                {
                    var firstN = new string(uuid.Take(n).ToArray());
                    var lastN  = new string(uuid.Reverse().Take(n).Reverse().ToArray());

                    uuid = string.Concat(firstN, lastN);
                }

                pingsPlayer.UUID = uuid;
            }
        }
示例#3
0
        private void PlayerFileData_SetAsActive(On.Terraria.IO.PlayerFileData.orig_SetAsActive orig, Terraria.IO.PlayerFileData self)
        {
            orig(self);

            PingsPlayer.CalculateUUIDForLocalPlayer();
        }
示例#4
0
文件: Ping.cs 项目: direwolf420/Pings
 public Ping(string uuid, PingType pingType, bool notify) : this(PingsPlayer.GetPlayerFromUUID(uuid), pingType, notify)
 {
     //This gets called on netreceive
     //Joining client actually receives pings before he receives info from other players about their UUIDs
     //Bandaid fix is simply requesting world info again once the player actually fully gets ingame
 }