Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 14.04.2007, 22:03   #2
[drzoom]
Архивный участник
 
Join Date: Jul 2006
Posts: 65
Default

CharInfo Packet
Code:
bool CharInfoPacket::init( const ByteBuffer& data )
{
	int pos = 1;

	char_.x_ = *(int*) &data[pos];
	pos += sizeof(int);		// X
	char_.y_ = *(int*) &data[pos];
	pos += sizeof(int);		// Y
	char_.z_ = *(int*) &data[pos];
	pos += sizeof(int);		// Z
	char_.heading_ = *(int*) &data[pos];
	pos += sizeof(int);		// heading
	char_.objectID_ = *(int*) &data[pos];
	pos += sizeof(int);		// objectID

	char_.name_.clear();
	while ( data[pos] != 0 )
	{
		char_.name_.push_back( (char) data[pos]);
		pos += 2;
	}
	pos += 2;

	char_.race_ = *(int*) &data[pos];
	pos += sizeof(int);		// race
	char_.sex_ = *(int*) &data[pos];
	pos += sizeof(int);		// sex
	char_.baseClass_ = *(int*) &data[pos];
	pos += sizeof(int);		// class

	char_.invUnder_ = *(int*) &data[pos];
	pos += sizeof(int);		// PAPERDOLL_UNDER
	char_.invHead_ = *(int*) &data[pos];
	pos += sizeof(int);		// PAPERDOLL_HEAD
	char_.invRHand_ = *(int*) &data[pos];
	pos += sizeof(int);		// PAPERDOLL_RHAND
	char_.invLHand_ = *(int*) &data[pos];
	pos += sizeof(int);		// PAPERDOLL_LHAND
	char_.invGloves_ = *(int*) &data[pos];
	pos += sizeof(int);		// PAPERDOLL_GLOVES
	char_.invChest_ = *(int*) &data[pos];
	pos += sizeof(int);		// PAPERDOLL_CHEST
	char_.invLegs_ = *(int*) &data[pos];
	pos += sizeof(int);		// PAPERDOLL_LEGS
	char_.invFeet_ = *(int*) &data[pos];
	pos += sizeof(int);		// PAPERDOLL_FEET
	char_.invBack_ = *(int*) &data[pos];
	pos += sizeof(int);		// PAPERDOLL_BACK
	char_.invLRHand_ = *(int*) &data[pos];
	pos += sizeof(int);		// PAPERDOLL_LRHAND
	char_.invHair_ = *(int*) &data[pos];
	pos += sizeof(int);		// PAPERDOLL_HAIR

	char_.pvpFlag_ = *(int*) &data[pos];
	pos += sizeof(int);		// pvp flag
	char_.karma_ = *(int*) &data[pos];
	pos += sizeof(int);		// karma

	pos += sizeof(int);		// mAtkSpd
	pos += sizeof(int);		// pAtkSpd

	pos += sizeof(int);		// pvp flag ?
	pos += sizeof(int);		// karma ?

	char_.runSpeed_ = *(int*) &data[pos];
    pos += sizeof(int); // run speed
	char_.walkSpeed_ = *(int*) &data[pos];
    pos += sizeof(int); // walk speed
    pos += sizeof(int); // swim run speed 
    pos += sizeof(int); // swim walk speed
    pos += sizeof(int); // fl run speed
    pos += sizeof(int); // fl walk speed
    pos += sizeof(int); // fly run speed
    pos += sizeof(int); // fly walk speed
    pos += sizeof(double); // getMovementSpeedMultiplier
    pos += sizeof(double); // getAttackSpeedMultiplier
    pos += sizeof(double); // collision radius
    pos += sizeof(double); // collision height

    pos += sizeof(int); // hair style
    pos += sizeof(int); // hair color
    pos += sizeof(int); // face

	pos += 52; // INTERLUDE - 52 bytes added

    char_.title_.clear();
    while ( data[pos] != 0 )
    {
        char_.title_.push_back( (char) data[pos]);
        pos += 2;
    }
    pos += 2;

    char_.clanID_ = *(int*) &data[pos];
    pos += sizeof(int);		// Clan ID
    char_.clanCrestID_ = *(int*) &data[pos];
    pos += sizeof(int);		// Clan crest ID
    char_.allyID_ = *(int*) &data[pos];
    pos += sizeof(int);		// Ally ID
    char_.allyCrestID_ = *(int*) &data[pos];
    pos += sizeof(int);		// Ally crest ID

    pos += sizeof(int);		// Seige Flag

    char_.sitting_ = data[pos];
    pos += sizeof(Byte);	// Sitting
    char_.running_ = data[pos];
    pos += sizeof(Byte);	// Running
    char_.inCombat_ = data[pos];
    pos += sizeof(Byte);	// In combat
    char_.dead_ = data[pos];
    pos += sizeof(Byte);	// Dead

    pos += sizeof(Byte);	// Invisible
    pos += sizeof(Byte);	// Mount type
    pos += sizeof(Byte);	// Private store
    
    short numCubics = *(short*) &data[pos];
    pos += sizeof(short);	// Cubics
    for ( int i = 0; i < numCubics; ++i )
    {
        pos += sizeof(short);	// Cubic ID
    }

    pos += sizeof(Byte);	// Find party members
	pos += sizeof(int);		// Abnormal effect

    pos += sizeof(Byte);	// Recs left
    pos += sizeof(short);	// Recs has
	char_.subClass_ = *(int*) &data[pos];
	pos += sizeof(int);		// Class ID

    char_.cp_ = *(int*) &data[pos];
    pos += sizeof(int);		// CP
    char_.maxCP_ = *(int*) &data[pos];
    pos += sizeof(int);		// Max CP

    pos += sizeof(Byte);	// Enchant
    pos += sizeof(Byte);	// Team
    pos += sizeof(int);	    // Clan large crest ID

    char_.noble_ = data[pos];
    pos += sizeof(Byte);	// Noble
    char_.hero_ = data[pos];
    pos += sizeof(Byte);	// Hero

    pos += sizeof(Byte);	// in fishing
    pos += sizeof(int);	    // Fish X
    pos += sizeof(int);	    // Fish Y
    pos += sizeof(int);	    // Fish Z

    pos += sizeof(int);	    // Name color
/*
    pos += sizeof(int);	    // ??
    pos += sizeof(int);	    // PAPERDOLL_FACE
    pos += sizeof(int);	    // Pledge class
    pos += sizeof(int);	    // ??
    pos += sizeof(int);	    // Title color
    pos += sizeof(int);	    // ??

    char_.cursedWeapon_ = *(int*) &data[pos];
    pos += sizeof(int);		// cursed weapon
*/
	return true;	
}
Use it
[drzoom] is offline  
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 21:16.