feat: port native AVA2 chest preview and CG235 pickup flows
This commit is contained in:
@@ -959,3 +959,42 @@ bool CPythonNetworkStream::RecvDragonSoulRefine()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// PORT: AVA2 GC 66 chest catalogue. CheckPacket buffers the complete DWORD-length frame.
|
||||
#include "../GameLib/ItemManager.h"
|
||||
bool CPythonNetworkStream::RecvChestDrop() {
|
||||
TPacketGCChestDrop p; DWORD chest=0,count=0;
|
||||
if(!Recv(sizeof(p),&p) || !Recv(4,&chest) || !Recv(4,&count)) return false;
|
||||
if(count>8190 || p.size!=sizeof(p)+8+count*8) return false;
|
||||
CItemManager::TChestDropItemInfoVec drops;
|
||||
for(DWORD i=0;i<count;++i) {
|
||||
CItemManager::SDropItemInfo row;
|
||||
if(!Recv(4,&row.dwDropVnum) || !Recv(4,&row.iCount)) return false;
|
||||
drops.push_back(row);
|
||||
}
|
||||
CItemManager::Instance().LoadChestDropFromServer(chest,drops);
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME],"OpenChestDrop",Py_BuildValue("(i)",chest));
|
||||
return true;
|
||||
}
|
||||
|
||||
// PORT: AVA2 CG235 batch pickup.
|
||||
bool CPythonNetworkStream::SendItemsPickUpPacket(std::vector<DWORD> itemVector)
|
||||
{
|
||||
if (itemVector.size()>4096) return false;
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
TPacketCGItemsPickUp itemsPickUpPacket;
|
||||
itemsPickUpPacket.header = HEADER_CG_ITEMS_PICKUP;
|
||||
itemsPickUpPacket.count = itemVector.size();
|
||||
if (!Send(sizeof(itemsPickUpPacket), &itemsPickUpPacket))
|
||||
return false;
|
||||
|
||||
for (size_t i = 0; i < itemVector.size(); i++){
|
||||
DWORD vid = itemVector[i];
|
||||
if (!Send(sizeof(vid), &vid))
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user