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

@@ -344,7 +344,7 @@ end
#===============================================================================
def pbTrainerTypeEditor
properties = GameData::TrainerType.editor_properties
pbListScreenBlock(_INTL("Trainer Types"), TrainerTypeLister.new(0, true)) { |button, tr_type|
pbListScreenBlock(_INTL("Trainer Types"), TrainerTypeLister.new(0, true)) do |button, tr_type|
if tr_type
case button
when Input::ACTION
@@ -386,7 +386,7 @@ def pbTrainerTypeEditor
end
end
end
}
end
end
def pbTrainerTypeEditorNew(default_name)
@@ -477,7 +477,7 @@ end
#===============================================================================
def pbTrainerBattleEditor
modified = false
pbListScreenBlock(_INTL("Trainer Battles"), TrainerBattleLister.new(0, true)) { |button, trainer_id|
pbListScreenBlock(_INTL("Trainer Battles"), TrainerBattleLister.new(0, true)) do |button, trainer_id|
if trainer_id
case button
when Input::ACTION
@@ -589,7 +589,7 @@ def pbTrainerBattleEditor
end
end
end
}
end
if modified && pbConfirmMessage(_INTL("Save changes?"))
GameData::Trainer.save
pbConvertTrainerData
@@ -821,7 +821,7 @@ end
#===============================================================================
def pbItemEditor
properties = GameData::Item.editor_properties
pbListScreenBlock(_INTL("Items"), ItemLister.new(0, true)) { |button, item|
pbListScreenBlock(_INTL("Items"), ItemLister.new(0, true)) do |button, item|
if item
case button
when Input::ACTION
@@ -863,7 +863,7 @@ def pbItemEditor
end
end
end
}
end
end
def pbItemEditorNew(default_name)
@@ -925,7 +925,7 @@ end
#===============================================================================
def pbPokemonEditor
properties = GameData::Species.editor_properties
pbListScreenBlock(_INTL("Pokémon species"), SpeciesLister.new(0, false)) { |button, species|
pbListScreenBlock(_INTL("Pokémon species"), SpeciesLister.new(0, false)) do |button, species|
if species
case button
when Input::ACTION
@@ -983,7 +983,7 @@ def pbPokemonEditor
end
end
end
}
end
end
#===============================================================================

View File

@@ -227,12 +227,12 @@ end
#
#===============================================================================
def pbTilesetScreen
pbFadeOutIn {
pbFadeOutIn do
Graphics.resize_screen(Settings::SCREEN_WIDTH, Settings::SCREEN_HEIGHT * 2)
pbSetResizeFactor(1)
scene = PokemonTilesetScene.new
scene.pbStartScene
Graphics.resize_screen(Settings::SCREEN_WIDTH, Settings::SCREEN_HEIGHT)
pbSetResizeFactor($PokemonSystem.screensize)
}
end
end

View File

@@ -271,9 +271,7 @@ class MapScreenScene
while j < ret.length && !connectionsSymmetric?(ret[j], conn)
j += 1
end
if j == ret.length
ret.push(conn)
end
ret.push(conn) if j == ret.length
end
end
return ret
@@ -567,7 +565,7 @@ end
#
#===============================================================================
def pbConnectionsEditor
pbCriticalCode {
pbCriticalCode do
Graphics.resize_screen(Settings::SCREEN_WIDTH + 288, Settings::SCREEN_HEIGHT + 288)
pbSetResizeFactor(1)
mapscreen = MapScreenScene.new
@@ -576,5 +574,5 @@ def pbConnectionsEditor
mapscreen.close
Graphics.resize_screen(Settings::SCREEN_WIDTH, Settings::SCREEN_HEIGHT)
pbSetResizeFactor($PokemonSystem.screensize)
}
end
end

View File

