Skip to content

Instantly share code, notes, and snippets.

@benjaminjackman
Created March 14, 2014 16:48
Show Gist options
  • Save benjaminjackman/9551659 to your computer and use it in GitHub Desktop.
Save benjaminjackman/9551659 to your computer and use it in GitHub Desktop.
object ItemContainer {
implicit class ItemContainerExtensions(val ic: ItemContainer) extends AnyVal {
def allItems(character: Option[String]): List[AnyItem] = {
ic.items.toList.flatMap { item =>
(item :: item.socketedItems.toList.map { i =>
i.inItem = item
i
}) map { i =>
character.foreach(c => i.character = c.toJs.asJsStr)
i.locationId = i.getLocationId.toJs.asJsStr
i
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment