public void HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player == null) { return; } packet.ReadInt(); // X packet.ReadInt(); // Y packet.ReadShort(); // id ushort itemSlot = packet.ReadShort(); byte itemCount = (byte)packet.ReadByte(); byte menuId = (byte)packet.ReadByte(); switch ((eMerchantWindowType)menuId) { case eMerchantWindowType.HousingInsideShop: case eMerchantWindowType.HousingOutsideShop: case eMerchantWindowType.HousingBindstoneHookpoint: case eMerchantWindowType.HousingCraftingHookpoint: case eMerchantWindowType.HousingNPCHookpoint: case eMerchantWindowType.HousingVaultHookpoint: case eMerchantWindowType.HousingDeedMenu: { HouseMgr.BuyHousingItem(client.Player, itemSlot, itemCount, (eMerchantWindowType)menuId); break; } default: { if (client.Player.TargetObject == null) { return; } // Forward the buy process to the merchant if (client.Player.TargetObject is GameMerchant merchant) { // Let merchant choose what happens merchant.OnPlayerBuy(client.Player, itemSlot, itemCount); } else { (client.Player.TargetObject as GameLotMarker)?.OnPlayerBuy(client.Player, itemSlot, itemCount); } break; } } }