Skip to content

04 ItemCategories

Marc Johnston edited this page Aug 5, 2022 · 1 revision

IItemCategory

The ItemCategory enumeration was converted into an object. Several hundred references, mostly in the Item.cs file were refactored into a methods on the ItemCategory objects.

BaseItemCategory

An interface was created IItemCategory from which all items will be based from. Since many items share a lot of code, a base abstract class was created ItemCategory. Due to the namespace collision with the enumeration, it was subsequently renamed to BaseItemCategory. Once the ItemCategory enumeration is no longer in use, the BaseItemCategory object will be renamed to drop the "Base" prefix.

The abstract BaseItemCategory provides much of the base functionality for categories of objects.

Armour, Weapons, Books, Jewellery and Lightsource ItemCategories

These objects inherit from the BaseItemCategory and provide basic functionality for groups of categories.

*ItemCategory Objects

An object for each of the ItemCategory enumerations was created. They provide the functionality that was often switch cased and often uses the base class for default functionality.

BaseItemType

The original BaseItemType object was a model class that was populated by the ReadCSV process. These objects are no longer being used, as each row of the BaseItemTypes.csv file has been scaffolded into a full object. The scaffolding process uses the BaseItemType.template file with macro processing to create each entity. The base/original Entity object that the original BaseItemType object inherited from, is no longer in use. The items that are scaffoled inherit from one of the category objects that was built from the ItemCategory enumerations.

Example of the inheriting:

  • HaftedWhip
    • HaftedItemCategory
      • WeaponItemCategory
        • ItemCategory
          • IItemCategory

ItemType

Scaffolded items are immutable. The ItemType objects hold state and refer to the scaffolded BaseItemType for functionality and the ability to reset (Stompping). The state for these ItemTypes identify flavors, tried and other stats.

Item

Items have an ItemType assigned to them. Items can also be empty and act as place holders for the player inventory.