Kiosani

protocol.cpp Golden Archer .90

Jun 13th, 2025
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. void GCRegEventChipRecv(PMSG_REGEVENTCHIP* lpMsg, int aIndex)
  2. {
  3. if ( !EVENCHIP_TYPE_RANGE(lpMsg->Type) )
  4. {
  5. return;
  6. }
  7.  
  8. LPOBJ lpObj = &gObj[aIndex];
  9.  
  10. if ( lpObj->m_IfState.type == 1 )
  11. {
  12. LogAddTD("[EventChip] [%s][%s] Attempted ItemCopy using Trade Window", lpObj->AccountID, lpObj->Name);
  13. return;
  14. }
  15.  
  16. if ( lpObj->m_IfState.type == 7 )
  17. {
  18. LogAddTD("[EventChip] [%s][%s] Attempted ItemCopy using ChaosBox Window", lpObj->AccountID, lpObj->Name);
  19. return;
  20. }
  21.  
  22. if ( lpObj->UseEventServer != FALSE )
  23. {
  24. PMSG_REGEVENTCHIP_RESULT Result;
  25.  
  26. PHeadSetB((LPBYTE)&Result, 0x95, sizeof(Result));
  27. Result.ChipCount = -1;
  28. Result.Type = lpMsg->Type;
  29.  
  30. LogAddTD("[EventChip] [%s][%s] Not Found EventChip (RegEventchip) #1 %d", lpObj->AccountID, lpObj->Name, lpMsg->ChipPos);
  31. DataSend(aIndex, (LPBYTE)&Result, Result.h.size);
  32. return;
  33. }
  34.  
  35. int Pos = lpMsg->ChipPos + INVENTORY_BAG_START;
  36. CItem * sitem = &lpObj->pInventory[Pos];
  37.  
  38. if ( !sitem->IsItem() )
  39. {
  40. PMSG_REGEVENTCHIP_RESULT Result;
  41.  
  42. PHeadSetB((LPBYTE)&Result, 0x95, sizeof(Result));
  43. Result.ChipCount = -1;
  44. Result.Type = lpMsg->Type;
  45.  
  46. LogAddTD("[EventChip] [%s][%s] Not Found EventChip (RegEventchip) #2 %d", lpObj->AccountID, lpObj->Name, lpMsg->ChipPos);
  47. DataSend(aIndex, (LPBYTE)&Result, Result.h.size);
  48. return;
  49. }
  50.  
  51. lpObj->UseEventServer = TRUE;
  52.  
  53. switch ( lpMsg->Type )
  54. {
  55. case 0x00:
  56. if ( sitem->m_Type == ITEMGET(14,21) && sitem->m_Level == 0 )
  57. {
  58. PMSG_REQ_REGISTER_EVENTCHIP pMsg;
  59.  
  60. PHeadSetB((LPBYTE)&pMsg, 0x02, sizeof(pMsg));
  61. pMsg.iINDEX = aIndex;
  62. pMsg.Pos = Pos;
  63. strcpy(pMsg.szUID, lpObj->AccountID);
  64.  
  65. DataSendEventChip((char*)&pMsg, sizeof(pMsg));
  66. }
  67. else
  68. {
  69. PMSG_REGEVENTCHIP_RESULT Result;
  70.  
  71. PHeadSetB((LPBYTE)&Result, 0x95, sizeof(Result));
  72. Result.ChipCount = -1;
  73. Result.Type = 0x00;
  74.  
  75. LogAddTD("[EventChip] [%s][%s] Not Found EventChip (RegEventchip) #3 %d", lpObj->AccountID, lpObj->Name, lpMsg->ChipPos);
  76.  
  77. DataSend(aIndex, (LPBYTE)&Result, Result.h.size);
  78. lpObj->UseEventServer = FALSE;
  79. }
  80. break;
  81. case 0x01:
  82. if ( sitem->m_Type == ITEMGET(14,21) && sitem->m_Level == 1 )
  83. {
  84. PMSG_REQ_REGISTER_STONES pMsg;
  85.  
  86. PHeadSetB((LPBYTE)&pMsg, 0x06, sizeof(pMsg));
  87. pMsg.iINDEX = aIndex;
  88. pMsg.iPosition = Pos;
  89. strcpy(pMsg.szUID, lpObj->AccountID);
  90.  
  91. DataSendEventChip((char*)&pMsg, sizeof(pMsg));
  92.  
  93. LogAddTD("[Stone] [%s][%s] Register Stone (Stone Pos:%d, Serial:%u)", lpObj->AccountID, lpObj->Name, lpMsg->ChipPos, sitem->m_Number);
  94. }
  95. else
  96. {
  97. PMSG_REGEVENTCHIP_RESULT Result;
  98.  
  99. PHeadSetB((LPBYTE)&Result, 0x95, sizeof(Result));
  100. Result.ChipCount = -1;
  101. Result.Type = 0x01;
  102.  
  103. LogAddTD("[Stone] [%s][%s] Not Found EventChip (Stone Pos: %d)", lpObj->AccountID, lpObj->Name, lpMsg->ChipPos);
  104.  
  105. DataSend(aIndex, (LPBYTE)&Result, Result.h.size);
  106. lpObj->UseEventServer = FALSE;
  107. }
  108. break;
  109. default:
  110. lpObj->UseEventServer = FALSE;
  111. break;
  112. }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment