Sync dropped items if another player triggers an action on the current level

This commit is contained in:
ephphatha 2022-01-24 23:19:18 +11:00 committed by Anders Jenbo
commit eeb9ac3303
3 changed files with 16 additions and 3 deletions

View file

@ -1614,10 +1614,17 @@ DWORD OnDropItem(const TCmd *pCmd, int pnum)
{
const auto &message = *reinterpret_cast<const TCmdPItem *>(pCmd);
if (gbBufferMsgs == 1)
if (gbBufferMsgs == 1) {
SendPacket(pnum, &message, sizeof(message));
else if (IsPItemValid(message))
DeltaPutItem(message, { message.x, message.y }, Players[pnum].plrlevel);
} else if (IsPItemValid(message)) {
int playerLevel = Players[pnum].plrlevel;
Point position = { message.x, message.y };
if (currlevel == playerLevel && pnum != MyPlayerId) {
SyncDropItem(position, message.wIndx, message.wCI, message.dwSeed, message.bId, message.bDur, message.bMDur, message.bCh, message.bMCh, message.wValue, message.dwBuff, message.wToHit, message.wMaxDam, message.bMinStr, message.bMinMag, message.bMinDex, message.bAC);
}
PutItemRecord(message.dwSeed, message.wCI, message.wIndx);
DeltaPutItem(message, position, playerLevel);
}
return sizeof(message);
}