silkedit 0.1.4 → 0.1.6
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/lib/commands/cheat.rb +63 -8
- data/lib/commands/zone_mkzone.rb +14 -13
- data/lib/silkedit/cheats/cheatengine.rb +1 -2
- data/lib/silkedit/cheats/silksong_cheats.rb +36 -2
- data/lib/silkedit/cheats/silksong_zoner.rb +1 -1
- data/lib/silkedit/config/silksong/cheatdata.yaml +300 -156
- data/lib/silkedit/config/silksong/permasaves.yaml +2 -0
- data/lib/silkedit/config/silksong/zones.yaml +28 -2
- data/lib/silkedit/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: d05ae384c578d0145ea95589e40baaff71f938ecf9e9e3d1abf64b42d5a7d34a
         | 
| 4 | 
            +
              data.tar.gz: 95bd985c710fd438824af21275b55f569ca7833bb16b0414e1e55873e9b2ea72
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: '09a35377f50b2b0ca8dc74151e5badbb17dd939145670eb14087ccc9755455e3cc0f2c52d08b04ae06b31b131271327b0da65001b736008c6d3fdbc94179a8f2'
         | 
| 7 | 
            +
              data.tar.gz: f7993d5aafd4ca024f1ed247104607d2595176cbb971e28587f595c065c17770968b3e5f970b5b5d10452062ef2fc8035cddca13287ef7993ab82cd2f5d7456d
         | 
    
        data/lib/commands/cheat.rb
    CHANGED
    
    | @@ -2,18 +2,73 @@ Rbcli.command 'cheat' do | |
| 2 2 | 
             
              description 'Applies one or more cheats to the selected savefile'
         | 
| 3 3 | 
             
              usage '<cheat1> <cheat2> <cheat3>...'
         | 
| 4 4 | 
             
              parameter :list, 'List all cheats', type: :bool, default: false
         | 
| 5 | 
            +
              # parameter :force, "Force application of a cheat even when requirements aren't met. Additional changes may be made to your savegave.", type: :bool, default: false
         | 
| 5 6 | 
             
              action do |opts, params, args, config, env|
         | 
| 6 7 | 
             
                s = Silkedit::Savegame::SaveFile.new(:silksong, opts[:savenum])
         | 
| 7 8 | 
             
                s.load_from_dat
         | 
| 8 9 | 
             
                c = Silkedit::Cheat::Engine.new(s.data)
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                 | 
| 11 | 
            -
                   | 
| 12 | 
            -
             | 
| 13 | 
            -
                   | 
| 14 | 
            -
                   | 
| 15 | 
            -
                   | 
| 16 | 
            -
                   | 
| 10 | 
            +
             | 
| 11 | 
            +
                display_simple_list = lambda do |list, cols|
         | 
| 12 | 
            +
                  max_length = list.map(&:length).max
         | 
| 13 | 
            +
                  display_set = []
         | 
| 14 | 
            +
                  rows = (list.length / cols.to_f).ceil
         | 
| 15 | 
            +
                  row_idx = 0
         | 
| 16 | 
            +
                  max_rows = rows - 1
         | 
| 17 | 
            +
                  list.length.times do |i|
         | 
| 18 | 
            +
                    display_set[row_idx] ||= []
         | 
| 19 | 
            +
                    display_set[row_idx] << list[i]
         | 
| 20 | 
            +
                    row_idx += 1
         | 
| 21 | 
            +
                    row_idx = 0 if row_idx > max_rows
         | 
| 22 | 
            +
                  end
         | 
| 23 | 
            +
                  display_set.map { |row| row.map { |z| z.ljust(max_length) }.join('   ') }.join("\n")
         | 
| 17 24 | 
             
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                if args.empty? || params[:list]
         | 
| 27 | 
            +
                  Rbcli.log.info 'Cheats:'
         | 
| 28 | 
            +
                  Rbcli.log.info display_simple_list.call(c.list_cheats, 5)
         | 
| 29 | 
            +
                  Rbcli.exit(0)
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                changes = args.map do |cht|
         | 
| 33 | 
            +
                  cht = cht.downcase
         | 
| 34 | 
            +
                  status = c.apply_cheat(cht)
         | 
