I think I understand how we can get more item info to be saved and retrieved but it's going to take some rewriting of code in MasterStorage, MasterStorageStorageGump, MasterStorageUtils, and possibly in BaseStorage and all of it's child classes. It's a hellova lot a work but I do see a possible solution.
Right now it works like this: When you choose an item type to save in your MasterStorage, it calls the method TryStoreType in MasterStorage, checks to see if the type is an allowed item type, and if it is it will add one to the number of items for that type defined in the dictionary StoredItems and sends the player a MasterStorageStorageGump which gives all item information currently being stored in StoredItems. In that gump you can choose to withdraw an item type and an amount of that type, which calls the method TryExtractType in MasterStorage. In that method, it checks to see if you have stored that amount of that type and then creates instances of that item type in the static method MasterStorageUtils.
The number of items of each type is the value (as a ulong) from StoredItems and you can access it by using code like this:
StoredItems[typeof(BaseInstrument)]
What I propose is a rewriting of the dictionary StoredItems in MasterStorage and define it like this:
private Dictionary<Type, Dictionary< string, ItemInformation>> storedItems;
public Dictionary<Type, Dictionary< string, ItemInformation>> StoredItems { get { return storedItems; } private set { storedItems = value; } }
I'm suggesting that you make StoredItems a dictionary of of dictionaries. Whenever an item type is added to StoredItems, instead of merely adding 1 to the number of stored items of that type, you add a new Dictionary<string, ItemInformation> to StoredItems, where the string is a unique name of the item, and ItemInformation is a custom class that we define to hold extra item information for that item.
We could define a private class ItemInformation inside the class MasterStorage to be something like this:
private class ItemInformation
{
private SlayerName m_Slayer, m_Slayer2;
public SlayerName Slayer { get { return m_Slayer; } set { m_Slayer = value; } }
public SlayerName Slayer2 { get { return m_Slayer2; } set { m_Slayer2 = value; } }
private InstrumentQuality m_Quality;
public InstrumentQuality Quality { get { return m_Quality; } set { m_Quality = value; } }
private Mobile m_Crafter;
public Mobile Crafter { get { return m_Crafter; } set { m_Crafter = value; } }
private int m_UsesRemaining;
public int UsesRemaining { get { return m_UsesRemaining; } set { m_UsesRemaining = value; } }
public ItemInformation(SlayerName[] slayers, InstrumentQuality quality, Mobile crafter, int uses)
{
if (slayers != null)
{
m_Slayer = slayers[0];
m_Slayer2 = slayers[1];
}
else
{
m_Slayer = SlayerName.None;
m_Slayer2 = SlayerName.None;
}
m_Quality = quality;
m_Crafter = crafter;
m_UsesRemaining = uses;
}
public void Serialize(GenericWriter writer)
{
writer.Write(0); // version
writer.Write((int)m_Slayer);
writer.Write((int)m_Slayer2);
writer.Write((int)m_Quality);
writer.Write(m_Crafter);
writer.Write((int)m_UsesRemaining);
}
public void Deserialize(GenericReader reader)
{
int version = reader.ReadInt();
m_Slayer = (SlayerName)reader.ReadInt();
m_Slayer2 = (SlayerName)reader.ReadInt();
m_Quality = (InstrumentQuality)reader.ReadInt();
m_Crafter = reader.ReadMobile();
m_UsesRemaining = reader.ReadInt();
}
}
So, adding a new item to StoredItems could be done like this:
if (StoredItems[typeof(BaseInstrument)] == null)
StoredItems[typeof(BaseInstrument)] = new Dictionary<string,ItemInformation>(); // we need to make sure value StoredItems[type] is not null
// a BaseInstrument instrument = The item we want to add
StoredItems[typeof(BaseInstrument)].Add( instrument.Name, new ItemInformation( new SlayerName[] {instrument.Slayer, instrument.Slayer2}, instrument.Quality, instrument.Crafter, instrument.UsesRemaining ) );
Also, we would have to change the code to serialize/deserialize to serialize the new information added and edit every line where StoredItems is accessed to get item information to display to the player. There might be an easier fix than this but I don't see an option yet.
*edit* Oh, and we may want to save the number of items of that item type in ItemInformation too. Also, if two unique items have the same name then we'll have to come up with another way to differentiate between unique items instead of only the name.