• HyperFilter | DoS Protection | DDoS Protection | DoS Mitigation | DDoS Mitigation | AntiDoS | AntiDDoS | Proxy Shielding

TS MOB ATACK SORUNU

Cevap: TS MOB ATACK SORUNU



arkadaşın demek istediği konu game serverdan



void CAISocket::RecvNpcAttack(Packet & pkt)

{

CNpc * pAttacker;

Unit * pTarget;

uint16 sAttackerID, sTargetID;

int16 sDamage;

uint8 bResult = ATTACK_FAIL;



pkt >> sAttackerID >> sTargetID;



pAttacker = g_pMain->GetNpcPtr(sAttackerID);

pTarget = g_pMain->GetUnitPtr(sTargetID);



if (pAttacker == nullptr

|| pAttacker->isPlayer()

|| pTarget == nullptr

|| pTarget -> isBlinking()

|| pAttacker->isDead()

|| pTarget->isDead()

|| TO_USER(pTarget)->isTransformed()

|| (TO_USER(pTarget)->isTransformed() && TO_NPC(pAttacker)->GetDamage(TO_USER(pTarget)) != 1))

return;



bu olayı uygularsanız ts sorurunu haletmiş olursunuz.
 
Cevap: TS MOB ATACK SORUNU



void CAISocket::RecvNpcAttack(Packet & pkt)

{

CNpc * pAttacker;

Unit * pTarget;

uint16 sAttackerID, sTargetID;

int16 sDamage;

uint8 bResult = ATTACK_FAIL;



pkt >> sAttackerID >> sTargetID;



pAttacker = g_pMain->GetNpcPtr(sAttackerID);

pTarget = g_pMain->GetUnitPtr(sTargetID);



if (pAttacker == nullptr

|| pAttacker->isPlayer()

|| pTarget == nullptr

|| pTarget -> isBlinking()

|| pAttacker->isDead()

|| pTarget->isDead()

|| TO_USER(pTarget)->isTransformed()

|| (TO_USER(pTarget)->isTransformed() && TO_NPC(pAttacker)->GetDamage(TO_USER(pTarget)) != 1))

return;



// TODO: Wrap this up into its own virtual method

sDamage = pAttacker->GetDamage(pTarget);

if (sDamage > 0)

{

pTarget->HpChange(-(sDamage), pAttacker);

if (pTarget->isDead())

bResult = ATTACK_TARGET_DEAD;

else

bResult = ATTACK_SUCCESS;



// Every hit takes a little of the defender's armour durability.

if (pTarget->isPlayer())

TO_USER(pTarget)->ItemWoreOut(DEFENCE, sDamage);

}



Packet result(WIZ_ATTACK, uint8(LONG_ATTACK));

result << bResult << sAttackerID << sTargetID;

pAttacker->SendToRegion(&result);

}
 
Geri
Üst