Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix detecting when got any item on item storage box window #610

Merged
merged 1 commit into from
Mar 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using RSBot.Core.Event;
using RSBot.Core.Objects;

namespace RSBot.Core.Network.Handler.Agent.StorageBox
{
public class StorageBoxTakeItemResponse : IPacketHandler
{
/// <summary>
/// <inheritdoc/>
/// </summary>
public ushort Opcode => 0xB558;

/// <summary>
/// <inheritdoc/>
/// </summary>
public PacketDestination Destination => PacketDestination.Client;

/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="packet"></param>
public void Invoke(Packet packet)
{
var result = packet.ReadBool();
if (!result)
return;

var count = packet.ReadInt();
for (int i = 0; i < count; i++)
{
var item = InventoryItem.FromPacket(packet);
if (item == null)
continue;

Game.Player.Inventory.Add(item);
}

EventManager.FireEvent("OnInventoryUpdate");
}
}
}