Big project cleanup with overhaul of file responsibilities (KISS) and code (DRY, YAGNI)
This commit is contained in:
@@ -29,12 +29,13 @@ public class ItemData
|
||||
|
||||
public string GetReadableName()
|
||||
{
|
||||
string noUnderscore = Id.Replace("_", " ").ToLower();
|
||||
return char.ToUpper(noUnderscore[0]) + noUnderscore.Substring(1);
|
||||
return GetReadableName(Id);
|
||||
}
|
||||
|
||||
public static string GetReadableName(string input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input)) return "";
|
||||
|
||||
string noUnderscore = input.Replace("_", " ").ToLower();
|
||||
return char.ToUpper(noUnderscore[0]) + noUnderscore.Substring(1);
|
||||
}
|
||||
@@ -46,6 +47,8 @@ public class ItemData
|
||||
|
||||
public string GetCraftingDisplay()
|
||||
{
|
||||
if (Inputs.Count <= 0) return GetReadableName() + ": \r";
|
||||
|
||||
string result = GetReadableName() + ": \r";
|
||||
|
||||
foreach (Ingredient ingredient in Inputs)
|
||||
@@ -53,8 +56,6 @@ public class ItemData
|
||||
result += $"{GetReadableName(ingredient.Item)} ({ingredient.Amount}),\r";
|
||||
}
|
||||
|
||||
if (Inputs.Count <= 0) return result;
|
||||
|
||||
result = result.Remove(result.Length - 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user