Possible fix
I ran a bunch of tests and haven't found any issues so far, with the following changes:
(changes start at Line 41):
```
modded class SlotsIcon
{
override void SetQuantity()
{
if( m_Item && m_CurrQuantity != GetQuantity() )
{
m_CurrQuantity = GetQuantity();
int has_quantity = QuantityConversions.HasItemQuantity( m_Item );
if( has_quantity == QUANTITY_COUNT )
{
string q_text = QuantityConversions.GetItemQuantityText( m_Item , true);
if( q_text == "" )
{
m_QuantityStack.Show( false );
m_QuantityProgress.Show( false );
}
else
{
m_QuantityItem.SetText( q_text );
m_QuantityStack.Show( true );
m_QuantityProgress.Show( false );
}
}
else if( has_quantity == QUANTITY_PROGRESS )
{
//float progress_max = m_QuantityProgress.GetMax(); // <-- Not used anywhere?!
int max = m_Item.ConfigGetInt( "varStackMax" ); // instead of "varQuantityMax"
int count = m_Item.ConfigGetInt( "count" );
float quantity = QuantityConversions.GetItemQuantity( m_Item );
if( count > 0 )
{
max = count;
}
if( max > 0 )
{
if ( m_SlotParent )
{
max = InventorySlots.GetStackMaxForSlotId(m_SlotID);
};
float value = Math.Round( ( quantity / max ) * 100 );
m_QuantityProgress.SetCurrent( value );
}
m_QuantityStack.Show( false );
m_QuantityProgress.Show( true );
}
}
override void SetQuantity()
{
if( m_Item && m_CurrQuantity != GetQuantity() )
{
m_CurrQuantity = GetQuantity();
int has_quantity = QuantityConversions.HasItemQuantity( m_Item );
if( has_quantity == QUANTITY_COUNT )
{
string q_text = QuantityConversions.GetItemQuantityText( m_Item , true);
if( q_text == "" )
{
m_QuantityStack.Show( false );
m_QuantityProgress.Show( false );
}
else
{
m_QuantityItem.SetText( q_text );
m_QuantityStack.Show( true );
m_QuantityProgress.Show( false );
}
}
else if( has_quantity == QUANTITY_PROGRESS )
{
//float progress_max = m_QuantityProgress.GetMax(); // <-- Not used anywhere?!
int max = m_Item.ConfigGetInt( "varStackMax" ); // instead of "varQuantityMax"
int count = m_Item.ConfigGetInt( "count" );
float quantity = QuantityConversions.GetItemQuantity( m_Item );
if( count > 0 )
{
max = count;
}
else
{
if ( m_SlotParent )
{
max = InventorySlots.GetStackMaxForSlotId(m_SlotID);
}
if ( max == 0)
{
max = m_Item.ConfigGetInt( "varQuantityMax" );
};
float value = Math.Round( ( quantity / max ) * 100 );
m_QuantityProgress.SetCurrent( value );
}
m_QuantityStack.Show( false );
m_QuantityProgress.Show( true );
}
}
}
}
```