Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void DecryptAttackPacket(byte[] Packet, Player player)
- {
- #region Extract attack information
- ushort SpellID = 0, X = 0, Y = 0;
- uint Target = 0;
- #region GetSkillID
- SpellID = Convert.ToUInt16(((long)Packet[28] & 0xFF) | (((long)Packet[29] & 0xFF) << 8));
- SpellID ^= (ushort)0x915d;
- SpellID ^= (ushort)player.UID;
- SpellID = (ushort)(SpellID << 0x3 | SpellID >> 0xd);
- SpellID -= 0xeb42;
- #endregion
- #region GetCoords
- X = (ushort)((Packet[20] & 0xFF) | ((Packet[21] & 0xFF) << 8));
- X = (ushort)(X ^ (uint)(player.UID & 0xffff) ^ 0x2ed6);
- X = (ushort)(((X << 1) | ((X & 0x8000) >> 15)) & 0xffff);
- X = (ushort)((X | 0xffff0000) - 0xffff22ee);
- Y = (ushort)((Packet[22] & 0xFF) | ((Packet[23] & 0xFF) << 8));
- Y = (ushort)(Y ^ (uint)(player.UID & 0xffff) ^ 0xb99b);
- Y = (ushort)(((Y << 5) | ((Y & 0xF800) >> 11)) & 0xffff);
- Y = (ushort)((Y | 0xffff0000) - 0xffff8922);
- #endregion
- #region GetTarget
- Target = ((uint)Packet[16] & 0xFF) | (((uint)Packet[17] & 0xFF) << 8) | (((uint)Packet[18] & 0xFF) << 16) | (((uint)Packet[19] & 0xFF) << 24);
- Target = ((((Target & 0xffffe000) >> 13) | ((Target & 0x1fff) << 19)) ^ 0x5F2D2463 ^ player.UID) - 0x746F4AE6;
- #endregion
- #endregion
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement