def AvailableGlobal(locations, items): progression = Progression(items) return [l for l in locations if l.Available(progression)]
def CanFillWithinWorld(locations, item, items): itemWorldProgression = Progression([i for i in items if i.World == item.World].append(item)) worldList = [] [worldList.append(l.Region.World) for l in locations if l.Region.World not in worldList] worldProgression = {world.Id : Progression([i for i in items if i.World == world]) for world in worldList} return [l for l in locations if l.CanFill(item, worldProgression[l.Region.World.Id] and next(ll for ll in item.World.Locations if ll.Id == l.Id).Available(itemWorldProgression))]