@@ -77,11 +77,11 @@ def pbMapTree
maplevels.push([i, level, info.parent_id, info.order])
end
end
maplevels.sort! { |a, b|
maplevels.sort! do |a, b|
next a[1] <=> b[1] if a[1] != b[1] # level
next a[2] <=> b[2] if a[2] != b[2] # parent ID
next a[3] <=> b[3] # order
}
end
stack = []
stack.push(0, 0)
while stack.length > 0
@@ -133,15 +133,15 @@ end
# the ID of the species to initially select. Pressing Input::ACTION will toggle
# the list sorting between numerical and alphabetical.
def pbChooseSpeciesList(default = nil)
return pbChooseFromGameDataList(:Species, default) { |data|
return pbChooseFromGameDataList(:Species, default) do |data|
next (data.form > 0) ? nil : data.real_name
}
end
end
def pbChooseSpeciesFormList(default = nil)
return pbChooseFromGameDataList(:Species, default) { |data|
return pbChooseFromGameDataList(:Species, default) do |data|
next (data.form > 0) ? sprintf("%s_%d", data.real_name, data.form) : data.real_name
}
end
end
# Displays a list of all types, and returns the ID of the type selected (or nil
@@ -149,9 +149,9 @@ end
# to initially select. Pressing Input::ACTION will toggle the list sorting
# between numerical and alphabetical.
def pbChooseTypeList(default = nil)
return pbChooseFromGameDataList(:Type, default) { |data|
return pbChooseFromGameDataList(:Type, default) do |data|
next (data.pseudo_type) ? nil : data.real_name
}
end
end
# Displays a list of all items, and returns the ID of the item selected (or nil

View File

@@ -32,9 +32,7 @@ class Window_Menu < Window_CommandPokemon
rc = Rect.new(0, 32 * (i - toprow), self.contents.width, 32)
rc.x += self.x + self.leftEdge
rc.y += self.y + self.topEdge
if rc.contains(mousepos[0], mousepos[1])
return i
end
return i if rc.contains(mousepos[0], mousepos[1])
end
return -1
end
@@ -341,8 +339,7 @@ class InvalidatableSprite < Sprite
# Redraws the sprite. This method should not check whether
# the sprite is invalid, to allow it to be explicitly called.
def refresh
end
def refresh; end
end
#===============================================================================
@@ -820,11 +817,11 @@ class AnimationCanvas < Sprite
currentFrame = getCurrentFrame
if currentFrame && !@selecting &&
(Input.triggerex?(:TAB) || Input.repeatex?(:TAB))
currentFrame.length.times {
currentFrame.length.times do
@currentcel += 1
@currentcel = 0 if @currentcel >= currentFrame.length
break if currentFrame[@currentcel]
}
end
invalidate
return
end

View File

@@ -72,21 +72,19 @@ class UIControl
return @invalid
end
def invalidate # Marks that the control must be redrawn to reflect current logic
def invalidate # Marks that the control must be redrawn to reflect current logic
@invalid = true
end
def update # Updates the logic on the control, invalidating it if necessary
end
def update; end # Updates the logic on the control, invalidating it if necessary
def refresh # Redraws the control
end
def refresh; end # Redraws the control
def validate # Makes the control no longer invalid
def validate # Makes the control no longer invalid
@invalid = false
end
def repaint # Redraws the control only if it is invalid
def repaint # Redraws the control only if it is invalid
if self.invalid?
self.refresh
self.validate
@@ -208,9 +206,7 @@ class Checkbox < Button
else
bitmap.fill_rect(x + 2, y + 2, width - 4, height - 4, Color.new(0, 0, 0, 0))
end
if self.checked
shadowtext(bitmap, x, y, 32, 32, "X", @disabled, 1)
end
shadowtext(bitmap, x, y, 32, 32, "X", @disabled, 1) if self.checked
size = bitmap.text_size(self.label).width
shadowtext(bitmap, x + 36, y, size, height, self.label, @disabled)
return ret
@@ -241,9 +237,7 @@ class TextField < UIControl
chars = self.text.scan(/./m)
chars.insert(@cursor, ch)
@text = ""
chars.each do |ch|
@text += ch
end
chars.each { |char| @text += char }
@cursor += 1
@frame = 0
self.changed = true
@@ -254,9 +248,7 @@ class TextField < UIControl
chars = self.text.scan(/./m)
chars.delete_at(@cursor - 1)
@text = ""
chars.each do |ch|
@text += ch
end
chars.each { |char| @text += char }
@cursor -= 1
@frame = 0
self.changed = true
@@ -533,6 +525,8 @@ class OptionalSlider < Slider
@checkbox.refresh
end
#-----------------------------------------------------------------------------
private
def updatedefs
@@ -786,6 +780,8 @@ class OptionalTextSlider < TextSlider
@checkbox.refresh
end
#-----------------------------------------------------------------------------
private
def updatedefs

View File

