} // method GetAllBlueprintsCreatedByTradeskillID public static ItemGroupEnum DetermineItemGroupByItemID(long objectID) { string cacheKey = "ItemGroupByItemID_" + objectID; ItemGroupEnum returnObject; if (HttpContext.Current.Cache[cacheKey] == null) { returnObject = ItemGroupEnum.Unknown; } else { returnObject = (ItemGroupEnum)HttpContext.Current.Cache[cacheKey]; } if (returnObject == ItemGroupEnum.Unknown) using (RepopdataEntities myEntities = new RepopdataEntities()) { // There's no easy way to determine the item "group" (recipe book, crafting component, etc.) // This method definitely needs refactoring var recipeResult = RecipeGateway.RecipesGrantedByRecipeBookID(objectID); if (recipeResult.Count > 0) { returnObject = ItemGroupEnum.RecipeBook; AppCaching.AddToCache(cacheKey, returnObject); return returnObject; } var rawMatResult = SpeciesGateway.AllSpeciesInfoForItem(objectID); if (rawMatResult.Count > 0) { returnObject = ItemGroupEnum.RawMaterial; AppCaching.AddToCache(cacheKey, returnObject); return returnObject; } var componentResult = ComponentGateway.ComponentsGetByItemID(objectID); if (componentResult.Count > 0) { returnObject = ItemGroupEnum.CraftingComponent; AppCaching.AddToCache(cacheKey, returnObject); return returnObject; } } // using return returnObject; } // DetermineItemGroupByItemID
} // property IngredientFullName public CraftingRecipeFilter(long recipeID, long filterID, long ingCount, long slot) { parentRecipeID = recipeID; Slot = slot; Count = ingCount; // In this case, the filter is a Crafting Component if (filterID == 0 && ingCount == -1) { List<CraftingRecipeIngredient> ingredients = RecipeGateway.IngredientsGetByRecipeID(parentRecipeID); var ingredient = (from item in ingredients where item.Slot == Slot select item).FirstOrDefault(); if (ingredient == null) { Ingredient = null; } else { Ingredient = ingredient.CraftingComponent; Count = ingredient.Count; _ingredientFullName = Ingredient.Name; return; } // if (ingredient == null) } // if (filterID == 0 && ingCount == -1) // If the ingredient count is 0, then there can't be anything in this slot if (ingCount == 0) { _ingredientFullName = "None"; return; } // Use the actual filter information if (filterID > 0) { Ingredient = new CraftingFilter(filterID); _ingredientFullName = Ingredient.Name; return; } // if (ingredientCount == 0) } // constructor
} // property Agents public CraftingRecipe(long recipeId) { ID = recipeId; Recipe recipeRecord = RecipeGateway.RecipeGetById(ID); if (recipeRecord == null) { Name = "n/a"; Description = "n/a"; Steps = -1; IngredientWeight = -1; AgentWeight = -1; parentSkillID = -1; } else { Name = recipeRecord.displayName; Description = recipeRecord.displayDescription; Steps = recipeRecord.steps; IngredientWeight = recipeRecord.ingredientWeight; AgentWeight = recipeRecord.agentWeight; parentSkillID = recipeRecord.skillID; } } // constructor