mirror of
https://github.com/kwsch/NHSE.git
synced 2026-09-14 14:15:35 -05:00
Add exclusion for one-time DIY indexes
Closes #523 Thanks @Zelfild for identifying the problematic indexes! Skips over these two indexes on give-all, and skips over them when spawning a set of DIY items onto the ground. Added control-key to set all IsNew to false instead of true (when doing GiveAll)
This commit is contained in:
@@ -26,18 +26,20 @@ public class RecipeBook
|
||||
public bool GetIsFavorite(int recipe) => FlagUtil.GetFlag(Data, 3 * BitFlagArraySize, recipe);
|
||||
public void SetIsFavorite(int recipe, bool value = true) => FlagUtil.SetFlag(Data, 3 * BitFlagArraySize, recipe, value);
|
||||
|
||||
public void GiveAll(IReadOnlyDictionary<ushort,ushort> recipes)
|
||||
public void GiveAll(IReadOnlyDictionary<ushort,ushort> recipes, bool isNew = true)
|
||||
{
|
||||
foreach (var entry in recipes)
|
||||
{
|
||||
var index = entry.Key;
|
||||
if (index is RecipeList.BridgeConstructionKit or RecipeList.CampsiteConstructionKit)
|
||||
continue;
|
||||
|
||||
bool alreadyHave = GetIsKnown(index);
|
||||
if (alreadyHave)
|
||||
continue;
|
||||
|
||||
SetIsKnown(index);
|
||||
SetIsNew(index);
|
||||
SetIsNew(index, isNew);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ namespace NHSE.Core
|
||||
{
|
||||
public static class RecipeList
|
||||
{
|
||||
public const int BridgeConstructionKit = 0x1CA;
|
||||
public const int CampsiteConstructionKit = 0x1CD;
|
||||
|
||||
public static readonly IReadOnlyDictionary<ushort, ushort> Recipes = new Dictionary<ushort, ushort>
|
||||
{
|
||||
{0x006, 02596}, // juicy-apple TV
|
||||
|
||||
@@ -44,7 +44,7 @@ private void B_Apply_Click(object sender, EventArgs e)
|
||||
var min = (ushort)NUD_DIYStart.Value;
|
||||
var max = (ushort)NUD_DIYStop.Value;
|
||||
var diy = RecipeList.Recipes
|
||||
.Where(z => min <= z.Key && z.Key <= max)
|
||||
.Where(z => z.Key is not RecipeList.BridgeConstructionKit or RecipeList.CampsiteConstructionKit && min <= z.Key && z.Key <= max)
|
||||
.Select(z => z.Key)
|
||||
.Select(z => new Item(Item.DIYRecipe) {FreeParam = z});
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ private static object GetEntryText(RecipeBook recipeBook, ushort index, string i
|
||||
return $"0x{index:X3} - {known} {item}";
|
||||
}
|
||||
|
||||
private void B_All_Click(object sender, EventArgs e) => DoAll(() => Book.GiveAll(RecipeList.Recipes));
|
||||
private void B_All_Click(object sender, EventArgs e) => DoAll(() => Book.GiveAll(RecipeList.Recipes, ModifierKeys != Keys.Control));
|
||||
private void B_ClearAll_Click(object sender, EventArgs e) => DoAll(Book.ClearAll);
|
||||
private void B_CraftAll_Click(object sender, EventArgs e) => DoAll(Book.CraftAll);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user