bcdice 3.1.2 → 3.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2845b53edc8eaf447d222d1bd08a305dcaf8d38c7a9d6bd37539ed990713f533
4
- data.tar.gz: 98bf76a14460707ec34952694e3e6256aabe6e66c187f1fd5394c816fb948df7
3
+ metadata.gz: af52626457e3a8d707ebba95dfad511c5cc8d84154ac4d141817b782be1a3f95
4
+ data.tar.gz: f567ff16168849b794537c88a6ac2568eebf3158086923c25262dc4fdee731e1
5
5
  SHA512:
6
- metadata.gz: 5860f30cf937951291575caf5795878894926ee27692f49bf9b586e6d8d1cde3f3eec62e1181d7868dfb16cda93a0035869da89c5e89f89089450c2d515f46e4
7
- data.tar.gz: 0723eb18505cc461a866feaf8f7a99e57c061be28acc716d7d6b0481eb7a7f1d8beb9ed9ec95196ac09593dac5ccfd052e05f7bc7957a69df0dd0748bd6e6c88
6
+ metadata.gz: a826afe976c398947e3a9e28ef7de6fa16f3b005137a4bad2c8ed98082f1b26916c4a250d0ebf374b9ff99557b542714df4edb2145fe7cec8f0b3684424c5a68
7
+ data.tar.gz: 476e0d4b6b0f7a6cfaf53c1e71fd19d0aaeea9f815e66fd1524f35e1e4f0c60e2066d0808abe7170c5e7c592f4c4fcc9d20385c28f32a8c7972eff8f7398da2c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # ChangeLog
2
2
 
3
+ ## 3.1.3 2021/04/12
4
+
5
+ ### バグ修正
6
+ - 悪意ある入力に対処 ([`c302300`](https://github.com/bcdice/BCDice/commit/c30230038b44b8d373e4a342b4cb4d528dc7c472))
7
+
3
8
  ## 3.1.2 2021/03/28
4
9
 
5
10
  ### バグ修正
@@ -244,7 +244,7 @@ module BCDice
244
244
 
245
245
  # 財宝表ロール
246
246
  def roll_treasure(command)
247
- m = /^TRS(\d+)*([+\-\d]+)?$/.match(command)
247
+ m = /^TRS(\d+)?([+\-\d]+)?$/.match(command)
248
248
  return nil unless m
249
249
 
250
250
  character_rank = m[1].to_i
@@ -261,7 +261,7 @@ module BCDice
261
261
 
262
262
  ### 財宝表 ###
263
263
  def roll_treasure_table(command)
264
- m = /^([CMIHG]TRS)(\d+)*([+\-\d]+)?(\$)?$/.match(command)
264
+ m = /^([CMIHG]TRS)(\d+)?([+\-\d]+)?(\$)?$/.match(command)
265
265
  return nil unless m
266
266
 
267
267
  type = m[1]
@@ -286,7 +286,7 @@ module BCDice
286
286
 
287
287
  # 拡張ルール財宝表
288
288
  def roll_treasure_table_b2(command)
289
- m = /^([CMIO]TRSE)(\d+)*([+\-\d]+)?(\$)?$/.match(command)
289
+ m = /^([CMIO]TRSE)(\d+)?([+\-\d]+)?(\$)?$/.match(command)
290
290
  return nil unless m
291
291
 
292
292
  type = m[1]
@@ -25,7 +25,7 @@ module BCDice
25
25
   例)DC4:【攻撃力】4でダメージチェック DC5[20]:【攻撃力】5でダメージチェック、うち1つは20mm機銃 DC5[20,30]:【攻撃力】5でダメージチェック、うち1つは20mm機銃、うち1つは30mmガンポッド
26
26
  MESSAGETEXT
27
27
 
28
- register_prefix('(\d+)*D20<=', '(\d+)*CP', 'RMT', 'TOT', 'EXT', 'SUT', 'DC(\d+)')
28
+ register_prefix('\d*D20<=', '\d*CP', 'RMT', 'TOT', 'EXT', 'SUT', 'DC(\d+)')
29
29
 
30
30
  def eval_game_system_specific_command(command) # ダイスロールコマンド
31
31
  # 通常判定部分をgetJudgeResultコマンドに切り分け
@@ -53,13 +53,13 @@ module BCDice
53
53
  # 通常判定
54
54
  def getJudgeResult(command)
55
55
  case command
56
- when /^(\d+)*D20<=(\d+)?(\[(\d+)(,(\d+))?\])?(@(\d+))?$/i
56
+ when /^(\d+)?D20<=(\d+)?(\[(\d+)(,(\d+))?\])?(@(\d+))?$/i
57
57
  number = (Regexp.last_match(1) || 1).to_i # ダイス数。省略時は1
58
58
  target = (Regexp.last_match(2) || 14).to_i # 目標値。省略時は14 if 空白 then 14 else 記載の値
59
59
  fumble1 = (Regexp.last_match(4) || 21).to_i # 追加ファンブル値。省略時は21
60
60
  fumble2 = (Regexp.last_match(6) || 21).to_i # 追加ファンブル値。省略時は21
61
61
  critical = (Regexp.last_match(8) || 21).to_i # 追加クリティカル値。省略時は21
62
- when /^(\d+)*CP(\d+)?(\[(\d+)(,(\d+))?\])?(@(\d+))?$/i
62
+ when /^(\d+)?CP(\d+)?(\[(\d+)(,(\d+))?\])?(@(\d+))?$/i
63
63
  number = (Regexp.last_match(1) || 1).to_i
64
64
  target = (Regexp.last_match(2) || 14).to_i
65
65
  fumble1 = (Regexp.last_match(4) || 21).to_i
@@ -37,8 +37,7 @@ module BCDice
37
37
   ・超未来の宇宙船内 INT
38
38
  MESSAGETEXT
39
39
 
40
- register_prefix('(\d+)*DA.*\[(\d+),(\d+)(,(\d+))?\]', 'VPFT', 'VNFT', 'VNRT', 'AAFT', 'AST', 'RNST', 'RET', 'TRST', 'TRAT', 'TRMT', 'TROT', 'TET', 'ENT', 'CUT', 'NAT', 'INT') # '(\d+)*DA.*\[.*\]'
41
-
40
+ register_prefix('\d*DA.*\[(\d+),(\d+)(,(\d+))?\]', 'VPFT', 'VNFT', 'VNRT', 'AAFT', 'AST', 'RNST', 'RET', 'TRST', 'TRAT', 'TRMT', 'TROT', 'TET', 'ENT', 'CUT', 'NAT', 'INT')
42
41
  def eval_game_system_specific_command(command) # ダイスロールコマンド
43
42
  # 通常判定部分をgetJudgeResultコマンドに切り分け
44
43
  output = getJudgeResult(command)
@@ -104,7 +103,7 @@ module BCDice
104
103
 
105
104
  def getJudgeResult(command)
106
105
  case command
107
- when /(\d+)*DA([\d+*\-]*\d)?\[(\d+),(\d+)(,(\d+))?\]/i
106
+ when /(\d+)?DA([\d+*\-]*\d)?\[(\d+),(\d+)(,(\d+))?\]/i
108
107
  number = (Regexp.last_match(1) || 1).to_i
109
108
  correction = (Regexp.last_match(2) || 0).to_i
110
109
  single = (Regexp.last_match(3) || 4).to_i
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BCDice
4
- VERSION = "3.1.2"
4
+ VERSION = "3.1.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcdice
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 3.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - SAKATA Sinji
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-28 00:00:00.000000000 Z
11
+ date: 2021-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n