[4267] Jump/Spawn Rollback/Bug

02/09/2012 00:13 killersub#1
Okay so I've been working with a 4267 source lately and it's been working exceedingly fine, however, I jump around IN the game and it somehow rolls the character back 1 pace and the spawns around do not update meaning when I attack a mob, it shows me that i attacked it but I cant attack it again unless I run towards it/jump in/out back into the same area (you get me?).

here is the official AppendJump from my source:

Code:
private void AppendJump(GameClient Client, DataPacket* DPacket, byte[] Packet)
        {
            if (!Client.Entity.Dead)
            {
                #region Disable Mining
                if (Client.Mining)
                    Client.Mining = false;
                #endregion
                uint Time = Native.timeGetTime();
                if (Kernel.GetDistance(DPacket->dwParam_Lo, DPacket->dwParam_Hi, Client.Entity.X, Client.Entity.Y) <= 16)
                {
                    #region Speeder Check(s)
                    if (Math.Abs(DPacket->TimeStamp - Client.Entity.Stamps.LastClientMovement) <= 500
                        || DPacket->TimeStamp == 0)
                    {
                        Client.DynamicTeleport(Client.Entity.MapID, Client.Entity.X, Client.Entity.Y, Client.Entity.MapID.DynamicID);
                        Client.Speak(Color.Red, ChatType.Center, "Pullback possible speed hacking!");
                        return;
                    }
                    if (Time - Client.Entity.Stamps.LastClientMovement <= 500)
                    {
                        Client.DynamicTeleport(Client.Entity.MapID, Client.Entity.X, Client.Entity.Y, Client.Entity.MapID.DynamicID);
                        Client.Speak(Color.Red, ChatType.Center, "Pullback possible speed hacking!");
                        return;
                    }
                    else
                    {
                        if (Time - Client.Entity.Stamps.LastServerMovement <= 300)
                        {
                            Client.DynamicTeleport(Client.Entity.MapID, Client.Entity.X, Client.Entity.Y, Client.Entity.MapID.DynamicID);
                            Client.Speak(Color.Red, ChatType.Center, "Pullback possible speed hacking!");
                            return;
                        }
                    }
                    #endregion
                    Client.SendScreen(Packet, true);

                    Client.Entity.Facing = Kernel.AngleEntity(DPacket->dwParam_Lo, DPacket->dwParam_Hi, Client.Entity.X, Client.Entity.Y);

                    if (Client.Entity.MapID == 1038)
                    {
                        if (!GuildWar.ValidJump(Client.TileColor, out Client.TileColor, DPacket->dwParam_Lo, DPacket->dwParam_Hi))
                        {
                            Client.DynamicTeleport(Client.Entity.MapID, Client.Entity.X, Client.Entity.Y, Client.Entity.MapID.DynamicID);
                            Client.Speak(Color.Red, ChatType.Center, "Please only walk to this area!");
                            return;
                        }
                    }
                    if (Kernel.ValidCordinate(Client.Entity.MapID, DPacket->dwParam_Lo, DPacket->dwParam_Hi))
                    {
                        Client.Entity.X = DPacket->dwParam_Lo;
                        Client.Entity.Y = DPacket->dwParam_Hi;
                        Client.Screen.Reload(false, null);
                    }
                    else
                        Client.Teleport(Client.Entity.MapID, Client.Entity.X, Client.Entity.Y);
                }
                else
                {
                    Client.Speak(Color.Red, ChatType.Center, "Pullback jump to far!");
                    return;
                }
            }
        }
could it be cause of the "pullback" mentioned in the code?

