ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Programacion Skill


Enviado por   •  19 de Julio de 2013  •  1.585 Palabras (7 Páginas)  •  294 Visitas

Página 1 de 7

void CMagicProcess::ExecuteType3(int magicid, int sid, int tid, int data1, int data2, int data3) // Applied when a magical attack, healing, and mana restoration is done.

{

int damage = 0, duration_damage = 0, send_index = 0, result = 1; // Variable initialization. result == 1 : success, 0 : fail

char send_buff[128]; memset( send_buff, NULL, 128);

char strLogData[128]; memset( strLogData, NULL, 128);

BOOL bFlag = FALSE;

CNpc* pMon = NULL;

/*if(!UserRegionCheck(sid,tid,magicid,10,data1,data3))

return;

*/

int casted_member[MAX_USER], party_index = 0 ;

for (int h = 0 ; h < MAX_USER ; h++) {

casted_member[h] = -1;

}

// //TRACE(execute type 3 - 1\n");

_MAGIC_TABLE* pMagic = NULL;

pMagic = m_pMain->m_MagictableArray.GetData( magicid ); // Get main magic table.

if( !pMagic ) return;

_MAGIC_TYPE3* pType = NULL;

pType = m_pMain->m_Magictype3Array.GetData(magicid); // Get magic skill table type 3.

if( !pType ) return;

if (sid >= NPC_BAND) {

bFlag = TRUE;

pMon = m_pMain->m_arNpcArray.GetData(sid);

if( !pMon || pMon->m_NpcState == NPC_DEAD ) return;

/* if(pTUser->m_sDuration[91] + pTUser->m_fStartTime[91] > TimeGet() )

if(magicid == 300139)

return;

*/ }

// //TRACE(execute type 3 - 2\n");

if (tid == -1) { // If the target was the source's party....

for (int i = 0 ; i < MAX_USER ; i++) { // Maximum number of users in the server....

CUser* pTUser = NULL ; // Pointer initialization!

pTUser = (CUser*)m_pMain->m_Iocport.m_SockArray[i]; // Get target info.

// if( !pTUser || pTUser->m_bResHpType == USER_DEAD || pTUser->m_bResHpType == USER_BLINKING) continue ;

if( !pTUser || pTUser->m_bResHpType == USER_DEAD || pTUser->m_bAbnormalType == ABNORMAL_BLINKING) continue ;

// if (UserRegionCheck(sid, i, magicid, pType->bRadius)) {

if (UserRegionCheck(sid, i, magicid, pType->bRadius, data1, data3)) {

casted_member[party_index] = i ;

party_index++ ;

// //TRACE(%d casted \n",i);

}

}

// //TRACE(execute type 3 - 3\n");

if (party_index == 0) { // If none of the members are in the region, return.

/*

SetByte( send_buff, WIZ_MAGIC_PROCESS, send_index );

SetByte( send_buff, MAGIC_FAIL, send_index );

SetDWORD( send_buff, magicid, send_index );

SetShort( send_buff, sid, send_index );

SetShort( send_buff, tid, send_index );

SetShort( send_buff, 0, send_index );

SetShort( send_buff, 0, send_index );

SetShort( send_buff, 0, send_index );

SetShort( send_buff, 0, send_index );

SetShort( send_buff, 0, send_index );

SetShort( send_buff, 0, send_index );

if (!bFlag) {

m_pMain->Send_Region( send_buff, send_index, m_pSrcUser->m_pUserData->m_bZone, m_pSrcUser->m_RegionX, m_pSrcUser->m_RegionZ, NULL, false );

}

else {

m_pMain->Send_Region( send_buff, send_index, pMon->m_sCurZone, pMon->m_sRegion_X, pMon->m_sRegion_Z, NULL, false );

}

return;*/

}

}

else

{ // If the target was another single player.

CUser* pTUser = NULL ; // Pointer initialization!

if (tid < 0 || tid >= MAX_USER) return;

pTUser = (CUser*)m_pMain->m_Iocport.m_SockArray[tid]; // Get target info.

if( !pTUser ) return; // Check if target exists and not already dead.

casted_member[0] = tid ;

party_index = 1 ;

}

for ( int j = 0 ; j < party_index ; j++) { // THIS IS WHERE THE FUN STARTS!!!

CUser* pTUser = NULL ; // Pointer

...

Descargar como (para miembros actualizados)  txt (17.3 Kb)  
Leer 6 páginas más »
Disponible sólo en Clubensayos.com