diff --git a/src/cgiDiceBot.rb b/src/cgiDiceBot.rb index 0a775d281..95b6fff6b 100644 --- a/src/cgiDiceBot.rb +++ b/src/cgiDiceBot.rb @@ -14,8 +14,6 @@ def initialize @rands = nil # テスト以外ではnilで良い。ダイス目操作パラメータ @isTest = false @bcdice = nil - - $SEND_STR_MAX = 99999 # 最大送信文字数(本来は500byte上限) end attr_reader :isSecret diff --git a/src/configBcDice.rb b/src/configBcDice.rb index 789e15de5..9e5cd9992 100644 --- a/src/configBcDice.rb +++ b/src/configBcDice.rb @@ -4,9 +4,6 @@ $bcDiceVersion = "2.06.01" -# @deprecated IRCボット機能の削除に伴い廃止予定。 -$SEND_STR_MAX = 405; # 最大送信文字数(本来は500byte上限) - $DICE_MAXCNT = 200; # ダイスが振れる最大個数 $DICE_MAXNUM = 1000; # ダイスの最大面数 $isHandSort = true; # 手札をソートする必要があるか? diff --git a/src/diceBot/BattleTech.rb b/src/diceBot/BattleTech.rb index fe35678b1..a4281c727 100644 --- a/src/diceBot/BattleTech.rb +++ b/src/diceBot/BattleTech.rb @@ -117,13 +117,9 @@ def getHitResult(count, damageFunc, tail) resultTexts << hitResult end - totalResultText = resultTexts.join("\n") - - if totalResultText.length >= $SEND_STR_MAX - totalResultText = "..." - end + resultTexts.push(" > #{hitCount}回命中") - totalResultText += "\n > #{hitCount}回命中" + totalResultText = resultTexts.join("\n") totalResultText += " 命中箇所:" + getTotalDamage(damages) if hitCount > 0 return totalResultText diff --git a/src/diceBot/DoubleCross.rb b/src/diceBot/DoubleCross.rb index ed1dd745c..c0662b938 100644 --- a/src/diceBot/DoubleCross.rb +++ b/src/diceBot/DoubleCross.rb @@ -84,7 +84,7 @@ def execute(bot) loop_count += 1 end - return result_str(value_groups, loop_count) + return result_str(value_groups) end private @@ -99,29 +99,13 @@ def node_expression # 判定結果の文字列を返す # @param [Array] value_groups 出目のグループの配列 - # @param [Integer] loop_count 回転数 # @return [String] - def result_str(value_groups, loop_count) + def result_str(value_groups) fumble = value_groups[0].values.all? { |value| value == 1 } # TODO: Ruby 2.4以降では Array#sum が使える sum = value_groups.map(&:max).reduce(0, &:+) achieved_value = fumble ? 0 : (sum + @modifier) - long_str = result_str_long(value_groups, achieved_value, fumble) - - if long_str.length > $SEND_STR_MAX - return result_str_short(loop_count, achieved_value, fumble) - end - - return long_str - end - - # ダイスロール結果の長い文字列表記を返す - # @param [Array] value_groups 出目のグループの配列 - # @param [Integer] achieved_value 達成値 - # @param [Boolean] fumble ファンブルしたか - # @return [String] - def result_str_long(value_groups, achieved_value, fumble) parts = [ "(#{@expression})", "#{value_groups.join('+')}#{@modifier_str}", @@ -132,23 +116,6 @@ def result_str_long(value_groups, achieved_value, fumble) return parts.compact.join(' > ') end - # ダイスロール結果の短い文字列表記を返す - # @param [Integer] loop_count 回転数 - # @param [Integer] achieved_value 達成値 - # @param [Boolean] fumble ファンブルしたか - # @return [String] - def result_str_short(loop_count, achieved_value, fumble) - parts = [ - "(#{@expression})", - '...', - "回転数#{loop_count}", - achieved_value_with_if_fumble(achieved_value, fumble), - compare_result(achieved_value, fumble) - ] - - return parts.compact.join(' > ') - end - # ファンブルかどうかを含む達成値の表記を返す # @param [Integer] achieved_value 達成値 # @param [Boolean] fumble ファンブルしたか diff --git a/src/diceBot/RecordOfSteam.rb b/src/diceBot/RecordOfSteam.rb index 9cc920c7f..73a9f8245 100644 --- a/src/diceBot/RecordOfSteam.rb +++ b/src/diceBot/RecordOfSteam.rb @@ -51,10 +51,6 @@ def rollDiceCommand(command) output = "(#{command}) > #{rollResult}" - if output.length > $SEND_STR_MAX - output = "(#{command}) > ..." - end - roundCountText = getRoundCountText(roundCount) successText = getSuccessText(successCount) specialText = getSpecialText(specialCount) diff --git a/src/diceBot/SwordWorld.rb b/src/diceBot/SwordWorld.rb index 4cdce91e6..2ddd40529 100644 --- a/src/diceBot/SwordWorld.rb +++ b/src/diceBot/SwordWorld.rb @@ -175,9 +175,8 @@ def rating(string) # レーティング表 break unless dice >= crit end - limitLength = $SEND_STR_MAX - output.length output += getResultText(totalValue, addValue, diceResults, diceResultTotals, - rateResults, diceOnlyTotal, round, limitLength, half) + rateResults, diceOnlyTotal, round, half) return output end @@ -414,12 +413,10 @@ def rollDice(_values) # @param rateResults [Array] # @param dice_total [Integer] # @param round [Integer] - # @param limitLength [Integer] # @param half [Boolean] def getResultText(rating_total, modifier, diceResults, diceResultTotals, - rateResults, dice_total, round, limitLength, half) + rateResults, dice_total, round, half) sequence = [] - short = ["..."] sequence.push("2D:[#{diceResults.join(' ')}]=#{diceResultTotals.join(',')}") @@ -443,7 +440,6 @@ def getResultText(rating_total, modifier, diceResults, diceResultTotals, if round > 1 round_text = "#{round - 1}回転" sequence.push(round_text) - short.push(round_text) end total = rating_total + modifier @@ -453,14 +449,8 @@ def getResultText(rating_total, modifier, diceResults, diceResultTotals, total_text = total.to_s sequence.push(total_text) - short.push(total_text) - ret = sequence.join(" > ") - if ret.length > limitLength - short.join(" > ") - else - ret - end + return sequence.join(" > ") end def setRatingTable(tnick)