Much help will sure be appreciated, sorry for this new thread but this was the only bug preventing my source to be "bug-free" (metaphorically speaking).
02/09/2012 00:33 Spirited#2
Your speed check is bugged. Players should be able to move faster than that.
Comment it out and see if that works. Then have the source output the difference so you can see what the lowest time really is. Don't forget to check ALL of the possible angles.
02/09/2012 00:35 killersub#3
Quote:
Originally Posted by Fаng View Post
Your speed check is bugged. Players should be able to move faster than that.
Comment it out and see if that works. Then have the source output the difference so you can see what the lowest time really is. Don't forget to check ALL of the possible angles.
for example?
02/09/2012 00:52 Spirited#4
Quote:
Originally Posted by killersub View Post
for example?
Well, surround the speed check region with comments ( \* comment *\ ). See if it works, then... if it does... output the difference of Time - Client.Entity.Stamps.LastClientMovement and on a new line, the difference between Time - Client.Entity.Stamps.LastServerMovement. Once you get that, change the code to reflect the new values. As it stands... your code checks 500 milliseconds for client movement and 300 milliseconds for server movement.
02/09/2012 00:56 killersub#5
Quote:
Originally Posted by Fаng View Post
Well, surround the speed check region with comments ( \* comment *\ ). See if it works, then... if it does... output the difference of Time - Client.Entity.Stamps.LastClientMovement and on a new line, the difference between Time - Client.Entity.Stamps.LastServerMovement. Once you get that, change the code to reflect the new values. As it stands... your code checks 500 milliseconds for client movement and 300 milliseconds for server movement.
I have quoted those lines, still I tested and yet the same thing happens.
02/09/2012 01:03 Spirited#6
Ok, so if you commented out the entire section like so:
Code:
private void AppendJump(GameClient Client, DataPacket* DPacket, byte[] Packet)
        {
            if (!Client.Entity.Dead)
            {
                #region Disable Mining
                if (Client.Mining)
                    Client.Mining = false;
                #endregion
                uint Time = Native.timeGetTime();
                if (Kernel.GetDistance(DPacket->dwParam_Lo, DPacket->dwParam_Hi, Client.Entity.X, Client.Entity.Y) <= 16)
                {
/* COMMENTED OUT -------------------------------------------------------------------------------------------------------
                    #region Speeder Check(s)
                    if (Math.Abs(DPacket->TimeStamp - Client.Entity.Stamps.LastClientMovement) <= 500
                        || DPacket->TimeStamp == 0)
                    {
                        Client.DynamicTeleport(Client.Entity.MapID, Client.Entity.X, Client.Entity.Y, Client.Entity.MapID.DynamicID);
                        Client.Speak(Color.Red, ChatType.Center, "Pullback possible speed hacking!");
                        return;
                    }
                    if (Time - Client.Entity.Stamps.LastClientMovement <= 500)
                    {
                        Client.DynamicTeleport(Client.Entity.MapID, Client.Entity.X, Client.Entity.Y, Client.Entity.MapID.DynamicID);
                        Client.Speak(Color.Red, ChatType.Center, "Pullback possible speed hacking!");
                        return;
                    }
                    else
                    {
                        if (Time - Client.Entity.Stamps.LastServerMovement <= 300)
                        {
                            Client.DynamicTeleport(Client.Entity.MapID, Client.Entity.X, Client.Entity.Y, Client.Entity.MapID.DynamicID);
                            Client.Speak(Color.Red, ChatType.Center, "Pullback possible speed hacking!");
                            return;
                        }
                    }
                    #endregion
----------------------------------------------------------------------------------------------------------------------------*/
                    Client.SendScreen(Packet, true);

                    Client.Entity.Facing = Kernel.AngleEntity(DPacket->dwParam_Lo, DPacket->dwParam_Hi, Client.Entity.X, Client.Entity.Y);

                    if (Client.Entity.MapID == 1038)
                    {
                        if (!GuildWar.ValidJump(Client.TileColor, out Client.TileColor, DPacket->dwParam_Lo, DPacket->dwParam_Hi))
                        {
                            // Console.WriteLine("Valid Jump!");
                            Client.DynamicTeleport(Client.Entity.MapID, Client.Entity.X, Client.Entity.Y, Client.Entity.MapID.DynamicID);
                            Client.Speak(Color.Red, ChatType.Center, "Please only walk to this area!");
                            return;
                        }
                    }
                    if (Kernel.ValidCordinate(Client.Entity.MapID, DPacket->dwParam_Lo, DPacket->dwParam_Hi))
                    {
                        // Console.WriteLine("Valid Jump!");
                        Client.Entity.X = DPacket->dwParam_Lo;
                        Client.Entity.Y = DPacket->dwParam_Hi;
                        Client.Screen.Reload(false, null);
                    }
                    else
                    // {
                        // Console.WriteLine("Invalid Jump!");
                        Client.Teleport(Client.Entity.MapID, Client.Entity.X, Client.Entity.Y);
                    // }
                }
                else
                {
                    // Console.WriteLine("Invalid Jump!");
                    Client.Speak(Color.Red, ChatType.Center, "Pullback jump to far!");
                    return;
                }
            }
        }
then there's a possibility that the jump isn't valid. If you know how to breakpoint, put breakpoints in and follow the code... else, do what I used to do back in the days of NewestCoServer. Make outputs such as the ones that I commented into the code above. Also, the distance should be 18 and based on a square, not a circle. If you're not sure if it's checking it as a square or circle, check the method.

