Beispiel #1
0
        public static void HandleTextureRequest(Packet packet)
        {
            byte[] hash = packet.ReadBytes(20);

            Log("Received request for hash " + BitConverter.ToString(hash));
            if (MultiplayerClient.textureCache.ContainsKey(hash))
            {
                byte[] texture = File.ReadAllBytes(MultiplayerClient.textureCache[hash]);
                Log("Sending texture for hash " + BitConverter.ToString(hash));
                ClientSend.SendTexture(texture);
            }
        }
        public static void CheckHashes(Packet packet)
        {
            string receivedBaldurHash    = packet.ReadString();
            string receivedFlukeHash     = packet.ReadString();
            string receivedGrimmHash     = packet.ReadString();
            string receivedHatchlingHash = packet.ReadString();
            string receivedKnightHash    = packet.ReadString();
            string receivedShieldHash    = packet.ReadString();
            string receivedSprintHash    = packet.ReadString();
            string receivedUnnHash       = packet.ReadString();
            string receivedVoidHash      = packet.ReadString();
            string receivedVSHash        = packet.ReadString();
            string receivedWeaverHash    = packet.ReadString();
            string receivedWraithsHash   = packet.ReadString();

            Dictionary <string, string> texHashes = Client.Instance.texHashes;
            Dictionary <string, byte[]> texBytes  = Client.Instance.texBytes;

            if (texHashes["Baldur"] != receivedBaldurHash)
            {
                ClientSend.SendTexture(texBytes["Baldur"], (int)ClientPackets.BaldurTexture);
            }
            else
            {
                ClientSend.SendTextureUpToDate((int)ClientPackets.BaldurTextureUpToDate);
            }

            if (texHashes["Fluke"] != receivedFlukeHash)
            {
                ClientSend.SendTexture(texBytes["Fluke"], (int)ClientPackets.FlukeTexture);
            }
            else
            {
                ClientSend.SendTextureUpToDate((int)ClientPackets.FlukeTextureUpToDate);
            }

            if (texHashes["Grimm"] != receivedGrimmHash)
            {
                ClientSend.SendTexture(texBytes["Grimm"], (int)ClientPackets.GrimmTexture);
            }
            else
            {
                ClientSend.SendTextureUpToDate((int)ClientPackets.GrimmTextureUpToDate);
            }

            if (texHashes["Hatchling"] != receivedHatchlingHash)
            {
                ClientSend.SendTexture(texBytes["Hatchling"], (int)ClientPackets.HatchlingTexture);
            }
            else
            {
                ClientSend.SendTextureUpToDate((int)ClientPackets.HatchlingTextureUpToDate);
            }

            if (texHashes["Knight"] != receivedKnightHash)
            {
                ClientSend.SendTexture(texBytes["Knight"], (int)ClientPackets.KnightTexture);
            }
            else
            {
                ClientSend.SendTextureUpToDate((int)ClientPackets.KnightTextureUpToDate);
            }

            if (texHashes["Shield"] != receivedShieldHash)
            {
                ClientSend.SendTexture(texBytes["Shield"], (int)ClientPackets.ShieldTexture);
            }
            else
            {
                ClientSend.SendTextureUpToDate((int)ClientPackets.ShieldTextureUpToDate);
            }

            if (texHashes["Sprint"] != receivedSprintHash)
            {
                ClientSend.SendTexture(texBytes["Sprint"], (int)ClientPackets.SprintTexture);
            }
            else
            {
                ClientSend.SendTextureUpToDate((int)ClientPackets.SprintTextureUpToDate);
            }

            if (texHashes["Unn"] != receivedUnnHash)
            {
                ClientSend.SendTexture(texBytes["Unn"], (int)ClientPackets.UnnTexture);
            }
            else
            {
                ClientSend.SendTextureUpToDate((int)ClientPackets.UnnTextureUpToDate);
            }

            if (texHashes["Void"] != receivedVoidHash)
            {
                ClientSend.SendTexture(texBytes["Void"], (int)ClientPackets.VoidTexture);
            }
            else
            {
                ClientSend.SendTextureUpToDate((int)ClientPackets.VoidTextureUpToDate);
            }

            if (texHashes["VS"] != receivedVSHash)
            {
                ClientSend.SendTexture(texBytes["VS"], (int)ClientPackets.VSTexture);
            }
            else
            {
                ClientSend.SendTextureUpToDate((int)ClientPackets.VSTextureUpToDate);
            }

            if (texHashes["Weaver"] != receivedWeaverHash)
            {
                ClientSend.SendTexture(texBytes["Weaver"], (int)ClientPackets.WeaverTexture);
            }
            else
            {
                ClientSend.SendTextureUpToDate((int)ClientPackets.WeaverTextureUpToDate);
            }

            if (texHashes["Wraiths"] != receivedWraithsHash)
            {
                ClientSend.SendTexture(texBytes["Wraiths"], (int)ClientPackets.WraithsTexture);
            }
            else
            {
                ClientSend.SendTextureUpToDate((int)ClientPackets.WraithsTextureUpToDate);
            }
        }