#Anyone wanna help me refactor this

1 messages · Page 1 of 1 (latest)

lilac wren
#

Let's talk here!

#

Looking at it separately it actually doesn't look that terrible

charred plover
#

Use the factory pattern. If each class creates its item differently, create a method on the ItemSO base class that each derived type overrides. Move the code from each if statement into their respective class' override method . . .

#

This removes all of the if statements. Once you get the item from the loot table, simply execute the method, e.g., itemSO.Create where Create is the base class method . . .