Пример #1
0
void CGameSocket::RecvAttackReq(Packet & pkt)
{
	uint16 sid, tid;
	float rx=0.0f, ry=0.0f, rz=0.0f, fDir = 0.0f, fHitAgi, fAvoidAgi;
	short sDamage, sAC, sItemAC, sAmountLeft, sAmountRight;
	uint8 type, result, bTypeLeft, bTypeRight;

	pkt >> type >> result >> sid >> tid >> sDamage >> sAC >> fHitAgi >> fAvoidAgi
		>> sItemAC >> bTypeLeft >> bTypeRight >> sAmountLeft >> sAmountRight;

	CUser* pUser = g_pMain->GetUserPtr(sid);
	if (pUser == nullptr
		|| pUser->m_bLive == AI_USER_DEAD
		|| pUser->m_sHP <= 0)
		return;

	pUser->m_sHitDamage = sDamage;
	pUser->m_fHitrate = fHitAgi;
	pUser->m_fAvoidrate = fAvoidAgi;
	pUser->m_sAC = sAC;
	pUser->m_sItemAC = sItemAC;
	pUser->m_bMagicTypeLeftHand = bTypeLeft;
	pUser->m_bMagicTypeRightHand = bTypeRight;
	pUser->m_sMagicAmountLeftHand = sAmountLeft;
	pUser->m_sMagicAmountRightHand = sAmountRight;

	pUser->Attack(sid, tid);
}
Пример #2
0
void CGameSocket::RecvAttackReq(Packet & pkt)
{
	uint16 sid, tid;
	uint8 type, result;

	pkt >> type >> result >> sid >> tid;
	CUser* pUser = g_pMain->GetUserPtr(sid);
	if (pUser == nullptr
		|| pUser->isDead())
		return;

	pUser->Attack(sid, tid);
}
Пример #3
0
void CGameSocket::RecvAttackReq(Packet & pkt)
{
	uint16 sid, tid;
	float rx=0.0f, ry=0.0f, rz=0.0f, fDir = 0.0f, fHitAgi, fAvoidAgi;
	short sDamage, sAC, sItemAC, sAmountLeft, sAmountRight;
	BYTE type, result, bTypeLeft, bTypeRight;

	pkt >> type >> result >> sid >> tid >> sDamage >> sAC >> fHitAgi >> fAvoidAgi
		>> sItemAC >> bTypeLeft >> bTypeRight >> sAmountLeft >> sAmountRight;

	CUser* pUser = g_pMain->GetUserPtr(sid);
	if(pUser == NULL) return;

	if(pUser->m_bLive == USER_DEAD || pUser->m_sHP <= 0)
	{
		if(pUser->m_sHP > 0)
		{
			pUser->m_bLive = USER_LIVE;
			TRACE("##### CGameSocket-Attack Fail : User가 Heal된 경우.. [id=%d, %s, bLive=%d, hp=%d] ######\n", pUser->m_iUserId, pUser->m_strUserID, pUser->m_bLive, pUser->m_sHP);
		}		
		else
		{
			TRACE("##### CGameSocket-Attack Fail : UserDead  [id=%d, %s, bLive=%d, hp=%d] ######\n", pUser->m_iUserId, pUser->m_strUserID, pUser->m_bLive, pUser->m_sHP);
			// 죽은 유저이므로 게임서버에 죽은 처리를 한다...
			Send_UserError(sid, tid);
			return;
		}
	}
	pUser->m_sHitDamage = sDamage;
	pUser->m_fHitrate = fHitAgi;
	pUser->m_fAvoidrate = fAvoidAgi;
	pUser->m_sAC = sAC;
	pUser->m_sItemAC = sItemAC;
	pUser->m_bMagicTypeLeftHand = bTypeLeft;
	pUser->m_bMagicTypeRightHand = bTypeRight;
	pUser->m_sMagicAmountLeftHand = sAmountLeft;
	pUser->m_sMagicAmountRightHand = sAmountRight;

	pUser->Attack(sid, tid);
}
Пример #4
0
void CGameSocket::RecvAttackReq(char* pBuf)
{
	int index = 0;
	int sid = -1, tid = -1;
	BYTE type, result;
	char buff[256];
	memset( buff, 0x00, 256 );
	float rx=0.0f, ry=0.0f, rz=0.0f;
	float fDir = 0.0f;
	short sDamage, sAC;
	float fHitAgi, fAvoidAgi;
//
	short sItemAC;
	BYTE   bTypeLeft;
	BYTE   bTypeRight;
	short  sAmountLeft;
	short  sAmountRight;
//

	type = GetByte(pBuf,index);
	result = GetByte(pBuf,index);
	sid = GetShort(pBuf,index);
	tid = GetShort(pBuf,index);
	sDamage = GetShort( pBuf, index );
	sAC = GetShort( pBuf, index );
	fHitAgi = Getfloat( pBuf, index );
	fAvoidAgi = Getfloat( pBuf, index );
//
	sItemAC = GetShort(pBuf, index);
	bTypeLeft = GetByte(pBuf, index);
	bTypeRight = GetByte(pBuf, index);
	sAmountLeft = GetShort(pBuf, index);
	sAmountRight = GetShort(pBuf, index);
//

	//TRACE("RecvAttackReq : [sid=%d, tid=%d, zone_num=%d] \n", sid, tid, m_sSocketID);

	CUser* pUser = NULL;
	pUser = m_pMain->GetUserPtr(sid);
	if(pUser == NULL) return;
	//TRACE("RecvAttackReq 222 :  [id=%d, %s, bLive=%d, zone_num=%d] \n", pUser->m_iUserId, pUser->m_strUserID, pUser->m_bLive, m_sSocketID);

	if(pUser->m_bLive == USER_DEAD || pUser->m_sHP <= 0)
	{
		if(pUser->m_sHP > 0)
		{
			pUser->m_bLive = USER_LIVE;
			TRACE("##### CGameSocket-Attack Fail : User가 Heal된 경우.. [id=%d, %s, bLive=%d, hp=%d] ######\n", pUser->m_iUserId, pUser->m_strUserID, pUser->m_bLive, pUser->m_sHP);
		}		
		else
		{
			TRACE("##### CGameSocket-Attack Fail : UserDead  [id=%d, %s, bLive=%d, hp=%d] ######\n", pUser->m_iUserId, pUser->m_strUserID, pUser->m_bLive, pUser->m_sHP);
			// 죽은 유저이므로 게임서버에 죽은 처리를 한다...
			Send_UserError(sid, tid);
			return;
		}
	}
	pUser->m_sHitDamage = sDamage;
	pUser->m_fHitrate = fHitAgi;
	pUser->m_fAvoidrate = fAvoidAgi;
	pUser->m_sAC = sAC;
//
	pUser->m_sItemAC = sItemAC;
	pUser->m_bMagicTypeLeftHand = bTypeLeft;
	pUser->m_bMagicTypeRightHand = bTypeRight;
	pUser->m_sMagicAmountLeftHand = sAmountLeft;
	pUser->m_sMagicAmountRightHand = sAmountRight;
//

	pUser->Attack(sid, tid);
}