mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Cleaned up evolution method definitions, rewrote the "Fill Bag" Debug feature to make it much faster, removed all instances of changing the game window's title
This commit is contained in:
@@ -483,7 +483,7 @@ DebugMenuCommands.register("additem", {
|
||||
DebugMenuCommands.register("fillbag", {
|
||||
"parent" => "itemsmenu",
|
||||
"name" => _INTL("Fill Bag"),
|
||||
"description" => _INTL("Add a certain number of every item to the Bag."),
|
||||
"description" => _INTL("Empties the Bag and then fills it with a certain number of every item."),
|
||||
"effect" => proc {
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(1, Settings::BAG_MAX_PER_SLOT)
|
||||
@@ -491,7 +491,19 @@ DebugMenuCommands.register("fillbag", {
|
||||
params.setCancelValue(0)
|
||||
qty = pbMessageChooseNumber(_INTL("Choose the number of items."), params)
|
||||
if qty > 0
|
||||
GameData::Item.each { |i| $PokemonBag.pbStoreItem(i.id, qty) }
|
||||
$PokemonBag.clear
|
||||
# NOTE: This doesn't simply use $PokemonBag.pbStoreItem for every item in
|
||||
# turn, because that's really slow when done in bulk.
|
||||
pocket_sizes = Settings::BAG_MAX_POCKET_SIZE
|
||||
bag = $PokemonBag.pockets # Called here so that it only rearranges itself once
|
||||
GameData::Item.each do |i|
|
||||
next if !pocket_sizes[i.pocket] || pocket_sizes[i.pocket] == 0
|
||||
next if bag[i.pocket].length >= pocket_sizes[i.pocket]
|
||||
item_qty = (i.is_important?) ? 1 : qty
|
||||
bag[i.pocket].push([i.id, item_qty])
|
||||
end
|
||||
# NOTE: Auto-sorting pockets don't need to be sorted afterwards, because
|
||||
# items are added in the same order they would be sorted into.
|
||||
pbMessage(_INTL("The Bag was filled with {1} of each item.", qty))
|
||||
end
|
||||
}
|
||||
@@ -1081,7 +1093,7 @@ DebugMenuCommands.register("compiledata", {
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
msgwindow = pbCreateMessageWindow
|
||||
Compiler.compile_all(true) { |msg| pbMessageDisplay(msgwindow, msg, false); echoln(msg) }
|
||||
Compiler.compile_all(true) { |msg| echoln msg }
|
||||
pbMessageDisplay(msgwindow, _INTL("All game data was compiled."))
|
||||
pbDisposeMessageWindow(msgwindow)
|
||||
}
|
||||
|
||||
@@ -681,21 +681,22 @@ end
|
||||
# Properly erases all non-existent tiles in maps (including event graphics)
|
||||
#===============================================================================
|
||||
def pbDebugFixInvalidTiles
|
||||
num_errors = 0
|
||||
total_errors = 0
|
||||
num_error_maps = 0
|
||||
tilesets = $data_tilesets
|
||||
mapData = Compiler::MapData.new
|
||||
t = Time.now.to_i
|
||||
Graphics.update
|
||||
total_maps = mapData.mapinfos.keys.length
|
||||
echoln _INTL("Checking {1} maps for invalid tiles...", total_maps)
|
||||
for id in mapData.mapinfos.keys.sort
|
||||
if Time.now.to_i - t >= 5
|
||||
Graphics.update
|
||||
t = Time.now.to_i
|
||||
end
|
||||
changed = false
|
||||
map_errors = 0
|
||||
map = mapData.getMap(id)
|
||||
next if !map || !mapData.mapinfos[id]
|
||||
pbSetWindowText(_INTL("Processing map {1} ({2})", id, mapData.mapinfos[id].name))
|
||||
passages = mapData.getTilesetPassages(map, id)
|
||||
# Check all tiles in map for non-existent tiles
|
||||
for x in 0...map.data.xsize
|
||||
@@ -704,8 +705,7 @@ def pbDebugFixInvalidTiles
|
||||
tile_id = map.data[x, y, i]
|
||||
next if pbCheckTileValidity(tile_id, map, tilesets, passages)
|
||||
map.data[x, y, i] = 0
|
||||
changed = true
|
||||
num_errors += 1
|
||||
map_errors += 1
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -716,19 +716,22 @@ def pbDebugFixInvalidTiles
|
||||
next if page.graphic.tile_id <= 0
|
||||
next if pbCheckTileValidity(page.graphic.tile_id, map, tilesets, passages)
|
||||
page.graphic.tile_id = 0
|
||||
changed = true
|
||||
num_errors += 1
|
||||
map_errors += 1
|
||||
end
|
||||
end
|
||||
next if !changed
|
||||
next if map_errors == 0
|
||||
# Map was changed; save it
|
||||
echoln _INTL("{1} error tile(s) found on map {2}: {3}.", map_errors, id, mapData.mapinfos[id].name)
|
||||
total_errors += map_errors
|
||||
num_error_maps += 1
|
||||
mapData.saveMap(id)
|
||||
end
|
||||
if num_error_maps == 0
|
||||
echoln _INTL("Done. No errors found.")
|
||||
pbMessage(_INTL("No invalid tiles were found."))
|
||||
else
|
||||
pbMessage(_INTL("{1} error(s) were found across {2} map(s) and fixed.", num_errors, num_error_maps))
|
||||
echoln _INTL("Done. {1} errors found and fixed. Close RPG Maker XP to ensure fixes are applied.", total_errors)
|
||||
pbMessage(_INTL("{1} error(s) were found across {2} map(s) and fixed.", total_errors, num_error_maps))
|
||||
pbMessage(_INTL("Close RPG Maker XP to ensure the changes are applied properly."))
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user