Skip to content

Commit

Permalink
Fixed money drops in extended protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
sven-n committed Dec 23, 2024
1 parent 5ea3c73 commit 0039043
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# C2 2F - MoneyDroppedExtended (by server)
# C1 2F - MoneyDroppedExtended (by server)

## Is sent when

Expand All @@ -12,9 +12,9 @@ The client adds the money to the ground.

| Index | Length | Data Type | Value | Description |
|-------|--------|-----------|-------|-------------|
| 0 | 1 | Byte | 0xC2 | [Packet type](PacketTypes.md) |
| 1 | 2 | Short | 12 | Packet header - length of the packet |
| 3 | 1 | Byte | 0x2F | Packet header - packet type identifier |
| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) |
| 1 | 1 | Byte | 12 | Packet header - length of the packet |
| 2 | 1 | Byte | 0x2F | Packet header - packet type identifier |
| 3 | 1 | Boolean | | IsFreshDrop; If this flag is set, the money is added to the map with an animation and sound. Otherwise, it's just added like it was already on the ground before. |
| 4 | 2 | ShortLittleEndian | | Id |
| 6 | 1 | Byte | | PositionX |
Expand Down
2 changes: 1 addition & 1 deletion docs/Packets/ServerToClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
* [C1 2A - ItemDurabilityChanged (by server)](C1-2A-ItemDurabilityChanged_by-server.md)
* [C1 2C - FruitConsumptionResponse (by server)](C1-2C-FruitConsumptionResponse_by-server.md)
* [C1 2D - EffectItemConsumption (by server)](C1-2D-EffectItemConsumption_by-server.md)
* [C2 2F - MoneyDroppedExtended (by server)](C2-2F-MoneyDroppedExtended_by-server.md)
* [C1 2F - MoneyDroppedExtended (by server)](C1-2F-MoneyDroppedExtended_by-server.md)
* [C3 30 - NpcWindowResponse (by server)](C3-30-NpcWindowResponse_by-server.md)
* [C2 31 - StoreItemList (by server)](C2-31-StoreItemList_by-server.md)
* [C1 32 - ItemBought (by server)](C1-32-ItemBought_by-server.md)
Expand Down
6 changes: 3 additions & 3 deletions src/Network/Packets/ServerToClient/ServerToClientPackets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8043,14 +8043,14 @@ private MoneyDroppedExtended(Memory<byte> data, bool initialize)
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (ushort)Math.Min(data.Length, Length);
header.Length = (byte)Math.Min(data.Length, Length);
}
}

/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC2;
public static byte HeaderType => 0xC1;

/// <summary>
/// Gets the operation code of this data packet.
Expand All @@ -8065,7 +8065,7 @@ private MoneyDroppedExtended(Memory<byte> data, bool initialize)
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C2Header Header => new (this._data);
public C1Header Header => new (this._data);

/// <summary>
/// Gets or sets if this flag is set, the money is added to the map with an animation and sound. Otherwise, it's just added like it was already on the ground before.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2929,7 +2929,7 @@
</Fields>
</Packet>
<Packet>
<HeaderType>C2Header</HeaderType>
<HeaderType>C1Header</HeaderType>
<Code>2F</Code>
<Name>MoneyDroppedExtended</Name>
<Length>12</Length>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7858,14 +7858,14 @@ private MoneyDroppedExtendedRef(Span<byte> data, bool initialize)
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (ushort)Math.Min(data.Length, Length);
header.Length = (byte)Math.Min(data.Length, Length);
}
}

/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC2;
public static byte HeaderType => 0xC1;

/// <summary>
/// Gets the operation code of this data packet.
Expand All @@ -7880,7 +7880,7 @@ private MoneyDroppedExtendedRef(Span<byte> data, bool initialize)
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C2HeaderRef Header => new (this._data);
public C1HeaderRef Header => new (this._data);

/// <summary>
/// Gets or sets if this flag is set, the money is added to the map with an animation and sound. Otherwise, it's just added like it was already on the ground before.
Expand Down

0 comments on commit 0039043

Please sign in to comment.