public static void F_PLAYER_STATE2(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (cclient.Plr == null || !cclient.Plr.IsInWorld()) return; Player Plr = cclient.Plr; try { long Pos = packet.Position; PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_STATE2); Out.Write(packet.ToArray(), (int)packet.Position, (int)packet.Size); Out.WriteByte(0); Plr.DispatchPacket(Out, false); packet.Position = Pos; } catch (Exception e) { Log.Error("F_PLAYER_STATE2", e.ToString()); } if (packet.Size < 17) { Plr.IsMoving = false; return; } UInt16 Key = packet.GetUint16(); byte MoveByte = packet.GetUint8(); byte UnkByte = packet.GetUint8(); byte CombatByte = packet.GetUint8(); byte RotateByte = packet.GetUint8(); UInt16 Heading = packet.GetUint16R(); UInt16 X = packet.GetUint16R(); UInt16 Y = packet.GetUint16R(); byte Unk1 = packet.GetUint8(); UInt16 Z = packet.GetUint16R(); //byte Unk2 = packet.GetUint8(); Heading /= 8; X /= 2; Y /= 2; Z /= 2; if (CombatByte >= 50 && CombatByte < 0x92 || CombatByte == 0xDF) { if (Plr.LastCX != 0 && Plr.LastCY != 0) { if (Plr.LastCX > 12288 && X < 4096) Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset); else if (X > 12288 && Plr.LastCX < 4096) Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset); if (Plr.LastCY > 24576 && Y < 8192) Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1)); else if (Y > 24576 && Plr.LastCY < 8192) Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1)); } Plr.LastCX = X; Plr.LastCY = Y; X = Plr.Zone.CalculCombat(X, Plr.XOffset, true); Y = Plr.Zone.CalculCombat(Y, Plr.YOffset, false); Heading /= 2; Z += 32768; Z /= 4; } else { if (Plr.LastX != 0 && Plr.LastY != 0) { if (Plr.LastX > 24576 && X < 4096) Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset); else if (Plr.LastX < 4096 && X > 24576) Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset); if (Plr.LastY > 24576 && Y < 4096) Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1)); else if (Plr.LastY < 4096 && Y > 24576) Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1)); } Plr.LastX = X; Plr.LastY = Y; X = Plr.Zone.CalculPin(X, Plr.XOffset, true); Y = Plr.Zone.CalculPin(Y, Plr.YOffset, false); } Plr.SetPosition(X, Y, Z, Heading); }
public static void F_PLAYER_STATE2(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (cclient.Plr == null || !cclient.Plr.IsInWorld()) return; Player Plr = cclient.Plr; long Pos = packet.Position; PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_STATE2); Out.Write(packet.ToArray(), (int)packet.Position, (int)packet.Size); Out.WriteByte(0); Plr.DispatchPacket(Out, false); packet.Position = Pos; UInt16 Key = packet.GetUint16(); byte Type = packet.GetUint8(); byte MoveingState = packet.GetUint8(); byte CombatByte = packet.GetUint8(); byte Strafe = packet.GetUint8(); UInt16 Heading = packet.GetUint16R(); UInt16 X = packet.GetUint16R(); UInt16 Y = packet.GetUint16R(); byte Unk1 = packet.GetUint8(); UInt16 Z = packet.GetUint16R(); byte zmod = packet.GetUint8(); // Log.Success("zMod ",""+zmod); // zmod is somewhat strange what i found out so far // z mod is 255 while standing // z mod is 0 while running and z is below 65535 // z mod is 1 while running and z is above 65535 // z mod can be 113 / 97 / 115 / 99 while running and z is below 65535 and enemy in target // z mod is 99 / 100 / 116 while running and z is above 65535 and enemy in target // z mod is 4 while running in water // z mod is 68 while swimming in water // z mod is ticking with 255 7 times then 68 while standing in deep water // z mod is 12 while running in water (that should lower your health / kill you and reduce movement speed) // z mod is ticking with 255 7 times then 12 while standing in lava if (packet.Size < 10) return; int z_temp = Z; Heading /= 8; X /= 2; Y /= 2; // z update if z is higher then 65535 if (zmod != 0 && zmod != 97 && zmod != 113 && zmod != 99 && zmod != 115) z_temp += 65535; if (Type != (byte)MovementTypes.NotMoving) Plr.IsMoving = true; else Plr.IsMoving = false; // Log.Success("Movement Before ", X + "," + Y + "," + Z + " ztemp"+ z_temp); if (CombatByte >= 50 && CombatByte < 0x92 || CombatByte == 0xDF) { if (Plr.LastCX != 0 && Plr.LastCY != 0) { if (Plr.LastCX > 12288 && X < 4096) Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset); else if (X > 12288 && Plr.LastCX < 4096) Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset); if (Plr.LastCY > 24576 && Y < 8192) Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1)); else if (Y > 24576 && Plr.LastCY < 8192) Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1)); } Plr.LastCX = X; Plr.LastCY = Y; X = Plr.Zone.CalculCombat(X, Plr.XOffset, true); Y = Plr.Zone.CalculCombat(Y, Plr.YOffset, false); Heading /= 2; z_temp /= 16; // combat offset z if (Plr._ZoneMgr.ZoneId == 161 || Plr._ZoneMgr.ZoneId == 162) { z_temp += 12288; } else z_temp += 4096; } else { if (Plr.LastX != 0 && Plr.LastY != 0) { if (Plr.LastX > 24576 && X < 4096) Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset); else if (Plr.LastX < 4096 && X > 24576) Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset); if (Plr.LastY > 24576 && Y < 4096) Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1)); else if (Plr.LastY < 4096 && Y > 24576) Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1)); } Plr.LastX = X; Plr.LastY = Y; X = Plr.Zone.CalculPin(X, Plr.XOffset, true); Y = Plr.Zone.CalculPin(Y, Plr.YOffset, false); Log.Success("4 ",""+z_temp); z_temp /= 4; } // if (Plr.IsInWorld() && Plr.Zone.ZoneId == 161) // Z += 16384; // Log.Success("Movement after", "X=" + X + ",Y=" + Y + ",Z=" + Z + ",ztemp = " + z_temp + "," + Type + "," + Unk1 + "," + CombatByte); Plr.SetPosition(X, Y,(ushort) z_temp, Heading); }
static public void F_PLAYER_STATE2(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (cclient.Plr == null || !cclient.Plr.IsInWorld()) return; Player Plr = cclient.Plr; long Pos = packet.Position; PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_STATE2); Out.Write(packet.ToArray(), (int)packet.Position, (int)packet.Size); Out.WriteByte(0); Plr.DispatchPacket(Out, false); packet.Position = Pos; UInt16 Key = packet.GetUint16(); byte Type = packet.GetUint8(); byte MoveingState = packet.GetUint8(); byte CombatByte = packet.GetUint8(); byte Strafe = packet.GetUint8(); UInt16 Heading = packet.GetUint16R(); UInt16 X = packet.GetUint16R(); UInt16 Y = packet.GetUint16R(); byte Unk1 = packet.GetUint8(); UInt16 Z = packet.GetUint16R(); if (packet.Size < 10) return; Heading /= 8; X /= 2; Y /= 2; Z /= 2; if (Type != (byte)MovementTypes.NotMoving) Plr.IsMoving = true; else Plr.IsMoving = false; //Log.Success("Movement Before ", X + "," + Y + "," + Z); if (CombatByte >= 50 && CombatByte < 0x92 || CombatByte == 0xDF) { if (Plr.LastCX != 0 && Plr.LastCY != 0) { if (Plr.LastCX > 12288 && X < 4096) Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset); else if (X > 12288 && Plr.LastCX < 4096) Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset); if (Plr.LastCY > 24576 && Y < 8192) Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1)); else if (Y > 24576 && Plr.LastCY < 8192) Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1)); } Plr.LastCX = X; Plr.LastCY = Y; X = Plr.Zone.CalculCombat(X, Plr.XOffset, true); Y = Plr.Zone.CalculCombat(Y, Plr.YOffset, false); Heading /= 2; Z += 32768; Z /= 4; Z /= 2; } else { if (Plr.LastX != 0 && Plr.LastY != 0) { if (Plr.LastX > 24576 && X < 4096) Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset); else if (Plr.LastX < 4096 && X > 24576) Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset); if (Plr.LastY > 24576 && Y < 4096) Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1)); else if (Plr.LastY < 4096 && Y > 24576) Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1)); } Plr.LastX = X; Plr.LastY = Y; X = Plr.Zone.CalculPin(X, Plr.XOffset, true); Y = Plr.Zone.CalculPin(Y, Plr.YOffset, false); Z /= 2; } if (Plr.IsInWorld() && Plr.Zone.ZoneId == 161) Z += 16384; //Log.Success("Movement after", "X=" + X + ",Y=" + Y + ",Z=" + Z + "," + Type + "," + Unk1 + "," + CombatByte); Plr.SetPosition(X, Y, Z, Heading); }