runeterra_cards 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/CHANGELOG.md +5 -0
- data/doc/README.md +2 -2
- data/lib/runeterra_cards/card_set.rb +16 -1
- data/lib/runeterra_cards/errors.rb +7 -4
- data/lib/runeterra_cards/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: 13de26db2b79d60bca9fce39d36d3d82fcaaa19fbcdae3dc2c6f34c785253d91
|
4
|
+
data.tar.gz: 061a9c9e56f751fc2451166af0e9b27f415c4b9293b1ac1d0dc58df714a46a6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cde13398e27b94c917c74efb2cedf4fa82c3af5b8cc7e2da4a19af959176bf24703574170718d17ace331cf20e23b019001150fdd12a90a81688cd2f17f186c3
|
7
|
+
data.tar.gz: 18d73970af5591a2f65ccf9ba4739800d1025f042499416ed5e2ccd6b5ad33797c3b4640bd7b89dd99600b1a4f2a3bc0f641be0499d392ad56385ec53318dc22
|
data/doc/CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [0.4.1] - 2021-02-05
|
8
|
+
|
9
|
+
Fixed
|
10
|
+
|
11
|
+
- Fixed issue where card numbers > 127 came out extremely wrong, e.g. Aphelios and several other of the new cards ([issue #4](https://github.com/zofrex/runeterra_cards/issues/4))
|
7
12
|
## [0.4.0] - 2020-12-08
|
8
13
|
### Added
|
9
14
|
- [`CardMetadata` now has a `#cost` attribute representing the mana cost of a card.](https://github.com/zofrex/runeterra_cards/pull/3) (thanks, [nieszkah](https://github.com/alpm)!) Technically this is backwards-compatibility breaking as it makes a new field in metadata json mandatory.
|
data/doc/README.md
CHANGED
@@ -9,13 +9,13 @@ This library makes it easy to decode Legends of Runeterra deck codes, load Data
|
|
9
9
|
Add the following to your `Gemfile`:
|
10
10
|
|
11
11
|
```
|
12
|
-
gem 'runeterra_cards', '~> 0.4.
|
12
|
+
gem 'runeterra_cards', '~> 0.4.1'
|
13
13
|
```
|
14
14
|
|
15
15
|
Or, if you're building a Gem, your `.gemspec`:
|
16
16
|
|
17
17
|
```
|
18
|
-
spec.add_dependency 'runeterra_cards', '~> 0.4.
|
18
|
+
spec.add_dependency 'runeterra_cards', '~> 0.4.1'
|
19
19
|
```
|
20
20
|
|
21
21
|
## Updates & Versioning
|
@@ -62,8 +62,9 @@ module RuneterraCards
|
|
62
62
|
|
63
63
|
raise unless format.equal? 1
|
64
64
|
|
65
|
-
int_array = binary_data[1..]
|
65
|
+
int_array = unpack_uleb128(binary_data[1..])
|
66
66
|
cards = assemble_card_list(int_array)
|
67
|
+
|
67
68
|
from_card_and_counts(cards)
|
68
69
|
end
|
69
70
|
|
@@ -108,5 +109,19 @@ module RuneterraCards
|
|
108
109
|
end
|
109
110
|
|
110
111
|
private_class_method :assemble_card_list
|
112
|
+
|
113
|
+
# @param [String] binary
|
114
|
+
# @return [Enumerable<Fixnum>]
|
115
|
+
def self.unpack_uleb128(binary)
|
116
|
+
binary.each_byte.slice_after { |b| (b & 0b1000_0000).zero? }.map do |int_bytes|
|
117
|
+
acc = 0
|
118
|
+
int_bytes.each_with_index do |byte, index|
|
119
|
+
acc += (byte & 0b0111_1111) << (7 * index)
|
120
|
+
end
|
121
|
+
acc
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
private_class_method :unpack_uleb128
|
111
126
|
end
|
112
127
|
end
|
@@ -10,7 +10,8 @@ module RuneterraCards
|
|
10
10
|
class Base32Error < DeckCodeParseError
|
11
11
|
# Returns a new instance of Base32Error with a helpful error message preloaded.
|
12
12
|
def initialize
|
13
|
-
super(
|
13
|
+
super(
|
14
|
+
'Encountered an error while Base32 decoding deck code.' \
|
14
15
|
' Probably an invalid deck code, or possibly a bug in the Base32 handling.')
|
15
16
|
end
|
16
17
|
end
|
@@ -37,8 +38,9 @@ module RuneterraCards
|
|
37
38
|
# @param [Fixnum] expected The version number we were expecting to see in the deck code.
|
38
39
|
# @param [Fixnum] got The version number we actually got.
|
39
40
|
def initialize(expected, got)
|
40
|
-
super(
|
41
|
-
|
41
|
+
super(
|
42
|
+
"Unrecognized deck code version number: #{got}, was expecting: #{expected}. "\
|
43
|
+
'Possibly an invalid deck code, possibly you need to update the deck code library version.')
|
42
44
|
@version = got
|
43
45
|
end
|
44
46
|
end
|
@@ -56,7 +58,8 @@ Possibly an invalid deck code, possibly you need to update the deck code library
|
|
56
58
|
|
57
59
|
# @param [Fixnum] faction_number The faction number we encountered and did not recognise.
|
58
60
|
def initialize(faction_number)
|
59
|
-
super(
|
61
|
+
super(
|
62
|
+
"Unrecognized faction number '#{faction_number}'."\
|
60
63
|
' Possibly you need to update this library to a newer version')
|
61
64
|
@faction_number = faction_number
|
62
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runeterra_cards
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James "zofrex" Sanderson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base32
|