- ServUO Version
- Publish 57
- Ultima Expansion
- Endless Journey
I'm working on the "old" Resource Storage Box system, trying to set them up so that you can add resources not only from your backpack, or by drag and drop, but from a secured container or a pets backpack. The only thing I could think of that might work is from the BOD gumps, using something similar to the Combine from them with the IsChildOf & targeted is Container. But so far I've managed to get non compiles more than anything. On the rare occasions I've gotten it to compile, the add either didn't work at all or crashed my Test server. I was originally going to use a 2nd add resource button for the other containers, but decided a single button would work for it all. I've gotten grumpy trying to do this with my admittedly limited skills & have removed all the changes several times now, so unfortunately, I have no current attempts to show. The section of BOD gump coding I thought might work is as follows. Oh yeah, I'm also not sure which script to put it in at the moment. The BaseResourceStorageBox or the BaseResourceStorageBoxGump.
C#:
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed.Deleted || !m_Deed.IsChildOf(m_From.Backpack))
return;
switch (info.ButtonID)
{
case 2: // Combine
{
m_From.SendGump(new SmallBODGump(m_From, m_Deed));
m_Deed.BeginCombine(m_From);
break;
}
case 3: // points mode
{
BODContext c = BulkOrderSystem.GetContext(m_From);
if (c != null)
{
switch (c.PointsMode)
{
case PointsMode.Enabled: c.PointsMode = PointsMode.Disabled; break;
case PointsMode.Disabled: c.PointsMode = PointsMode.Automatic; break;
case PointsMode.Automatic: c.PointsMode = PointsMode.Enabled; break;
}
}
m_From.SendGump(new SmallBODGump(m_From, m_Deed));
break;
}
case 4: // combine from container
{
m_From.BeginTarget(-1, false, Targeting.TargetFlags.None, (m, targeted) =>
{
if (!m_Deed.Deleted && targeted is Container)
{
List<Item> list = new List<Item>(((Container)targeted).Items);
foreach (Item item in list)
{
m_Deed.EndCombine(m_From, item);
}
}
});
break;
}
}
}