@@ -132,13 +132,9 @@ class PointPath
end
def smoothPointPath(frames, roundValues = false)
if frames < 0
raise ArgumentError.new("frames out of range: #{frames}")
end
raise ArgumentError.new("frames out of range: #{frames}") if frames < 0
ret = PointPath.new
if @points.length == 0
return ret
end
return ret if @points.length == 0
step = 1.0 / frames
t = 0.0
(frames + 2).times do
@@ -160,9 +156,7 @@ class PointPath
end
return nil if @points.length == 0
ret = @points[@points.length - 1].clone
if @points.length == 1
return ret
end
return ret if @points.length == 1
curdist = 0
distForT = @totaldist * t
i = 0
@@ -217,9 +211,7 @@ def getCurvePoint(src, t)
end
def curveToPointPath(curve, numpoints)
if numpoints < 2
return nil
end
return nil if numpoints < 2
path = PointPath.new
step = 1.0 / (numpoints - 1)
t = 0.0
@@ -311,9 +303,7 @@ def pbDefinePath(canvas)
end
mousepos = Mouse.getMousePos(true)
newtext = (mousepos) ? sprintf("(%d,%d)", mousepos[0], mousepos[1]) : "(??,??)"
if window.text != newtext
window.text = newtext
end
window.text = newtext if window.text != newtext
if curve[0].visible && curve[3].visible &&
!curve[0].dragging && !curve[3].dragging
points.each do |point|
@@ -332,10 +322,10 @@ def pbDefinePath(canvas)
if showline
step = 1.0 / (points.length - 1)
t = 0.0
points.length.times do |i|
points.length.times do |j|
point = getCurvePoint(curve, t)
points[i].x = point[0]
points[i].y = point[1]
points[j].x = point[0]
points[j].y = point[1]
t += step
end
end
@@ -418,14 +408,14 @@ def pbDefinePath(canvas)
end
thiscel = canvas.currentCel
celnumber = canvas.currentcel
(canvas.currentframe...neededsize).each do |i|
cel = canvas.animation[i][celnumber]
if !canvas.animation[i][celnumber]
(canvas.currentframe...neededsize).each do |j|
cel = canvas.animation[j][celnumber]
if !canvas.animation[j][celnumber]
cel = pbCreateCel(0, 0, thiscel[AnimFrame::PATTERN], canvas.animation.position)
canvas.animation[i][celnumber] = cel
canvas.animation[j][celnumber] = cel
end
cel[AnimFrame::X] = path[i - canvas.currentframe][0]
cel[AnimFrame::Y] = path[i - canvas.currentframe][1]
cel[AnimFrame::X] = path[j - canvas.currentframe][0]
cel[AnimFrame::Y] = path[j - canvas.currentframe][1]
end
break
elsif sliderwin2.changed?(cancelbutton) || Input.trigger?(Input::BACK)

View File

@@ -26,9 +26,9 @@ def pbExportAnim(animations)
if filename != ""
begin
filename += ".anm"
File.open(filename, "wb") { |f|
File.open(filename, "wb") do |f|
f.write(dumpBase64Anim(animations[animations.selected]))
}
end
failed = false
rescue
pbMessage(_INTL("Couldn't save the animation to {1}.", filename))
@@ -43,9 +43,7 @@ end
def pbImportAnim(animations, canvas, animwin)
animfiles = []
pbRgssChdir(".") {
animfiles.concat(Dir.glob("*.anm"))
}
pbRgssChdir(".") { animfiles.concat(Dir.glob("*.anm")) }
cmdwin = pbListWindow(animfiles, 320)
cmdwin.opacity = 200
cmdwin.height = 480

View File

