- Requirements
- ServUO (tested on p58-wip / ServUO 5.8)
Server running C# 7.3 / .NET 4.x (default ServUO tooling)
For the optional add-on: Feng’s VirtualStorageChest system installed https://www.servuo.dev/archive/virtual-storage-chests-qol-item-count-reduction-system.2593/
Everything is vibe coded using gpt-5.2. Document below is also generated using gpt-5.2
Step A: add one
At the top of the file, in the references/usings area, add:
Step B: replace the
Inside
You will find a line like:
Replace that single line so it calls the provider chain instead of the backpack:
This appears in both:
That’s it. Crafting will now “see” resources from backpack and bank (and any optional providers you plug into the chain).
What the base package does
- Keeps all normal crafting behavior and validations intact.
- Extends the resource lookup/consumption path so crafting checks:
- Backpack
- (Optional) any custom providers you add later
- BankBox (recursive)
What the optional VirtualStorage add-on does
If you also use Feng’s VirtualStorageChest system, you can install the optional module to let crafting pull resources from yourVirtualStorageChests as well.- Uses account tags to persist which chests are “linked” for crafting
(account-wide, shared by all characters on the account).
How to modify (base package)
File to edit in ServUO
Scripts/Services/Craft/Core/CraftItem.cs
Step A: add one using
At the top of the file, in the references/usings area, add:
Code:
using Server.Custom.CraftResourceProviders;
Step B: replace the UseAllRes max-calculation lookup
Inside ConsumeRes(...), search for the UseAllRes block that computes tempAmount from the backpack.You will find a line like:
Code:
int tempAmount = ourPack.GetAmount(types[i]);
Code:
int tempAmount = CraftResourceService.Chain.GetBestGroupAmount(from, types[i], true, CheckHueGrouping);
Step C: replace the grouped-consume calls (twice)
Still insideConsumeRes(...), search for the grouped consume call that looks like:
Code:
ourPack.ConsumeTotalGrouped(types, amounts, true, ResourceValidator, OnResourceConsumed, CheckHueGrouping);
- the
ConsumeType.Allbranch - the
ConsumeType.Halfbranch
Code:
CraftResourceService.Chain.ConsumeTotalGrouped(from, types, amounts, true, ResourceValidator, OnResourceConsumed, CheckHueGrouping);
Git diff (ServUO changes)
Code:
[COLOR=rgb(106, 115, 125)]diff --git a/Scripts/Services/Craft/Core/CraftItem.cs b/Scripts/Services/Craft/Core/CraftItem.cs
index 041055e55..ead9fc5b0 100644
--- a/Scripts/Services/Craft/Core/CraftItem.cs
+++ b/Scripts/Services/Craft/Core/CraftItem.cs[/COLOR]
[COLOR=rgb(0, 92, 197)]@@ -1,4 +1,5 @@[/COLOR]
#region References
[COLOR=rgb(34, 134, 58)]+using Server.Custom.CraftResourceProviders;[/COLOR]
using Server.Commands;
using Server.Engines.Plants;
using Server.Engines.Quests;
[COLOR=rgb(0, 92, 197)]@@ -1002,7 +1003,7 @@[/COLOR] namespace Server.Engines.Craft
// For stackable items that can ben crafted more than one at a time
if (UseAllRes)
{
[COLOR=rgb(179, 29, 40)]- int tempAmount = ourPack.GetAmount(types[i]);[/COLOR]
[COLOR=rgb(34, 134, 58)]+ int tempAmount = CraftResourceService.Chain.GetBestGroupAmount(from, types[i], true, CheckHueGrouping);[/COLOR]
tempAmount /= amounts[i];
if (tempAmount < maxPossible)
[COLOR=rgb(0, 92, 197)]@@ -1136,7 +1137,7 @@[/COLOR] namespace Server.Engines.Craft
}
else
{
[COLOR=rgb(179, 29, 40)]- index = ourPack.ConsumeTotalGrouped(types, amounts, true, ResourceValidator, OnResourceConsumed, CheckHueGrouping);[/COLOR]
[COLOR=rgb(34, 134, 58)]+ index = CraftResourceService.Chain.ConsumeTotalGrouped(from, types, amounts, true, ResourceValidator, OnResourceConsumed, CheckHueGrouping);[/COLOR]
}
resHue = m_ResHue;
[COLOR=rgb(0, 92, 197)]@@ -1168,7 +1169,7 @@[/COLOR] namespace Server.Engines.Craft
}
else
{
[COLOR=rgb(179, 29, 40)]- index = ourPack.ConsumeTotalGrouped(types, amounts, true, ResourceValidator, OnResourceConsumed, CheckHueGrouping);[/COLOR]
[COLOR=rgb(34, 134, 58)]+ index = CraftResourceService.Chain.ConsumeTotalGrouped(from, types, amounts, true, ResourceValidator, OnResourceConsumed, CheckHueGrouping);[/COLOR]
}
resHue = m_ResHue;
Optional VirtualStorage: provider insertion instruction
If you install the optional VirtualStorage module, edit:Scripts/Custom/CraftResourceProviders/CraftResourceProviderBootstrap.cs
Code:
new VirtualStorageChestResourceProvider(new AccountTagVirtualStorageLocator()),