Ejemplo n.º 1
0
        private int Packet_PutInt32Callback(uint _this, Int32 a2)
        {
            if (isFreshPacket)
            {
                isBlacklisted = false;//!packetwhitelist.Contains((uint)a2);
                if (!isBlacklisted)
                {
                    PacketsEnum packetName = (PacketsEnum)a2;

                    Print("[JAM Packet: {0} ({1})]", packetName, a2.ToString("X"));
                    CurrentOpcode = (uint)a2;
                }
                isFreshPacket = false;
            }
            else
            {
                if (!isBlacklisted)
                {
                    int tick = GeneralHelper.Memory.Read <int>(Offsets.Packet.OsTick);
                    Print("PutInt32: {0} ({1}) - {2}", a2, a2.ToString("X"), tick);
                }
            }

            return((int)Packet_PutInt32_Detour.CallOriginal(_this, a2));
        }
Ejemplo n.º 2
0
        protected void InvokeHandler(PacketsEnum packetId, IPacket data, int connectionID)
        {
            PacketHandler handler;

            if (Options.TryGetHandler(packetId, out handler))
            {
                handler.Invoke(data, connectionID);
            }
        }
        public bool AddPacket(PacketsEnum packetId, IPacket packet)
        {
            var r = Packets.ContainsKey(packetId);

            if (!r)
            {
                Packets.Add(packetId, packet);
            }
            return(!r);
        }
        public void RegisterHandler(PacketsEnum packetId, PacketHandler action)
        {
            PacketHandler del;

            bool hasVal = PacketsHanlders.TryGetValue(packetId, out del);

            if (hasVal)
            {
                del += action;
            }
            else
            {
                PacketsHanlders.Add(packetId, new PacketHandler(action));
            }
        }
Ejemplo n.º 5
0
 public void RegisterHandler(PacketsEnum packetId, PacketHandler action)
 {
     Options.RegisterHandler(packetId, action);
 }
 public NetworkPacket()
 {
     packetType = this.GetPacketEnum();
 }
 public bool TryGetHandler(PacketsEnum packetId, out PacketHandler del)
 {
     return(PacketsHanlders.TryGetValue(packetId, out del));
 }