public ShipFitting Add(string fitting) { var shipFitting = new ShipFitting(fitting, this.Settings.DefaultAmmoAmount, this.Settings.DefaultCapChargesAmount); if (!shipFitting.HasError) this.Add(shipFitting); return shipFitting; }
public ShipFitting Clone() { var newFitting = new ShipFitting { Id = Guid.NewGuid(), Name = this.Name, Fitting = this.Fitting, Items = this.Items }; return newFitting; }
public void AddShipFitItems(ShipFitting shipFitting) { foreach (var item in shipFitting.Items) { if (items.ContainsKey(item.Name)) { var existingItem = this.items[item.Name]; existingItem.Add(item.Quantity); } else { // Make a new item to prevent deep references. items.Add(item.Name, new Item(item)); } } this.UpdateLists(); }
public void Add(ShipFitting shipFitting) { this.shipFittings.Add(shipFitting.Id, shipFitting); this.AddShipFitItems(shipFitting); }
public void Remove(ShipFitting shipFitting) { this.shipFittings.Remove(shipFitting.Id); foreach (var item in shipFitting.Items) { var existingItem = this.items[item.Name]; var isEmpty = existingItem.Subtract(item.Quantity); if (isEmpty) this.items.Remove(item.Name); } this.UpdateLists(); }