本文整理汇总了C++中CNpc::GetID方法的典型用法代码示例。如果您正苦于以下问题:C++ CNpc::GetID方法的具体用法?C++ CNpc::GetID怎么用?C++ CNpc::GetID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNpc
的用法示例。
在下文中一共展示了CNpc::GetID方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitEventMonster
void CAISocket::InitEventMonster(int index)
{
int count = index;
if( count < 0 || count > NPC_BAND ) {
TRACE("### InitEventMonster index Fail = %d ###\n", index);
return;
}
int max_eventmop = count+EVENT_MONSTER;
for( int i=count; i<max_eventmop; i++ ) {
CNpc* pNpc = NULL;
pNpc = new CNpc;
if(pNpc == NULL) return;
pNpc->Initialize();
pNpc->m_sNid = i+NPC_BAND;
//TRACE("InitEventMonster : uid = %d\n", pNpc->m_sNid);
if( !g_pMain->m_arNpcArray.PutData( pNpc->GetID(), pNpc) ) {
TRACE("Npc PutData Fail - %d\n", pNpc->GetID());
delete pNpc;
pNpc = NULL;
}
}
count = g_pMain->m_arNpcArray.GetSize();
TRACE("TotalMonster = %d\n", count);
}
示例2: UpdateQuestMark
void CMiniMapDlg::UpdateQuestMark()
{
m_IconTable.SetPositionHead();
for( CMiniMapIcon* pIcon = m_IconTable.GetData() ; pIcon > 0 ; pIcon = m_IconTable.GetData() )
{
eQUEST_MARK mark = eQM_NONE;
const DWORD dwObjectID = pIcon->GetObjectID();
CObject* pObject = OBJECTMGR->GetObject( dwObjectID );
STATIC_NPCINFO* pStaticNpcInfo = GAMERESRCMNGR->GetStaticNpcInfo( (WORD)dwObjectID );
if( pObject != NULL && pObject->GetObjectKind() == eObjectKind_Npc )
{
CNpc* pNpc = (CNpc*)pObject;
mark = QUESTMGR->GetQuestMarkState( pNpc->GetNpcUniqueIdx(), pNpc->GetID() );
if( GAMEIN->GetBigMapDialog() )
GAMEIN->GetBigMapDialog()->ShowQuestMarkIcon( pNpc, mark );
}
else if( pStaticNpcInfo != NULL )
{
mark = QUESTMGR->GetQuestMarkState( pStaticNpcInfo->wNpcUniqueIdx, 0 );
}
pIcon->ShowQuestMark( mark );
}
}
示例3: RecvGateDestory
void CAISocket::RecvGateDestory(Packet & pkt)
{
uint16 nid, sCurZone, rX, rZ;
bool bGateStatus;
pkt >> nid >> bGateStatus >> sCurZone >> rX >> rZ;
CNpc* pNpc = g_pMain->GetNpcPtr(nid);
if (pNpc == nullptr)
return;
pNpc->m_byGateOpen = bGateStatus;
TRACE("RecvGateDestory - (%d,%s), gate_status=%d\n", pNpc->GetID(), pNpc->GetName().c_str(), pNpc->m_byGateOpen);
}
示例4: RecvGateDestory
void CAISocket::RecvGateDestory(Packet & pkt)
{
uint16 nid, sCurZone, rX, rZ;
uint8 bGateStatus;
pkt >> nid >> bGateStatus >> sCurZone >> rX >> rZ;
CNpc* pNpc = g_pMain->m_arNpcArray.GetData(nid);
if (pNpc == NULL)
return;
pNpc->m_byGateOpen = bGateStatus;
TRACE("RecvGateDestory - (%d,%s), gate_status=%d\n", pNpc->GetID(), pNpc->m_strName, pNpc->m_byGateOpen);
}
示例5: RecvNpcInfo
void CAISocket::RecvNpcInfo(Packet & pkt)
{
std::string strName;
uint8 Mode, byDirection;
uint16 sNid;
pkt.SByte();
pkt >> Mode >> sNid;
CNpc *pNpc = g_pMain->m_arNpcArray.GetData(sNid);
if (pNpc == NULL)
return;
pkt >> pNpc->m_sSid >> pNpc->m_sPid >> pNpc->m_sSize >> pNpc->m_iWeapon_1 >> pNpc->m_iWeapon_2
>> pNpc->m_bZone >> strName >> pNpc->m_bNation >> pNpc->m_bLevel
>> pNpc->m_curx >> pNpc->m_curz >> pNpc->m_cury >> byDirection >> pNpc->m_NpcState
>> pNpc->m_tNpcType >> pNpc->m_iSellingGroup >> pNpc->m_iMaxHP >> pNpc->m_iHP >> pNpc->m_byGateOpen
>> pNpc->m_sTotalHitrate >> pNpc->m_sTotalEvasionrate >> pNpc->m_sTotalAc >> pNpc->m_byObjectType
>> pNpc->m_byTrapNumber;
if (strName.empty() || strName.length() > MAX_NPC_SIZE)
{
pNpc->DecRef();
return;
}
pNpc->m_byDirection = byDirection;
strcpy(pNpc->m_strName, strName.c_str());
if (pNpc->GetMap() == NULL)
return;
pNpc->InsertRegion(pNpc->GetNewRegionX(), pNpc->GetNewRegionZ());
pNpc->SetRegion(pNpc->GetNewRegionX(), pNpc->GetNewRegionZ());
if (pNpc->m_byObjectType == SPECIAL_OBJECT)
{
_OBJECT_EVENT *pEvent = pNpc->GetMap()->GetObjectEvent( pNpc->m_sSid );
if (pEvent != NULL)
pEvent->byLife = 1;
}
if (Mode == 0)
{
TRACE("RecvNpcInfo - dead monster nid=%d, name=%s\n", pNpc->GetID(), pNpc->m_strName);
return;
}
pNpc->SendInOut(INOUT_IN, pNpc->GetX(), pNpc->GetZ(), pNpc->GetY());
}
示例6: RecvNpcInfo
void CAISocket::RecvNpcInfo(Packet & pkt)
{
std::string strName;
uint8 Mode, byDirection;
uint16 sNid;
bool bCreated = false;
pkt.SByte();
pkt >> Mode >> sNid;
CNpc *pNpc = g_pMain->GetNpcPtr(sNid);
if (pNpc == nullptr)
{
pNpc = new CNpc();
pNpc->m_sNid = sNid;
bCreated = true;
}
pkt >> pNpc->m_sSid >> pNpc->m_sPid >> pNpc->m_sSize >> pNpc->m_iWeapon_1 >> pNpc->m_iWeapon_2
>> pNpc->m_bZone >> strName >> pNpc->m_bNation >> pNpc->m_bLevel
>> pNpc->m_curx >> pNpc->m_curz >> pNpc->m_cury >> byDirection
>> pNpc->m_tNpcType >> pNpc->m_iSellingGroup >> pNpc->m_iMaxHP >> pNpc->m_iHP >> pNpc->m_byGateOpen
>> pNpc->m_fTotalHitrate >> pNpc->m_fTotalEvasionrate
>> pNpc->m_sTotalAc >> pNpc->m_sTotalHit
>> pNpc->m_byObjectType
>> pNpc->m_byTrapNumber >> pNpc->m_bMonster
>> pNpc->m_sFireR >> pNpc->m_sColdR >> pNpc->m_sLightningR
>> pNpc->m_sMagicR >> pNpc->m_sDiseaseR >> pNpc->m_sPoisonR;
if (strName.empty() || strName.length() > MAX_NPC_SIZE)
{
pNpc->DecRef();
return;
}
pNpc->m_NpcState = Mode;
pNpc->m_byDirection = byDirection;
pNpc->m_strName = strName;
pNpc->m_pMap = g_pMain->GetZoneByID(pNpc->GetZoneID());
if (pNpc->GetMap() == nullptr)
{
pNpc->DecRef();
return;
}
pNpc->RegisterRegion();
if (pNpc->m_byObjectType == SPECIAL_OBJECT)
{
_OBJECT_EVENT *pEvent = pNpc->GetMap()->GetObjectEvent( pNpc->m_sSid );
if (pEvent != nullptr)
pEvent->byLife = 1;
}
if (bCreated)
g_pMain->m_arNpcArray.PutData(pNpc->GetID(), pNpc);
if (pNpc->m_NpcState == NPC_DEAD)
{
TRACE("RecvNpcInfo - dead monster nid=%d, name=%s\n", pNpc->GetID(), pNpc->GetName().c_str());
return;
}
pNpc->SendInOut(INOUT_IN, pNpc->GetX(), pNpc->GetZ(), pNpc->GetY());
}
示例7: RecvNpcInfoAll
void CAISocket::RecvNpcInfoAll(Packet & pkt)
{
uint8 bCount = pkt.read<uint8>(); // max of 20
pkt.SByte();
for (int i = 0; i < bCount; i++)
{
uint8 bDirection;
std::string strName;
CNpc* pNpc = new CNpc();
pNpc->Initialize();
pkt >> pNpc->m_NpcState >> pNpc->m_sNid >> pNpc->m_sSid >> pNpc->m_sPid >> pNpc->m_sSize >> pNpc->m_iWeapon_1 >> pNpc->m_iWeapon_2
>> pNpc->m_bZone >> strName >> pNpc->m_bNation >> pNpc->m_bLevel
>> pNpc->m_curx >> pNpc->m_curz >> pNpc->m_cury >> bDirection
>> pNpc->m_tNpcType >> pNpc->m_iSellingGroup >> pNpc->m_iMaxHP >> pNpc->m_iHP >> pNpc->m_byGateOpen
>> pNpc->m_fTotalHitrate >> pNpc->m_fTotalEvasionrate
>> pNpc->m_sTotalAc >> pNpc->m_sTotalHit
>> pNpc->m_byObjectType
>> pNpc->m_byTrapNumber >> pNpc->m_bMonster
>> pNpc->m_sFireR >> pNpc->m_sColdR >> pNpc->m_sLightningR
>> pNpc->m_sMagicR >> pNpc->m_sDiseaseR >> pNpc->m_sPoisonR;
if (strName.empty())
strName = "<the spawn with no name>";
if (strName.length() > MAX_NPC_SIZE)
{
pNpc->DecRef();
continue;
}
pNpc->m_pMap = g_pMain->GetZoneByID(pNpc->GetZoneID());
if (pNpc->GetMap() == nullptr)
{
pNpc->DecRef();
continue;
}
//TRACE("Recv --> NpcUserInfo : uid = %d, x=%f, z=%f.. \n", nid, fPosX, fPosZ);
pNpc->m_strName = strName;
pNpc->m_byDirection = bDirection;
pNpc->SetRegion(pNpc->GetNewRegionX(), pNpc->GetNewRegionZ());
if (pNpc->m_byObjectType == SPECIAL_OBJECT)
{
_OBJECT_EVENT* pEvent = pNpc->GetMap()->GetObjectEvent(pNpc->m_sSid);
if (pEvent != nullptr)
pEvent->byLife = 1;
}
// TRACE("Recv --> NpcUserInfoAll : uid=%d, sid=%d, name=%s, x=%f, z=%f. gate=%d, objecttype=%d \n", nid, sPid, szName, fPosX, fPosZ, byGateOpen, byObjectType);
if (!g_pMain->m_arNpcArray.PutData(pNpc->GetID(), pNpc))
{
TRACE("Npc PutData Fail - %d\n", pNpc->GetID());
pNpc->DecRef();
continue;
}
if (pNpc->m_NpcState == NPC_DEAD)
{
TRACE("Recv --> NpcUserInfoAll : nid=%d, sid=%d, name=%s\n", pNpc->GetID(), pNpc->m_sSid, strName.c_str());
continue;
}
pNpc->SendInOut(INOUT_IN, pNpc->GetX(), pNpc->GetZ(), pNpc->GetY());
}
}
示例8: RecvNpcInfo
void CAISocket::RecvNpcInfo(Packet & pkt)
{
std::string strName;
uint8 Mode, byDirection;
uint16 sNid;
pkt.SByte();
pkt >> Mode >> sNid;
CNpc *pNpc = g_pMain->m_arNpcArray.GetData(sNid);
if (pNpc == NULL)
return;
pkt >> pNpc->m_sSid >> pNpc->m_sPid >> pNpc->m_sSize >> pNpc->m_iWeapon_1 >> pNpc->m_iWeapon_2
>> pNpc->m_bZoneID >> strName >> pNpc->m_byGroup >> pNpc->m_byLevel
>> pNpc->m_fCurX >> pNpc->m_fCurZ >> pNpc->m_fCurY >> byDirection >> pNpc->m_NpcState
>> pNpc->m_tNpcType >> pNpc->m_iSellingGroup >> pNpc->m_iMaxHP >> pNpc->m_iHP >> pNpc->m_byGateOpen
>> pNpc->m_sTotalHitrate >> pNpc->m_sTotalEvasionrate >> pNpc->m_sTotalAc >> pNpc->m_byObjectType;
if (strName.empty() || strName.length() > MAX_NPC_SIZE)
{
delete pNpc;
return;
}
pNpc->m_byDirection = byDirection;
strcpy(pNpc->m_strName, strName.c_str());
// Bug? Test?
// pNpc->m_NpcState = NPC_DEAD;
if (pNpc->m_NpcState == NPC_LIVE)
{
char strLog[256];
CTime t = CTime::GetCurrentTime();
sprintf_s(strLog, sizeof(strLog), "## time(%d:%d-%d) npc regen check(%d) : nid=%d, name=%s, x=%d, z=%d, rx=%d, rz=%d ## \r\n", t.GetHour(), t.GetMinute(), t.GetSecond(),
pNpc->m_NpcState, pNpc->GetID(), pNpc->m_strName, (int)pNpc->m_fCurX, (int)pNpc->m_fCurZ, pNpc->GetRegionX(), pNpc->GetRegionZ());
EnterCriticalSection( &g_LogFile_critical );
g_pMain->m_RegionLogFile.Write( strLog, strlen(strLog) );
LeaveCriticalSection( &g_LogFile_critical );
TRACE(strLog);
// to-do: replace with g_pMain->WriteRegionLog(...);
}
if (pNpc->GetMap() == NULL)
return;
pNpc->InsertRegion(pNpc->GetNewRegionX(), pNpc->GetNewRegionZ());
pNpc->SetRegion(pNpc->GetNewRegionX(), pNpc->GetNewRegionZ());
if (pNpc->m_byObjectType == SPECIAL_OBJECT)
{
_OBJECT_EVENT *pEvent = pNpc->GetMap()->GetObjectEvent( pNpc->m_sSid );
if (pEvent != NULL)
pEvent->byLife = 1;
}
if (Mode == 0)
{
TRACE("RecvNpcInfo - dead monster nid=%d, name=%s\n", pNpc->GetID(), pNpc->m_strName);
return;
}
pNpc->SendInOut(INOUT_IN, pNpc->GetX(), pNpc->GetZ(), pNpc->GetY());
}
示例9: RecvNpcInfoAll
void CAISocket::RecvNpcInfoAll(Packet & pkt)
{
uint8 bCount = pkt.read<uint8>(); // max of 20
pkt.SByte();
for (int i = 0; i < bCount; i++)
{
uint8 bType, bDirection;
std::string strName;
CNpc* pNpc = new CNpc();
pNpc->Initialize();
pkt >> bType >> pNpc->m_sNid >> pNpc->m_sSid >> pNpc->m_sPid >> pNpc->m_sSize >> pNpc->m_iWeapon_1 >> pNpc->m_iWeapon_2
>> pNpc->m_bZoneID >> strName >> pNpc->m_byGroup >> pNpc->m_byLevel >> pNpc->m_fCurX >> pNpc->m_fCurZ >> pNpc->m_fCurY
>> bDirection >> pNpc->m_tNpcType >> pNpc->m_iSellingGroup >> pNpc->m_iMaxHP >> pNpc->m_iHP >> pNpc->m_byGateOpen
>> pNpc->m_sTotalHitrate >> pNpc->m_sTotalEvasionrate >> pNpc->m_sTotalAc >> pNpc->m_byObjectType;
if (strName.empty() || strName.length() > MAX_NPC_SIZE)
{
delete pNpc;
continue;
}
//TRACE("Recv --> NpcUserInfo : uid = %d, x=%f, z=%f.. \n", nid, fPosX, fPosZ);
strcpy(pNpc->m_strName, strName.c_str());
pNpc->m_pMap = g_pMain->GetZoneByID(pNpc->GetZoneID());
pNpc->m_NpcState = NPC_LIVE;
pNpc->m_byDirection = bDirection;
pNpc->SetRegion(pNpc->GetNewRegionX(), pNpc->GetNewRegionZ());
if (pNpc->GetMap() == NULL)
{
delete pNpc;
pNpc = NULL;
continue;
}
if (pNpc->m_byObjectType == SPECIAL_OBJECT)
{
_OBJECT_EVENT* pEvent = pNpc->GetMap()->GetObjectEvent(pNpc->m_sSid);
if (pEvent != NULL)
pEvent->byLife = 1;
}
// TRACE("Recv --> NpcUserInfoAll : uid=%d, sid=%d, name=%s, x=%f, z=%f. gate=%d, objecttype=%d \n", nid, sPid, szName, fPosX, fPosZ, byGateOpen, byObjectType);
if (!g_pMain->m_arNpcArray.PutData(pNpc->GetID(), pNpc))
{
TRACE("Npc PutData Fail - %d\n", pNpc->GetID());
delete pNpc;
continue;
}
if (bType == 0)
{
TRACE("Recv --> NpcUserInfoAll : nid=%d, sid=%d, name=%s\n", pNpc->GetID(), pNpc->m_sSid, strName.c_str());
continue;
}
// RegionNpcAdd()
pNpc->SendInOut(INOUT_IN, pNpc->GetX(), pNpc->GetZ(), pNpc->GetY());
}
}
示例10: ExcuteAction
//.........这里部分代码省略.........
}
// 081125 LYW --- CAction : 리미트 던전 입장 게이트 체크.
else if( pNpc->GetNpcJob() == LIMITDUNGEON_ROLE )
{
cMapMoveDialog* const pDlg = GAMEIN->GetMapMoveDlg() ;
if( pDlg )
{
pDlg->SetUseCase(eLimitDungeon) ;
pDlg->SetActive(TRUE) ;
}
break;
}
// 091014 ONS 스위치기능 NPC.
else if( pNpc->GetNpcJob() == DUNGEON_SWITCH_ROLE )
{
MSG_DWORD2 msg;
msg.Category = MP_NPC;
msg.Protocol = MP_NPC_SWITCHNPC_SYN;
msg.dwObjectID = HEROID;
msg.dwData1 = m_ActionTarget.GetTargetID(); //NPC Idx
msg.dwData2 = pNpc->GetNpcUniqueIdx();
NETWORK->Send( &msg, sizeof( msg ) );
break;
}
// 100329 ShinJS --- 던전 입장
else if( DungeonMGR->IsDungeonEntranceNpc( pNpc->GetNpcJob() ) )
{
cMapMoveDialog* const pDlg = GAMEIN->GetMapMoveDlg() ;
if( pDlg )
{
pDlg->SetUseCase(eDungeon, pNpc->GetID()) ;
if( pDlg->GetMapListCount() > 0 )
{
pDlg->SetActive(TRUE) ;
}
else
{
pDlg->SetActive(FALSE) ;
WINDOWMGR->MsgBox( MBI_NOTICE, MBT_OK, CHATMGR->GetChatMsg(2297) );
}
}
break;
}
// 080822 LYW --- CAction : 소환 된 npc인지 확인한다.
NPC_TOTALINFO* pTotalInfo = NULL ;
pTotalInfo = pNpc->GetNpcTotalInfo() ;
if( pTotalInfo )
{
if( NPCRECALLMGR->Check_RecallNpc(pTotalInfo->dwRecallNpcIdx) )
{
pNpc->OnClicked() ;
break;
}
}
// 090227 ShinJS --- 이동NPC인 경우 이동전 준비중인지 확인한다
if( pNpc->IsReadyToMove() )
{
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg( 1907 ), pNpc->GetObjectName() );
break;
}
示例11: SendFishing_Ready
void CFishingManager::SendFishing_Ready(DWORD dwBaitIdx, POSTYPE BaitPos)
{
const EObjectState IsRestMode = OBJECTSTATEMGR->GetObjectState(HERO) ;
if(IsRestMode == eObjectState_FishingResult)
{
OBJECTSTATEMGR->EndObjectState(HERO, eObjectState_FishingResult);
OBJECTSTATEMGR->StartObjectState(HERO, eObjectState_None);
}
else if(IsRestMode != eObjectState_None)
{
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(1524) );
goto FISHING_SENDREADY_ERROR;
}
if(m_bActive)
{
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(1525) );
goto FISHING_SENDREADY_ERROR;
}
CObject* pObject = OBJECTMGR->GetSelectedObject();
if(pObject && pObject->GetObjectKind() == eObjectKind_Npc)
{
CNpc* pNpc = (CNpc*)pObject;
if(pNpc->GetNpcJob() != FISHINGPLACE_ROLE)
{
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(1526) );
goto FISHING_SENDREADY_ERROR;
}
if(HERO->GetWeaponEquipType() != eWeaponType_FishingPole)
{
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(1532) );
goto FISHING_SENDREADY_ERROR;
}
if(pNpc->IsDied())
{
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(1524) );
goto FISHING_SENDREADY_ERROR;
}
if(0==dwBaitIdx)
{
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(1527) );
goto FISHING_SENDREADY_ERROR;
}
// 거리제한
VECTOR3 vHeroPos;
HERO->GetPosition(&vHeroPos) ;
float fDistance = CalcDistanceXZ(&vHeroPos, &pObject->GetBaseMoveInfo()->CurPosition) ;
if(MAX_FISHING_DISTANCE < fDistance)
{
CHATMGR->AddMsg(CTC_SYSMSG, CHATMGR->GetChatMsg(1548)) ;
goto FISHING_SENDREADY_ERROR;
}
// 방향전환
VECTOR3 pos;
pNpc->GetPosition(&pos);
MOVEMGR->SetLookatPos(HERO,&pos,0,gCurTime);
GAMEIN->GetFishingDlg()->SetLastFishingEndTime(0);
MSG_FISHING_READY_SYN msg;
msg.Category = MP_FISHING;
msg.Protocol = MP_FISHING_READY_SYN;
msg.dwObjectID = HEROID;
msg.dwPlaceIdx = pNpc->GetID();
msg.dwPoleItemIdx = HERO->GetWearedItemIdx(eWearedItem_Weapon);
msg.wBaitItemPos = BaitPos;
msg.dwBaitItemIdx = dwBaitIdx;
NETWORK->Send(&msg, sizeof(msg));
return;
}
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(1526) );
goto FISHING_SENDREADY_ERROR;
FISHING_SENDREADY_ERROR:
GAMEIN->GetFishingDlg()->SetPushStartBtn(FALSE);
GAMEIN->GetFishingDlg()->SetLastFishingEndTime(0);
}
示例12: AreaAttackDamage
void CMagicProcess::AreaAttackDamage(int magictype, int rx, int rz, int magicid, int moral, int data1, int data2, int data3, int dexpoint, int righthand_damage)
{
MAP* pMap = m_pSrcUser->GetMap();
if (pMap == nullptr) return;
// 자신의 region에 있는 UserArray을 먼저 검색하여,, 가까운 거리에 유저가 있는지를 판단..
if(rx < 0 || rz < 0 || rx > pMap->GetXRegionMax() || rz > pMap->GetZRegionMax()) {
TRACE("#### CMagicProcess-AreaAttackDamage() Fail : [nid=%d, name=%s], nRX=%d, nRZ=%d #####\n", m_pSrcUser->m_iUserId, m_pSrcUser->m_strUserID, rx, rz);
return;
}
_MAGIC_TYPE3* pType3 = nullptr;
_MAGIC_TYPE4* pType4 = nullptr;
_MAGIC_TABLE* pMagic = nullptr;
int damage = 0, tid = 0, target_damage = 0, attribute = 0;
float fRadius = 0;
pMagic = g_pMain->m_MagictableArray.GetData( magicid ); // Get main magic table.
if( !pMagic ) {
TRACE("#### CMagicProcess-AreaAttackDamage Fail : magic maintable error ,, magicid=%d\n", magicid);
return;
}
if(magictype == 3) {
pType3 = g_pMain->m_Magictype3Array.GetData( magicid ); // Get magic skill table type 3.
if( !pType3 ) {
TRACE("#### CMagicProcess-AreaAttackDamage Fail : magic table3 error ,, magicid=%d\n", magicid);
return;
}
target_damage = pType3->sFirstDamage;
attribute = pType3->bAttribute;
fRadius = (float)pType3->bRadius;
}
else if(magictype == 4) {
pType4 = g_pMain->m_Magictype4Array.GetData( magicid ); // Get magic skill table type 3.
if( !pType4 ) {
TRACE("#### CMagicProcess-AreaAttackDamage Fail : magic table4 error ,, magicid=%d\n", magicid);
return;
}
fRadius = (float)pType4->bRadius;
}
if( fRadius <= 0 ) {
TRACE("#### CMagicProcess-AreaAttackDamage Fail : magicid=%d, radius = %d\n", magicid, fRadius);
return;
}
__Vector3 vStart, vEnd;
CNpc* pNpc = nullptr ; // Pointer initialization!
float fDis = 0.0f;
vStart.Set((float)data1, (float)0, (float)data3);
int count = 0, total_mon = 0, attack_type=0;
int* pNpcIDList = nullptr;
bool bResult = true;
pMap->m_lock.Acquire();
CRegion *pRegion = &pMap->m_ppRegion[rx][rz];
total_mon = pRegion->m_RegionNpcArray.GetSize();
pNpcIDList = new int[total_mon];
foreach_stlmap (itr, pRegion->m_RegionNpcArray)
pNpcIDList[count++] = *itr->second;
pMap->m_lock.Release();
for(int i = 0; i < total_mon; i++)
{
int nid = pNpcIDList[i];
if( nid < NPC_BAND ) continue;
pNpc = g_pMain->m_arNpc.GetData(nid);
if (pNpc == nullptr || pNpc->m_NpcState == NPC_DEAD)
continue;
if( m_pSrcUser->m_bNation == pNpc->m_byGroup ) continue;
vEnd.Set(pNpc->GetX(), pNpc->GetY(), pNpc->GetZ());
fDis = pNpc->GetDistance(vStart, vEnd);
if(fDis > fRadius)
continue;
if (magictype == 3)
{
damage = GetMagicDamage(pNpc->GetID(), target_damage, attribute, dexpoint, righthand_damage);
TRACE("Area magictype3 ,, magicid=%d, damage=%d\n", magicid, damage);
if(damage >= 0) {
bResult = pNpc->SetHMagicDamage(damage);
}
else {
damage = abs(damage);
if(pType3->bAttribute == 3) attack_type = 3; // 기절시키는 마법이라면.....
else attack_type = magicid;
if(pNpc->SetDamage(attack_type, damage, m_pSrcUser->m_iUserId + USER_BAND) == false) {
m_pSrcUser->SendAttackSuccess(pNpc->GetID(), MAGIC_ATTACK_TARGET_DEAD, damage, pNpc->m_iHP);
}
else {
m_pSrcUser->SendAttackSuccess(pNpc->GetID(), ATTACK_SUCCESS, damage, pNpc->m_iHP);
}
}
//.........这里部分代码省略.........