| 35 | 
            +
                  case status
         | 
| 36 | 
            +
                  when :no_cheat
         | 
| 37 | 
            +
                    Rbcli.log.warn "Could not apply cheat #{cht}: Cheat does not exist"
         | 
| 38 | 
            +
                    Rbcli.log.info 'Did you mean one of these?'
         | 
| 39 | 
            +
                    possible_cheats = c.list_cheats.select { |cheat| cheat.include?(cht) }
         | 
| 40 | 
            +
                    Rbcli.log.info display_simple_list.call(possible_cheats, 5)
         | 
| 41 | 
            +
                    nil
         | 
| 42 | 
            +
                  when :failed_act_check
         | 
| 43 | 
            +
                    Rbcli.log.warn "Could not apply cheat #{cht.colorize(:red)}: The player is in the wrong act. Use --(f)orce to override."
         | 
| 44 | 
            +
                    nil
         | 
| 45 | 
            +
                  when :failed_soft_reqs
         | 
| 46 | 
            +
                    Rbcli.log.warn "Could not apply cheat #{cht.colorize(:red)}: Soft requirements not met. Use --(f)orce to apply the required changes."
         | 
| 47 | 
            +
                    nil
         | 
| 48 | 
            +
                  when :failed_hard_reqs
         | 
| 49 | 
            +
                    Rbcli.log.error "Could not apply cheat #{cht.colorize(:red)}: Hard requirements not met. Applying the cheat would cause in-game errors."
         | 
| 50 | 
            +
                    nil
         | 
| 51 | 
            +
                  when :success
         | 
| 52 | 
            +
                    Rbcli.log.info "    Success!".colorize(:green)
         | 
| 53 | 
            +
                    cht
         | 
| 54 | 
            +
                  else
         | 
| 55 | 
            +
                    raise "Unknown status: #{status}"
         | 
| 56 | 
            +
                  end
         | 
| 57 | 
            +
                end
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                if changes.empty?
         | 
| 60 | 
            +
                  Rbcli.log.info ''
         | 
| 61 | 
            +
                  Rbcli.log.info 'No cheats applied'
         | 
| 62 | 
            +
                  Rbcli.exit(0)
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                if changes.include?(nil)
         | 
| 66 | 
            +
                  Rbcli.log.info ''
         | 
| 67 | 
            +
                  Rbcli.log.info 'Some cheats failed to apply. Discarding changes.'
         | 
| 68 | 
            +
                  Rbcli.exit(0)
         | 
| 69 | 
            +
                end
         | 
| 70 | 
            +
             | 
| 71 | 
            +
                s.direct_backup
         | 
| 72 | 
            +
                s.save_to_dat
         | 
| 18 73 | 
             
              end
         | 
| 19 74 | 
             
            end
         | 
    
        data/lib/commands/zone_mkzone.rb
    CHANGED
    
    | @@ -1,25 +1,26 @@ | |
| 1 1 | 
             
            Rbcli.command 'zone' do
         | 
| 2 2 | 
             
              description 'Zones the character to a different respawn point'
         | 
| 3 3 | 
             
              usage '<zone> (--(f)orce)'
         | 
| 4 | 
            -
              parameter :force, 'Force select a spawn point even when requirements are not met. Changes may be made to your savegave.', type: :bool, default: false
         | 
| 5 4 | 
             
              parameter :list, 'Display the full list of zones to select from', type: :bool, default: false
         | 
| 5 | 
            +
              parameter :force, 'Force select a spawn point even when requirements are not met. Changes may be made to your savegave.', type: :bool, default: false
         | 
| 6 6 | 
             
              action do |opts, params, args, config, env|
         | 
| 7 7 | 
             
                s = Silkedit::Savegame::SaveFile.new(:silksong, opts[:savenum])
         | 
| 8 8 | 
             
                s.load_from_dat
         | 
| 9 9 | 
             
                c = Silkedit::Cheat::Engine.new(s.data)
         | 
| 10 10 |  | 
| 11 | 
            -
                 | 
| 11 | 
            +
                display_simple_list = lambda do |list, cols|
         | 
| 12 | 
            +
                  max_length = list.map(&:length).max
         | 
