Initial MSVC 2008 projects workspace
This commit is contained in:
78
l2ooghelper/packet_send/ps_atk.cpp
Normal file
78
l2ooghelper/packet_send/ps_atk.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
#include "stdafx.h"
|
||||
#include "Logger.h"
|
||||
#include "L2Client.h"
|
||||
|
||||
void L2Client::send_RequestMagicSkillUse( unsigned int skillID,
|
||||
unsigned int ctrlPressed, unsigned char shiftPressed )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket *pack = new L2GamePacket();
|
||||
pack->setPacketType( 0x39 ); // RequestMagicSkillUse
|
||||
pack->writeUInt( skillID );
|
||||
pack->writeUInt( ctrlPressed );
|
||||
pack->writeUChar( shiftPressed );
|
||||
sendPacket( pack, true );
|
||||
delete pack; pack = NULL;
|
||||
}
|
||||
|
||||
void L2Client::send_Action( unsigned int objectID, int x, int y, int z, unsigned char useShift )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
if( x == 0 ) x = usr.x;
|
||||
if( y == 0 ) y = usr.y;
|
||||
if( z == 0 ) z = usr.z;
|
||||
L2GamePacket *pack = new L2GamePacket();
|
||||
pack->setPacketType( 0x1F ); // Action
|
||||
pack->writeUInt( objectID );
|
||||
pack->writeInt( x );
|
||||
pack->writeInt( y );
|
||||
pack->writeInt( z );
|
||||
pack->writeUChar( useShift );
|
||||
sendPacket( pack, true );
|
||||
delete pack; pack = NULL;
|
||||
}
|
||||
|
||||
void L2Client::send_RequestTargetCanceld()
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket *pack = new L2GamePacket();
|
||||
pack->setPacketType( 0x48 ); // RequestTargetCanceld
|
||||
pack->writeUShort( 0x0000 );
|
||||
sendPacket( pack, true );
|
||||
delete pack; pack = NULL;
|
||||
}
|
||||
|
||||
void L2Client::send_AttackRequest( unsigned int objectID, int x, int y, int z, unsigned char useShift )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
if( objectID == 0 ) objectID = usr.targetObjectID;
|
||||
if( objectID == 0 ) return;
|
||||
//
|
||||
if( x == 0 ) x = usr.x;
|
||||
if( y == 0 ) y = usr.y;
|
||||
if( z == 0 ) z = usr.z;
|
||||
//
|
||||
L2GamePacket *pack = new L2GamePacket();
|
||||
pack->setPacketType( 0x01 ); // AttackRequest
|
||||
pack->writeUInt( objectID );
|
||||
pack->writeInt( x );
|
||||
pack->writeInt( y );
|
||||
pack->writeInt( z );
|
||||
pack->writeUChar( useShift );
|
||||
sendPacket( pack, true );
|
||||
delete pack; pack = NULL;
|
||||
}
|
||||
|
||||
|
||||
void L2Client::send_RequestAutoSoulshot( unsigned int itemID, bool enable )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket *pack = new L2GamePacket();
|
||||
pack->setPacketType( 0xD0 );
|
||||
pack->writeUShort( 0x000D ); // D0:000D RequestAutoSoulshot
|
||||
pack->writeUInt( itemID );
|
||||
enable ? pack->writeUInt( 1 ) : pack->writeUInt( 0 );
|
||||
sendPacket( pack, true );
|
||||
delete pack; pack = NULL;
|
||||
}
|
||||
|
57
l2ooghelper/packet_send/ps_buySell.cpp
Normal file
57
l2ooghelper/packet_send/ps_buySell.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "stdafx.h"
|
||||
#include "Logger.h"
|
||||
#include "L2Client.h"
|
||||
|
||||
/** Client: Len 19 [RequestBuyItem]
|
||||
13 00
|
||||
40
|
||||
90 00 00 00 // list ID
|
||||
01 00 00 00 // count
|
||||
[[ for each item ]]
|
||||
25 04 00 00 // itemID
|
||||
64 00 00 00 // count **/
|
||||
void L2Client::send_RequestBuyItem( TradeItemsList *plist )
|
||||
{
|
||||
if( !plist ) return;
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x40 ); // RequestBuyItem
|
||||
p.writeUInt( plist->listID );
|
||||
p.writeInt( plist->itemCount );
|
||||
int i;
|
||||
for( i=0; i<plist->itemCount; i++ )
|
||||
{
|
||||
p.writeUInt( plist->item[i].itemID );
|
||||
if( getL2Version() < L2_VERSION_T23 ) p.writeD( (int)plist->item[i].count );
|
||||
else p.writeQ( plist->item[i].count );
|
||||
}
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
/** Client: Len 59 [RequestSellItem]
|
||||
3B 00
|
||||
37 // pcode
|
||||
00 00 00 00 // list ID (0 - to NPC?)
|
||||
04 00 00 00 // count
|
||||
[[ for each item ]]
|
||||
1D 21 01 10 // objectID
|
||||
F0 0F 00 00 // itemID
|
||||
01 00 00 00 // count **/
|
||||
void L2Client::send_RequestSellItem( TradeItemsList *plist )
|
||||
{
|
||||
if( !plist ) return;
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x37 ); // RequestSellItem
|
||||
p.writeUInt( plist->listID );
|
||||
p.writeInt( plist->itemCount );
|
||||
int i;
|
||||
for( i=0; i<plist->itemCount; i++ )
|
||||
{
|
||||
p.writeUInt( plist->item[i].objectID );
|
||||
p.writeUInt( plist->item[i].itemID );
|
||||
if( getL2Version() < L2_VERSION_T23 ) p.writeD( (int)plist->item[i].count );
|
||||
else p.writeQ( plist->item[i].count );
|
||||
}
|
||||
sendPacket( &p, true );
|
||||
}
|
86
l2ooghelper/packet_send/ps_items.cpp
Normal file
86
l2ooghelper/packet_send/ps_items.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
#include "stdafx.h"
|
||||
#include "Logger.h"
|
||||
#include "L2Client.h"
|
||||
|
||||
void L2Client::send_UseItem( unsigned int objectID )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2Game_UseItem *p = new L2Game_UseItem();
|
||||
p->create( objectID );
|
||||
sendPacket( p, true );
|
||||
delete p; p = NULL;
|
||||
}
|
||||
|
||||
/** Client: Len 11 [RequestDestroyItem]
|
||||
0B 00
|
||||
60
|
||||
71 08 00 10 // objectID
|
||||
01 00 00 00 // count **/
|
||||
void L2Client::send_RequestDestroyItem( unsigned int objectID, long long int count )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2_VERSION ver = getL2Version();
|
||||
L2GamePacket *p = new L2GamePacket();
|
||||
p->setPacketType( 0x60 ); // RequestDestroyItem
|
||||
p->writeUInt( objectID );
|
||||
if( ver < L2_VERSION_T23 ) p->writeD( (int)count ); else p->writeQ( count );
|
||||
sendPacket( p, true );
|
||||
delete p; p = NULL;
|
||||
}
|
||||
|
||||
/** Client: Len 23 [RequestDropItem]
|
||||
17 00
|
||||
17
|
||||
E4 09 00 10 // objectID
|
||||
01 00 00 00 // count
|
||||
F4 AA 00 00 // x
|
||||
2F A4 00 00 // y
|
||||
43 F2 FF FF // z **/
|
||||
void L2Client::send_RequestDropItem( unsigned int objectID, long long int count, int x, int y, int z )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2_VERSION ver = getL2Version();
|
||||
if( x == 0 ) x = usr.x;
|
||||
if( y == 0 ) y = usr.y;
|
||||
if( z == 0 ) z = usr.z;
|
||||
L2GamePacket *p = new L2GamePacket();
|
||||
p->setPacketType( 0x17 ); // RequestDropItem
|
||||
p->writeUInt( objectID );
|
||||
if( ver < L2_VERSION_T23 ) p->writeD( (int)count ); else p->writeQ( count );
|
||||
p->writeInt( x );
|
||||
p->writeInt( y );
|
||||
p->writeInt( z );
|
||||
sendPacket( p, true );
|
||||
delete p; p = NULL;
|
||||
}
|
||||
|
||||
// Format: dd (objectID,count)
|
||||
/** Client: Len 11
|
||||
0B 00
|
||||
2F
|
||||
13 14 04 10 // objectID 268702739
|
||||
01 00 00 00 // count 1 **/
|
||||
void L2Client::send_RequestCrystallizeItem( unsigned int objectID, long long int count )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2_VERSION ver = getL2Version();
|
||||
L2GamePacket *p = new L2GamePacket();
|
||||
p->setPacketType( 0x2F ); // RequestCrystallizeItem
|
||||
p->writeUInt( objectID );
|
||||
if( ver < L2_VERSION_T23 ) p->writeD( (int)count ); else p->writeQ( count );
|
||||
sendPacket( p, true );
|
||||
delete p; p = NULL;
|
||||
}
|
||||
|
||||
// Format: dd (objectID,count)
|
||||
void L2Client::send_RequestGiveItemToPet( unsigned int objectID, long long int count )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2_VERSION ver = getL2Version();
|
||||
L2GamePacket *p = new L2GamePacket();
|
||||
p->setPacketType( 0x95 ); // RequestGiveItemToPet
|
||||
p->writeUInt( objectID );
|
||||
if( ver < L2_VERSION_T23 ) p->writeD( (int)count ); else p->writeQ( count );
|
||||
sendPacket( p, true );
|
||||
delete p; p = NULL;
|
||||
}
|
255
l2ooghelper/packet_send/ps_misc.cpp
Normal file
255
l2ooghelper/packet_send/ps_misc.cpp
Normal file
@@ -0,0 +1,255 @@
|
||||
#include "stdafx.h"
|
||||
#include "Logger.h"
|
||||
#include "L2Client.h"
|
||||
|
||||
void L2Client::handle_ConfirmDlg( wchar_t *question, unsigned int sm_ID,
|
||||
unsigned int requestId, unsigned int timeLimit, const wchar_t *text )
|
||||
{
|
||||
const char *party_auto_accept_names = botcfg.getValStr( "party_auto_accept_names" );
|
||||
if( party_auto_accept_names && (this->bot_enabled > 0) && (text != NULL) )
|
||||
{
|
||||
char arequester[256] = {0};
|
||||
WideCharToMultiByte( CP_ACP, 0, text, -1, arequester, 255, NULL, NULL );
|
||||
if( BotCfg_IsInList( arequester, party_auto_accept_names ) )
|
||||
{
|
||||
send_DlgAnswer( sm_ID, 0x00000001, requestId );
|
||||
return;
|
||||
}
|
||||
}
|
||||
MessageBoxTimeout *mb = new MessageBoxTimeout( this->hWnd, 0,
|
||||
MessageBoxTimeout::TYPE_CONFIRMDLG, question, (int)timeLimit );
|
||||
mb->runConfirmDlg( this->usr.charName, requestId, sm_ID, (void *)this );
|
||||
if( question ) free( question );
|
||||
}
|
||||
|
||||
// packet senders
|
||||
|
||||
void L2Client::send_DlgAnswer( unsigned int sm_ID, int answer, unsigned int requestId )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0xC6 ); // DlgAnswer
|
||||
p.writeUInt( sm_ID ); // systemMessageID
|
||||
p.writeInt( answer ); // 0x00000001 = accepted, 0x00000000 - no =[
|
||||
p.writeUInt( requestId );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
|
||||
/** * RequestGMList Client: Len 3 | 03 00 / 8B / */
|
||||
void L2Client::send_RequestGMList()
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x8B );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
void L2Client::send_RequestActionUse( unsigned int actionID, unsigned int ctrlPressed, unsigned char shiftPressed )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket *gp = new L2GamePacket();
|
||||
gp->setPacketType( 0x56 ); // RequestActionUse opcode :)
|
||||
gp->writeUInt( actionID ); // actionID; 0 - sitstand; 1 - runwalk
|
||||
gp->writeUInt( ctrlPressed ); // ctrlPressed
|
||||
gp->writeUChar( shiftPressed ); // shiftPressed
|
||||
sendPacket( gp, true );
|
||||
delete gp; gp = NULL;
|
||||
}
|
||||
|
||||
void L2Client::send_RequestUserCommand( unsigned int commandID )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2Game_RequestUserCommand *pack = new L2Game_RequestUserCommand();
|
||||
pack->create( commandID );
|
||||
sendPacket( pack, true );
|
||||
delete pack; pack = NULL;
|
||||
}
|
||||
|
||||
// Client: Len 43 [SendBypassBuildCmd] | 2B 00 / 74 / 63 00 72 00 .... 30 00 00 00
|
||||
// _command = readS();
|
||||
void L2Client::send_SendBypassBuildCmd( const wchar_t *cmd )
|
||||
{
|
||||
if( !cmd ) return;
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
log_error( LOG_DEBUG, "use admin command: [%S]\n", cmd );
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x74 );
|
||||
p.writeUnicodeString( cmd + 2 ); // string starts with "//", pass 1st 2 chars
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
// pcode 0xC2; read: _targetId = readD();
|
||||
void L2Client::send_RequestEvaluate()
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
if( usr.targetObjectID == 0 ) return;
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0xC2 ); // RequestEvaluate
|
||||
p.writeUInt( usr.targetObjectID );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
/** Client: Len 13 [RequestDispel]
|
||||
0D 00
|
||||
D0 4E 00 // D0:004E RequestDispel D0:004B RequestExDspel (G.Final)
|
||||
4B 05 00 00 // skillID 1355 (PoWater?)
|
||||
01 00 00 00 // skillLvl lvl 1 **/
|
||||
void L2Client::send_RequestDispel( unsigned int skillID )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
// only in Gracia T2
|
||||
if( this->account.getL2Version() < L2_VERSION_T2 ) return;
|
||||
UserBuff buf;
|
||||
buffs.getBuffnfoBySkillId( skillID, &buf );
|
||||
if( (buf.skillID == 0) || (buf.skillLvl == 0) ) return; // error, no such buff!
|
||||
// create packet
|
||||
L2GamePacket *p = new L2GamePacket();
|
||||
p->setPacketType( 0xD0 );
|
||||
// opcode is different in Gracia Final
|
||||
if( this->account.serverVersion <= (int)L2_VERSION_T22 )
|
||||
p->writeUShort( 0x004E ); // D0:004E RequestDispel L2 <= T22
|
||||
else
|
||||
p->writeUShort( 0x004B ); // D0:004B RequestDispel L2 >= T23 Gracia Final
|
||||
p->writeUInt( skillID );
|
||||
p->writeUInt( buf.skillLvl );
|
||||
sendPacket( p, true );
|
||||
delete p; p = NULL;
|
||||
}
|
||||
|
||||
void L2Client::send_RequestBypassToServer( const wchar_t *bypassStr )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
if( !bypassStr ) return;
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x23 ); // RequestBypassToServer
|
||||
p.writeUnicodeString( bypassStr );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
void L2Client::send_RequestLinkHtml( const wchar_t *link )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
if( !link ) return;
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x22 ); // RequestLinkHtml
|
||||
p.writeUnicodeString( link );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
/*** Client: Len 7 [RequestRestartPoint]
|
||||
07 00
|
||||
7D
|
||||
00 00 00 00 // pointType
|
||||
|
||||
case 1: // to clanhall
|
||||
case 2: // to castle
|
||||
case 3: // to fortress
|
||||
case 4: // to siege HQ
|
||||
case 5: // Fixed or Player is a festival participant
|
||||
|
||||
after successful restart point server sends TeleportToLocation
|
||||
then client send Appearing
|
||||
then server sends Revive ***/
|
||||
void L2Client::send_RequestRestartPoint( unsigned int pointType/* = 0*/ )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
// only if we are dead!
|
||||
if( !usr.isDead )
|
||||
{
|
||||
MessageBox( hWnd, TEXT("<EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!"), TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), MB_ICONWARNING );
|
||||
return;
|
||||
}
|
||||
if( (pointType == 0) && (usr.canResurrectToVillage == 0) )
|
||||
{
|
||||
MessageBox( hWnd, TEXT("<EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!"), TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), MB_ICONWARNING );
|
||||
return;
|
||||
}
|
||||
if( (pointType == 1) && (usr.canResurrectToCH == 0) )
|
||||
{
|
||||
MessageBox( hWnd, TEXT("<EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!"), TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), MB_ICONWARNING );
|
||||
return;
|
||||
}
|
||||
if( (pointType == 2) && (usr.canResurrectToCastle == 0) )
|
||||
{
|
||||
MessageBox( hWnd, TEXT("<EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>!"), TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), MB_ICONWARNING );
|
||||
return;
|
||||
}
|
||||
if( (pointType == 3) && (usr.canResurrectToFortress == 0) )
|
||||
{
|
||||
MessageBox( hWnd, TEXT("<EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>!"), TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), MB_ICONWARNING );
|
||||
return;
|
||||
}
|
||||
if( (pointType == 4) && (usr.canResurrectToSiegeHQ == 0) )
|
||||
{
|
||||
MessageBox( hWnd, TEXT("<EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>!"), TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), MB_ICONWARNING );
|
||||
return;
|
||||
}
|
||||
if( (pointType == 5) && (usr.canResurrectFixed == 0) )
|
||||
{
|
||||
MessageBox( hWnd, TEXT("<EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>!"), TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), MB_ICONWARNING );
|
||||
return;
|
||||
}
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x7D ); // RequestRestartPoint
|
||||
p.writeUInt( pointType );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
void L2Client::send_Say2( unsigned int chat_type, const wchar_t *text, const wchar_t *to )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
// send Say2
|
||||
L2GamePacket *pack = new L2GamePacket();
|
||||
pack->writeReset();
|
||||
pack->setPacketType( 0x49 ); // Say2
|
||||
pack->writeUnicodeString( text );
|
||||
pack->writeUInt( chat_type );
|
||||
if( chat_type == L2_CHAT_MESSAGE::TELL && to ) pack->writeUnicodeString( to );
|
||||
this->sendPacket( pack, true );
|
||||
delete pack; pack = NULL;
|
||||
}
|
||||
|
||||
|
||||
// hack function, do not use!
|
||||
// input: string consisting of sequence of hex chars, representing packet, starting from packet type
|
||||
// packet length will be prefixed automatically!
|
||||
// example: 1F39A400109ACB00003D2BFFFFA9F3FFFF00 - 1F Action packet, without packet len
|
||||
void L2Client::send_hackPacketHex( const char *szHexStr )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
if( !szHexStr ) return;
|
||||
int ll = (int)strlen( szHexStr );
|
||||
if( ll % 2 ) return;
|
||||
int nBytes = ll / 2;
|
||||
int i;
|
||||
unsigned char *bytebuffer = (unsigned char *)malloc( nBytes );
|
||||
if( !bytebuffer ) return;
|
||||
memset( bytebuffer, 0, nBytes );
|
||||
//log_error_np( LOG_OK, "\ngame_sendPacketHex(): %d bytes\n", nBytes );
|
||||
for( i=0; i<ll; i+=2 )
|
||||
{
|
||||
char c1 = szHexStr[i];
|
||||
char c2 = szHexStr[i+1];
|
||||
//log_error_np( LOG_OK, "Parsing byte [%d] %c%c... ", i/2, c1, c2 );
|
||||
int i1 = 0;
|
||||
int i2 = 0;
|
||||
if( (c1>='0') && (c1<='9') ) i1 = 0 + c1 - '0';
|
||||
if( (c1>='a') && (c1<='f') ) i1 = 10 + c1 - 'a';
|
||||
if( (c1>='A') && (c1<='F') ) i1 = 10 + c1 - 'A';
|
||||
if( (c2>='0') && (c2<='9') ) i2 = 0 + c2 - '0';
|
||||
if( (c2>='a') && (c2<='f') ) i2 = 10 + c2 - 'a';
|
||||
if( (c2>='A') && (c2<='F') ) i2 = 10 + c2 - 'A';
|
||||
//log_error_np( LOG_OK, "%d * 16 + %d... ", i1, i2 );
|
||||
unsigned char b = (unsigned char)( ((i1 << 4) | i2) & 0xFF );
|
||||
//log_error_np( LOG_OK, "%d (%02X)\n", (int)b, b );
|
||||
bytebuffer[i/2] = b;
|
||||
}
|
||||
L2GamePacket *pack = new L2GamePacket();
|
||||
pack->writeReset();
|
||||
pack->writeBytes( bytebuffer, nBytes );
|
||||
sendPacket( pack, true );
|
||||
delete pack;
|
||||
pack = NULL;
|
||||
}
|
||||
|
58
l2ooghelper/packet_send/ps_move.cpp
Normal file
58
l2ooghelper/packet_send/ps_move.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#include "stdafx.h"
|
||||
#include "Logger.h"
|
||||
#include "L2Client.h"
|
||||
|
||||
void L2Client::send_Appearing()
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket pack;
|
||||
pack.setPacketType( 0x3A ); // pcode Appearing
|
||||
sendPacket( &pack, true );
|
||||
}
|
||||
|
||||
void L2Client::send_MoveBackwardToLocation( int xDst, int yDst, int zDst /*= 0x7FFFFFFF*/ )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
if( zDst == 0x7FFFFFFF ) zDst = usr.z;
|
||||
L2GamePacket *pack = new L2GamePacket();
|
||||
pack->setPacketType( 0x0F ); // MoveBackwardToLocation
|
||||
pack->writeInt( xDst );
|
||||
pack->writeInt( yDst );
|
||||
pack->writeInt( zDst );
|
||||
pack->writeInt( usr.x );
|
||||
pack->writeInt( usr.y );
|
||||
pack->writeInt( usr.z );
|
||||
pack->writeInt( 1 ); // for movement used mouse
|
||||
sendPacket( pack, true );
|
||||
delete pack; pack = NULL;
|
||||
}
|
||||
|
||||
void L2Client::game_MoveToDelta( int dx, int dy, int dz /*= 0*/ )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
int xDst = usr.x + dx;
|
||||
int yDst = usr.y + dy;
|
||||
int zDst = usr.z + dz;
|
||||
send_MoveBackwardToLocation( xDst, yDst, zDst );
|
||||
}
|
||||
|
||||
/** Client: Len 23 [ValidatePosition]
|
||||
17 00
|
||||
59
|
||||
B3 A5 00 00 // x 42419
|
||||
39 A4 00 00 // y 42041
|
||||
5B F2 FF FF // z -3493
|
||||
E2 24 00 00 // heading 9442
|
||||
00 00 00 00 // wtf data? L2J ignores **/
|
||||
void L2Client::send_ValidatePosition()
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x59 ); // ValidatePosition
|
||||
p.writeInt( usr.x );
|
||||
p.writeInt( usr.y );
|
||||
p.writeInt( usr.z );
|
||||
p.writeInt( usr.heading ); // L2J ignores...?
|
||||
p.writeInt( 0x00 );
|
||||
sendPacket( &p, true );
|
||||
}
|
101
l2ooghelper/packet_send/ps_party.cpp
Normal file
101
l2ooghelper/packet_send/ps_party.cpp
Normal file
@@ -0,0 +1,101 @@
|
||||
#include "stdafx.h"
|
||||
#include "Logger.h"
|
||||
#include "L2Client.h"
|
||||
|
||||
// 0 - Finders Keepers
|
||||
// 1 - Random
|
||||
// 2 - Random including spoil
|
||||
// 3 - by turn
|
||||
// 4 - by turn including spoil
|
||||
void L2Client::handle_AskJoinParty( const wchar_t *requester, unsigned int itemDistribution )
|
||||
{
|
||||
// OnAskJoinParty must look into config to possible auto-accept pary invites from some players
|
||||
const char *party_auto_accept_names = botcfg.getValStr( "party_auto_accept_names" );
|
||||
if( party_auto_accept_names && (this->bot_enabled > 0) )
|
||||
{
|
||||
char arequester[256] = {0};
|
||||
WideCharToMultiByte( CP_ACP, 0, requester, -1, arequester, 255, NULL, NULL );
|
||||
if( BotCfg_IsInList( arequester, party_auto_accept_names ) )
|
||||
{
|
||||
send_RequestAnswerJoinParty( 1 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
// not enabled auto accept or wrong char.
|
||||
// Display UI request
|
||||
TCHAR question[512] = {0};
|
||||
TCHAR lootType[64] = {0};
|
||||
switch( itemDistribution )
|
||||
{
|
||||
case 0: lstrcpy( lootType, TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>") ); break;
|
||||
case 1: lstrcpy( lootType, TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>") ); break;
|
||||
case 2: lstrcpy( lootType, TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>") ); break;
|
||||
case 3: lstrcpy( lootType, TEXT("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>") ); break;
|
||||
case 4: lstrcpy( lootType, TEXT("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>") ); break;
|
||||
}
|
||||
wsprintf( question, TEXT("%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>: %s"),
|
||||
requester, lootType );
|
||||
MessageBoxTimeout *mb = new MessageBoxTimeout( hWnd, WMMY_UI_MESSAGEBOXTIMEOUTREPLY,
|
||||
MessageBoxTimeout::TYPE_PARTY, question, 15 );
|
||||
mb->run( this->usr.charName );
|
||||
}
|
||||
|
||||
// packet senders
|
||||
|
||||
void L2Client::send_RequestAnswerJoinParty( unsigned int accepted )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // can answer only in game
|
||||
// answer AskJoinParty request
|
||||
L2GamePacket *pack = new L2GamePacket();
|
||||
pack->writeReset();
|
||||
pack->setPacketType( 0x43 ); // RequestAnswerJoinParty
|
||||
pack->writeUInt( accepted );
|
||||
this->sendPacket( pack, true );
|
||||
delete pack; pack = NULL;
|
||||
}
|
||||
|
||||
void L2Client::send_RequestJoinParty( const wchar_t *target, unsigned int itemDistribution )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
// send RequestJoinParty
|
||||
L2Game_RequestJoinParty *pack = new L2Game_RequestJoinParty();
|
||||
pack->create( target, itemDistribution );
|
||||
sendPacket( pack, true );
|
||||
delete pack; pack = NULL;
|
||||
}
|
||||
|
||||
void L2Client::send_RequestWithdrawalParty()
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket *pack = new L2GamePacket();
|
||||
pack->writeReset();
|
||||
pack->setPacketType( 0x44 ); // RequestWithDrawalParty
|
||||
sendPacket( pack, true );
|
||||
delete pack; pack = NULL;
|
||||
}
|
||||
|
||||
void L2Client::send_RequestOustPartyMember( const wchar_t *playerName )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
if( !playerName ) return;
|
||||
L2GamePacket *pack = new L2GamePacket();
|
||||
pack->writeReset();
|
||||
pack->setPacketType( 0x45 ); // RequestOustPartyMember
|
||||
pack->writeUnicodeString( playerName );
|
||||
sendPacket( pack, true );
|
||||
delete pack; pack = NULL;
|
||||
}
|
||||
|
||||
void L2Client::send_RequestChangePartyLeader( const wchar_t *playerName )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
if( !playerName ) return;
|
||||
L2GamePacket *pack = new L2GamePacket();
|
||||
pack->writeReset();
|
||||
pack->setPacketType( 0xD0 ); // D0:000C RequestChangePartyLeader
|
||||
pack->writeUShort( 0x0000C );
|
||||
pack->writeUnicodeString( playerName );
|
||||
sendPacket( pack, true );
|
||||
delete pack; pack = NULL;
|
||||
}
|
||||
|
281
l2ooghelper/packet_send/ps_pvtStore.cpp
Normal file
281
l2ooghelper/packet_send/ps_pvtStore.cpp
Normal file
@@ -0,0 +1,281 @@
|
||||
#include "stdafx.h"
|
||||
#include "Logger.h"
|
||||
#include "L2Client.h"
|
||||
// dialogs
|
||||
#include "BuySellDlg.h"
|
||||
#include "PrivateStoreDlg.h"
|
||||
|
||||
void L2Client::handle_BuyList( TradeItemsList *list )
|
||||
{
|
||||
if( !list ) return;
|
||||
BuySellDlg *dlg = new BuySellDlg( hWnd, WMMY_UI_BUYSELLDLGREPLY, BuySellDlg::TYPE_BUYLIST, list );
|
||||
dlg->run();
|
||||
}
|
||||
|
||||
void L2Client::handle_SellList( TradeItemsList *list )
|
||||
{
|
||||
if( !list ) return;
|
||||
BuySellDlg *dlg = new BuySellDlg( hWnd, WMMY_UI_BUYSELLDLGREPLY, BuySellDlg::TYPE_SELLLIST, list );
|
||||
dlg->run();
|
||||
}
|
||||
|
||||
void L2Client::handle_PrivateStoreManageListSell( TradeItemsList *list1, TradeItemsList *list2 )
|
||||
{
|
||||
PrivateStoreManageDlg *dlg = new PrivateStoreManageDlg( hWnd, WMMY_UI_PRIVATESTOREDLGREPLY,
|
||||
PrivateStoreManageDlg::TYPE_SELL, list1, list2 );
|
||||
dlg->run();
|
||||
}
|
||||
|
||||
void L2Client::handle_PrivateStoreManageListBuy( TradeItemsList *list1, TradeItemsList *list2 )
|
||||
{
|
||||
PrivateStoreManageDlg *dlg = new PrivateStoreManageDlg( hWnd, WMMY_UI_PRIVATESTOREDLGREPLY,
|
||||
PrivateStoreManageDlg::TYPE_BUY, list1, list2 );
|
||||
dlg->run();
|
||||
}
|
||||
|
||||
void L2Client::handle_RecipeShopManageList( TradeItemsList *list1, TradeItemsList *list2 )
|
||||
{
|
||||
int dtype = PrivateStoreManageDlg::TYPE_CRAFT;
|
||||
if( list1->isCommonCraft ) dtype = PrivateStoreManageDlg::TYPE_COMMONCRAFT;
|
||||
PrivateStoreManageDlg *dlg = new PrivateStoreManageDlg( hWnd, WMMY_UI_PRIVATESTOREDLGREPLY, dtype, list1, list2 );
|
||||
dlg->run();
|
||||
}
|
||||
|
||||
void L2Client::handle_PrivateStoreBuyList( TradeItemsList *list )
|
||||
{
|
||||
if( !list ) return;
|
||||
BuySellDlg *dlg = new BuySellDlg( hWnd, WMMY_UI_BUYSELLDLGREPLY, BuySellDlg::TYPE_PRIVATESTOREBUYLIST, list );
|
||||
dlg->run();
|
||||
}
|
||||
|
||||
void L2Client::handle_PrivateStoreSellList( TradeItemsList *list )
|
||||
{
|
||||
if( !list ) return;
|
||||
BuySellDlg *dlg = new BuySellDlg( hWnd, WMMY_UI_BUYSELLDLGREPLY, BuySellDlg::TYPE_PRIVATESTORESELLLIST, list );
|
||||
dlg->run();
|
||||
}
|
||||
|
||||
|
||||
// packet senders
|
||||
|
||||
// Client: Len 3 [RequestPrivateStoreQuitSell] | 03 00 / 96 /
|
||||
void L2Client::send_RequestPrivateStoreQuitSell()
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x96 ); // RequestPrivateStoreQuitSell
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
// Client: Len 3 [RequestPrivateStoreQuitBuy] | 03 00 / 9C /
|
||||
void L2Client::send_RequestPrivateStoreQuitBuy()
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x9C ); // RequestPrivateStoreQuitBuy
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
// Client: Len 3 [RequestRecipeShopManageQuit] | 03 00 / BC /
|
||||
void L2Client::send_RequestRecipeShopManageQuit()
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0xBC ); // RequestRecipeShopManageQuit
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
// Client: Len 11 [SetPrivateStoreMsgBuy] | 0B 00 / 9D / 53 00 53 00 44 00 00 00
|
||||
void L2Client::send_SetPrivateStoreMsgBuy( const wchar_t *message )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x9D ); // SetPrivateStoreMsgBuy
|
||||
p.writeUnicodeString( message );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
// Client: Len 11 [SetPrivateStoreMsgSell] | 0B 00 / 97 / 53 00 53 00 44 00 00 00
|
||||
void L2Client::send_SetPrivateStoreMsgSell( const wchar_t *message )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x97 ); // SetPrivateStoreMsgSell
|
||||
p.writeUnicodeString( message );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
void L2Client::send_SetPrivateStoreWholeMsg( const wchar_t *message )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0xD0 ); // extended packet
|
||||
p.writeUShort( 0x4D ); // D0:004D SetPrivateStoreMsgSell
|
||||
p.writeUnicodeString( message );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
void L2Client::send_RequestRecipeShopMessageSet( const wchar_t *message )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0xBA ); // RequestRecipeShopMessageSet
|
||||
p.writeUnicodeString( message );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
void L2Client::send_SetPrivateStoreListSell( TradeItemsList *list )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
if( !list ) return;
|
||||
if( list->packageSale ) send_SetPrivateStoreWholeMsg( list->message );
|
||||
else send_SetPrivateStoreMsgSell( list->message );
|
||||
int i = 0;
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x31 );
|
||||
p.writeUInt( list->packageSale );
|
||||
p.writeInt( list->itemCount );
|
||||
for( i=0; i<list->itemCount; i++ )
|
||||
{
|
||||
p.writeUInt( list->item[i].objectID );
|
||||
if( getL2Version() < L2_VERSION_T23 )
|
||||
{
|
||||
p.writeD( (int)list->item[i].count );
|
||||
p.writeD( (int)list->item[i].price );
|
||||
}
|
||||
else
|
||||
{
|
||||
p.writeQ( list->item[i].count );
|
||||
p.writeQ( list->item[i].price );
|
||||
}
|
||||
}
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
void L2Client::send_SetPrivateStoreListBuy( TradeItemsList *list )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
if( !list ) return;
|
||||
send_SetPrivateStoreMsgBuy( list->message );
|
||||
int i = 0;
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x9A );
|
||||
p.writeInt( list->itemCount );
|
||||
for( i=0; i<list->itemCount; i++ )
|
||||
{
|
||||
p.writeUInt( list->item[i].itemID );
|
||||
p.writeUInt( list->item[i].objectID ); // unknown field
|
||||
if( getL2Version() < L2_VERSION_T23 )
|
||||
{
|
||||
p.writeD( (int)list->item[i].count );
|
||||
p.writeD( (int)list->item[i].price );
|
||||
}
|
||||
else
|
||||
{
|
||||
p.writeQ( list->item[i].count );
|
||||
p.writeQ( list->item[i].price );
|
||||
// attributes (?) some 16 bytes, L2J ignores
|
||||
p.writeH( (short)list->item[i].attributeAtkType );
|
||||
p.writeH( (short)list->item[i].attributeAtkValue );
|
||||
p.writeH( (short)list->item[i].attributeDefFire );
|
||||
p.writeH( (short)list->item[i].attributeDefWater );
|
||||
p.writeH( (short)list->item[i].attributeDefWind );
|
||||
p.writeH( (short)list->item[i].attributeDefEarth );
|
||||
p.writeH( (short)list->item[i].attributeDefHoly );
|
||||
p.writeH( (short)list->item[i].attributeDefUnholy );
|
||||
}
|
||||
}
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
void L2Client::send_RequestRecipeShopListSet( TradeItemsList *list )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
if( !list ) return;
|
||||
send_RequestRecipeShopMessageSet( list->message );
|
||||
int i = 0;
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0xBB ); // RequestRecipeShopListSet
|
||||
p.writeInt( list->itemCount );
|
||||
for( i=0; i<list->itemCount; i++ )
|
||||
{
|
||||
p.writeUInt( list->item[i].itemID ); // recipe ID
|
||||
if( getL2Version() < L2_VERSION_T23 ) p.writeD( (int)list->item[i].price ); // cost
|
||||
else p.writeQ( list->item[i].price ); // cost
|
||||
}
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
/** Client: Len 23 [RequestPrivateStoreBuy]
|
||||
17 00
|
||||
83 // pcode
|
||||
CE 09 00 10 // seller player oid
|
||||
01 00 00 00 // count
|
||||
// for each item
|
||||
D0 09 00 10 // item oid
|
||||
01 00 00 00 // count
|
||||
01 00 00 00 // price **/
|
||||
void L2Client::send_RequestPrivateStoreBuy( TradeItemsList *list )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
if( !list ) return;
|
||||
int i = 0;
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x83 ); // RequestPrivateStoreBuy
|
||||
p.writeUInt( list->listID );
|
||||
p.writeInt( list->itemCount );
|
||||
for( i=0; i<list->itemCount; i++ )
|
||||
{
|
||||
p.writeUInt( list->item[i].objectID );
|
||||
if( getL2Version() < L2_VERSION_T23 )
|
||||
{
|
||||
p.writeD( (int)list->item[i].count );
|
||||
p.writeD( (int)list->item[i].price );
|
||||
}
|
||||
else
|
||||
{
|
||||
p.writeQ( list->item[i].count );
|
||||
p.writeQ( list->item[i].price );
|
||||
}
|
||||
}
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
/** Client: Len 31 [RequestPrivateStoreSell]
|
||||
1F 00
|
||||
9F // pcode
|
||||
CE 09 00 10 // seller oid
|
||||
01 00 00 00 // count
|
||||
|
||||
C7 09 00 10 // oid
|
||||
F4 25 00 00 // iid
|
||||
00 00 00 00 // ?? 0x00000000
|
||||
02 00 00 00 // cnt
|
||||
01 00 00 00 // price **/
|
||||
void L2Client::send_RequestPrivateStoreSell( TradeItemsList *list )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
if( !list ) return;
|
||||
int i = 0;
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x9F ); // RequestPrivateStoreSell
|
||||
p.writeUInt( list->listID );
|
||||
p.writeInt( list->itemCount );
|
||||
for( i=0; i<list->itemCount; i++ )
|
||||
{
|
||||
p.writeUInt( list->item[i].objectID );
|
||||
p.writeUInt( list->item[i].itemID );
|
||||
p.writeUInt( 0x00000000 ); // ??
|
||||
if( getL2Version() < L2_VERSION_T23 )
|
||||
{
|
||||
p.writeD( (int)list->item[i].count );
|
||||
p.writeD( (int)list->item[i].price );
|
||||
}
|
||||
else
|
||||
{
|
||||
p.writeQ( list->item[i].count );
|
||||
p.writeQ( list->item[i].price );
|
||||
}
|
||||
}
|
||||
sendPacket( &p, true );
|
||||
}
|
87
l2ooghelper/packet_send/ps_sys.cpp
Normal file
87
l2ooghelper/packet_send/ps_sys.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
#include "stdafx.h"
|
||||
#include "Logger.h"
|
||||
#include "L2Client.h"
|
||||
|
||||
void L2Client::send_AuthLogin()
|
||||
{
|
||||
// create AuthLogin
|
||||
L2Game_AuthLogin p_game_al;
|
||||
p_game_al.create( account.login, login_sessionKey1, login_sessionKey2 );
|
||||
// send AuthLogin
|
||||
sendPacket( &p_game_al, true ); // true - obfuscate and XOR encode
|
||||
}
|
||||
|
||||
void L2Client::send_Logout()
|
||||
{
|
||||
L2GamePacket *pack = new L2GamePacket();
|
||||
pack->writeChar( 0x00 ); // Logout
|
||||
sendPacket( pack, true );
|
||||
delete pack; pack = NULL;
|
||||
}
|
||||
|
||||
void L2Client::send_RequestRestart()
|
||||
{
|
||||
L2GamePacket *pack = new L2GamePacket();
|
||||
pack->writeChar( 0x57 ); // RequestRestart
|
||||
sendPacket( pack, true );
|
||||
delete pack; pack = NULL;
|
||||
}
|
||||
|
||||
void L2Client::send_CharacterSelect( int iCharSlot )
|
||||
{
|
||||
// create CharSelect
|
||||
L2Game_CharacterSelect *p_game_charselect = new L2Game_CharacterSelect();
|
||||
p_game_charselect->create( (unsigned int)iCharSlot );
|
||||
// send
|
||||
sendPacket( p_game_charselect, true );
|
||||
delete p_game_charselect; p_game_charselect = NULL;
|
||||
}
|
||||
|
||||
void L2Client::send_RequestGotoLobby()
|
||||
{
|
||||
L2Game_RequestGotoLobby p;
|
||||
p.create( account.getL2Version() );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
void L2Client::send_NewCharacter()
|
||||
{
|
||||
L2Game_NewCharacter p;
|
||||
p.create( account.getL2Version() );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
void L2Client::send_CharacterDelete( int iCharSlot )
|
||||
{
|
||||
L2Game_CharacterDelete p;
|
||||
p.p_charSlot = iCharSlot;
|
||||
p.create( account.getL2Version() );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
void L2Client::send_CharacterRestore( int iCharSlot )
|
||||
{
|
||||
L2Game_CharacterRestore p;
|
||||
p.p_charSlot = iCharSlot;
|
||||
p.create( account.getL2Version() );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
void L2Client::send_CharacterCreate( const wchar_t *name, const L2Game_NewCharacterTemplate *tmpl,
|
||||
int hairStyle, int hairColor, int face, int is_female )
|
||||
{
|
||||
L2Game_CharacterCreate p;
|
||||
p.create( tmpl, name, hairStyle, hairColor, face, is_female );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
void L2Client::send_GameGuardReply( unsigned int r1, unsigned int r2, unsigned int r3, unsigned int r4 )
|
||||
{
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0xCB ); // GameGuardReply
|
||||
p.writeUInt( r1 );
|
||||
p.writeUInt( r2 );
|
||||
p.writeUInt( r3 );
|
||||
p.writeUInt( r4 );
|
||||
sendPacket( &p, true );
|
||||
}
|
63
l2ooghelper/packet_send/ps_trade_p2p.cpp
Normal file
63
l2ooghelper/packet_send/ps_trade_p2p.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
#include "stdafx.h"
|
||||
#include "Logger.h"
|
||||
#include "L2Client.h"
|
||||
|
||||
/*** Client: Len 7 [TradeRequest] | 07 00
|
||||
1A // pcode
|
||||
C5 09 00 10 // objectID of partner ***/
|
||||
void L2Client::send_TradeRequest( unsigned int targetObjectId/* = 0*/ )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
if( (this->usr.targetObjectID == 0) && (targetObjectId == 0) ) return; // target must be set
|
||||
if( targetObjectId == 0 ) targetObjectId = this->usr.targetObjectID;
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x1A ); // TradeRequest
|
||||
p.writeUInt( targetObjectId );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
/*** Client: Len 7 [AnswerTradeRequest]
|
||||
07 00
|
||||
55 // pcode
|
||||
01 00 00 00 // 1 - ok, 0 - cancel **/
|
||||
void L2Client::send_AnswerTradeRequest( bool accept/* = true*/ )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x55 ); // AnswerTradeRequest
|
||||
if( accept ) p.writeUInt( 0x00000001 );
|
||||
else p.writeUInt( 0x00000000 );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
/** Client: Len 15 [AddTradeItem]
|
||||
0F 00
|
||||
1B // pcode
|
||||
01 00 00 00 // tradeId? O_o wtf L2J ignores this
|
||||
D1 09 00 10 // objectID
|
||||
01 00 00 00 // count **/
|
||||
void L2Client::send_AddTradeItem( unsigned int tradeID, unsigned int objectID, long long int count )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x1B ); // AddTradeItem
|
||||
p.writeUInt( tradeID );
|
||||
p.writeUInt( objectID );
|
||||
if( getL2Version() < L2_VERSION_T23 )
|
||||
p.writeD( (int)count );
|
||||
else p.writeQ( count );
|
||||
sendPacket( &p, true );
|
||||
}
|
||||
|
||||
/*** Client: Len 7 [TradeDone]
|
||||
07 00
|
||||
1C // pcode
|
||||
01 00 00 00 // OK/cancel trade? **/
|
||||
void L2Client::send_TradeDone( int bConfirm )
|
||||
{
|
||||
if( this->state != STATE_IN_GAME ) return; // only in game
|
||||
L2GamePacket p;
|
||||
p.setPacketType( 0x1C ); // TradeDone
|
||||
p.writeInt( bConfirm );
|
||||
sendPacket( &p, true );
|
||||
}
|
Reference in New Issue
Block a user