Hello,
That's Full Attack Decode
im dont test it yet thanks :D .
That's Full Attack Decode
PHP Code:
public class AttackDecode
{
public static void PacketArray(byte[] Packet)
{
ushort Length = BitConverter.ToUInt16(Packet, 0);
ushort Type = BitConverter.ToUInt16(Packet, 2);
int Time1 = BitConverter.ToInt32(Packet, 4);
int Time2 = BitConverter.ToInt32(Packet, 8);
ushort SpellID = BitConverter.ToUInt16(Packet, 28);
ushort ResponeDamage = BitConverter.ToUInt16(Packet, 30);
uint Attacker = BitConverter.ToUInt32(Packet, 12);
uint Attacked = BitConverter.ToUInt32(Packet, 16);
ushort X = BitConverter.ToUInt16(Packet, 20);
ushort Y = BitConverter.ToUInt16(Packet, 22);
ushort AttackType = BitConverter.ToUInt16(Packet, 24);
//X,Y Decryption
Y = (ushort)(Y ^ Attacker ^ 0xB99B);
Y = (ushort)(RotateLeftushort(Y, 5) + 0x76DE);
X = (ushort)(X ^ Attacker ^ 0x2ED6);
X = (ushort)(RotateLeftushort(X, 1) - 0x22EE);
//SpellID
SpellID = (ushort)(X ^ Attacker ^ 0x915D);
SpellID = (ushort)(RotateLeftushort(SpellID, 3) + 0x14BE);
//TargetUID
Attacked = (RotateRightuint(Attacked, 13) ^ 0x5F2D2463 ^ Attacker) - 0x746F4AE6;
//ResponeDamage
if ((int)SpellID >= 1000
&& ((int)SpellID <= 1002 || SpellID == 1030 || SpellID == 1125 || SpellID == 1150 || SpellID == 1160 || SpellID == 1165))
ResponeDamage ^= (ushort)0x6279u;
ResponeDamage = (ResponeDamage ^ 0x3721) - (ushort)((Time2 & 0xFF) << 8);
}
public static uint RotateLeftuint(this uint value, int count)
{
return (value << count) | (value >> (32 - count));
}
public static uint RotateRightuint(this uint value, int count)
{
return (value >> count) | (value << (32 - count));
}
public static ushort RotateLeftushort(this ushort value, short count)
{
return (ushort)(((value << count) | (value >> (16 - count))) & 0xFFFF);
}
public static ushort RotateRightushort(this ushort value, short count)
{
return (ushort)(((value >> count) | (value << (16 - count))) & 0xFFFF);
}
}