@@ -25,9 +25,7 @@ end
#===============================================================================
def pbSelectAnim(canvas, animwin)
animfiles = []
pbRgssChdir(File.join("Graphics", "Animations")) {
animfiles.concat(Dir.glob("*.png"))
}
pbRgssChdir(File.join("Graphics", "Animations")) { animfiles.concat(Dir.glob("*.png")) }
cmdwin = pbListWindow(animfiles, 320)
cmdwin.opacity = 200
cmdwin.height = 512
@@ -507,12 +505,12 @@ def pbSelectSE(canvas, audio)
displayname = (filename != "") ? filename : _INTL("<user's cry>")
animfiles = []
ret = false
pbRgssChdir(File.join("Audio", "SE", "Anim")) {
pbRgssChdir(File.join("Audio", "SE", "Anim")) do
animfiles.concat(Dir.glob("*.wav"))
# animfiles.concat(Dir.glob("*.mp3"))
animfiles.concat(Dir.glob("*.ogg"))
animfiles.concat(Dir.glob("*.wma"))
}
end
animfiles.uniq!
animfiles.sort! { |a, b| a.downcase <=> b.downcase }
animfiles = [_INTL("[Play user's cry]")] + animfiles
@@ -535,13 +533,11 @@ def pbSelectSE(canvas, audio)
Input.update
cmdwin.update
maxsizewindow.update
if maxsizewindow.changed?(3) && animfiles.length > 0 # Play Sound
if maxsizewindow.changed?(3) && animfiles.length > 0 # Play Sound
fname = (cmdwin.index == 0) ? "Cries/001Cry" : "Anim/" + filename
pbSEPlay(RPG::AudioFile.new(fname, maxsizewindow.value(1), maxsizewindow.value(2)))
end
if maxsizewindow.changed?(4) && animfiles.length > 0 # Stop Sound
pbSEStop
end
pbSEStop if maxsizewindow.changed?(4) && animfiles.length > 0 # Stop Sound
if maxsizewindow.changed?(5) # OK
audio.name = File.basename(filename, ".*")
audio.volume = maxsizewindow.value(1)
@@ -549,9 +545,7 @@ def pbSelectSE(canvas, audio)
ret = true
break
end
if maxsizewindow.changed?(6) # Cancel
break
end
break if maxsizewindow.changed?(6) # Cancel
if Input.trigger?(Input::USE) && animfiles.length > 0
filename = (cmdwin.index == 0) ? "" : cmdwin.commands[cmdwin.index]
displayname = (filename != "") ? filename : _INTL("<user's cry>")
@@ -571,13 +565,13 @@ def pbSelectBG(canvas, timing)
animfiles = []
animfiles[cmdErase = animfiles.length] = _INTL("[Erase background graphic]")
ret = false
pbRgssChdir(File.join("Graphics", "Animations")) {
pbRgssChdir(File.join("Graphics", "Animations")) do
animfiles.concat(Dir.glob("*.png"))
animfiles.concat(Dir.glob("*.gif"))
# animfiles.concat(Dir.glob("*.jpg"))
# animfiles.concat(Dir.glob("*.jpeg"))
# animfiles.concat(Dir.glob("*.bmp"))
}
end
animfiles.map! { |f| File.basename(f, ".*") }
animfiles.uniq!
animfiles.sort! { |a, b| a.downcase <=> b.downcase }
@@ -615,9 +609,7 @@ def pbSelectBG(canvas, timing)
ret = true
break
end
if maxsizewindow.changed?(9) # Cancel
break
end
break if maxsizewindow.changed?(9) # Cancel
if Input.trigger?(Input::USE) && animfiles.length > 0
filename = (cmdwin.index == cmdErase) ? "" : cmdwin.commands[cmdwin.index]
maxsizewindow.controls[0].text = _INTL("File: \"{1}\"", filename)
@@ -676,9 +668,7 @@ def pbEditBG(canvas, timing)
end
break
end
if maxsizewindow.changed?(9) # Cancel
break
end
break if maxsizewindow.changed?(9) # Cancel
if Input.trigger?(Input::BACK)
break
end
@@ -1001,9 +991,7 @@ def animationEditorMain(animation)
sidewin.update
animwin.update
bottomwindow.update
if animwin.changed?
canvas.pattern = animwin.selected
end
canvas.pattern = animwin.selected if animwin.changed?
if Input.trigger?(Input::BACK)
if pbConfirmMessage(_INTL("Save changes?"))
save_data(animation, "Data/PkmnAnimations.rxdata")
@@ -1031,9 +1019,7 @@ def animationEditorMain(animation)
Clipboard.setData(canvas.animation[canvas.currentframe], "PBAnimFrame")
end
when 1 # Paste
if canvas.currentframe >= 0
canvas.pasteFrame(canvas.currentframe)
end
canvas.pasteFrame(canvas.currentframe) if canvas.currentframe >= 0
when 2 # Clear Frame
canvas.clearFrame(canvas.currentframe)
when 3 # Insert Frame
@@ -1076,9 +1062,7 @@ def animationEditorMain(animation)
canvas.deleteCel(canvas.currentcel)
end
when 2 # Copy
if canvas.currentCel
Clipboard.setData(canvas.currentCel, "PBAnimCel")
end
Clipboard.setData(canvas.currentCel, "PBAnimCel") if canvas.currentCel
when 3 # Paste
canvas.pasteCel(mousepos[0], mousepos[1])
when 4 # Delete
@@ -1087,9 +1071,7 @@ def animationEditorMain(animation)
if canvas.currentcel && canvas.currentcel >= 2
cel1 = canvas.currentcel
cel2 = pbChooseNum(cel1)
if cel2 >= 2 && cel1 != cel2
canvas.swapCels(cel1, cel2)
end
canvas.swapCels(cel1, cel2) if cel2 >= 2 && cel1 != cel2
end
when 6 # Extrapolate Path
if canvas.currentCel
@@ -1128,9 +1110,7 @@ def animationEditorMain(animation)
indexes = [2, 1, 3, 4] # Keeping backwards compatibility
positions.length.times do |i|
selected = "[ ]"
if animation[animation.selected].position == indexes[i]
selected = "[x]"
end
selected = "[x]" if animation[animation.selected].position == indexes[i]
positions[i] = sprintf("%s %s", selected, positions[i])
end
pos = pbShowCommands(nil, positions, -1)

