muffin v7.38.4
This commit is contained in:
parent
bbc394c386
commit
7177a5440c
8 changed files with 5330 additions and 4542 deletions
|
|
@ -30,16 +30,16 @@ internal static class Craft
|
|||
return new global::_003C_003Ez__ReadOnlyArray<ITask>(new ITask[2]
|
||||
{
|
||||
new Questionable.Controller.Steps.Common.Mount.UnmountTask(),
|
||||
new CraftTask(step.ItemId.Value, step.ItemCount.Value)
|
||||
new CraftTask(step.ItemId.Value, step.ItemCount.Value, step.RequireHq == true)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed record CraftTask(uint ItemId, int ItemCount) : ITask
|
||||
internal sealed record CraftTask(uint ItemId, int ItemCount, bool RequireHq) : ITask
|
||||
{
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Craft {ItemCount}x {ItemId} (with Artisan)";
|
||||
return $"Craft {ItemCount}x {ItemId}{(RequireHq ? " (HQ)" : "")} (with Artisan)";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ internal static class Craft
|
|||
{
|
||||
if (HasRequestedItems())
|
||||
{
|
||||
logger.LogInformation("Already own {ItemCount}x {ItemId}", base.Task.ItemCount, base.Task.ItemId);
|
||||
logger.LogInformation("Already own {ItemCount}x {ItemId}{HqSuffix}", base.Task.ItemCount, base.Task.ItemId, base.Task.RequireHq ? " (HQ)" : "");
|
||||
return false;
|
||||
}
|
||||
RecipeLookup? rowOrDefault = dataManager.GetExcelSheet<RecipeLookup>().GetRowOrDefault(base.Task.ItemId);
|
||||
|
|
@ -88,7 +88,7 @@ internal static class Craft
|
|||
throw new TaskException($"Unable to determine recipe for item {base.Task.ItemId}");
|
||||
}
|
||||
int num2 = base.Task.ItemCount - GetOwnedItemCount();
|
||||
logger.LogInformation("Starting craft for item {ItemId} with recipe {RecipeId} for {RemainingItemCount} items", base.Task.ItemId, num, num2);
|
||||
logger.LogInformation("Starting craft for item {ItemId} with recipe {RecipeId} for {RemainingItemCount} items{HqSuffix}", base.Task.ItemId, num, num2, base.Task.RequireHq ? " (HQ required)" : "");
|
||||
if (!artisanIpc.CraftItem((ushort)num, num2))
|
||||
{
|
||||
throw new TaskException($"Failed to start Artisan craft for recipe {num}");
|
||||
|
|
@ -128,7 +128,16 @@ internal static class Craft
|
|||
private unsafe int GetOwnedItemCount()
|
||||
{
|
||||
InventoryManager* ptr = InventoryManager.Instance();
|
||||
return ptr->GetInventoryItemCount(base.Task.ItemId, isHq: false, checkEquipped: false, checkArmory: true, 0) + ptr->GetInventoryItemCount(base.Task.ItemId, isHq: true, checkEquipped: false, checkArmory: true, 0);
|
||||
if (base.Task.RequireHq)
|
||||
{
|
||||
int inventoryItemCount = ptr->GetInventoryItemCount(base.Task.ItemId, isHq: true, checkEquipped: false, checkArmory: true, 0);
|
||||
logger.LogTrace("HQ item count for {ItemId}: {Count}", base.Task.ItemId, inventoryItemCount);
|
||||
return inventoryItemCount;
|
||||
}
|
||||
int inventoryItemCount2 = ptr->GetInventoryItemCount(base.Task.ItemId, isHq: false, checkEquipped: false, checkArmory: true, 0);
|
||||
int inventoryItemCount3 = ptr->GetInventoryItemCount(base.Task.ItemId, isHq: true, checkEquipped: false, checkArmory: true, 0);
|
||||
logger.LogTrace("Total item count for {ItemId}: {NqCount} NQ + {HqCount} HQ = {Total}", base.Task.ItemId, inventoryItemCount2, inventoryItemCount3, inventoryItemCount2 + inventoryItemCount3);
|
||||
return inventoryItemCount2 + inventoryItemCount3;
|
||||
}
|
||||
|
||||
public override bool ShouldInterruptOnDamage()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue