class Sorare::Rewards::Cards::PickForDivision

PickForDivision picks the rewards for a given division Receive a list of pickers for each tiers and quality

{
  'rare' => { 'tier_0' => Picker, 'tier_1' => Picker },
  'super_rare' => { 'tier_0' => Picker, 'tier_1' => Picker }
}

And a reward allocations

{
  'rare' => [5, 15, 0, 0],
  'super_rare' => [1, 4, 0, 0],
  'unique' => [0, 0, 1, 0]
}

Public Instance Methods

call() click to toggle source
# File lib/sorare/rewards/interactors/cards/pick_for_division.rb, line 27
def call
  context.cards_picked = allocations.keys.index_with do |rarity|
    PickForDivisionAndRarity.call!(
      **context.to_h,
      rarity: rarity,
      pickers: pickers[rarity],
      allocations: allocations[rarity]
    ).cards_picked
  end
end