Lots of rubocop

This commit is contained in:
Maruno17
2023-01-28 15:21:12 +00:00
parent 2d056052ce
commit 13aab8d911
159 changed files with 1679 additions and 1931 deletions

View File

@@ -436,9 +436,7 @@ MenuHandlers.add(:debug_menu, :encounter_version, {
params.setInitialValue($PokemonGlobal.encounter_version)
params.setCancelValue(-1)
value = pbMessageChooseNumber(_INTL("Set encounters version to which value?"), params)
if value >= 0
$PokemonGlobal.encounter_version = value
end
$PokemonGlobal.encounter_version = value if value >= 0
}
})
@@ -457,7 +455,7 @@ MenuHandlers.add(:debug_menu, :add_item, {
"parent" => :items_menu,
"description" => _INTL("Choose an item and a quantity of it to add to the Bag."),
"effect" => proc {
pbListScreenBlock(_INTL("ADD ITEM"), ItemLister.new) { |button, item|
pbListScreenBlock(_INTL("ADD ITEM"), ItemLister.new) do |button, item|
if button == Input::USE && item
params = ChooseNumberParams.new
params.setRange(1, Settings::BAG_MAX_PER_SLOT)
@@ -470,7 +468,7 @@ MenuHandlers.add(:debug_menu, :add_item, {
pbMessage(_INTL("Gave {1}x {2}.", qty, GameData::Item.get(item).name))
end
end
}
end
}
})
@@ -558,17 +556,15 @@ MenuHandlers.add(:debug_menu, :give_demo_party, {
"effect" => proc {
party = []
species = [:PIKACHU, :PIDGEOTTO, :KADABRA, :GYARADOS, :DIGLETT, :CHANSEY]
species.each do |id|
party.push(id) if GameData::Species.exists?(id)
end
species.each { |id| party.push(id) if GameData::Species.exists?(id) }
$player.party.clear
# Generate Pokémon of each species at level 20
party.each do |species|
pkmn = Pokemon.new(species, 20)
party.each do |spec|
pkmn = Pokemon.new(spec, 20)
$player.party.push(pkmn)
$player.pokedex.register(pkmn)
$player.pokedex.set_owned(species)
case species
$player.pokedex.set_owned(spec)
case spec
when :PIDGEOTTO
pkmn.learn_move(:FLY)
when :KADABRA
@@ -617,7 +613,7 @@ MenuHandlers.add(:debug_menu, :quick_hatch_party_eggs, {
MenuHandlers.add(:debug_menu, :fill_boxes, {
"name" => _INTL("Fill Storage Boxes"),
"parent" => :pokemon_menu,
"description" => _INTL("Add one Pokémon of each species (at Level 50) to storage."),
"description" => _INTL("Puts one Pokémon of each species (at Level 50) in storage."),
"effect" => proc {
added = 0
box_qty = $PokemonStorage.maxPokemon(0)
@@ -680,11 +676,11 @@ MenuHandlers.add(:debug_menu, :open_storage, {
"parent" => :pokemon_menu,
"description" => _INTL("Opens the Pokémon storage boxes in Organize Boxes mode."),
"effect" => proc {
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonStorageScene.new
screen = PokemonStorageScreen.new(scene, $PokemonStorage)
screen.pbStartScreen(0)
}
end
}
})
@@ -1010,11 +1006,11 @@ MenuHandlers.add(:debug_menu, :position_sprites, {
"parent" => :editors_menu,
"description" => _INTL("Reposition Pokémon sprites in battle."),
"effect" => proc {
pbFadeOutIn {
pbFadeOutIn do
sp = SpritePositioner.new
sps = SpritePositionerScreen.new(sp)
sps.pbStart
}
end
}
})

View File

@@ -329,12 +329,12 @@ def pbDebugDayCare
case pbMessage("\\ts[]" + msg,
[_INTL("Summary"), _INTL("Withdraw"), _INTL("Cancel")], 3)
when 0 # Summary
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonSummary_Scene.new
screen = PokemonSummaryScreen.new(scene, false)
screen.pbStartScreen([pkmn], 0)
need_refresh = true
}
end
when 1 # Withdraw
if $player.party_full?
pbMessage(_INTL("Party is full, can't withdraw Pokémon."))
@@ -557,9 +557,9 @@ def pbExportAllAnimations
Graphics.update
safename = anim.name.gsub(/\W/, "_")
Dir.mkdir("Animations/#{safename}") rescue nil
File.open("Animations/#{safename}/#{safename}.anm", "wb") { |f|
File.open("Animations/#{safename}/#{safename}.anm", "wb") do |f|
f.write(dumpBase64Anim(anim))
}
end
if anim.graphic && anim.graphic != ""
graphicname = RTP.getImagePath("Graphics/Animations/" + anim.graphic)
pbSafeCopyFile(graphicname, "Animations/#{safename}/" + File.basename(graphicname))
@@ -592,12 +592,10 @@ end
def pbImportAllAnimations
animationFolders = []
if safeIsDirectory?("Animations")
Dir.foreach("Animations") { |fb|
Dir.foreach("Animations") do |fb|
f = "Animations/" + fb
if safeIsDirectory?(f) && fb != "." && fb != ".."
animationFolders.push(f)
end
}
animationFolders.push(f) if safeIsDirectory?(f) && fb != "." && fb != ".."
end
end
if animationFolders.length == 0
pbMessage(_INTL("There are no animations to import. Put each animation in a folder within the Animations folder."))
@@ -610,24 +608,24 @@ def pbImportAllAnimations
Graphics.update
audios = []
files = Dir.glob(folder + "/*.*")
["wav", "ogg", "mid", "wma"].each { |ext| # mp3
["wav", "ogg", "mid", "wma"].each do |ext| # mp3
upext = ext.upcase
audios.concat(files.find_all { |f| f[f.length - 3, 3] == ext })
audios.concat(files.find_all { |f| f[f.length - 3, 3] == upext })
}
end
audios.each do |audio|
pbSafeCopyFile(audio, RTP.getAudioPath("Audio/SE/Anim/" + File.basename(audio)), "Audio/SE/Anim/" + File.basename(audio))
end
images = []
["png", "gif"].each { |ext| # jpg jpeg bmp
["png", "gif"].each do |ext| # jpg jpeg bmp
upext = ext.upcase
images.concat(files.find_all { |f| f[f.length - 3, 3] == ext })
images.concat(files.find_all { |f| f[f.length - 3, 3] == upext })
}
end
images.each do |image|
pbSafeCopyFile(image, RTP.getImagePath("Graphics/Animations/" + File.basename(image)), "Graphics/Animations/" + File.basename(image))
end
Dir.glob(folder + "/*.anm") { |f|
Dir.glob(folder + "/*.anm") do |f|
textdata = loadBase64Anim(IO.read(f)) rescue nil
if textdata.is_a?(PBAnimation)
index = pbAllocateAnimation(animations, textdata.name)
@@ -650,7 +648,7 @@ def pbImportAllAnimations
end
animations[index] = textdata
end
}
end
end
save_data(animations, "Data/PkmnAnimations.rxdata")
$game_temp.battle_animations_data = nil
@@ -788,7 +786,7 @@ class PokemonDebugPartyScreen
@messageBox.text = text
@messageBox.visible = true
@helpWindow.visible = false
using(cmdwindow = Window_CommandPokemon.new([_INTL("Yes"), _INTL("No")])) {
using(cmdwindow = Window_CommandPokemon.new([_INTL("Yes"), _INTL("No")])) do
cmdwindow.visible = false
pbBottomRight(cmdwindow)
cmdwindow.y -= @messageBox.height
@@ -809,7 +807,7 @@ class PokemonDebugPartyScreen
end
end
end
}
end
@messageBox.visible = false
@helpWindow.visible = true
return ret
@@ -818,7 +816,7 @@ class PokemonDebugPartyScreen
def pbShowCommands(text, commands, index = 0)
ret = -1
@helpWindow.visible = true
using(cmdwindow = Window_CommandPokemonColor.new(commands)) {
using(cmdwindow = Window_CommandPokemonColor.new(commands)) do
cmdwindow.z = @viewport.z + 1
cmdwindow.index = index
pbBottomRight(cmdwindow)
@@ -840,7 +838,7 @@ class PokemonDebugPartyScreen
break
end
end
}
end
return ret
end

View File

@@ -295,7 +295,6 @@ MenuHandlers.add(:battle_pokemon_debug_menu, :hidden_values, {
"effect" => proc { |pkmn, battler, battle|
cmd = 0
loop do
persid = sprintf("0x%08X", pkmn.personalID)
cmd = pbMessage("\\ts[]" + _INTL("Choose hidden values to edit."),
[_INTL("Set EVs"), _INTL("Set IVs")], -1, nil, cmd)
break if cmd < 0

View File

@@ -6,11 +6,11 @@ module FilenameUpdater
def readDirectoryFiles(directory, formats)
files = []
Dir.chdir(directory) {
Dir.chdir(directory) do
formats.each do |format|
Dir.glob(format) { |f| files.push(f) }
end
}
end
return files
end