/// <summary> /// Returns the amount of a cargo the settlement wants to buy /// </summary> /// <param name="id">The id of the cargo</param> /// <returns>The quatity of cargo to buy</returns> public int GetWantQuantity(Cargoes id) { Ware ware = GetBuyWare(id); if (ware == null) { return(0); } return(ware.count); }
/// <summary> /// Returns the price the warehouse buys a cargo for /// </summary> /// <param name="id">Id of the cargo to buy</param> /// <param name="count">Optional cargo count</param> /// <returns>The buying price</returns> public int GetBuyPrice(Cargoes id, int count = 1) { Ware ware = GetBuyWare(id); if (ware == null) { return(0); } int basePrice = Mathf.RoundToInt(ware.priceMod * CargoManager.GetCargo(id).price); return(basePrice * count); }
/// <summary> /// Modify the quantity of a ware being bought /// </summary> /// <param name="id">The id of the ware</param> /// <param name="amount">The amount to change, positive or negative</param> public void ModifyBuyingWare(Cargoes id, int amount) { Ware ware = GetBuyWare(id); if (ware != null) { ware.count += amount; if (ware.count < 0) { ware.count = 0; } } }