At the moment I'm looking at storing all item data in that list as Item[xxxx] rather than itemname for Items
Please don't make the file completely illegible to humans by replacing unambiguous item names with id. If you want to add that syntax, please make it an additional syntax, not something that you impose on "ALL item data" (emphasis mine). If you want to tag all items, then either prefix the name with Item: or allow Item[name] - I don't care - but please allow us to still see the name for the vast majority of items whose names are unique within that namespace.
This all does feel a little like opening Pandora's box, but I think that is worthwhile here.
It's a huge change which needs planning and design rather than incremental bandaids. (which is not to say that I have not inserted incremental bandaids, myself: for example, the namespace used to be "canonical" names - lowercased, mostly - and when I noticed that we had items & effects with the same name save for capitalization, I changed that.)
As you said, there is a single namespace for modifiers - items, effects, passive skills, what have you. We do have "prefixes" on some of the names - Fam:, Throne:, Loc:, Zone:, etc.
Seems like we could start by doing a couple of things:
- tagging every name, adding Item:, Effect:, Campground:, Skill:, for example. Internally, we might give each of those categories a separate map from NAME -> MODIFIERS, for example, rather than a single namespace.
- for any category which has a natural "id" space, we allow a different syntax: Item:1234 would be item with id 1234. That item has a name, of course - and it is a lot clearer to look in the file and see the name - but this would handle the case of items in the same category that have the identical name. Such as the Staff of Ed.
- (for the above, you propose Item[ID] - or Item[NAME], I hope - rather than a prefix. That is fine.)
- So, for categories that have an "id" space, perhaps the map is ID -> MODIFIERS.
- A wrinkle is things like "Food" or "Booze", which have items and non-items (hot dogs, sushi).
For all of the above, we really need to always deal with things that have "ids" exclusively by that ID. Rather than passing around (ambiguous or aliased) item "names", always pass around the "id".
Quite a bit of ItemDatabase is already based around ItemIds (mainly those bits not dealing with consumables)
Yes - because "consumables" are not always items, as I mentioned. Perhaps we really need ConsumablesDatabase.
In summary: lets figure this out before starting to make changes. Lets start with goals/specifications. Here are a few:
- The data file(s) need to be human readable & editable, as now (some of us depend on being able to look things up in modifiers.txt.
- Things which have a natural id-space - items, effects, skills - need to be manipulated internally strictly in terms of said ids. We will still need to display names for humans to look at, and will need to be able to accept names from humans (or KoL) and do our best to unambiguously map them to the right id. Fortunately, that is mostly typed input - for which we can prompt or report ambiguities or something - since things displayed in the GUI will, we assume, be objects with specific IDs.