Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Programming
You last visited: Today at 17:21

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[HELP]Magicattack Packet

Discussion on [HELP]Magicattack Packet within the CO2 Programming forum part of the Conquer Online 2 category.

Reply
 
Old   #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
xmen01235V2 is offline  
Old 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.
phize is offline  
Thanks
1 User
Old 06/23/2015, 02:03   #3
 
elite*gold: 0
Join Date: Jun 2015
Posts: 7
Received Thanks: 0
Quote:
Originally Posted by phize View Post
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?
xmen01235V2 is offline  
Old 06/23/2015, 03:21   #4
 
elite*gold: 0
Join Date: Sep 2006
Posts: 774
Received Thanks: 8,576
Quote:
Originally Posted by xmen01235V2 View Post
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);	}
phize is offline  
Thanks
1 User
Old 06/23/2015, 04:51   #5
 
elite*gold: 0
Join Date: Jun 2015
Posts: 7
Received Thanks: 0
Quote:
Originally Posted by phize View Post
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.
xmen01235V2 is offline  
Old 06/23/2015, 12:45   #6
 
elite*gold: 0
Join Date: Sep 2006
Posts: 774
Received Thanks: 8,576
Quote:
Originally Posted by xmen01235V2 View Post
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.
phize is offline  
Old 06/23/2015, 14:19   #7
 
{ Angelius }'s Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 991
Received Thanks: 1,107
Encoding: (1 + 0x100 * (TimeStamp % 0x100) ^ 0x3721)

Decoding is your Homework.
{ Angelius } is offline  
Thanks
1 User
Old 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 } View Post
Encoding: (1 + 0x100 * (TimeStamp % 0x100) ^ 0x3721)

Decoding is your Homework.
This should be the decoding right?

Code:
(ushort)(_mypacket.ReadUshort(30)  ^ 0x21)
xmen01235V2 is offline  
Reply




All times are GMT +2. The time now is 17:21.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.