Edit: I'm going to class. I'll bbl.
02/09/2012 01:17 killersub#7
Quote:
Originally Posted by Fаng View Post
Ok, so if you commented out the entire section like so:
Code:
private void AppendJump(GameClient Client, DataPacket* DPacket, byte[] Packet)
        {
            if (!Client.Entity.Dead)
            {
                #region Disable Mining
                if (Client.Mining)
                    Client.Mining = false;
                #endregion
                uint Time = Native.timeGetTime();
                if (Kernel.GetDistance(DPacket->dwParam_Lo, DPacket->dwParam_Hi, Client.Entity.X, Client.Entity.Y) <= 16)
                {
/* COMMENTED OUT -------------------------------------------------------------------------------------------------------
                    #region Speeder Check(s)
                    if (Math.Abs(DPacket->TimeStamp - Client.Entity.Stamps.LastClientMovement) <= 500
                        || DPacket->TimeStamp == 0)
                    {
                        Client.DynamicTeleport(Client.Entity.MapID, Client.Entity.X, Client.Entity.Y, Client.Entity.MapID.DynamicID);
                        Client.Speak(Color.Red, ChatType.Center, "Pullback possible speed hacking!");
                        return;
                    }
                    if (Time - Client.Entity.Stamps.LastClientMovement <= 500)
                    {
                        Client.DynamicTeleport(Client.Entity.MapID, Client.Entity.X, Client.Entity.Y, Client.Entity.MapID.DynamicID);
                        Client.Speak(Color.Red, ChatType.Center, "Pullback possible speed hacking!");
                        return;
                    }
                    else
                    {
                        if (Time - Client.Entity.Stamps.LastServerMovement <= 300)
                        {
                            Client.DynamicTeleport(Client.Entity.MapID, Client.Entity.X, Client.Entity.Y, Client.Entity.MapID.DynamicID);
                            Client.Speak(Color.Red, ChatType.Center, "Pullback possible speed hacking!");
                            return;
                        }
                    }
                    #endregion
----------------------------------------------------------------------------------------------------------------------------*/
                    Client.SendScreen(Packet, true);

                    Client.Entity.Facing = Kernel.AngleEntity(DPacket->dwParam_Lo, DPacket->dwParam_Hi, Client.Entity.X, Client.Entity.Y);

                    if (Client.Entity.MapID == 1038)
                    {
                        if (!GuildWar.ValidJump(Client.TileColor, out Client.TileColor, DPacket->dwParam_Lo, DPacket->dwParam_Hi))
                        {
                            // Console.WriteLine("Valid Jump!");
                            Client.DynamicTeleport(Client.Entity.MapID, Client.Entity.X, Client.Entity.Y, Client.Entity.MapID.DynamicID);
                            Client.Speak(Color.Red, ChatType.Center, "Please only walk to this area!");
                            return;
                        }
                    }
                    if (Kernel.ValidCordinate(Client.Entity.MapID, DPacket->dwParam_Lo, DPacket->dwParam_Hi))
                    {
                        // Console.WriteLine("Valid Jump!");
                        Client.Entity.X = DPacket->dwParam_Lo;
                        Client.Entity.Y = DPacket->dwParam_Hi;
                        Client.Screen.Reload(false, null);
                    }
                    else
                    // {
                        // Console.WriteLine("Invalid Jump!");
                        Client.Teleport(Client.Entity.MapID, Client.Entity.X, Client.Entity.Y);
                    // }
                }
                else
                {
                    // Console.WriteLine("Invalid Jump!");
                    Client.Speak(Color.Red, ChatType.Center, "Pullback jump to far!");
                    return;
                }
            }
        }
then there's a possibility that the jump isn't valid. If you know how to breakpoint, put breakpoints in and follow the code... else, do what I used to do back in the days of NewestCoServer. Make outputs such as the ones that I commented into the code above. Also, the distance should be 18 and based on a square, not a circle. If you're not sure if it's checking it as a square or circle, check the method.

Edit: I'm going to class. I'll bbl.
yessir, just like you did.

here is how it checks valid coordinates:

Code:
public static bool ValidCordinate(ushort MapID, ushort X, ushort Y)
        {
            if (ConquerDMap.Maps[MapID].Invalid(X, Y))
                return false;
            return true;
        }
here is the Invalid void behind the DMap file:
Code:
public ushort MapID;
        public byte[,] Coordinates;
        public short MaxHeight, MaxWidth;

        public bool Invalid(ushort X, ushort Y)
        {
            if (X > MaxWidth || Y > MaxHeight)
                return false;
            return Coordinates[X, Y] == 1;
        }
02/09/2012 02:38 Spirited#8
Quote:
Originally Posted by killersub View Post
yessir, just like you did.

here is how it checks valid coordinates:

Code:
public static bool ValidCordinate(ushort MapID, ushort X, ushort Y)
        {
            if (ConquerDMap.Maps[MapID].Invalid(X, Y))
                return false;
            return true;
        }
here is the Invalid void behind the DMap file:
Code:
public ushort MapID;
        public byte[,] Coordinates;
        public short MaxHeight, MaxWidth;

        public bool Invalid(ushort X, ushort Y)
        {
            if (X > MaxWidth || Y > MaxHeight)
                return false;
            return Coordinates[X, Y] == 1;
        }
I meant the method that checks for distance. Anyways, make the outputs to check out what's going wrong. If you copy my code and uncomment the output codes, you should get an answer.
02/09/2012 04:17 killersub#9
Quote:
Originally Posted by Fаng View Post
I meant the method that checks for distance. Anyways, make the outputs to check out what's going wrong. If you copy my code and uncomment the output codes, you should get an answer.
when I did that, in the console it says, "Valid Jump!" but my character jumps without moving now.
02/09/2012 05:04 Spirited#10
Quote:
Originally Posted by killersub View Post
when I did that, in the console it says, "Valid Jump!" but my character jumps without moving now.
Do you mean that it jumps in place... or do you mean that it jumps without being teleported back?
02/09/2012 20:51 killersub#11
Quote:
Originally Posted by Fаng View Post
Do you mean that it jumps in place... or do you mean that it jumps without being teleported back?
it jumps in place.

Like I jump and stays in the same place with a rollback everytime so basically I can only walk/run.