Hireling should be it's own entity that is a monster that has an inventory. This will make retrieving the mercenary gear less clunky. Additionally, better detection of a save file with NO mercenary is needed.
Instead of checking gameScreen.player.merc.items.items != null, it should be as simple as gameScreen.player.merc != null
Side note yes, I'm aware that the current code looks weird as gameScreen.player.merc.items.items.items -- this is due to how the data is saved in the D2S mostly for debugging purposes to keep the data grouped as in the file. This is really GameScreen.Player.MercData.MercItemData.ItemData.Array<Item> with ItemData being the same object as the D2S.ItemData so player items are read the same way as merc items.
Hireling should be it's own entity that is a monster that has an inventory. This will make retrieving the mercenary gear less clunky. Additionally, better detection of a save file with NO mercenary is needed.
Instead of checking
gameScreen.player.merc.items.items != null
, it should be as simple asgameScreen.player.merc != null
Side note yes, I'm aware that the current code looks weird as
gameScreen.player.merc.items.items.items
-- this is due to how the data is saved in theD2S
mostly for debugging purposes to keep the data grouped as in the file. This is reallyGameScreen.Player.MercData.MercItemData.ItemData.Array<Item>
withItemData
being the same object as theD2S.ItemData
so player items are read the same way as merc items.