private int waterFlowers(ref Item[] items) { int ctr = 0; foreach (Item i in items.Where(t => getIsWilted(t.ID))) { ctr++; i.Watered = true; } return ctr; }
public void Where_NotEmpty_Filtered() { Option<Item> item = new Item { Data = "Data" }.ToOption(); Option<Item> result = item.Where(x => string.IsNullOrWhiteSpace(x.Data) == false); Assert.True(result.HasValue); }
private int clearWeeds(ref Item[] items) { int ctr = 0; foreach (Item i in items.Where(t => getIsWeed(t.ID))) { ctr++; i.ID = 0x7FFE; i.Flag1 = 0; i.Flag2 = 0; } return ctr; }
public void Add(Item[] add) { add = add.Where(val => val != null).ToArray(); int added = 0; for (int i = 0; i < Inventory.Length; i++) if (Inventory[i] == null) { Inventory[i] = add[added]; SendInfo("Added item " + Inventory[i].ObjectId + ":" + Inventory[i].ObjectType + " to slot " + i); added++; if(added >= add.Length) { break; } } UpdateCount++; return; }