Beispiel #1
0
        public static string AddGold(LeagueServer server, int client, string args)
        {
            if (string.IsNullOrEmpty(args))
            {
                return("Missing speed value!");
            }
            float value = float.Parse(args);

            byte[] buffer = BitConverter.GetBytes(value);

            var packet = new OnReplication();

            packet.SyncID = (uint)Environment.TickCount;
            var data = new ReplicationData()
            {
                UnitNetID = 0x40000001,
            };

            data.Data[0]           = new Tuple <uint, byte[]>(1, buffer);
            packet.ReplicationData = new List <ReplicationData>()
            {
                data
            };
            server.SendEncrypted(client, ChannelID.Broadcast, packet);


            var packet2 = new UnitAddGold
            {
                GoldAmmount = value,
                TargetNetID = 0x40000001,
            };

            server.SendEncrypted(client, ChannelID.Broadcast, packet2);
            return("Gold Added!");
        }
Beispiel #2
0
        public static string TestRep(LeagueServer server, ClientID client, string args)
        {
            var packet = new OnReplication();

            packet.SyncID = (uint)Environment.TickCount;
            var data = new ReplicationData()
            {
                UnitNetID = (NetID)0x40000001,
            };

            byte[] buffer;
            using (var stream = new MemoryStream())
            {
                using (var writer = new PacketWriter(stream, true))
                {
                    writer.WritePackedFloat(333.0f);
                    writer.WritePackedFloat(123.0f);
                }
                buffer = new byte[stream.Length];
                Buffer.BlockCopy(stream.GetBuffer(), 0, buffer, 0, buffer.Length);
            }
            data.Data[3] = new Tuple <uint, byte[]>((1 << 0) | (1 << 1), buffer);

            packet.ReplicationData = new List <ReplicationData>()
            {
                data
            };
            server.SendEncrypted(client, ChannelID.Broadcast, packet);
            return("TestRep!");
        }
Beispiel #3
0
        public static string TestRep(LeagueServer server, int client, string args)
        {
            var packet = new OnReplication();

            packet.SyncID = (uint)Environment.TickCount;
            var data = new ReplicationData()
            {
                UnitNetID = 0x40000001,
            };

            using (var writer = new ByteWriter())
            {
                writer.WritePackedFloat(333.0f);
                writer.WritePackedFloat(123.0f);
                data.Data[3] = new Tuple <uint, byte[]>((1 << 0) | (1 << 1), writer.GetBytes());
            }

            packet.ReplicationData = new List <ReplicationData>()
            {
                data
            };
            server.SendEncrypted(client, ChannelID.Broadcast, packet);
            return("TestRep!");
        }