Best OOP solution to a problem

Discussion in 'Plugin Development' started by Scullyking, Jul 11, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Scullyking

    My plugin is effectively overriding most in-game items with custom fields such as weildLevel and xpReturn etc.

    I'm using standard inheritance at the moment laid out like this:

    Item( Tool(Weapon), Ore, Fish, Log, Generic)

    E.g. weapons are a type of tool which is a type of item.

    My trouble is that some of these items are craftable in my re-written crafting system.

    Craftable items have a list of materials needed to make them and a level required to craft it.

    Some Weapons are craftable, others aren't. Some Generics are craftable, others aren't.

    How should I, using OOP, implement this craftability to some items of some classes? An interface? I obviously don't want to be creating classes for every item.

    Thanks
     
  2. Offline

    teej107

    @Scullyking Interfaces are good. Adding a method to your current classes to show if it can be crafted is another way.
     
Thread Status:
Not open for further replies.

Share This Page