Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void GCRegEventChipRecv(PMSG_REGEVENTCHIP* lpMsg, int aIndex)
- {
- if ( !EVENCHIP_TYPE_RANGE(lpMsg->Type) )
- {
- return;
- }
- LPOBJ lpObj = &gObj[aIndex];
- if ( lpObj->m_IfState.type == 1 )
- {
- LogAddTD("[EventChip] [%s][%s] Attempted ItemCopy using Trade Window", lpObj->AccountID, lpObj->Name);
- return;
- }
- if ( lpObj->m_IfState.type == 7 )
- {
- LogAddTD("[EventChip] [%s][%s] Attempted ItemCopy using ChaosBox Window", lpObj->AccountID, lpObj->Name);
- return;
- }
- if ( lpObj->UseEventServer != FALSE )
- {
- PMSG_REGEVENTCHIP_RESULT Result;
- PHeadSetB((LPBYTE)&Result, 0x95, sizeof(Result));
- Result.ChipCount = -1;
- Result.Type = lpMsg->Type;
- LogAddTD("[EventChip] [%s][%s] Not Found EventChip (RegEventchip) #1 %d", lpObj->AccountID, lpObj->Name, lpMsg->ChipPos);
- DataSend(aIndex, (LPBYTE)&Result, Result.h.size);
- return;
- }
- int Pos = lpMsg->ChipPos + INVENTORY_BAG_START;
- CItem * sitem = &lpObj->pInventory[Pos];
- if ( !sitem->IsItem() )
- {
- PMSG_REGEVENTCHIP_RESULT Result;
- PHeadSetB((LPBYTE)&Result, 0x95, sizeof(Result));
- Result.ChipCount = -1;
- Result.Type = lpMsg->Type;
- LogAddTD("[EventChip] [%s][%s] Not Found EventChip (RegEventchip) #2 %d", lpObj->AccountID, lpObj->Name, lpMsg->ChipPos);
- DataSend(aIndex, (LPBYTE)&Result, Result.h.size);
- return;
- }
- lpObj->UseEventServer = TRUE;
- switch ( lpMsg->Type )
- {
- case 0x00:
- if ( sitem->m_Type == ITEMGET(14,21) && sitem->m_Level == 0 )
- {
- PMSG_REQ_REGISTER_EVENTCHIP pMsg;
- PHeadSetB((LPBYTE)&pMsg, 0x02, sizeof(pMsg));
- pMsg.iINDEX = aIndex;
- pMsg.Pos = Pos;
- strcpy(pMsg.szUID, lpObj->AccountID);
- DataSendEventChip((char*)&pMsg, sizeof(pMsg));
- }
- else
- {
- PMSG_REGEVENTCHIP_RESULT Result;
- PHeadSetB((LPBYTE)&Result, 0x95, sizeof(Result));
- Result.ChipCount = -1;
- Result.Type = 0x00;
- LogAddTD("[EventChip] [%s][%s] Not Found EventChip (RegEventchip) #3 %d", lpObj->AccountID, lpObj->Name, lpMsg->ChipPos);
- DataSend(aIndex, (LPBYTE)&Result, Result.h.size);
- lpObj->UseEventServer = FALSE;
- }
- break;
- case 0x01:
- if ( sitem->m_Type == ITEMGET(14,21) && sitem->m_Level == 1 )
- {
- PMSG_REQ_REGISTER_STONES pMsg;
- PHeadSetB((LPBYTE)&pMsg, 0x06, sizeof(pMsg));
- pMsg.iINDEX = aIndex;
- pMsg.iPosition = Pos;
- strcpy(pMsg.szUID, lpObj->AccountID);
- DataSendEventChip((char*)&pMsg, sizeof(pMsg));
- LogAddTD("[Stone] [%s][%s] Register Stone (Stone Pos:%d, Serial:%u)", lpObj->AccountID, lpObj->Name, lpMsg->ChipPos, sitem->m_Number);
- }
- else
- {
- PMSG_REGEVENTCHIP_RESULT Result;
- PHeadSetB((LPBYTE)&Result, 0x95, sizeof(Result));
- Result.ChipCount = -1;
- Result.Type = 0x01;
- LogAddTD("[Stone] [%s][%s] Not Found EventChip (Stone Pos: %d)", lpObj->AccountID, lpObj->Name, lpMsg->ChipPos);
- DataSend(aIndex, (LPBYTE)&Result, Result.h.size);
- lpObj->UseEventServer = FALSE;
- }
- break;
- default:
- lpObj->UseEventServer = FALSE;
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment