So I'm making a game in which the player will have a number of units with different "job classes", say a Knight, Paige, Alchemist etc... I'm currently making an inventory system and have run into a small problem with respect to code modularity and maintaining good code. Here's the layout of my code so far:
I have an equip class, an instance for every weapon, and each equip has a type; let's say "shortsword" and "greatsword" are types of equipment. Furthermore, a character of class Knight can equip greatsword and shortsword, but a character of type Paige can only equip shortswords
Jobs are organized using a Job class which each character owns (using a List which is stored in character class). The Inventory class should access the character and get the Job and then request all items that the job can equip.
My current prototype utilizes a string field in the Equip class called EquipType which will store these "shortsword/greatsword" strings. Job class will then have a List field which will be sent to Inventory class and get items using string matching.
However, this is annoying in terms of maintaining code since I'm retyping strings for both Equip and Job classes, not very elegant. I was thinking of using enums since that will allow me to get items by enum type, but that will compromise modularity of code and couple things that (maybe??) shouldn't be coupled - and global enums are bad practice anyway. In addition, the enum will then be quite big (15-20 elements).
Are there cleaner and more elegant methods to such an inventory system?