Fixing the ~1_AMT~ bug within the crafting gump
I don't need help with this anymore, heres how I fixed it (2.0 RC1).
Open up CraftGump.cs
Find this:
Replace it with this:
Now find this:
And replace with this:
Some credit for this fix goes to Kamron @ Casiopia.
I don't need help with this anymore, heres how I fixed it (2.0 RC1).
Open up CraftGump.cs
Find this:
Code:
// If the system has more than one resource
if ( craftSystem.CraftSubRes.Init )
{
string nameString = craftSystem.CraftSubRes.NameString;
int nameNumber = craftSystem.CraftSubRes.NameNumber;
int resIndex = ( context == null ? -1 : context.LastResourceIndex );
if ( resIndex > -1 )
{
CraftSubRes subResource = craftSystem.CraftSubRes.GetAt( resIndex );
nameString = subResource.NameString;
nameNumber = subResource.NameNumber;
}
AddButton( 15, 362, 4005, 4007, GetButtonID( 6, 0 ), GumpButtonType.Reply, 0 );
if ( nameNumber > 0 )
AddHtmlLocalized( 50, 365, 250, 18, nameNumber, LabelColor, false, false );
else
AddLabel( 50, 362, LabelHue, nameString );
}
// ****************************************
Replace it with this:
Code:
// If the system has more than one resource
if ( craftSystem.CraftSubRes.Init )
{
string nameString = craftSystem.CraftSubRes.NameString;
int nameNumber = craftSystem.CraftSubRes.NameNumber;
int resIndex = ( context == null ? -1 : context.LastResourceIndex );
if ( resIndex > -1 )
{
CraftSubRes subResource = craftSystem.CraftSubRes.GetAt( resIndex );
nameString = subResource.NameString;
nameNumber = subResource.NameNumber;
}
Type resourceType = ( resIndex > -1 ? craftSystem.CraftSubRes.GetAt( resIndex ).ItemType : craftSystem.CraftSubRes.ResType );
int resourceCount = 0;
if ( m_From.Backpack != null )
{
Item[] items = m_From.Backpack.FindItemsByType( resourceType, true );
for ( int j = 0; j < items.Length; ++j )
resourceCount += items[j].Amount;
}
AddButton( 15, 362, 4005, 4007, GetButtonID( 6, 0 ), GumpButtonType.Reply, 0 );
if ( nameNumber > 0 )
AddHtmlLocalized( 50, 365, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false );
else
AddLabel( 50, 362, LabelHue, String.Format( "{0} ({1})", nameString, resourceCount.ToString() ) );
}
// ****************************************
Now find this:
Code:
public void CreateResList( bool opt )
{
CraftSubResCol res = ( opt ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes );
for ( int i = 0; i < res.Count; ++i )
{
int index = i % 10;
CraftSubRes subResource = res.GetAt( i );
if ( index == 0 )
{
if ( i > 0 )
AddButton( 485, 260, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1 );
AddPage( (i / 10) + 1 );
if ( i > 0 )
AddButton( 455, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10 );
CraftContext context = m_CraftSystem.GetContext( m_From );
AddButton( 220, 260, 4005, 4007, GetButtonID( 6, 4 ), GumpButtonType.Reply, 0 );
AddHtmlLocalized( 255, 263, 200, 18, (context == null || !context.DoNotColor) ? 1061591 : 1061590, LabelColor, false, false );
}
AddButton( 220, 60 + (index * 20), 4005, 4007, GetButtonID( 5, i ), GumpButtonType.Reply, 0 );
if ( subResource.NameNumber > 0 )
AddHtmlLocalized( 255, 63 + (index * 20), 250, 18, subResource.NameNumber, LabelColor, false, false );
else
AddLabel( 255, 60 + (index * 20), LabelHue, subResource.NameString );
}
}
And replace with this:
Code:
public void CreateResList( bool opt )
{
CraftSubResCol res = ( opt ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes );
CraftContext context = m_CraftSystem.GetContext( m_From );
for ( int i = 0; i < res.Count; ++i )
{
int index = i % 10;
CraftSubRes subResource = res.GetAt( i );
if ( index == 0 )
{
if ( i > 0 )
AddButton( 485, 260, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1 );
AddPage( (i / 10) + 1 );
if ( i > 0 )
AddButton( 455, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10 );
//CraftContext context = m_CraftSystem.GetContext( m_From );
AddButton( 220, 260, 4005, 4007, GetButtonID( 6, 4 ), GumpButtonType.Reply, 0 );
AddHtmlLocalized( 255, 263, 200, 18, (context == null || !context.DoNotColor) ? 1061591 : 1061590, LabelColor, false, false );
}
Type resourceType = subResource.ItemType;
int resourceCount = 0;
if ( m_From.Backpack != null )
{
Item[] items = m_From.Backpack.FindItemsByType( resourceType, true );
for ( int j = 0; j < items.Length; ++j )
resourceCount += items[j].Amount;
}
AddButton( 220, 60 + (index * 20), 4005, 4007, GetButtonID( 5, i ), GumpButtonType.Reply, 0 );
if ( subResource.NameNumber > 0 )
AddHtmlLocalized( 255, 63 + (index * 20), 250, 18, subResource.NameNumber, resourceCount.ToString(), LabelColor, false, false );
else
AddLabel( 255, 60 + (index * 20), LabelHue, String.Format( "{0} ({1})", subResource.NameString, resourceCount.ToString() ) );
}
}
Some credit for this fix goes to Kamron @ Casiopia.