| 12 13 | 
             
                  display_set = []
         | 
| 13 | 
            -
                  rows = ( | 
| 14 | 
            +
                  rows = (list.length / cols.to_f).ceil
         | 
| 14 15 | 
             
                  row_idx = 0
         | 
| 15 16 | 
             
                  max_rows = rows - 1
         | 
| 16 | 
            -
                   | 
| 17 | 
            +
                  list.length.times do |i|
         | 
| 17 18 | 
             
                    display_set[row_idx] ||= []
         | 
| 18 | 
            -
                    display_set[row_idx] <<  | 
| 19 | 
            +
                    display_set[row_idx] << list[i]
         | 
| 19 20 | 
             
                    row_idx += 1
         | 
| 20 21 | 
             
                    row_idx = 0 if row_idx > max_rows
         | 
| 21 22 | 
             
                  end
         | 
| 22 | 
            -
                  display_set.map { |row| row.map { |z| z. | 
| 23 | 
            +
                  display_set.map { |row| row.map { |z| z.ljust(max_length) }.join('   ') }.join("\n")
         | 
| 23 24 | 
             
                end
         | 
| 24 25 |  | 
| 25 26 | 
             
                display_detailed_zone_list = lambda do |list|
         | 
| @@ -33,7 +34,7 @@ Rbcli.command 'zone' do | |
| 33 34 |  | 
| 34 35 | 
             
                if args.empty? || params[:list]
         | 
| 35 36 | 
             
                  Rbcli.log.info 'Shortcuts:'
         | 
| 36 | 
            -
                  Rbcli.log.info  | 
| 37 | 
            +
                  Rbcli.log.info display_simple_list.call(c.list_shortcuts.keys, 5)
         | 
| 37 38 | 
             
                end
         | 
| 38 39 |  | 
| 39 40 | 
             
                if params[:list]
         | 
| @@ -47,20 +48,20 @@ Rbcli.command 'zone' do | |
| 47 48 | 
             
                status = c.zone_to(args.first, force_soft_reqs: params[:force], enforce_min_act: !params[:force])
         | 
| 48 49 | 
             
                case status
         | 
| 49 50 | 
             
                when :no_zone
         | 
| 50 | 
            -
                  Rbcli.log. | 
| 51 | 
            +
                  Rbcli.log.warn "Could not zone to #{args.first}: Specified spawn point does not exist"
         | 
| 51 52 | 
             
                  Rbcli.log.info 'Did you mean one of these?'
         | 
| 52 53 | 
             
                  possible_zones = c.list_zones.select { |zone| zone[:slug].include?(args.first) || !zone[:shortcut].nil? && zone[:shortcut].include?(args.first) }
         | 
| 53 | 
            -
                  Rbcli.log.info display_detailed_zone_list.call(possible_zones)
         | 
| 54 | 
            +
                  Rbcli.log.info display_detailed_zone_list.call(possible_zones, 5)
         | 
| 54 55 | 
             
                when :failed_act_check
         | 
| 55 | 
            -
                  Rbcli.log.warn "Could not zone to #{args.first}: The player is in the wrong act. Use --(f)orce to override."
         | 
| 56 | 
            +
                  Rbcli.log.warn "Could not zone to #{args.first.colorize(:red)}: The player is in the wrong act. Use --(f)orce to override."
         | 
| 56 57 | 
             
                when :failed_soft_reqs
         | 
| 57 | 
            -
                  Rbcli.log.warn "Could not zone to #{args.first}: Soft requirements not met. Use --(f)orce to apply the required changes."
         | 
| 58 | 
            +
                  Rbcli.log.warn "Could not zone to #{args.first.colorize(:red)}: Soft requirements not met. Use --(f)orce to apply the required changes."
         | 
| 58 59 | 
             
                when :failed_hard_reqs
         | 
| 59 | 
            -
                  Rbcli.log.error "Could not zone to #{args.first}: Hard requirements not met. Zoning here would cause errors."
         | 
| 60 | 
            +
                  Rbcli.log.error "Could not zone to #{args.first.colorize(:red)}: Hard requirements not met. Zoning here would cause in-game errors."
         | 
| 60 61 | 
             
                when :success
         | 
| 61 62 | 
             
                  s.direct_backup
         | 
| 62 63 | 
             
                  s.save_to_dat
         | 
| 63 | 
            -
                  Rbcli.log.info "Zoned to #{args.first}"
         | 
| 64 | 
            +
                  Rbcli.log.info "Zoned to #{args.first.colorize(:green)}"
         | 
| 64 65 | 
             
                else
         | 
| 65 66 | 
             
                  raise "Unknown status: #{status}"
         | 
| 66 67 | 
             
                end
         | 
| @@ -33,7 +33,8 @@ module Silkedit::Cheat | |
| 33 33 | 
             
                end
         | 
| 34 34 |  | 
| 35 35 | 
             
                def max_everything
         | 
| 36 | 
            -
                   | 
| 36 | 
            +
                  backup_data = @data.dup
         | 
| 37 | 
            +
                  result = %w[
         | 
| 37 38 | 
             
                    max_health
         | 
| 38 39 | 
             
                    max_silk
         | 
| 39 40 | 
             
                    max_weapon
         | 
| @@ -48,12 +49,31 @@ module Silkedit::Cheat | |
| 48 49 | 
             
                    give_consumables
         | 
| 49 50 | 
             
                    max_rosaries
         | 
| 50 51 | 
             
                    max_shards
         | 
| 51 | 
            -
                  ]. | 
| 52 | 
            +
                  ].map { |cht| self.send(cht.to_sym) }
         | 
| 53 | 
            +
                  if result.all?(:success)
         | 
| 54 | 
            +
                    :success
         | 
| 55 | 
            +
                  else
         | 
| 56 | 
            +
                    @data = backup_data
         | 
| 57 | 
            +
                    result.reject { |r| r == :success }.first
         | 
| 58 | 
            +
                  end
         | 
| 52 59 | 
             
                end
         | 
| 53 60 |  | 
| 54 61 | 
             
                def max_shards
         | 
| 55 62 | 
             
                  Rbcli.log.info 'Applying cheat max_shards', 'CHEATS'
         | 
| 56 63 | 
             
                  @data['playerData']['ShellShards'] = 400 + (@data['playerData']['ToolPouchUpgrades'] || 0) * 100
         | 
| 64 | 
            +
                  :success
         | 
| 65 | 
            +
                end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                def all_crests
         | 
| 68 | 
            +
                  cheatdata = Silkedit::Cheat::SilksongCheats.module_eval { @cheatdata }
         | 
| 69 | 
            +
                  Rbcli.log.info "Applying cheat all_crests", 'CHEATS'
         | 
| 70 | 
            +
                  Silkedit::Cheat.merge_cheat(@data, cheatdata['reference']['all_crests'], should_merge_arrays: true)
         | 
| 71 | 
            +
                  %w[CurrentCrestID PreviousCrestID].each do |equip|
         | 
| 72 | 
            +
                    %w[Hunter Hunter_v2].each do |hunter_crest_version|
         | 
| 73 | 
            +
                      @data['playerData'][equip] = 'Hunter_v3' if @data['playerData'][equip] == hunter_crest_version
         | 
| 74 | 
            +
                    end
         | 
| 75 | 
            +
                  end
         | 
| 76 | 
            +
                  :success
         | 
| 57 77 | 
             
                end
         | 
| 58 78 |  | 
| 59 79 | 
             
                def all_crest_unlocks
         | 
| @@ -68,11 +88,21 @@ module Silkedit::Cheat | |
| 68 88 | 
             
                    end
         | 
| 69 89 | 
             
                    crest['Data']['Slots'].each { |slot| slot['IsUnlocked'] = true }
         | 
| 70 90 | 
             
                  end
         | 
| 91 | 
            +
                  :success
         | 
| 92 | 
            +
                end
         | 
| 93 | 
            +
             | 
| 94 | 
            +
                def overcharge_tools
         | 
| 95 | 
            +
                  Rbcli.log.info "Applying cheat overcharge_tools", 'CHEATS'
         | 
| 96 | 
            +
                  @data['playerData']['Tools']['savedData'].each do |tool|
         | 
| 97 | 
            +
                    tool['Data']['AmountLeft'] = 1000
         | 
| 98 | 
            +
                  end
         | 
| 99 | 
            +
                  :success
         | 
| 71 100 | 
             
                end
         | 
| 72 101 |  | 
| 73 102 | 
             
                def toggle_map_reveal
         | 
| 74 103 | 
             
                  @data['playerData']['mapAllRooms'] = !@data['playerData']['mapAllRooms']
         | 
| 75 104 | 
             
                  Rbcli.log.info "Full map reveal is #{@data['playerData']['mapAllRooms'] ? 'enabled' : 'disabled'}", 'CHEATS'
         | 
| 105 | 
            +
                  :success
         | 
| 76 106 | 
             
                end
         | 
| 77 107 |  | 
| 78 108 | 
             
                def toggle_flea_reveal
         | 
| @@ -80,6 +110,7 @@ module Silkedit::Cheat | |
| 80 110 | 
             
                  is_enabled = flea_keys.all? { |k| @data['playerData'][k] }
         | 
| 81 111 | 
             
                  flea_keys.each { |k| @data[k] = !is_enabled }
         | 
| 82 112 | 
             
                  Rbcli.log.info "Flea locations are #{is_enabled ? 'hidden' : 'revealed'} on map", 'CHEATS'
         | 
| 113 | 
            +
                  :success
         | 
| 83 114 | 
             
                end
         | 
| 84 115 |  | 
| 85 116 | 
             
                def toggle_cloakless
         | 
| @@ -110,18 +141,21 @@ module Silkedit::Cheat | |
| 110 141 | 
             
                    # @data['playerData']['slab_cloak_battle_completed'] = true
         | 
| 111 142 | 
             
                    @data['playerData']['IsSilkSpoolBroken'] = false
         | 
| 112 143 | 
             
                  end
         | 
| 144 | 
            +
                  :success
         | 
| 113 145 | 
             
                end
         | 
| 114 146 |  | 
| 115 147 | 
             
                def toggle_permadeath_mode
         | 
| 116 148 | 
             
                  toggle = @data['playerData']['permadeathMode'] == 0
         | 
| 117 149 | 
             
                  Rbcli.log.info "Toggling permadeath mode #{toggle ? 'ON' : 'OFF'}", 'CHEATS'
         | 
| 118 150 | 
             
                  @data['playerData']['permadeathMode'] = toggle ? 1 : 0
         | 
| 151 | 
            +
                  :success
         | 
| 119 152 | 
             
                end
         | 
| 120 153 |  | 
| 121 154 | 
             
                def toggle_fly_mode
         | 
| 122 155 | 
             
                  toggle = @data['playerData']['infiniteAirJump'] == false
         | 
| 123 156 | 
             
                  Rbcli.log.info "Toggling fly mode #{toggle ? 'ON' : 'OFF'}", 'CHEATS'
         | 
| 124 157 | 
             
                  @data['playerData']['infiniteAirJump'] = toggle ? true : false
         | 
| 158 | 
            +
                  :success
         | 
| 125 159 | 
             
                end
         | 
| 126 160 | 
             
              end
         | 
| 127 161 | 
             
            end
         | 
| @@ -25,7 +25,7 @@ module Silkedit::Cheat | |
| 25 25 | 
             
                  zonelist = Silkedit::Cheat::SilksongZoner.module_eval { @zonelist }
         | 
| 26 26 | 
             
                  shortcuts = Silkedit::Cheat::SilksongZoner.module_eval { @shortcuts }
         | 
| 27 27 | 
             
                  Rbcli.log.info "Zoning to #{zone}", 'ZONER'
         | 
| 28 | 
            -
                  return self.zone_to(shortcuts[zone]) if shortcuts.key?(zone)
         | 
| 28 | 
            +
                  return self.zone_to(shortcuts[zone], force_soft_reqs: force_soft_reqs, enforce_min_act: enforce_min_act) if shortcuts.key?(zone)
         | 
| 29 29 | 
             
                  return :no_zone unless zonelist.find { |z| z['slug'] == zone }
         | 
| 30 30 | 
             
                  region, target = zone.split('.')
         | 
| 31 31 | 
             
                  Silkedit::Cheat.merge_cheat(
         |