Ejemplo n.º 1
0
CPositionPacket::CPositionPacket(CBaseEntity* PEntity) 
{
	this->type = 0x5B;
	this->size = 0x0E;
	
	WBUFF(data,(0x04)) = PEntity->loc.p.x;
	WBUFF(data,(0x08)) = PEntity->loc.p.y;  
	WBUFF(data,(0x0C)) = PEntity->loc.p.z; 
	WBUFB(data,(0x17)) = PEntity->loc.p.rotation;

	WBUFL(data,(0x10)) = PEntity->id;
	WBUFW(data,(0x14)) = PEntity->targid;
}
CWideScanTrackPacket::CWideScanTrackPacket(CBaseEntity * PEntity) 
{
	this->type = 0xF5;
	this->size = 0x0C;

	WBUFF(data,(0x04)-4) = PEntity->loc.p.x;
	WBUFF(data,(0x08)-4) = PEntity->loc.p.y;
	WBUFF(data,(0x0C)-4) = PEntity->loc.p.z;

	WBUFB(data,(0x10)-4) = 1;
	WBUFW(data,(0x12)-4) = PEntity->targid;
	WBUFB(data,(0x14)-4) = PEntity->status == STATUS_DISAPPEAR ? 2 : 1;
}
Ejemplo n.º 3
0
CPositionPacket::CPositionPacket(CCharEntity* PChar) 
{
	this->type = 0x5B;
	this->size = 0x0E;
	
	WBUFF(data,(0x04)-4) = PChar->loc.p.x;
	WBUFF(data,(0x08)-4) = PChar->loc.p.y;  
	WBUFF(data,(0x0C)-4) = PChar->loc.p.z; 
	WBUFB(data,(0x17)-4) = PChar->loc.p.rotation;

	WBUFL(data,(0x10)-4) = PChar->id;
	WBUFW(data,(0x14)-4) = PChar->targid;
}
Ejemplo n.º 4
0
CCSPositionPacket::CCSPositionPacket(CCharEntity* PChar) 
{
	this->type = 0x65;
	this->size = 0x10;
	
	WBUFF(data,(0x04)-4) = PChar->loc.p.x;
	WBUFF(data,(0x08)-4) = PChar->loc.p.y;  
	WBUFF(data,(0x0C)-4) = PChar->loc.p.z; 
	WBUFB(data,(0x17)-4) = PChar->loc.p.rotation;

	WBUFL(data,(0x10)-4) = PChar->id;
	WBUFW(data,(0x14)-4) = PChar->targid;

    if (PChar->status == STATUS_DISAPPEAR)
    {
        WBUFB(data,(0x16)-4) = 0x05;
        WBUFB(data,(0x1C)-4) = 0x01;
    } else {
        WBUFB(data,(0x16)-4) = 0x01;
        WBUFB(data,(0x18)-4) = 0x01;
    }
}
Ejemplo n.º 5
0
CCharPacket::CCharPacket(CCharEntity * PChar, ENTITYUPDATE type)
{
	this->type = 0x0D;
	this->size = 0x36;

	WBUFL(data,(0x04)-4) = PChar->id;
	WBUFW(data,(0x08)-4) = PChar->targid;

	switch(type)
	{
		case ENTITY_DESPAWN:
		{
			WBUFB(data,(0x0A)-4) = 0x20;
		}
		break;
		case ENTITY_SPAWN:
		case ENTITY_UPDATE:
		{
			WBUFB(data,(0x0A)-4) = 0x1F;

			WBUFB(data,(0x0B)-4) = PChar->loc.p.rotation;
			WBUFF(data,(0x0C)-4) = PChar->loc.p.x;
			WBUFF(data,(0x10)-4) = PChar->loc.p.y;
			WBUFF(data,(0x14)-4) = PChar->loc.p.z;
			WBUFW(data,(0x18)-4) = PChar->loc.p.moving;
			WBUFW(data,(0x1A)-4) = PChar->m_TargID << 1;
            WBUFB(data,(0x1C)-4) = PChar->GetSpeed();
			WBUFB(data,(0x1D)-4) = PChar->speedsub;
			WBUFB(data,(0x1E)-4) = PChar->GetHPP();
			WBUFB(data,(0x1F)-4) = PChar->animation;

			WBUFL(data,(0x20)-4) = PChar->nameflags.flags;
			WBUFB(data,(0x21)-4)|= PChar->GetGender() * 128 + (1 << PChar->look.size);

			//if (PChar->StatusEffectContainer->HasStatusEffect(EFFECT_SNEAK))
			//{
			//	WBUFB(data,(0x22)-4) = 0x20;
			//}

			if (PChar->StatusEffectContainer->HasStatusEffectByFlag(EFFECTFLAG_INVISIBLE))
			{
				WBUFB(data,(0x23)-4) = 0x20;
			}

            if (PChar->equip[SLOT_LINK] != 0)
            {
			    CItemLinkshell* linkshell = (CItemLinkshell*)PChar->getStorage(LOC_INVENTORY)->GetItem(PChar->equip[SLOT_LINK]);

			    if ((linkshell != NULL) && linkshell->isType(ITEM_LINKSHELL))
			    {
				    lscolor_t LSColor = linkshell->GetLSColor();

				    WBUFB(data,(0x24)-4) = (LSColor.R << 4) + 15;
				    WBUFB(data,(0x25)-4) = (LSColor.G << 4) + 15;
				    WBUFB(data,(0x26)-4) = (LSColor.B << 4) + 15;
			    }
            }
            WBUFB(data,(0x27)-4) = PChar->m_PVPFlag;
            
            // Mentor flag..
            if (PChar->m_isMentor)
                WBUFB(data, (0x2B) - 4) = 0x01;
            else
                WBUFB(data, (0x2B) - 4) = 0x00;

            // New Player Flag..
            if (PChar->m_isNewPlayer)
                WBUFB(data, (0x2A) - 4) |= 0x80;

            WBUFW(data,(0x30)-4) = PChar->m_Costum;

            WBUFL(data,(0x34)-4) = 0x010CA248; // black chocobo

			if (PChar->PPet != NULL)
			{
				WBUFW(data,(0x3C)-4) = PChar->PPet->targid << 3;
			}

			WBUFB(data,(0x44)-4) = PChar->look.face;
			WBUFB(data,(0x45)-4) = PChar->look.race;
			WBUFW(data,(0x46)-4) = PChar->look.head   + 0x1000;
			WBUFW(data,(0x48)-4) = PChar->look.body   + 0x2000;
			WBUFW(data,(0x4A)-4) = PChar->look.hands  + 0x3000;
			WBUFW(data,(0x4C)-4) = PChar->look.legs   + 0x4000;
			WBUFW(data,(0x4E)-4) = PChar->look.feet   + 0x5000;
			WBUFW(data,(0x50)-4) = PChar->look.main   + 0x6000;
			WBUFW(data,(0x52)-4) = PChar->look.sub    + 0x7000;
			WBUFW(data,(0x54)-4) = PChar->look.ranged + 0x8000;

			memcpy(data+(0x56)-4, PChar->GetName(), PChar->name.size());
		}
		break;
	}
}
Ejemplo n.º 6
0
CEntityUpdatePacket::CEntityUpdatePacket(CBaseEntity* PEntity, ENTITYUPDATE type, uint8 updatemask)
{
	this->type = 0x0E;
	this->size = 0x1C;

	WBUFL(data,(0x04)-4) = PEntity->id;
	WBUFW(data,(0x08)-4) = PEntity->targid;
	WBUFB(data,(0x0A)-4) = updatemask;

	switch(type)
	{
		case ENTITY_DESPAWN:
		{
			WBUFB(data,(0x0A)-4) = 0x20;
            updatemask = UPDATE_ALL_MOB;
		}
		break;
		case ENTITY_SPAWN:
		{
            updatemask = UPDATE_ALL_MOB;
			if (PEntity->objtype == TYPE_PET)
			{
				WBUFB(data,(0x28)-4) = 0x04;
			}
			if (PEntity->look.size == MODEL_EQUIPED || PEntity->look.size == MODEL_CHOCOBO)
			{
				updatemask = 0x57;
			}
            WBUFB(data,(0x0A)-4) = updatemask;
		}
		break;
	}

	if (updatemask & UPDATE_POS){
		WBUFB(data,(0x0B)-4) = PEntity->loc.p.rotation;
		WBUFF(data,(0x0C)-4) = PEntity->loc.p.x;
		WBUFF(data,(0x10)-4) = PEntity->loc.p.y;
		WBUFF(data,(0x14)-4) = PEntity->loc.p.z;
		WBUFW(data,(0x18)-4) = PEntity->loc.p.moving;
		WBUFW(data,(0x1A)-4) = PEntity->m_TargID << 1;
		WBUFB(data,(0x1C)-4) = PEntity->speed;
		WBUFB(data,(0x1D)-4) = PEntity->speedsub;
	}

    if (PEntity->allegiance == ALLEGIANCE_PLAYER && PEntity->status == STATUS_UPDATE)
        WBUFB(data, (0x20) - 4) = STATUS_NORMAL;
    else
        WBUFB(data, (0x20) - 4) = PEntity->status;

	switch(PEntity->objtype)
	{
		case TYPE_NPC:
		{
			if (updatemask & UPDATE_HP)
			{
				WBUFB(data,(0x1E)-4) = 0x64;
                WBUFB(data,(0x1F)-4) = PEntity->animation;
                WBUFB(data,(0x2A)-4) = PEntity->animationsub;
				WBUFL(data,(0x21)-4) = ((CNpcEntity*)PEntity)->unknown;
				WBUFB(data,(0x22)-4) |= (PEntity->untargetable ? 0x08 : 0x00);
				WBUFB(data,(0x22)-4) |= (PEntity->hpvis ? 0x00 : 0x01);
				WBUFB(data,(0x27)-4) = ((CNpcEntity*)PEntity)->name_prefix;     // gender and something else
				WBUFB(data,(0x29)-4) = PEntity->allegiance;
				WBUFB(data,(0x2B)-4) = PEntity->namevis;
			}
		}
		break;
		case TYPE_MOB:
		{
			CMobEntity* PMob = (CMobEntity*)PEntity;

			if(PMob->PMaster != NULL && PMob->PMaster->objtype == TYPE_PC && 
				PMob->PBattleAI->GetCurrentAction() == ACTION_FALL)
			{
                WBUFB(data,(0x21)-4) = 0x99;
                //WBUFB (data,(0x27)-4) = 0x28;
                WBUFB(data,(0x1E)-4) = 0x00; //0% HP
                WBUFB(data,(0x1F)-4) = ANIMATION_DEATH; //death anim
                WBUFB(data,(0x20)-4) = STATUS_NORMAL;
				WBUFB(data,(0x29)-4) = PEntity->allegiance;
				WBUFB(data,(0x2B)-4) = PEntity->namevis;
			}
			else
			{
				if (updatemask & UPDATE_HP)
				{
					WBUFB(data,(0x1E)-4) = PMob->GetHPP();
					WBUFB(data,(0x1F)-4) = PEntity->animation;
                    WBUFB(data,(0x2A)-4) = PEntity->animationsub;
					WBUFL(data,(0x21)-4) = PMob->m_unknown;
					WBUFB(data,(0x21)-4) |= PMob->m_CallForHelp;
					WBUFB(data,(0x22)-4) |= (PEntity->untargetable ? 0x08 : 0x00);
					WBUFB(data,(0x22)-4) |= (PEntity->hpvis ? 0x00 : 0x01);
					WBUFB(data,(0x27)-4) = PMob->m_name_prefix;
					if (PMob->PMaster != NULL && PMob->PMaster->objtype == TYPE_PC)
						WBUFB(data,(0x27)-4) |= 0x08;
                    WBUFB(data,(0x28)-4) |= (PMob->StatusEffectContainer->HasStatusEffect(EFFECT_TERROR) ? 0x10 : 0x00);
					WBUFB(data,(0x29)-4) = PEntity->allegiance;
                    WBUFB(data, (0x2B) - 4) = 0;//PEntity->namevis;
				}
				if (updatemask & UPDATE_STATUS)
				{
                    WBUFL(data, (0x2C) - 4) = PMob->m_OwnerID.id;
				}
			}
			if (updatemask & UPDATE_NAME)
			{
				//depending on size of name, this can be 0x20, 0x22, or 0x24
				this->size = 0x24;
				memcpy(data + (0x34) - 4, PEntity->GetName(), (PEntity->name.size() > 15 ? 15 : PEntity->name.size()));
			}
		}
		break;
		case TYPE_PET:
		{
			if(((CPetEntity*)PEntity)->PBattleAI->GetCurrentAction()==ACTION_FALL){
				WBUFB(data,(0x21)-4) = 0x99;
                WBUFB(data,(0x25)-4) = 0x08;
                WBUFB(data,(0x27)-4) = 0x08 | ((CPetEntity*)PEntity)->m_name_prefix;
				WBUFB(data,(0x29)-4) = PEntity->allegiance;
                WBUFB(data,(0x28)-4) = (((CBattleEntity*)PEntity)->health.hp > 0 ? 0x08 : 0x00);
				WBUFB(data,(0x1E)-4) = 0x00; //0% HP
				WBUFB(data,(0x1F)-4) = ANIMATION_DEATH;
				WBUFB(data,(0x20)-4) = STATUS_NORMAL;
			}
			else{
				if (updatemask & UPDATE_HP)
				{
					WBUFB(data,(0x1E)-4) = ((CPetEntity*)PEntity)->GetHPP();
                    WBUFB(data,(0x1F)-4) = PEntity->animation;
                    WBUFB(data,(0x2A)-4) = PEntity->animationsub;
                    WBUFB(data,(0x28)-4) |= (((CPetEntity*)PEntity)->StatusEffectContainer->HasStatusEffect(EFFECT_TERROR) ? 0x10 : 0x00);
                    WBUFB(data,(0x29)-4) = PEntity->allegiance;
				}
				if (updatemask & UPDATE_STATUS)
				{
					WBUFB(data,(0x27)-4) = 0x08 | ((CPetEntity*)PEntity)->m_name_prefix;
				}
				if (updatemask & UPDATE_NAME)
				{
					this->size = 0x24;
					memcpy(data + (0x34) - 4, PEntity->GetName(), (PEntity->name.size() > 15 ? 15 : PEntity->name.size()));
				}
			}
		}
		break;
	}

	switch(PEntity->look.size)
	{
		case MODEL_STANDARD:
		case MODEL_UNK_5:
		case MODEL_AUTOMATON:
		{
			WBUFL(data,(0x30)-4) = RBUFL(&PEntity->look,0);
		}
		break;
		case MODEL_EQUIPED:
        case MODEL_CHOCOBO:
		{
			this->size = 0x24;

			memcpy(data + (0x30) - 4, &(PEntity->look), 20);
		}
		break;
		case MODEL_DOOR:
		case MODEL_ELEVATOR:
		case MODEL_SHIP:
		{
			this->size = 0x24;

			WBUFW (data,(0x30)-4) = PEntity->look.size;
			memcpy(data+(0x34)-4, PEntity->GetName(),(PEntity->name.size() > 12 ? 12 : PEntity->name.size()));
		}
		break;
	}
}
Ejemplo n.º 7
0
CZoneInPacket::CZoneInPacket(CCharEntity * PChar, int16 csid)
{
    this->type = 0x0A;
    this->size = 0x82;

    // необходимо для работы manaklipper
    // последние 8 байт похожи на время
    //unsigned char packet [] = {
    //0x0D, 0x3A, 0x0C, 0x00, 0x11, 0x00, 0x19, 0x00, 0x02, 0xE4, 0x93, 0x10, 0x91, 0xE5, 0x93, 0x10}; // 0x2a = 0x10
    //0x89, 0x39, 0x0C, 0x00, 0x19, 0x00, 0x07, 0x00, 0x5C, 0xE1, 0x93, 0x10, 0x81, 0xE3, 0x93, 0x10}; // 0x2a = 0x08
    //memcpy(data + 0x70-4, &packet, 16);

    //data[0x2A-4] = 0x08;//data[0x2A-4] = 0x80;  // в зоне 3 управляет путями следования транспорта 0x10 и 0x08

    WBUFL(data,(0x04)-4) = PChar->id;
    WBUFW(data,(0x08)-4) = PChar->targid;

    memcpy(data+(0x84)-4, PChar->GetName(), PChar->name.size());

    WBUFB(data,(0x0B)-4) = PChar->loc.p.rotation;
    WBUFF(data,(0x0C)-4) = PChar->loc.p.x;
    WBUFF(data,(0x10)-4) = PChar->loc.p.y;
    WBUFF(data,(0x14)-4) = PChar->loc.p.z;

    WBUFB(data,(0x1C)-4) = PChar->GetSpeed();
    WBUFB(data,(0x1D)-4) = PChar->speedsub;
    WBUFB(data,(0x1E)-4) = PChar->GetHPP();
    WBUFB(data,(0x1F)-4) = PChar->animation;

    WBUFL(data,(0x38)-4) = CVanaTime::getInstance()->getSysTime();
    WBUFL(data,(0x3C)-4) = CVanaTime::getInstance()->getVanaTime();

    WBUFB(data,(0x44)-4) = PChar->look.face;
    WBUFB(data,(0x45)-4) = PChar->look.race;
    WBUFW(data,(0x46)-4) = PChar->look.head   + 0x1000;
    WBUFW(data,(0x48)-4) = PChar->look.body   + 0x2000;
    WBUFW(data,(0x4A)-4) = PChar->look.hands  + 0x3000;
    WBUFW(data,(0x4C)-4) = PChar->look.legs   + 0x4000;
    WBUFW(data,(0x4E)-4) = PChar->look.feet   + 0x5000;
    WBUFW(data,(0x50)-4) = PChar->look.main   + 0x6000;
    WBUFW(data,(0x52)-4) = PChar->look.sub    + 0x7000;
    WBUFW(data,(0x54)-4) = PChar->look.ranged + 0x8000;

    WBUFB(data,(0x56)-4) = PChar->loc.zone->GetBackgroundMusic();
    WBUFB(data,(0x58)-4) = PChar->loc.zone->GetBackgroundMusic();
    WBUFB(data,(0x5A)-4) = PChar->loc.zone->GetSoloBattleMusic();
    WBUFB(data,(0x5C)-4) = PChar->loc.zone->GetPartyBattleMusic();

    WBUFW(data,(0x60)-4) = PChar->loc.boundary;
    WBUFW(data,(0x68)-4) = PChar->loc.zone->GetWeather();
    WBUFL(data,(0x6A)-4) = PChar->loc.zone->GetWeatherChangeTime();
    //WBUFL(data,(0x6C)-4) = PChar->loc.zone->GetWeather();
    //WBUFL(data,(0x70)-4) = PChar->loc.zone->GetWeatherChangeTime();

    if(csid != -1)
    {
        //WBUFB(data,(0x1F)-4) = 4;								// предположительно animation
        //WBUFB(data,(0x20)-4) = 2;

        WBUFW(data,(0x40)-4) = PChar->getZone();
        WBUFW(data,(0x62)-4) = PChar->getZone();
        WBUFW(data,(0x64)-4) = csid;
    }

    if (PChar->getZone() == 0)
    {
        WBUFB(data,(0x80)-4) = 1;
        WBUFW(data,(0x30)-4) = PChar->loc.prevzone;             // form zone
        WBUFW(data,(0x42)-4) = PChar->loc.prevzone;             // from zone
        WBUFW(data,(0xAA)-4) = GetMogHouseID(PChar);            // Mog House id
        WBUFB(data,(0xAE)-4) = GetMosHouseFlag(PChar);          // Mog House leaving flag
    } else {
        WBUFB(data,(0x80)-4) = 2;
        WBUFW(data,(0x30)-4) = PChar->getZone();                // to zone
        WBUFW(data,(0x42)-4) = PChar->getZone();                // to zone
        WBUFW(data,(0xAA)-4) = 0x01FF;
        WBUFB(data,(0xAC)-4) = csid > 0 ? 0x01 : 0x00;          //if 0x01 then pause between zone
        WBUFB(data,(0xAF)-4) = PChar->loc.zone->CanUseMisc(MISC_MOGMENU);	// флаг, позволяет использовать mog menu за пределами mog house
    }

    WBUFL(data,(0xA0)-4) = 0x00000000;							// время, проведенное персонажем в игре с момента создания

    // current death timestamp is less than an hour ago and the player is dead.
    if (PChar->m_DeathTimestamp > 0 && ((time(NULL)-PChar->m_DeathTimestamp) < (60*60)) && PChar->isDead())
    {
        // 60min starts at 0x03A020 (66 min) and ventures down to 0x5460 (6 min)
        WBUFL(data,(0xA4)-4) = (0x03A020 - (60*(time(NULL) - PChar->m_DeathTimestamp)));
    }

    memcpy(data+(0xCC)-4, &PChar->stats, 14);

    WBUFL(data,(0xE8)-4) = PChar->GetMaxHP();
    WBUFL(data,(0xEB)-4) = PChar->GetMaxMP();

    WBUFB(data,(0x100)-4) = 0x01;
}
Ejemplo n.º 8
0
CEntityUpdatePacket::CEntityUpdatePacket(CBaseEntity* PEntity, ENTITYUPDATE type)
{
	this->type = 0x0E;
	this->size = 0x1C;

	WBUFL(data,(0x04)-4) = PEntity->id;
	WBUFW(data,(0x08)-4) = PEntity->targid;

	switch(type)
	{
		case ENTITY_DESPAWN:
		{
			switch(PEntity->objtype)
			{
				case TYPE_NPC:
				{
					WBUFB(data,(0x0A)-4) = 0x20;
				}
				break;
				case TYPE_MOB:
				{
					WBUFB(data,(0x0A)-4) = 0x07;
					WBUFB(data,(0x20)-4) = 0x07;
				}
				break;
				case TYPE_PET:
				{
					WBUFB(data,(0x0A)-4) = 0x20;
				}
				break;
			}
		}
		break;
		case ENTITY_SPAWN:
		{
			switch(PEntity->objtype)
			{
				case TYPE_PET:
				{
					WBUFB(data,(0x28)-4) = 0x04;
				}
				break;
			}
		}
		case ENTITY_UPDATE:
		{
			WBUFB(data,(0x0B)-4) = PEntity->loc.p.rotation;
			WBUFF(data,(0x0C)-4) = PEntity->loc.p.x;
			WBUFF(data,(0x10)-4) = PEntity->loc.p.y;
			WBUFF(data,(0x14)-4) = PEntity->loc.p.z;
			WBUFW(data,(0x18)-4) = PEntity->loc.p.moving;
			WBUFW(data,(0x1A)-4) = PEntity->m_TargID << 1;
			WBUFB(data,(0x1C)-4) = PEntity->speed;
			WBUFB(data,(0x1D)-4) = PEntity->speedsub;
			WBUFB(data,(0x1F)-4) = PEntity->animation;

			WBUFB(data,(0x20)-4) = PEntity->status;
			WBUFB(data,(0x2A)-4) = PEntity->animationsub;

			WBUFB(data,(0x2B)-4) = PEntity->namevis;

			switch(PEntity->objtype)
			{
				case TYPE_NPC:
				{
					WBUFB(data,(0x1E)-4) = 0x64;
					WBUFL(data,(0x21)-4) = ((CNpcEntity*)PEntity)->unknown;
                    WBUFB(data,(0x27)-4) = ((CNpcEntity*)PEntity)->name_prefix;     // gender and something else
				}
				break;
				case TYPE_MOB:
				{
					CMobEntity* PMob = (CMobEntity*)PEntity;

					if(PMob->PMaster != NULL && PMob->PMaster->objtype == TYPE_PC)
					{
						//charmed mob
						if(PMob->PMaster->objtype = TYPE_PC)
						{
							if(PMob->PBattleAI->GetCurrentAction()==ACTION_FALL)
							{
									WBUFB(data,(0x0A)-4) = 0x07;
									WBUFB (data,(0x21)-4) = 0x99;
									//WBUFB (data,(0x27)-4) = 0x28;
									WBUFW(data,(0x1A)-4) = 0x00;
									WBUFW(data,(0x1B)-4) = 0x00;
									WBUFB (data,(0x1E)-4) = 0x00; //0% HP
									WBUFB (data,(0x1F)-4) = ANIMATION_DEATH; //death anim
									WBUFB (data,(0x20)-4) = STATUS_NORMAL;
							}
							else
							{
									this->size = 0x24;
									WBUFB (data,(0x1E)-4) = PMob->GetHPP();
									WBUFB (data,(0x27)-4) = 0x08;
									memcpy(data+(0x34)-4, PEntity->GetName(),(PEntity->name.size() > 15 ? 15 : PEntity->name.size()));
							}
						}
					}
					else
					{

						WBUFB(data,(0x1E)-4) = PMob->GetHPP();
						WBUFL(data,(0x21)-4) = PMob->m_unknown;
						WBUFB(data,(0x21)-4) |= PMob->m_CallForHelp;
						WBUFB(data,(0x27)-4) = PMob->m_name_prefix;
						WBUFL(data,(0x2C)-4) = PMob->m_OwnerID.id;
						//set bit0 to 1 to make HP bars invisible e.g. Yilgeban, another bit somewhere controls mob targetability
						//WBUFB(data,(0x22)-4) = 0;

						if (PMob->PMaster != NULL && PMob->PMaster->objtype == TYPE_PC)
							WBUFB(data,(0x27)-4) = 0x08; //todo: may need |=
					}
				}
				break;
				case TYPE_PET:
				{
					if(((CPetEntity*)PEntity)->PBattleAI->GetCurrentAction()==ACTION_FALL){
						WBUFB(data,(0x0A)-4) = 0x07;
						WBUFB(data,(0x21)-4) = 0x99;
					  //WBUFB(data,(0x27)-4) = 0x28;
						WBUFW(data,(0x1A)-4) = 0x00;
						WBUFB(data,(0x1E)-4) = 0x00; //0% HP
						WBUFB(data,(0x1F)-4) = ANIMATION_DEATH;
						WBUFB(data,(0x20)-4) = STATUS_NORMAL;
					}
					else{
						this->size = 0x24;
						WBUFB (data,(0x1E)-4) = ((CPetEntity*)PEntity)->GetHPP();
						WBUFB (data,(0x27)-4) = 0x08;
						memcpy(data+(0x34)-4, PEntity->GetName(),(PEntity->name.size() > 15 ? 15 : PEntity->name.size()));
					}
				}
				break;
			}

			switch(PEntity->look.size)
			{
				case MODEL_STANDARD:
				case MODEL_UNK_5:
				case MODEL_UNK_6:
				{
					WBUFB(data,(0x0A)-4) = 0x0F;
					WBUFL(data,(0x30)-4) = RBUFL(&PEntity->look,0);
				}
				break;
				case MODEL_EQUIPED:
                case MODEL_CHOCOBO:
				{
					this->size = 0x24;

					WBUFB (data,(0x0A)-4) = 0x57;
					memcpy(data+(0x30)-4, &(PEntity->look), 20);
				}
				break;
				case MODEL_DOOR:
				case MODEL_ELEVATOR:
				case MODEL_SHIP:
				{
					this->size = 0x24;

					WBUFB (data,(0x0A)-4) = 0x07;
					WBUFW (data,(0x30)-4) = PEntity->look.size;
					memcpy(data+(0x34)-4, PEntity->GetName(),(PEntity->name.size() > 12 ? 12 : PEntity->name.size()));
				}
				break;
			}
		}
		break;
	}
}
Ejemplo n.º 9
0
CZoneInPacket::CZoneInPacket(CCharEntity * PChar, int16 csid) 
{
	this->type = 0x0A;
	this->size = 0x82;

    // необходимо для работы manaklipper
	// последние 8 байт похожи на время
	//unsigned char packet [] = {
	//0x0D, 0x3A, 0x0C, 0x00, 0x11, 0x00, 0x19, 0x00, 0x02, 0xE4, 0x93, 0x10, 0x91, 0xE5, 0x93, 0x10}; // 0x2a = 0x10 
    //0x89, 0x39, 0x0C, 0x00, 0x19, 0x00, 0x07, 0x00, 0x5C, 0xE1, 0x93, 0x10, 0x81, 0xE3, 0x93, 0x10}; // 0x2a = 0x08
	//memcpy(data + 0x70, &packet, 16);

    //data[0x2A] = 0x08;//data[0x2A] = 0x80;  // в зоне 3 управляет путями следования транспорта 0x10 и 0x08

	WBUFL(data,(0x04)) = PChar->id;
	WBUFW(data,(0x08)) = PChar->targid;

	memcpy(data+(0x84), PChar->GetName(), PChar->name.size());   

	WBUFB(data,(0x0B)) = PChar->loc.p.rotation;		
	WBUFF(data,(0x0C)) = PChar->loc.p.x;				
	WBUFF(data,(0x10)) = PChar->loc.p.y;				
	WBUFF(data,(0x14)) = PChar->loc.p.z;

	WBUFB(data,(0x1C)) = PChar->GetSpeed();
	WBUFB(data,(0x1D)) = PChar->speedsub;
	WBUFB(data,(0x1E)) = PChar->GetHPP();
	WBUFB(data,(0x1F)) = PChar->animation;
    WBUFB(data,(0x21)) = PChar->GetGender() * 128 + (1 << PChar->look.size);

    look_t *look = (PChar->getStyleLocked() ? &PChar->mainlook : &PChar->look);
	WBUFB(data,(0x44)) = look->face;
	WBUFB(data,(0x45)) = look->race;
	WBUFW(data,(0x46)) = look->head   + 0x1000;
	WBUFW(data,(0x48)) = look->body   + 0x2000;
	WBUFW(data,(0x4A)) = look->hands  + 0x3000;
	WBUFW(data,(0x4C)) = look->legs   + 0x4000;
	WBUFW(data,(0x4E)) = look->feet   + 0x5000;
	WBUFW(data,(0x50)) = look->main   + 0x6000;
	WBUFW(data,(0x52)) = look->sub    + 0x7000;
	WBUFW(data,(0x54)) = look->ranged + 0x8000;

	if (PChar->m_Monstrosity != 0)
	{
		WBUFW(data, (0x44) ) = PChar->m_Monstrosity;
		WBUFW(data, (0x54) ) = 0xFFFF;
	}

	WBUFB(data,(0x56)) = PChar->loc.zone->GetBackgroundMusicDay();
	WBUFB(data,(0x58)) = PChar->loc.zone->GetBackgroundMusicNight();
	WBUFB(data,(0x5A)) = PChar->loc.zone->GetSoloBattleMusic();
	WBUFB(data,(0x5C)) = PChar->loc.zone->GetPartyBattleMusic();
    WBUFB(data,(0x5E)) = 0xD4; //default chocobo music for all zones

	WBUFW(data,(0x60)) = PChar->loc.boundary;
    WBUFW(data,(0x68)) = PChar->loc.zone->GetWeather();
    WBUFL(data,(0x6A)) = PChar->loc.zone->GetWeatherChangeTime();
  //WBUFL(data,(0x6C)) = PChar->loc.zone->GetWeather();
  //WBUFL(data,(0x70)) = PChar->loc.zone->GetWeatherChangeTime();

	if(csid != -1) 
	{
	  //WBUFB(data,(0x1F)) = 4;								// предположительно animation
	  //WBUFB(data,(0x20)) = 2;

		WBUFW(data,(0x40)) = PChar->getZone();
		WBUFW(data,(0x62)) = PChar->getZone();
		WBUFW(data,(0x64)) = csid;
	}

    WBUFW(data, (0x30) ) = PChar->getZone();
    WBUFW(data, (0x42) ) = PChar->getZone();

	if (PChar->m_moghouseID != 0) 
	{
		WBUFB(data,(0x80)) = 1;
	    WBUFW(data,(0xAA)) = GetMogHouseID(PChar);            // Mog House id
		WBUFB(data,(0xAE)) = GetMosHouseFlag(PChar);          // Mog House leaving flag
	} else {
		WBUFB(data,(0x80)) = 2;
	    WBUFW(data,(0xAA)) = 0x01FF;
        WBUFB(data,(0xAC)) = csid > 0 ? 0x01 : 0x00;          //if 0x01 then pause between zone
		WBUFB(data,(0xAF)) = PChar->loc.zone->CanUseMisc(MISC_MOGMENU);	// флаг, позволяет использовать mog menu за пределами mog house
	}

	WBUFL(data,(0xA0)) = PChar->GetPlayTime();				// время, проведенное персонажем в игре с момента создания

    uint32 pktTime = CVanaTime::getInstance()->getVanaTime();

    WBUFL(data,(0x38)) = pktTime + VTIME_BASEDATE;
    WBUFL(data,(0x3C)) = pktTime;

    // 60min starts at 0x03A020 (66 min) and ventures down to 0x5460 (6 min)
    if (PChar->m_DeathCounter < 3600 && PChar->isDead())
        WBUFL(data,(0xA4)) = 0x03A020 - (60 * PChar->m_DeathCounter);

	memcpy(data+(0xCC), &PChar->stats, 14);

    WBUFL(data,(0xE8)) = PChar->GetMaxHP();
    WBUFL(data,(0xEC)) = PChar->GetMaxMP();

    WBUFB(data, (0x100)) = 0x01;
}
Ejemplo n.º 10
0
CZoneInPacket::CZoneInPacket(CCharEntity * PChar, int16 csid) 
{
	this->type = 0x0A;
	this->size = 0x82;

	WBUFL(data,(0x04)-4) = PChar->id;
	WBUFW(data,(0x08)-4) = PChar->targid;

	memcpy(data+(0x84)-4, PChar->GetName(), PChar->name.size());   

	WBUFB(data,(0x0B)-4) = PChar->loc.p.rotation;		
	WBUFF(data,(0x0C)-4) = PChar->loc.p.x;				
	WBUFF(data,(0x10)-4) = PChar->loc.p.y;				
	WBUFF(data,(0x14)-4) = PChar->loc.p.z;

	WBUFB(data,(0x1C)-4) = PChar->speed * (100 + PChar->getMod(MOD_MOVE)) / 100;
	WBUFB(data,(0x1D)-4) = PChar->speedsub;
	WBUFB(data,(0x1E)-4) = PChar->GetHPP();
	WBUFB(data,(0x1F)-4) = PChar->animation;

	uint32 time  = CVanaTime::getInstance()->getSysTime(); 

	WBUFL(data,(0x38)-4) = time;
	WBUFL(data,(0x3C)-4) = time - 1009810800;

	WBUFB(data,(0x44)-4) = PChar->look.face;
	WBUFB(data,(0x45)-4) = PChar->look.race;
	WBUFW(data,(0x46)-4) = PChar->look.head   + 0x1000;
	WBUFW(data,(0x48)-4) = PChar->look.body   + 0x2000;
	WBUFW(data,(0x4A)-4) = PChar->look.hands  + 0x3000;
	WBUFW(data,(0x4C)-4) = PChar->look.legs   + 0x4000;
	WBUFW(data,(0x4E)-4) = PChar->look.feet   + 0x5000;
	WBUFW(data,(0x50)-4) = PChar->look.main   + 0x6000;
	WBUFW(data,(0x52)-4) = PChar->look.sub    + 0x7000;
	WBUFW(data,(0x54)-4) = PChar->look.ranged + 0x8000;

	WBUFB(data,(0x56)-4) = PChar->loc.zone->GetBackgroundMusic();
	WBUFB(data,(0x58)-4) = PChar->loc.zone->GetBackgroundMusic();
	WBUFB(data,(0x5A)-4) = PChar->loc.zone->GetSoloBattleMusic();
	WBUFB(data,(0x5C)-4) = PChar->loc.zone->GetPartyBattleMusic();

	WBUFW(data,(0x60)-4) = PChar->loc.boundary;

	if(csid != -1) 
	{
	  //WBUFB(data,(0x1F)-4) = 4;								// animation
	  //WBUFB(data,(0x20)-4) = 2;

		WBUFB(data,(0x40)-4) = PChar->getZone();
		WBUFB(data,(0x62)-4) = PChar->getZone();
		WBUFW(data,(0x64)-4) = csid;
	}

	if (PChar->getZone() == 0) 
	{
		WBUFB(data,(0x80)-4) = 1;
		WBUFB(data,(0x30)-4) = PChar->loc.prevzone;				// form zone
		WBUFB(data,(0x42)-4) = PChar->loc.prevzone;				// from zone
	    WBUFW(data,(0xAA)-4) = GetMogHouseID(PChar);			// Mog House id
		WBUFB(data,(0xAE)-4) = PChar->profile.mhflag;			// Mog House leaving flag
	} else {
		WBUFB(data,(0x80)-4) = 2;										
		WBUFB(data,(0x30)-4) = PChar->getZone();				// to zone
		WBUFB(data,(0x42)-4) = PChar->getZone();				// to zone
	    WBUFW(data,(0xAA)-4) = 0x01FF;
	    WBUFB(data,(0xAC)-4) = 0x01;							// сообщаем клиенту, что он должен начать отправлять 0x15-ые пакеты лишь после полной загрузки
		WBUFB(data,(0xAF)-4) = PChar->loc.zone->CanUseMisc(MISC_MOGMENU);	// флаг, позволяет использовать mog menu за пределами mog house
	}

  //WBUFL(data,(0x98)-4) = PChar->clientip;

	WBUFL(data,(0xA0)-4) = 0x00000000;							// время, проведенное персонажем в игре с момента создания
	WBUFL(data,(0xA4)-4) = 0x00000000;							// оставшееся время до возрождения после смерти (формат времени неизвестен)

	memcpy(data+(0xCC)-4, &PChar->stats, 14);

    WBUFL(data,(0xE8)-4) = PChar->GetMaxHP();
    WBUFL(data,(0xEB)-4) = PChar->GetMaxMP();

	WBUFB(data,(0x100)-4) = 0x01;
}