Okay, let me rephrase all of my questions into one: How do MMORPGs define, create, and store items?
However they want. But it would probably be in some kind of a database. In a single player RPG, databases are overkill. In a MMORPG, some kind of database is probably essential, though the item definitions could probably be included in regular files if necessary.
For the Inventory class, you have either
a name or id number as the key in the HashMap. And then the quantity is the value. That's how you store multiple items. Equipped items might be specially stored in the Inventory class or possible stored by the class for the character itself.
The ItemDefinitions class has a different
HashMap that maps the item name or id number to the item's definition. There would generally be another class called ItemDefinition that actually defines one item definition. I had envisioned it as an internal class only used by the ItemDefinitions class, but it might be better to make a public class to avoid checking the HashMap twice when you have to get the item's definition twice.
I was a little vague about that in the previous post.
So, basically, the ItemDefinitions class is like a database storing data about the objects. The Inventory class stores the objects a particular character has. It's like having 2 tables in the same database that are both indexed by the same key. They're completely separate because how many of an item you have and what an item does are two independent concepts.
The ItemDefinition class itself would include the item name (if it wasn't the key for HashMap) and generally what statistics the item modifies when equipped. It could also include the value of the item when sold and/or special effects the item has.
You don't have to do this way. It's just the way that comes to mind. This isn't the sort of thing where the design has to be perfect.