I've improved it so you can see the content..
This script implements a custom bag called `ReagentBelt`, specifically designed for reagents in an Ultima Online server. It only accepts items of the type `BaseReagent` and displays a list of all contained reagents along with their quantities when the player hovers over the bag.
Key Functions and Properties:
1.
Constructors: There are two constructors. The default constructor creates a reagent bag with a maximum of 13 items. An additional constructor allows setting a custom maximum item limit.
2.
OnDragDrop and
OnDragDropInto: These methods prevent non-reagents from being added to the bag. If an unsuitable item is added, the player receives a message indicating that only reagents are allowed.
3.
AddNameProperty: This method adds the reagent list to the bag’s tooltip. All reagent names and quantities are displayed, and if the bag is empty, it shows "This bag is empty."
4.
OnItemAdded and
OnItemRemoved: When an item is added or removed, `
InvalidateProperties()` is called to refresh the tooltip and immediately display the latest contents.
5.
Serialization and Deserialization: These methods save and load the object properties.
6.
GetTotal and UpdateTotal: These set the bag’s weight to be ignored in calculations by setting the weight to zero.