View File

@@ -1558,8 +1558,8 @@ class EvolutionsProperty
ret = ""
value.length.times do |i|
ret << "," if i > 0
ret << value[i][0].to_s + ","
ret << value[i][1].to_s + ","
ret << (value[i][0].to_s + ",")
ret << (value[i][1].to_s + ",")
ret << value[i][2].to_s if value[i][2]
end
return ret

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

View File

@@ -93,18 +93,14 @@ def pbListScreenBlock(title, lister)
if Input.trigger?(Input::ACTION)
yield(Input::ACTION, lister.value(selectedmap))
list.commands = lister.commands
if list.index == list.commands.length
list.index = list.commands.length
end
list.index = list.commands.length if list.index == list.commands.length
lister.refresh(list.index)
elsif Input.trigger?(Input::BACK)
break
elsif Input.trigger?(Input::USE)
yield(Input::USE, lister.value(selectedmap))
list.commands = lister.commands
if list.index == list.commands.length
list.index = list.commands.length
end
list.index = list.commands.length if list.index == list.commands.length
lister.refresh(list.index)
end
end
@@ -146,13 +142,13 @@ class GraphicsLister
def commands
@commands.clear
Dir.chdir(@folder) {
Dir.chdir(@folder) do
Dir.glob("*.png") { |f| @commands.push(f) }
Dir.glob("*.gif") { |f| @commands.push(f) }
# Dir.glob("*.jpg") { |f| @commands.push(f) }
# Dir.glob("*.jpeg") { |f| @commands.push(f) }
# Dir.glob("*.bmp") { |f| @commands.push(f) }
}
end
@commands.sort!
@commands.length.times do |i|
@index = i if @commands[i] == @selection
@@ -199,8 +195,7 @@ class MusicFileLister
pbPlayBGM(@oldbgm)
end
def setViewport(viewport)
end
def setViewport(viewport); end
def getPlayingBGM
($game_system) ? $game_system.getPlayingBGM : nil
@@ -217,13 +212,13 @@ class MusicFileLister
def commands
folder = (@bgm) ? "Audio/BGM/" : "Audio/ME/"
@commands.clear
Dir.chdir(folder) {
Dir.chdir(folder) do
# Dir.glob("*.mp3") { |f| @commands.push(f) }
Dir.glob("*.ogg") { |f| @commands.push(f) }
Dir.glob("*.wav") { |f| @commands.push(f) }
Dir.glob("*.mid") { |f| @commands.push(f) }
Dir.glob("*.midi") { |f| @commands.push(f) }
}
end
@commands.uniq!
@commands.sort! { |a, b| a.downcase <=> b.downcase }
@commands.length.times do |i|
@@ -325,9 +320,7 @@ class MapLister
def commands
@commands.clear
if @addGlobalOffset == 1
@commands.push(_INTL("[GLOBAL]"))
end
@commands.push(_INTL("[GLOBAL]")) if @addGlobalOffset == 1
@maps.length.times do |i|
@commands.push(sprintf("%s%03d %s", (" " * @maps[i][2]), @maps[i][0], @maps[i][1]))
end
@@ -578,7 +571,7 @@ class TrainerBattleLister
cmds.push([idx, trainer.trainer_type, trainer.real_name, trainer.version])
idx += 1
end
cmds.sort! { |a, b|
cmds.sort! do |a, b|
if a[1] == b[1]
if a[2] == b[2]
(a[3] == b[3]) ? a[0] <=> b[0] : a[3] <=> b[3]
@@ -588,7 +581,7 @@ class TrainerBattleLister
else
a[1].to_s.downcase <=> b[1].to_s.downcase
end
}
end
if @includeNew
@commands.push(_INTL("[NEW TRAINER BATTLE]"))
@ids.push(true)