[K Relay] 059's AntiLag updated

Posts 115 of 69 · Page 1 of 5
[K Relay] 059's AntiLag updated

All credits to 059 for AntiLag. Credits to Kronks and all the contibutors for K Relay.

If you still haven't updated to latest version of K Relay, now is a great time to do so. I've included a separate download for the newest version of K Relay, compiled and ready for use. This download also includes AntiLag.

If there are still any plugins that haven't been updated, you may request for updating them in this thread. Please include a link to the original post in your request.

If you're switching versions, you might need to redownload einaras' Enter Full Realms plugin.

 
AntiLag
Code:
using Lib_K_Relay;
using Lib_K_Relay.Interface;
using Lib_K_Relay.Networking;
using Lib_K_Relay.Networking.Packets;
using Lib_K_Relay.Networking.Packets.Server;

namespace AntiLag
{
    public class AntiLag : IPlugin
    {
        public string GetAuthor()
        {
            return "059";
        }

        public string GetName()
        {
            return "AntiLag";
        }

        public string GetDescription()
        {
            return "Blocks certain packets which contribute significantly to lagging your client.";
        }

        public string[] GetCommands()
        {
            return new string[0];
        }

        public void Initialize(Proxy proxy)
        {
            proxy.HookPacket(PacketType.SHOWEFFECT, OnShowEffect);
            proxy.HookPacket(PacketType.ALLYSHOOT, OnAllyShoot);
            proxy.HookPacket(PacketType.DAMAGE, OnDamage);
        }

        private void OnShowEffect(Client client, Packet packet)
        {
            ShowEffectPacket sep = (ShowEffectPacket)packet;
            switch ((int)sep.EffectType)
            {
                case 5:
                    if (sep.TargetId != client.ObjectId)
                        packet.Send = false;
                    break;
                case 1:
                case 2:
                case 6:
                case 7:
                case 8:
                case 9:
                case 10:
                case 12:
                case 17:
                case 18:
                case 19:
                    packet.Send = false;
                    break;
            }
        }

        private void OnAllyShoot(Client client, Packet packet)
        {
            packet.Send = false;
        }

        private void OnDamage(Client client, Packet packet)
        {
            DamagePacket dp = (DamagePacket)packet;
            if (dp.ObjectId != client.ObjectId)
                packet.Send = false;
        }
    }
}


Edit: People didn't seem too thrilled about me removing all the commands so I created a second version with commands for toggling everything.

 
AntiLag v2
Code:
using Lib_K_Relay;
using Lib_K_Relay.Interface;
using Lib_K_Relay.Utilities;
using Lib_K_Relay.Networking;
using Lib_K_Relay.Networking.Packets;
using Lib_K_Relay.Networking.Packets.Server;

namespace AntiLag
{
    public class AntiLag : IPlugin
    {
        private bool[] active = { true, true, true};

        public string GetAuthor()
        {
            return "059";
        }

        public string GetName()
        {
            return "AntiLag";
        }

        public string GetDescription()
        {
            return "Blocks certain packets which contribute significantly to lagging your client.\n\n/al ally toggles allied projectiles\n/al damage toggles the damage display on allies\n/al particle toggles particle effects succh as necromancer skull\n/al toggles them all";
        }

        public string[] GetCommands()
        {
            return new string[]
            {
                "/al <ally:damage:particle>"
            };
        }

        public void Initialize(Proxy proxy)
        {
            proxy.HookPacket(PacketType.SHOWEFFECT, OnShowEffect);
            proxy.HookPacket(PacketType.ALLYSHOOT, OnAllyShoot);
            proxy.HookPacket(PacketType.DAMAGE, OnDamage);
            proxy.HookCommand("al", OnCommand);
        }
        
        private void OnCommand(Client client, string command, string[] args)
        {
            if (args.Length == 0)
            {
                active[0] = !active[0];
                active[1] = !active[1];
                active[2] = !active[2];
            }
            else if (args[0] == "ally")
                active[0] = !active[0];
            else if (args[0] == "damage")
                active[1] = !active[1];
            else if (args[0] == "particle")
                active[2] = !active[2];
            string msg = "Allied Projectiles: " + active[0].ToString() + ", Damage Display: " + active[1].ToString() +", Particle Effects: " + active[2].ToString();
            client.SendToClient(PluginUtils.CreateOryxNotification("AntiLag", msg));
        }

        private void OnShowEffect(Client client, Packet packet)
        {
            if (active[2])
            {
                ShowEffectPacket sep = (ShowEffectPacket)packet;
                switch ((int)sep.EffectType)
                {
                    case 5:
                        if (sep.TargetId != client.ObjectId)
                            packet.Send = false;
                        break;
                    case 1:
                    case 2:
                    case 6:
                    case 7:
                    case 8:
                    case 9:
                    case 10:
                    case 12:
                    case 17:
                    case 18:
                    case 19:
                        packet.Send = false;
                        break;
                }
            }
        }

        private void OnAllyShoot(Client client, Packet packet)
        {
            if (active[0])
                packet.Send = false;
        }

        private void OnDamage(Client client, Packet packet)
        {
            if (active[1])
            {
                DamagePacket dp = (DamagePacket)packet;
                if (dp.ObjectId != client.ObjectId)
                    packet.Send = false;
            }
        }
    }
}


Virus scans:
Jotti 0/19
Virustotal 0/56

Jotti 0/19
Virustotal 0/56

Jotti 0/19
Virustotal 0/56

Yes, I'm planning to make everyone use the same version so we won't have to release 2 separate versions for every plugin, thanks to Riigged.
K_Relay_mpgh.net.zip2.8 MB · 1,300 downloads Clean
AntiLag_v2_mpgh.net.zip4 KB · 722 downloads Clean
AntiLag_mpgh.net.zip3 KB · 253 downloads Clean
Quote Originally Posted by CrazyJani View Post
Yes, I'm planning to make everyone use the same version so we won't have to release 2 separate versions for every plugin, thanks to Riigged.
lol

so this is just an update, nothing new added
did you remove the secret command or updated that one too?
Quote Originally Posted by FlutterM4rk View Post
did you remove the secret command or updated that one too?
I removed it.
I also removed the deactivation command, why would anyone want to deactivate it anyway?
Quote Originally Posted by CrazyJani View Post
I removed it.
I also removed the deactivation command, why would anyone want to deactivate it anyway?
I deactivated it all the time to debug some stuff.
Quote Originally Posted by CrazyJani View Post
I removed it.
I also removed the deactivation command, why would anyone want to deactivate it anyway?
to see other's projectiles?
K-Relay is already released, no need for another, deleted that.
File approved
Quote Originally Posted by Luis View Post
K-Relay is already released, no need for another, deleted that.
File approved
That KRelay was updated, it is different from riiggeds
Quote Originally Posted by New View Post


That KRelay was updated, it is different from riiggeds
Shulda said something, @CrazyJani please reupload it, deleted due to a misunderstanding
Quote Originally Posted by Luis View Post
Shulda said something, @CrazyJani please reupload it, deleted due to a misunderstanding
I've included a separate download for the newest version of K Relay
he did .
Quote Originally Posted by New View Post


he did .
I misunderstood on my part
I liked turning it off because it's fun to see other's projectiles.
File approved, report back results.
Nice. Meant to update this. I added options to toggle the following:
- projectiles
- damage text
-misc effects

Cause in small groups you can turn on ally projectiles without lagging.
Posts 115 of 69 · Page 1 of 5

Post a Reply

Similar Threads

Tags for this Thread

Need help?