// ---------------------------------------------------------------------------------------------------------------------- void CDarkSpirit::SendAttackMsg(int aIndex, int aTargetIndex, int criticaldamage, int iActionType) { PMSG_PET_ITEM_ATTACK_COMMAND pMsg; if ( criticaldamage != 2 ) { pMsg.PetType = 0; pMsg.SkillType = (criticaldamage)? 0 : 1; pMsg.NumberH = SET_NUMBERH(aIndex); pMsg.NumberL = SET_NUMBERL(aIndex); pMsg.TargetNumberH = SET_NUMBERH(aTargetIndex); pMsg.TargetNumberL = SET_NUMBERL(aTargetIndex); pMsg.h.set((LPBYTE)&pMsg, 0xA8, sizeof(pMsg)); gSendProto.DataSend(aIndex, (UCHAR*)&pMsg, pMsg.h.size); gSendProto.VPMsgSend(&gObj[aIndex], (UCHAR*)&pMsg, pMsg.h.size); if ( iActionType == 1 ) { criticaldamage = 0; if ( (rand()%10) < 3 ) { criticaldamage = TRUE; } } } else { criticaldamage = 0; } gObjAddAttackProcMsgSendDelay(&gObj[aIndex], 51, aTargetIndex, 600, criticaldamage, iActionType); }
void CDarkSpirit::SendAttackMsg(int aIndex, int aTargetIndex, int criticaldamage, int iActionType) { PMSG_PET_ITEM_ATTACK_COMMAND pMsg; if ( criticaldamage != 3 ) { pMsg.PetType = 0; pMsg.SkillType = (criticaldamage)? 0 : 1; pMsg.NumberH = SET_NUMBERH(aIndex); pMsg.NumberL = SET_NUMBERL(aIndex); pMsg.TargetNumberH = SET_NUMBERH(aTargetIndex); pMsg.TargetNumberL = SET_NUMBERL(aTargetIndex); pMsg.h.set((LPBYTE)&pMsg, 0xA8, sizeof(pMsg)); DataSend(aIndex, (UCHAR*)&pMsg, pMsg.h.size); MsgSendV2(&gObj[aIndex], (UCHAR*)&pMsg, pMsg.h.size); if ( iActionType == 1 ) { criticaldamage = 0; LPOBJ lpObj = &gObj[aIndex]; if ( (rand()%100) < (this->m_iCriticalSuccessRate+lpObj->m_MPSkillOpt.MpsDarkSpiritStr2) ) { criticaldamage = 1; } if( (rand()%100) < (this->m_iExcelentSuccessRate+lpObj->m_MPSkillOpt.MpsDarkSpiritStr3) ) { criticaldamage = 2; } } } else { criticaldamage = 0; } gObjAddAttackProcMsgSendDelay(&gObj[aIndex], 51, aTargetIndex, 600, criticaldamage, iActionType); }