Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinscham committed Feb 29, 2024
2 parents e68eb8f + ae764b3 commit 395ceef
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.7.0
current_version = 1.7.1
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-(?P<release>[a-z]+))?
commit = True
tag = False
Expand Down
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). Related: [versioning strategy](./VERSIONING.md).

## v1.7.1 - Feb 29, 2024
### Fixed
- Fixed and extended English locale detection
- #34 Loot with line breaks in its name will now properly be listed in the disenchant preview
- #126 Network related errors will no longer break the script
- #152 Mastery Token upgrade no longer offers inefficient upgrades
- This happened when you had a champion permanent that had a disenchant value higher than the upgrade price
- Champion shard disenchanting will now also take this into consideration

## v1.7.0 - Feb 29, 2024
### Added
- #144 Support for i18n, you can contribute using [Weblate](https://weblate.ms-ds.org/engage/disenchanter/).
Expand All @@ -16,7 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
- #35 Disenchanter can be started from anywhere now
- It will try to find your League Client via registry > start menu > default path > locally
- #57 Rerolling owned esports emotes that cannot be disenchanted
- #57 Re-rolling owned esports emotes that cannot be disenchanted
- #19 Tacticians can now be disenchanted
- Shortcut to your [Mastery Chart](https://masterychart.com) profile
- #27 Proper changelog and versioning info
Expand Down
3 changes: 3 additions & 0 deletions i18n/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ en:
create_an_issue: Please take a screenshot and create an issue at %{url}
send_email_instead: If you don't have a GitHub account, send it to %{email}
skipping_step: Something went wrong. Skipping this step...
network_error: Oops, we probably hit an API limit. Retry in a minute or report
to %{email} if this keeps happening.
capsule:
no_capsules_found: Found no keyless capsules to open.
found_capsules: "Found %{count} capsules:"
Expand All @@ -146,6 +148,7 @@ en:
shards to be kept?
note_level7: at mastery 7
note_below_threshold: below threshold
note_more_valuable: value higher than Mastery 7 upgrade
no_unowned_champs_found: Found no shards of champions you don't own yet.
ask_keep_unowned_champs: Keep a shard for champions you don't own yet?
found_champs_with_tokens: Found %{count} champions with owned mastery tokens
Expand Down
5 changes: 5 additions & 0 deletions scripts/build_main.sh → scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ ocran src/main.rb \
--icon ./assets/BE_icon.ico \
--output ./build/disenchanter.exe

ocran src/updater.rb \
--gemfile ./Gemfile \
--icon ./assets/BE_icon.ico \
--output ./build/disenchanter_up.exe

rm ./build/.build.lockfile
10 changes: 0 additions & 10 deletions scripts/build_updater.sh

This file was deleted.

2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sonar.projectKey=marvinscham_disenchanter_AY088C575jK4ghmshIlp
sonar.projectVersion=v1.7.0
sonar.projectVersion=v1.7.1

sonar.sources=.
sonar.sourceEncoding=UTF-8
Expand Down
6 changes: 6 additions & 0 deletions src/class/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ def request_post(path, body)
res = http.request req
JSON.parse(res.body)
end
rescue Net::OpenTimeout, SocketError, Errno::ETIMEDOUT, Net::HTTPFatalError => e
puts "#{e.class}/#{e.message}".light_yellow

e.backtrace = ['No backtrace'] unless e.backtrace
puts e.backtrace.join("\n").light_black
puts I18n.t(:'handler.exception.network_error', email: '[email protected]').light_red
end

def refresh_loot
Expand Down
2 changes: 1 addition & 1 deletion src/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
def run
check_build_env

current_version = 'v1.7.0'
current_version = 'v1.7.1'
stat_tracker = StatTracker.new
client = Client.new(stat_tracker, current_version)

Expand Down
5 changes: 4 additions & 1 deletion src/modules/handlers/champions_mastery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ def handle_champions_mastery(client, loot_shards, keep_all: false)

def adjust_shard_counts_by_threshold(shard, keep_all, m6_ids, m7_ids, threshold_ids)
if m7_ids.include? shard['storeItemId']
shard['disenchant_note'] = I18n.t(:'handler.champion.by_mastery.note_level7').light_black
shard['disenchant_note'] = I18n.t(:'handler.champion.by_mastery.note_level7').light_green
elsif shard['disenchantValue'] > 2950
# Upgrade price to M7 is 2950 BE so it's not worth to keep
shard['disenchant_note'] = I18n.t(:'handler.champion.by_mastery.note_more_valuable').light_magenta
elsif m6_ids.include? shard['storeItemId']
shard['count'] -= 1
shard['count_keep'] += 1
Expand Down
3 changes: 2 additions & 1 deletion src/modules/handlers/generic_loot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def create_generic_disenchant_info(loot_generic, loot_name_index, name, totals)
end

def create_generic_info_single(loot, loot_name_index)
loot_name = loot[loot_name_index].chomp
loot_value = loot['disenchantValue'] * loot['count']
loot_currency = if loot['disenchantLootName'] == Dictionary::BLUE_ESSENCE
I18n.t(:'loot.blue_essence_short')
Expand All @@ -129,7 +130,7 @@ def create_generic_info_single(loot, loot_name_index)
end

print pad("#{loot['count']}x ", 5, right: false).light_black
print pad(loot[loot_name_index], 30).light_white
print pad(loot_name, 40).light_white
print ' @ '.light_black
print pad("#{loot_value} #{loot_currency}", 8, right: false).light_black
print " (#{I18n.t(:'common.not_owned')})".yellow unless loot['redeemableStatus'] == Dictionary::STATUS_OWNED
Expand Down
2 changes: 1 addition & 1 deletion src/modules/handlers/icons.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Wrapper for summoner icons
# @param client Client connector
# @note No shards for icons!
# @note No shards for icons! lootIds are like SUMMONER_ICON_<ID>
def handle_icons(client)
handle_generic(client, I18n.t(:'loot.icons'), Dictionary::ICON)
end
28 changes: 15 additions & 13 deletions src/modules/handlers/mastery_tokens.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,35 +58,37 @@ def determine_token_crafting_resources(client, loot_mastery_tokens)
print t['lootName'][-1].light_white
print " #{I18n.t(:'handler.mastery_tokens.using')} ".light_black

calc_token_crafting_resource(player_loot, t, needed_resources)
calc_token_crafting_resource(client, player_loot, t, needed_resources)
puts
end
puts

needed_resources
end

def check_token_ref_crafting_material(player_loot, ref_id, type)
def check_token_ref_crafting_material(client, player_loot, token, type)
type_id = type == 'shard' ? Dictionary::CHAMPION_SHARD : Dictionary::CHAMPION_PERMANENT

ref_mat = player_loot.select do |l|
l['type'] == type_id && ref_id == l['storeItemId'].to_s
l['type'] == type_id && token['refId'] == l['storeItemId'].to_s
end

!ref_mat.empty? && ref_mat[0]['count'].positive?
!ref_mat.empty? &&
ref_mat[0]['count'].positive? &&
ref_mat[0]['disenchantValue'] < mastery_be_upgrade_cost(client, (token['lootName'])[-1])
end

def calc_token_crafting_resource(player_loot, token, needed_resources)
if check_token_ref_crafting_material(player_loot, token['refId'], 'shard')
def calc_token_crafting_resource(client, player_loot, token, needed_resources)
if check_token_ref_crafting_material(client, player_loot, token, 'shard')
print I18n.t(:'handler.mastery_tokens.using_champion_shard').green
needed_resources['shards'] += 1
token['upgrade_type'] = 'shard'
elsif check_token_ref_crafting_material(player_loot, token['refId'], 'perm')
elsif check_token_ref_crafting_material(client, player_loot, token, 'perm')
print I18n.t(:'handler.mastery_tokens.using_champion_permanent').green
needed_resources['perms'] += 1
token['upgrade_type'] = 'permanent'
else
recipe_cost = mastery_upgrade_cost(client, (token['lootName'])[-1])
recipe_cost = mastery_be_upgrade_cost(client, (token['lootName'])[-1])
print I18n.t(:'handler.mastery_tokens.using_blue_essence', recipe_cost:).yellow
needed_resources['essence'] += recipe_cost
token['upgrade_type'] = 'essence'
Expand All @@ -96,7 +98,7 @@ def calc_token_crafting_resource(player_loot, token, needed_resources)
# Grabs token set blue essence upgrade cost
# @param client Client connector
# @param level Token level (6/7)
def mastery_upgrade_cost(client, level)
def mastery_be_upgrade_cost(client, level)
recipes = client.req_get_recipes_for_item("#{Dictionary.const_get("MASTERY_#{level}_TOKEN")}-1")

recipe_cost = recipes.select do |r|
Expand All @@ -110,15 +112,15 @@ def mastery_upgrade_cost(client, level)
# @param needed_resources Hash of needed shards, perms and blue essence
def build_token_crafting_confirm_question(loot_mastery_tokens, needed_resources)
question_string = "#{I18n.t(:'handler.mastery_tokens.confirm_total_upgrades', count: loot_mastery_tokens.count)} "
question_string += "#{needed_resources['shards']} #{I18n.t(:'loot.shards')}, " if needed_resources['shards'].positive?
question_string += "#{needed_resources['shards']} #{I18n.t(:'loot.shards')} + " if needed_resources['shards'].positive?
if needed_resources['perms'].positive?
question_string += "#{needed_resources['perms']} #{I18n.t(:'loot.permanents')}, "
question_string += "#{needed_resources['perms']} #{I18n.t(:'loot.permanents')} + "
end
if needed_resources['essence'].positive?
question_string += "#{needed_resources['essence']} #{I18n.t(:'loot.blue_essence')}, "
question_string += "#{needed_resources['essence']} #{I18n.t(:'loot.blue_essence')} + "
end

question_string = question_string.delete_suffix(', ')
question_string = question_string.delete_suffix(' + ')
"#{question_string}?"
end

Expand Down
7 changes: 5 additions & 2 deletions src/modules/locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ def setup_locale(client)

def map_locale(locale)
dictionary = {
en_GB: 'en',
en_US: 'en'
'en_GB' => 'en',
'en_US' => 'en',
'en_AU' => 'en',
'en_PH' => 'en',
'en_SG' => 'en'
}

return dictionary[locale] if dictionary.key?(locale)
Expand Down
6 changes: 3 additions & 3 deletions techstack.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ marvinscham/disenchanter is built on the following main stack:
- [Ruby](https://www.ruby-lang.org) – Languages
- [Swift](https://developer.apple.com/swift/) – Languages
- [RuboCop](http://batsov.com/rubocop/) – Code Review
- [GitHub Actions](https://github.com/features/actions) – Continuous Integration
- [RuboCop](http://batsov.com/rubocop/) – Code Review
Full tech stack [here](/techstack.md)
Expand All @@ -18,8 +18,8 @@ marvinscham/disenchanter is built on the following main stack:
- <img width='25' height='25' src='https://img.stackshare.io/service/989/ruby.png' alt='Ruby'/> [Ruby](https://www.ruby-lang.org) – Languages
- <img width='25' height='25' src='https://img.stackshare.io/service/1009/tuHsaI2U.png' alt='Swift'/> [Swift](https://developer.apple.com/swift/) – Languages
- <img width='25' height='25' src='https://img.stackshare.io/service/2643/rubocop.png' alt='RuboCop'/> [RuboCop](http://batsov.com/rubocop/) – Code Review
- <img width='25' height='25' src='https://img.stackshare.io/service/11563/actions.png' alt='GitHub Actions'/> [GitHub Actions](https://github.com/features/actions) – Continuous Integration
- <img width='25' height='25' src='https://img.stackshare.io/service/2643/rubocop.png' alt='RuboCop'/> [RuboCop](http://batsov.com/rubocop/) – Code Review
Full tech stack [here](/techstack.md)
Expand All @@ -30,7 +30,7 @@ Full tech stack [here](/techstack.md)
# Tech Stack File
![](https://img.stackshare.io/repo.svg "repo") [marvinscham/disenchanter](https://github.com/marvinscham/disenchanter)![](https://img.stackshare.io/public_badge.svg "public")
<br/><br/>
|12<br/>Tools used|01/05/24 <br/>Report generated|
|12<br/>Tools used|02/29/24 <br/>Report generated|
|------|------|
</div>

Expand Down
4 changes: 2 additions & 2 deletions techstack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ repo_name: marvinscham/disenchanter
report_id: 77abef689a45d775d034168bffbe8c69
version: 0.1
repo_type: Public
timestamp: '2024-01-05T08:51:35+00:00'
timestamp: '2024-02-29T18:38:00+00:00'
requested_by: marvinscham
provider: github
branch: main
Expand All @@ -23,7 +23,7 @@ tools:
last_updated_by: Marvin Scham
last_updated_on: 2022-07-24 23:09:25.000000000 Z
- name: Swift
description: 'An innovative new programming language for Cocoa and Cocoa Touch. '
description: An innovative new programming language for Cocoa and Cocoa Touch.
website_url: https://developer.apple.com/swift/
license: Apache-2.0
open_source: true
Expand Down

0 comments on commit 395ceef

Please sign in to comment.