|
You last visited: Today at 17:21
Advertisement
[HELP]Magicattack Packet
Discussion on [HELP]Magicattack Packet within the CO2 Programming forum part of the Conquer Online 2 category.
06/22/2015, 16:31
|
#1
|
elite*gold: 0
Join Date: Jun 2015
Posts: 7
Received Thanks: 0
|
[HELP]Magicattack Packet
Its been so long that I have never played around with conquer packet and I forget already if what does this part of the packet means.
2C 00 - Packet Length
FE 03 - Packet ID
CC E8 C9 00 - Timer
CC E8 C9 00 - Timer2
BE FF 2F 00 - Character ID
73 65 2F B2 - Target ID
A3 40 - AimX
69 F2 - AimY
18 00 00 00 - Action Type
AD 2D - Skill ID
21 FB - ????? (<------------------)
00 00 00 00 00 00 00 00 00 00 00 00 54 51 43 6C 69 65 6E 74
|
|
|
06/22/2015, 18:15
|
#2
|
elite*gold: 0
Join Date: Sep 2006
Posts: 774
Received Thanks: 8,576
|
Offset 28 is magic type, 30 is magic level. That is, on retail.
|
|
|
06/23/2015, 02:03
|
#3
|
elite*gold: 0
Join Date: Jun 2015
Posts: 7
Received Thanks: 0
|
Quote:
Originally Posted by phize
Offset 28 is magic type, 30 is magic level. That is, on retail.
|
Hi thanks appreciate your help. I noticed that it changes its value randomly and it seems it is coded with the timer. By chance do you know how to decode and encode it?
|
|
|
06/23/2015, 03:21
|
#4
|
elite*gold: 0
Join Date: Sep 2006
Posts: 774
Received Thanks: 8,576
|
Quote:
Originally Posted by xmen01235V2
Hi thanks appreciate your help. I noticed that it changes its value randomly and it seems it is coded with the timer. By chance do you know how to decode and encode it?
|
From Eudemons:
Code:
inline unsigned int ExchangeShortBits(unsigned long nData, int nBits)
{
MYASSERT(nBits >= 0 && nBits < 16);
nData &= 0xFFFF;
return ((nData>>nBits) | (nData<<(16-nBits))) & 0xFFFF;
}
inline unsigned int ExchangeLongBits(unsigned long nData, int nBits)
{
MYASSERT(nBits >= 0 && nBits < 32);
return (nData>>nBits) | (nData<<(32-nBits));
}
Code:
#define ENCODE_MAGICATTACK(idUser,usType,idTarget,usPosX,usPosY) { \
usType = (::ExchangeShortBits((usType - 0x14BE),3) ^ (idUser) ^ 0x915D); \
idTarget = ::ExchangeLongBits(((idTarget - 0x8B90B51A) ^ (idUser) ^ 0x5F2D2463),32-13); \
usPosX = (::ExchangeShortBits((usPosX - 0xDD12),1) ^ (idUser) ^ 0x2ED6); \
usPosY = (::ExchangeShortBits((usPosY - 0x76DE),5) ^ (idUser) ^ 0xB99B); }
#define DECODE_MAGICATTACK(idUser,usType,idTarget,usPosX,usPosY) { \
usType = 0xFFFF&(::ExchangeShortBits(((usType) ^ (idUser) ^ 0x915D),16-3) + 0x14BE); \
idTarget = (::ExchangeLongBits((idTarget),13) ^ (idUser) ^ 0x5F2D2463) + 0x8B90B51A; \
usPosX = 0xFFFF&(::ExchangeShortBits(((usPosX) ^ (idUser) ^ 0x2ED6),16-1) + 0xDD12); \
usPosY = 0xFFFF&(::ExchangeShortBits(((usPosY) ^ (idUser) ^ 0xB99B),16-5) + 0x76DE); }
|
|
|
06/23/2015, 04:51
|
#5
|
elite*gold: 0
Join Date: Jun 2015
Posts: 7
Received Thanks: 0
|
Quote:
Originally Posted by phize
From Eudemons:
Code:
inline unsigned int ExchangeShortBits(unsigned long nData, int nBits)
{
MYASSERT(nBits >= 0 && nBits < 16);
nData &= 0xFFFF;
return ((nData>>nBits) | (nData<<(16-nBits))) & 0xFFFF;
}
inline unsigned int ExchangeLongBits(unsigned long nData, int nBits)
{
MYASSERT(nBits >= 0 && nBits < 32);
return (nData>>nBits) | (nData<<(32-nBits));
}
Code:
#define ENCODE_MAGICATTACK(idUser,usType,idTarget,usPosX,usPosY) { \
usType = (::ExchangeShortBits((usType - 0x14BE),3) ^ (idUser) ^ 0x915D); \
idTarget = ::ExchangeLongBits(((idTarget - 0x8B90B51A) ^ (idUser) ^ 0x5F2D2463),32-13); \
usPosX = (::ExchangeShortBits((usPosX - 0xDD12),1) ^ (idUser) ^ 0x2ED6); \
usPosY = (::ExchangeShortBits((usPosY - 0x76DE),5) ^ (idUser) ^ 0xB99B); }
#define DECODE_MAGICATTACK(idUser,usType,idTarget,usPosX,usPosY) { \
usType = 0xFFFF&(::ExchangeShortBits(((usType) ^ (idUser) ^ 0x915D),16-3) + 0x14BE); \
idTarget = (::ExchangeLongBits((idTarget),13) ^ (idUser) ^ 0x5F2D2463) + 0x8B90B51A; \
usPosX = 0xFFFF&(::ExchangeShortBits(((usPosX) ^ (idUser) ^ 0x2ED6),16-1) + 0xDD12); \
usPosY = 0xFFFF&(::ExchangeShortBits(((usPosY) ^ (idUser) ^ 0xB99B),16-5) + 0x76DE); }
|
Thanks mate . But it seems that the magiclevel is not included on that chunk of codes yet.
|
|
|
06/23/2015, 12:45
|
#6
|
elite*gold: 0
Join Date: Sep 2006
Posts: 774
Received Thanks: 8,576
|
Quote:
Originally Posted by xmen01235V2
Thanks mate . But it seems that the magiclevel is not included on that chunk of codes yet.
|
My bad. Just have a look at any of the more recent pserver sources, they should have it implemented.
|
|
|
06/23/2015, 14:19
|
#7
|
elite*gold: 0
Join Date: Aug 2010
Posts: 991
Received Thanks: 1,107
|
Encoding: (1 + 0x100 * (TimeStamp % 0x100) ^ 0x3721)
Decoding is your Homework.
|
|
|
06/23/2015, 16:27
|
#8
|
elite*gold: 0
Join Date: Jun 2015
Posts: 7
Received Thanks: 0
|
Thanks a lot guys. I saw the complete routine also while digging in the pserver source. Just need to try it later when I will arrive home .
Quote:
Originally Posted by { Angelius }
Encoding: (1 + 0x100 * (TimeStamp % 0x100) ^ 0x3721)
Decoding is your Homework.
|
This should be the decoding right?
Code:
(ushort)(_mypacket.ReadUshort(30) ^ 0x21)
|
|
|
All times are GMT +2. The time now is 17:21.
|
|