Implement buyResources function