sorare-rewards 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sorare/rewards/interactors/supply/compute_for_rarity.rb +21 -12
- data/lib/sorare/rewards/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df838191acb56979062609ee4184646e5c45381610efe994cc3c7e84d397aac7
|
4
|
+
data.tar.gz: 300f47f3db86b1ea465360f15c59fa926b78544b70bf3c3242972c28213a51f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29ee679bddd7d79e01c96b3a15331d8c5946ea3cde90650d7afbc68b66a699e21739774a942b1cd2c45c991ce53eb984914d30890c1dc2abcc00ba245ff03775
|
7
|
+
data.tar.gz: 8375b5b15925506505a29fc39e41b7bf8a7dbdbe6f0895abb03d768fd69c99d515ce7aaacf6134d9a2f46b5a9686428d966c4d5f82e1ff0f2571d20ee456042d
|
data/Gemfile.lock
CHANGED
@@ -21,37 +21,46 @@ module Sorare
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def rewardable_supply
|
24
|
-
total_float_supply = supply.keys.sum { |player|
|
24
|
+
total_float_supply = supply.keys.sum { |player| player_contribution(player) }
|
25
25
|
|
26
|
-
|
26
|
+
round_and_cap_league_supply(total_float_supply)
|
27
27
|
end
|
28
28
|
|
29
29
|
def distribute_in_tiers!
|
30
30
|
ctx = Tiers::QualifySupply.call!(sorted_supply: supply)
|
31
|
-
|
31
|
+
qualified_players = Tiers::QualifyPlayers.call!(sorted_supply: supply).players
|
32
|
+
ctx.supply.each_with_index do |tier_supply, index|
|
32
33
|
rarity_supply.push(
|
33
|
-
|
34
|
-
randomizer: randomizer,
|
35
|
-
total_supply: ctx.count,
|
36
|
-
tier_supply: tier_supply,
|
37
|
-
rewardable: rewardable,
|
38
|
-
rewarded: rarity_supply
|
39
|
-
).quality_supply
|
34
|
+
capped_tier_supply(ctx.count, tier_supply, rewardable, qualified_players[index])
|
40
35
|
)
|
41
36
|
end
|
42
37
|
end
|
43
38
|
|
44
|
-
|
39
|
+
# Cap with the actual pickable supply for the tier
|
40
|
+
def capped_tier_supply(total_supply, tier_supply, rewardable, tier_players)
|
41
|
+
target = ComputeForQuality.call!(
|
42
|
+
randomizer: randomizer, total_supply: total_supply,
|
43
|
+
tier_supply: tier_supply, rewardable: rewardable, rewarded: rarity_supply
|
44
|
+
).quality_supply
|
45
|
+
|
46
|
+
[target, tier_players.sum { |player| player_pickable_supply(player) }].min
|
47
|
+
end
|
48
|
+
|
49
|
+
def round_and_cap_league_supply(float_supply)
|
45
50
|
[
|
46
51
|
float_supply.floor + remaining_supply(float_supply.modulo(1)), # Supply limit
|
47
52
|
league.cards_in_circulation_limit(rarity) # Circulation limit
|
48
53
|
].compact.min
|
49
54
|
end
|
50
55
|
|
51
|
-
def
|
56
|
+
def player_contribution(slug)
|
52
57
|
game_week.player(slug).reward_pool_supply_contribution(league, rarity)
|
53
58
|
end
|
54
59
|
|
60
|
+
def player_pickable_supply(slug)
|
61
|
+
game_week.player(slug).pickable_supply(league, rarity)
|
62
|
+
end
|
63
|
+
|
55
64
|
def remaining_supply(reward_probability)
|
56
65
|
probability = randomizer.rand
|
57
66
|
return 0 unless probability < reward_probability
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sorare-rewards
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pierre
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|