public static ValMap ToMap(StardewValley.Item item) { if (item == null) { return(null); } var result = new ValMap(); result.map[_type] = new ValString(item.GetType().Name); // ToDo: limit the following to ones that really apply for this type. result.map[_name] = new ValString(item.Name); result["displayName"] = new ValString(item.DisplayName); result["stack"] = new ValNumber(item.Stack); result["maxStack"] = new ValNumber(item.maximumStackSize()); result["category"] = new ValString(item.getCategoryName()); result["value"] = new ValNumber(item.salePrice()); result["description"] = new ValString(item.getDescription().Trim()); if (item is StardewValley.Tools.WateringCan can) { result["waterLeft"] = new ValNumber(can.WaterLeft); result["waterMax"] = new ValNumber(can.waterCanMax); } return(result); }
public bool canStackWith(Item other) { if (other == null || (!(other is Object) || !(this is Object)) && (!(other is ColoredObject) || !(this is ColoredObject)) || (this is ColoredObject && other is ColoredObject && !(this as ColoredObject).color.Equals((other as ColoredObject).color) || (this.maximumStackSize() <= 1 || other.maximumStackSize() <= 1 || ((this as Object).ParentSheetIndex != (other as Object).ParentSheetIndex || (this as Object).bigCraftable != (other as Object).bigCraftable))) || (this as Object).quality != (other as Object).quality) { return(false); } return(this.Name.Equals(other.Name)); }
// Token: 0x06000286 RID: 646 RVA: 0x00035CDC File Offset: 0x00033EDC public bool canStackWith(Item other) { return(other != null && ((other is Object && this is Object) || (other is ColoredObject && this is ColoredObject)) && (!(this is ColoredObject) || !(other is ColoredObject) || (this as ColoredObject).color.Equals((other as ColoredObject).color)) && (this.maximumStackSize() > 1 && other.maximumStackSize() > 1 && (this as Object).ParentSheetIndex == (other as Object).ParentSheetIndex && (this as Object).bigCraftable == (other as Object).bigCraftable && (this as Object).quality == (other as Object).quality) && this.Name.Equals(other.Name)); }