public int GetCapacityForCategory(FishTankCategories category) { return(category switch { FishTankCategories.Swim => this.Data.TankSwimmingCapacity, FishTankCategories.Ground => this.Data.TankGroundCapacity, FishTankCategories.Decoration => this.Data.TankDecorationCapacity, _ => 0 });
public bool HasRoomForThisItem(Item item) { if (!CanBeDeposited(item)) { return(false); } FishTankCategories category = GetCategoryFromItem(item); int capacity = GetCapacityForCategory(category); if (item is Hat) { capacity = 999; } if (capacity < 0) { foreach (Item held_item2 in heldItems) { if (held_item2 != null && held_item2.ParentSheetIndex == item.ParentSheetIndex) { return(false); } } return(true); } int current_count = 0; foreach (Item held_item in heldItems) { if (held_item != null) { if (GetCategoryFromItem(held_item) == category) { current_count++; } if (current_count >= capacity) { return(false); } } } return(true); }
public int GetCapacityForCategory(FishTankCategories category) { int tiles_wide = getTilesWide(); switch (category) { case FishTankCategories.Swim: return(tiles_wide - 1); case FishTankCategories.Ground: return(tiles_wide - 1); case FishTankCategories.Decoration: if (tiles_wide <= 2) { return(1); } return(-1); default: return(0); } }
/********* ** Private methods *********/ /// <summary>The method to call before <see cref="FishTankFurniture.GetCapacityForCategory"/>.</summary> /// <returns>Returns whether to run the original method.</returns> private static bool Before_GetCapacityForCategory(FishTankFurniture __instance, FishTankCategories category, ref int __result) { if (__instance is CustomFishTankFurniture fishTank) { __result = fishTank.GetCapacityForCategory(category); return(false); } return(true); }