mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Wrote a generalised data property editor that deals with a list of things from a GameData module, allowed the WildItem properties for species to contain multiple items each
This commit is contained in:
@@ -89,9 +89,9 @@ module GameData
|
|||||||
"EggMoves" => [0, "*e", :Move],
|
"EggMoves" => [0, "*e", :Move],
|
||||||
"Abilities" => [0, "*e", :Ability],
|
"Abilities" => [0, "*e", :Ability],
|
||||||
"HiddenAbilities" => [0, "*e", :Ability],
|
"HiddenAbilities" => [0, "*e", :Ability],
|
||||||
"WildItemCommon" => [0, "e", :Item],
|
"WildItemCommon" => [0, "*e", :Item],
|
||||||
"WildItemUncommon" => [0, "e", :Item],
|
"WildItemUncommon" => [0, "*e", :Item],
|
||||||
"WildItemRare" => [0, "e", :Item],
|
"WildItemRare" => [0, "*e", :Item],
|
||||||
"EggGroups" => [0, "*e", :EggGroup],
|
"EggGroups" => [0, "*e", :EggGroup],
|
||||||
"HatchSteps" => [0, "v"],
|
"HatchSteps" => [0, "v"],
|
||||||
"Height" => [0, "f"],
|
"Height" => [0, "f"],
|
||||||
@@ -168,9 +168,9 @@ module GameData
|
|||||||
@egg_moves = hash[:egg_moves] || []
|
@egg_moves = hash[:egg_moves] || []
|
||||||
@abilities = hash[:abilities] || []
|
@abilities = hash[:abilities] || []
|
||||||
@hidden_abilities = hash[:hidden_abilities] || []
|
@hidden_abilities = hash[:hidden_abilities] || []
|
||||||
@wild_item_common = hash[:wild_item_common]
|
@wild_item_common = hash[:wild_item_common] || []
|
||||||
@wild_item_uncommon = hash[:wild_item_uncommon]
|
@wild_item_uncommon = hash[:wild_item_uncommon] || []
|
||||||
@wild_item_rare = hash[:wild_item_rare]
|
@wild_item_rare = hash[:wild_item_rare] || []
|
||||||
@egg_groups = hash[:egg_groups] || [:Undiscovered]
|
@egg_groups = hash[:egg_groups] || [:Undiscovered]
|
||||||
@hatch_steps = hash[:hatch_steps] || 1
|
@hatch_steps = hash[:hatch_steps] || 1
|
||||||
@incense = hash[:incense]
|
@incense = hash[:incense]
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ module GameData
|
|||||||
def self.editor_properties
|
def self.editor_properties
|
||||||
return [
|
return [
|
||||||
["StartMoney", LimitProperty.new(Settings::MAX_MONEY), _INTL("The amount of money that the player starts the game with.")],
|
["StartMoney", LimitProperty.new(Settings::MAX_MONEY), _INTL("The amount of money that the player starts the game with.")],
|
||||||
["StartItemStorage", ItemPoolProperty, _INTL("Items that are already in the player's PC at the start of the game.")],
|
["StartItemStorage", GameDataPoolProperty.new(:Item), _INTL("Items that are already in the player's PC at the start of the game.")],
|
||||||
["Home", MapCoordsFacingProperty, _INTL("Map ID and X/Y coordinates of where the player goes after a loss if no Pokémon Center was visited.")],
|
["Home", MapCoordsFacingProperty, _INTL("Map ID and X/Y coordinates of where the player goes after a loss if no Pokémon Center was visited.")],
|
||||||
["StorageCreator", StringProperty, _INTL("Name of the Pokémon Storage creator (the storage option is named \"XXX's PC\").")],
|
["StorageCreator", StringProperty, _INTL("Name of the Pokémon Storage creator (the storage option is named \"XXX's PC\").")],
|
||||||
["WildBattleBGM", BGMProperty, _INTL("Default BGM for wild Pokémon battles.")],
|
["WildBattleBGM", BGMProperty, _INTL("Default BGM for wild Pokémon battles.")],
|
||||||
|
|||||||
@@ -405,11 +405,11 @@ def pbGenerateWildPokemon(species,level,isRoamer=false)
|
|||||||
end
|
end
|
||||||
itemrnd = rand(100)
|
itemrnd = rand(100)
|
||||||
if (items[0]==items[1] && items[1]==items[2]) || itemrnd<chances[0]
|
if (items[0]==items[1] && items[1]==items[2]) || itemrnd<chances[0]
|
||||||
genwildpoke.item = items[0]
|
genwildpoke.item = items[0].sample
|
||||||
elsif itemrnd<(chances[0]+chances[1])
|
elsif itemrnd<(chances[0]+chances[1])
|
||||||
genwildpoke.item = items[1]
|
genwildpoke.item = items[1].sample
|
||||||
elsif itemrnd<(chances[0]+chances[1]+chances[2])
|
elsif itemrnd<(chances[0]+chances[1]+chances[2])
|
||||||
genwildpoke.item = items[2]
|
genwildpoke.item = items[2].sample
|
||||||
end
|
end
|
||||||
# Improve chances of shiny Pokémon with Shiny Charm and battling more of the
|
# Improve chances of shiny Pokémon with Shiny Charm and battling more of the
|
||||||
# same species
|
# same species
|
||||||
|
|||||||
@@ -573,7 +573,7 @@ class Pokemon
|
|||||||
return held_item && held_item == check_item
|
return held_item && held_item == check_item
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [Array<Symbol>] the items this species can be found holding in the wild
|
# @return [Array<Array<Symbol>>] the items this species can be found holding in the wild
|
||||||
def wildHoldItems
|
def wildHoldItems
|
||||||
sp_data = species_data
|
sp_data = species_data
|
||||||
return [sp_data.wild_item_common, sp_data.wild_item_uncommon, sp_data.wild_item_rare]
|
return [sp_data.wild_item_common, sp_data.wild_item_uncommon, sp_data.wild_item_rare]
|
||||||
|
|||||||
@@ -1010,23 +1010,23 @@ def pbPokemonEditor
|
|||||||
[_INTL("GenderRatio"), GameDataProperty.new(:GenderRatio), _INTL("Proportion of males to females for this species.")],
|
[_INTL("GenderRatio"), GameDataProperty.new(:GenderRatio), _INTL("Proportion of males to females for this species.")],
|
||||||
[_INTL("CatchRate"), LimitProperty.new(255), _INTL("Catch rate of this species (0-255).")],
|
[_INTL("CatchRate"), LimitProperty.new(255), _INTL("Catch rate of this species (0-255).")],
|
||||||
[_INTL("Happiness"), LimitProperty.new(255), _INTL("Base happiness of this species (0-255).")],
|
[_INTL("Happiness"), LimitProperty.new(255), _INTL("Base happiness of this species (0-255).")],
|
||||||
[_INTL("Moves"), MovePoolProperty, _INTL("Moves which the Pokémon learns while levelling up.")],
|
[_INTL("Moves"), LevelUpMovesProperty, _INTL("Moves which the Pokémon learns while levelling up.")],
|
||||||
[_INTL("TutorMoves"), EggMovesProperty, _INTL("Moves which the Pokémon can be taught by TM/HM/Move Tutor.")],
|
[_INTL("TutorMoves"), EggMovesProperty.new, _INTL("Moves which the Pokémon can be taught by TM/HM/Move Tutor.")],
|
||||||
[_INTL("EggMoves"), EggMovesProperty, _INTL("Moves which the Pokémon can learn via breeding.")],
|
[_INTL("EggMoves"), EggMovesProperty.new, _INTL("Moves which the Pokémon can learn via breeding.")],
|
||||||
[_INTL("Ability 1"), AbilityProperty, _INTL("One ability which the Pokémon can have.")],
|
[_INTL("Ability 1"), AbilityProperty, _INTL("One ability which the Pokémon can have.")],
|
||||||
[_INTL("Ability 2"), AbilityProperty, _INTL("Another ability which the Pokémon can have.")],
|
[_INTL("Ability 2"), AbilityProperty, _INTL("Another ability which the Pokémon can have.")],
|
||||||
[_INTL("HiddenAbility 1"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")],
|
[_INTL("HiddenAbility 1"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")],
|
||||||
[_INTL("HiddenAbility 2"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")],
|
[_INTL("HiddenAbility 2"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")],
|
||||||
[_INTL("HiddenAbility 3"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")],
|
[_INTL("HiddenAbility 3"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")],
|
||||||
[_INTL("HiddenAbility 4"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")],
|
[_INTL("HiddenAbility 4"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")],
|
||||||
[_INTL("WildItemCommon"), ItemProperty, _INTL("Item commonly held by wild Pokémon of this species.")],
|
[_INTL("WildItemCommon"), GameDataPoolProperty.new(:Item), _INTL("Item(s) commonly held by wild Pokémon of this species.")],
|
||||||
[_INTL("WildItemUncommon"), ItemProperty, _INTL("Item uncommonly held by wild Pokémon of this species.")],
|
[_INTL("WildItemUncommon"), GameDataPoolProperty.new(:Item), _INTL("Item(s) uncommonly held by wild Pokémon of this species.")],
|
||||||
[_INTL("WildItemRare"), ItemProperty, _INTL("Item rarely held by wild Pokémon of this species.")],
|
[_INTL("WildItemRare"), GameDataPoolProperty.new(:Item), _INTL("Item(s) rarely held by wild Pokémon of this species.")],
|
||||||
[_INTL("EggGroup 1"), GameDataProperty.new(:EggGroup), _INTL("Compatibility group (egg group) for breeding purposes.")],
|
[_INTL("EggGroup 1"), GameDataProperty.new(:EggGroup), _INTL("Compatibility group (egg group) for breeding purposes.")],
|
||||||
[_INTL("EggGroup 2"), GameDataProperty.new(:EggGroup), _INTL("Compatibility group (egg group) for breeding purposes.")],
|
[_INTL("EggGroup 2"), GameDataProperty.new(:EggGroup), _INTL("Compatibility group (egg group) for breeding purposes.")],
|
||||||
[_INTL("HatchSteps"), LimitProperty.new(99999), _INTL("Number of steps until an egg of this species hatches.")],
|
[_INTL("HatchSteps"), LimitProperty.new(99999), _INTL("Number of steps until an egg of this species hatches.")],
|
||||||
[_INTL("Incense"), ItemProperty, _INTL("Item needed to be held by a parent to produce an egg of this species.")],
|
[_INTL("Incense"), ItemProperty, _INTL("Item needed to be held by a parent to produce an egg of this species.")],
|
||||||
[_INTL("Offspring"), SpeciesPoolProperty, _INTL("All possible species that an egg can be when breeding for an egg of this species (if blank, the egg can only be this species).")],
|
[_INTL("Offspring"), GameDataPoolProperty.new(:Species), _INTL("All possible species that an egg can be when breeding for an egg of this species (if blank, the egg can only be this species).")],
|
||||||
[_INTL("Evolutions"), EvolutionsProperty.new, _INTL("Evolution paths of this species.")],
|
[_INTL("Evolutions"), EvolutionsProperty.new, _INTL("Evolution paths of this species.")],
|
||||||
[_INTL("Height"), NonzeroLimitProperty.new(999), _INTL("Height of the Pokémon in 0.1 metres (e.g. 42 = 4.2m).")],
|
[_INTL("Height"), NonzeroLimitProperty.new(999), _INTL("Height of the Pokémon in 0.1 metres (e.g. 42 = 4.2m).")],
|
||||||
[_INTL("Weight"), NonzeroLimitProperty.new(9999), _INTL("Weight of the Pokémon in 0.1 kilograms (e.g. 42 = 4.2kg).")],
|
[_INTL("Weight"), NonzeroLimitProperty.new(9999), _INTL("Weight of the Pokémon in 0.1 kilograms (e.g. 42 = 4.2kg).")],
|
||||||
@@ -1080,9 +1080,9 @@ def pbPokemonEditor
|
|||||||
spec.hidden_abilities[1],
|
spec.hidden_abilities[1],
|
||||||
spec.hidden_abilities[2],
|
spec.hidden_abilities[2],
|
||||||
spec.hidden_abilities[3],
|
spec.hidden_abilities[3],
|
||||||
spec.wild_item_common,
|
spec.wild_item_common.clone,
|
||||||
spec.wild_item_uncommon,
|
spec.wild_item_uncommon.clone,
|
||||||
spec.wild_item_rare,
|
spec.wild_item_rare.clone,
|
||||||
spec.egg_groups[0],
|
spec.egg_groups[0],
|
||||||
spec.egg_groups[1],
|
spec.egg_groups[1],
|
||||||
spec.hatch_steps,
|
spec.hatch_steps,
|
||||||
|
|||||||
@@ -111,29 +111,64 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# List all members of a class
|
# List all members of a class
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
def pbChooseFromGameDataList(game_data, default = nil)
|
||||||
|
if !GameData.const_defined?(game_data.to_sym)
|
||||||
|
raise _INTL("Couldn't find class {1} in module GameData.", game_data.to_s)
|
||||||
|
end
|
||||||
|
game_data_module = GameData.const_get(game_data.to_sym)
|
||||||
|
commands = []
|
||||||
|
game_data_module.each do |data|
|
||||||
|
name = data.real_name
|
||||||
|
name = yield(data) if block_given?
|
||||||
|
next if !name
|
||||||
|
index = commands.length + 1
|
||||||
|
index = data.id_number if data.respond_to?("id_number")
|
||||||
|
commands.push([commands.length + 1, name, data.id])
|
||||||
|
end
|
||||||
|
return pbChooseList(commands, default, nil, -1)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# Displays a list of all Pokémon species, and returns the ID of the species
|
# Displays a list of all Pokémon species, and returns the ID of the species
|
||||||
# selected (or nil if the selection was canceled). "default", if specified, is
|
# selected (or nil if the selection was canceled). "default", if specified, is
|
||||||
# the ID of the species to initially select. Pressing Input::ACTION will toggle
|
# the ID of the species to initially select. Pressing Input::ACTION will toggle
|
||||||
# the list sorting between numerical and alphabetical.
|
# the list sorting between numerical and alphabetical.
|
||||||
def pbChooseSpeciesList(default = nil)
|
def pbChooseSpeciesList(default = nil)
|
||||||
commands = []
|
return pbChooseFromGameDataList(:Species, default) { |data|
|
||||||
index = 1
|
next (data.form > 0) ? nil : data.real_name
|
||||||
GameData::Species.each_species do |s|
|
}
|
||||||
commands.push([index, s.real_name, s.id])
|
|
||||||
index += 1
|
|
||||||
end
|
|
||||||
return pbChooseList(commands, default, nil, -1)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbChooseSpeciesFormList(default = nil)
|
def pbChooseSpeciesFormList(default = nil)
|
||||||
commands = []
|
return pbChooseFromGameDataList(:Species, default) { |data|
|
||||||
index = 1
|
next (data.form > 0) ? sprintf("%s_%d", data.real_name, data.form) : data.real_name
|
||||||
GameData::Species.each do |s|
|
}
|
||||||
name = (s.form == 0) ? s.real_name : sprintf("%s_%d", s.real_name, s.form)
|
end
|
||||||
commands.push([index, name, s.id])
|
|
||||||
index += 1
|
# Displays a list of all types, and returns the ID of the type selected (or nil
|
||||||
end
|
# if the selection was canceled). "default", if specified, is the ID of the type
|
||||||
return pbChooseList(commands, default, nil, -1)
|
# to initially select. Pressing Input::ACTION will toggle the list sorting
|
||||||
|
# between numerical and alphabetical.
|
||||||
|
def pbChooseTypeList(default = nil)
|
||||||
|
return pbChooseFromGameDataList(:Type, default) { |data|
|
||||||
|
next (data.pseudo_type) ? nil : data.real_name
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Displays a list of all items, and returns the ID of the item selected (or nil
|
||||||
|
# if the selection was canceled). "default", if specified, is the ID of the item
|
||||||
|
# to initially select. Pressing Input::ACTION will toggle the list sorting
|
||||||
|
# between numerical and alphabetical.
|
||||||
|
def pbChooseItemList(default = nil)
|
||||||
|
return pbChooseFromGameDataList(:Item, default)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Displays a list of all abilities, and returns the ID of the ability selected
|
||||||
|
# (or nil if the selection was canceled). "default", if specified, is the ID of
|
||||||
|
# the ability to initially select. Pressing Input::ACTION will toggle the list
|
||||||
|
# sorting between numerical and alphabetical.
|
||||||
|
def pbChooseAbilityList(default = nil)
|
||||||
|
return pbChooseFromGameDataList(:Ability, default)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Displays a list of all moves, and returns the ID of the move selected (or nil
|
# Displays a list of all moves, and returns the ID of the move selected (or nil
|
||||||
@@ -141,13 +176,7 @@ end
|
|||||||
# to initially select. Pressing Input::ACTION will toggle the list sorting
|
# to initially select. Pressing Input::ACTION will toggle the list sorting
|
||||||
# between numerical and alphabetical.
|
# between numerical and alphabetical.
|
||||||
def pbChooseMoveList(default = nil)
|
def pbChooseMoveList(default = nil)
|
||||||
commands = []
|
return pbChooseFromGameDataList(:Move, default)
|
||||||
index = 1
|
|
||||||
GameData::Move.each do |m|
|
|
||||||
commands.push([index, m.real_name, m.id])
|
|
||||||
index += 1
|
|
||||||
end
|
|
||||||
return pbChooseList(commands, default, nil, -1)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbChooseMoveListForSpecies(species, defaultMoveID = nil)
|
def pbChooseMoveListForSpecies(species, defaultMoveID = nil)
|
||||||
@@ -189,49 +218,6 @@ def pbChooseMoveListForSpecies(species, defaultMoveID = nil)
|
|||||||
return (ret >= 0) ? commands[ret][2] : nil
|
return (ret >= 0) ? commands[ret][2] : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# Displays a list of all types, and returns the ID of the type selected (or nil
|
|
||||||
# if the selection was canceled). "default", if specified, is the ID of the type
|
|
||||||
# to initially select. Pressing Input::ACTION will toggle the list sorting
|
|
||||||
# between numerical and alphabetical.
|
|
||||||
def pbChooseTypeList(default = nil)
|
|
||||||
commands = []
|
|
||||||
index = 0
|
|
||||||
GameData::Type.each do |t|
|
|
||||||
next if t.pseudo_type
|
|
||||||
commands.push([index, t.name, t.id])
|
|
||||||
index += 1
|
|
||||||
end
|
|
||||||
return pbChooseList(commands, default, nil, -1)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Displays a list of all items, and returns the ID of the item selected (or nil
|
|
||||||
# if the selection was canceled). "default", if specified, is the ID of the item
|
|
||||||
# to initially select. Pressing Input::ACTION will toggle the list sorting
|
|
||||||
# between numerical and alphabetical.
|
|
||||||
def pbChooseItemList(default = nil)
|
|
||||||
commands = []
|
|
||||||
index = 1
|
|
||||||
GameData::Item.each do |i|
|
|
||||||
commands.push([index, i.name, i.id])
|
|
||||||
index += 1
|
|
||||||
end
|
|
||||||
return pbChooseList(commands, default, nil, -1)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Displays a list of all abilities, and returns the ID of the ability selected
|
|
||||||
# (or nil if the selection was canceled). "default", if specified, is the ID of
|
|
||||||
# the ability to initially select. Pressing Input::ACTION will toggle the list
|
|
||||||
# sorting between numerical and alphabetical.
|
|
||||||
def pbChooseAbilityList(default = nil)
|
|
||||||
commands = []
|
|
||||||
index = 1
|
|
||||||
GameData::Ability.each do |a|
|
|
||||||
commands.push([index, a.name, a.id])
|
|
||||||
index += 1
|
|
||||||
end
|
|
||||||
return pbChooseList(commands, default, nil, -1)
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbChooseBallList(defaultMoveID = nil)
|
def pbChooseBallList(defaultMoveID = nil)
|
||||||
cmdwin = pbListWindow([], 200)
|
cmdwin = pbListWindow([], 200)
|
||||||
commands = []
|
commands = []
|
||||||
|
|||||||
@@ -975,81 +975,103 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
module SpeciesPoolProperty
|
class GameDataPoolProperty
|
||||||
def self.set(_settingname, oldsetting)
|
def initialize(game_data, allow_multiple = true, auto_sort = false)
|
||||||
# Get all species in the pool
|
if !GameData.const_defined?(game_data.to_sym)
|
||||||
realcmds = []
|
raise _INTL("Couldn't find class {1} in module GameData.", game_data.to_s)
|
||||||
realcmds.push([nil, "-", -1]) # Species ID, index in this list, name
|
|
||||||
for i in 0...oldsetting.length
|
|
||||||
realcmds.push([oldsetting[i], GameData::Species.get(oldsetting[i]).real_name, i])
|
|
||||||
end
|
end
|
||||||
# Edit species pool
|
@game_data = game_data
|
||||||
cmdwin = pbListWindow([], 200)
|
@game_data_module = GameData.const_get(game_data.to_sym)
|
||||||
oldsel = -1
|
@allow_multiple = allow_multiple
|
||||||
ret = oldsetting
|
@auto_sort = auto_sort # Alphabetically
|
||||||
cmd = [0, 0]
|
end
|
||||||
|
|
||||||
|
def set(setting_name, old_setting)
|
||||||
|
ret = old_setting
|
||||||
|
old_setting.uniq! if !@allow_multiple
|
||||||
|
old_setting.sort! if @auto_sort
|
||||||
|
# Get all values already in the pool
|
||||||
|
values = []
|
||||||
|
values.push([nil, _INTL("[ADD VALUE]")]) # Value ID, name
|
||||||
|
old_setting.each do |value|
|
||||||
|
values.push([value, @game_data_module.get(value).real_name])
|
||||||
|
end
|
||||||
|
# Set things up
|
||||||
|
command_window = pbListWindow([], 200)
|
||||||
|
cmd = [0, 0] # [input type, list index] (input type: 0=select, 1=swap up, 2=swap down)
|
||||||
commands = []
|
commands = []
|
||||||
refreshlist = true
|
need_refresh = true
|
||||||
|
# Edit value pool
|
||||||
loop do
|
loop do
|
||||||
if refreshlist
|
if need_refresh
|
||||||
realcmds.sort! { |a, b| a[2] <=> b[2] }
|
if @auto_sort
|
||||||
commands = []
|
values.sort! { |a, b| (a[0].nil?) ? -1 : b[0].nil? ? 1 : a[1] <=> b[1] }
|
||||||
realcmds.each_with_index do |entry, i|
|
|
||||||
commands.push((entry[0].nil?) ? _INTL("[ADD SPECIES]") : entry[1])
|
|
||||||
end
|
end
|
||||||
|
commands = values.map { |entry| entry[1] }
|
||||||
|
need_refresh = false
|
||||||
end
|
end
|
||||||
refreshlist = false
|
# Choose a value
|
||||||
oldsel = -1
|
cmd = pbCommands3(command_window, commands, -1, cmd[1], true)
|
||||||
cmd = pbCommands3(cmdwin, commands, -1, cmd[1], true)
|
case cmd[0] # 0=selected/cancelled, 1=pressed Action+Up, 2=pressed Action+Down
|
||||||
case cmd[0]
|
when 1 # Swap value up
|
||||||
when 1 # Swap species up
|
if cmd[1] > 0 && cmd[1] < values.length - 1
|
||||||
if cmd[1] > 0 && cmd[1] < realcmds.length - 1
|
values[cmd[1] + 1], values[cmd[1]] = values[cmd[1]], values[cmd[1] + 1]
|
||||||
realcmds[cmd[1] + 1][2], realcmds[cmd[1]][2] = realcmds[cmd[1]][2], realcmds[cmd[1] + 1][2]
|
need_refresh = true
|
||||||
refreshlist = true
|
|
||||||
end
|
end
|
||||||
when 2 # Swap species down
|
when 2 # Swap value down
|
||||||
if cmd[1] > 1
|
if cmd[1] > 1
|
||||||
realcmds[cmd[1] - 1][2], realcmds[cmd[1]][2] = realcmds[cmd[1]][2], realcmds[cmd[1] - 1][2]
|
values[cmd[1] - 1], values[cmd[1]] = values[cmd[1]], values[cmd[1] - 1]
|
||||||
refreshlist = true
|
need_refresh = true
|
||||||
end
|
end
|
||||||
when 0
|
when 0
|
||||||
if cmd[1] >= 0 # Chose an entry
|
if cmd[1] >= 0 # Chose an entry
|
||||||
entry = realcmds[cmd[1]]
|
entry = values[cmd[1]]
|
||||||
if entry[0].nil? # Add new species
|
if entry[0].nil? # Add new value
|
||||||
new_species = pbChooseSpeciesList
|
new_value = pbChooseFromGameDataList(@game_data)
|
||||||
if new_species
|
if new_value
|
||||||
maxid = -1
|
if !@allow_multiple && values.any? { |val| val[0] == new_value }
|
||||||
realcmds.each { |e| maxid = [maxid, e[2]].max }
|
cmd[1] = values.index { |val| val[0] == new_value }
|
||||||
realcmds.push([new_species, GameData::Species.get(new_species).real_name, maxid + 1])
|
next
|
||||||
refreshlist = true
|
end
|
||||||
|
values.push([new_value, @game_data_module.get(new_value).real_name])
|
||||||
|
need_refresh = true
|
||||||
end
|
end
|
||||||
else # Edit existing species
|
else # Edit existing value
|
||||||
case pbMessage(_INTL("\\ts[]Do what with this species?"),
|
case pbMessage(_INTL("\\ts[]Do what with this value?"),
|
||||||
[_INTL("Change species"), _INTL("Delete"), _INTL("Cancel")], 3)
|
[_INTL("Change value"), _INTL("Delete"), _INTL("Cancel")], 3)
|
||||||
when 0 # Change species
|
when 0 # Change value
|
||||||
new_species = pbChooseSpeciesList(entry[0])
|
new_value = pbChooseFromGameDataList(@game_data, entry[0])
|
||||||
if new_species && new_species != entry[0]
|
if new_value && new_value != entry[0]
|
||||||
entry[0] = new_species
|
if !@allow_multiple && values.any? { |val| val[0] == new_value }
|
||||||
entry[1] = GameData::Species.get(new_species).real_name
|
values.delete_at(cmd[1])
|
||||||
oldsel = entry[2]
|
cmd[1] = values.index { |val| val[0] == new_value }
|
||||||
refreshlist = true
|
need_refresh = true
|
||||||
|
next
|
||||||
|
end
|
||||||
|
entry[0] = new_value
|
||||||
|
entry[1] = @game_data_module.get(new_value).real_name
|
||||||
|
if @auto_sort
|
||||||
|
values.sort! { |a, b| a[1] <=> b[1] }
|
||||||
|
cmd[1] = values.index { |val| val[0] == new_value }
|
||||||
|
end
|
||||||
|
need_refresh = true
|
||||||
end
|
end
|
||||||
when 1 # Delete
|
when 1 # Delete
|
||||||
realcmds.delete_at(cmd[1])
|
values.delete_at(cmd[1])
|
||||||
cmd[1] = [cmd[1], realcmds.length - 1].min
|
cmd[1] = [cmd[1], values.length - 1].min
|
||||||
refreshlist = true
|
need_refresh = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else # Cancel/quit
|
else # Cancel/quit
|
||||||
case pbMessage(_INTL("Save changes?"),
|
case pbMessage(_INTL("Apply changes?"),
|
||||||
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
|
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
|
||||||
when 0
|
when 0
|
||||||
realcmds.shift
|
values.shift # Remove the "add value" option
|
||||||
for i in 0...realcmds.length
|
for i in 0...values.length
|
||||||
realcmds[i] = realcmds[i][0]
|
values[i] = values[i][0]
|
||||||
end
|
end
|
||||||
realcmds.compact!
|
values.compact!
|
||||||
ret = realcmds
|
ret = values
|
||||||
break
|
break
|
||||||
when 1
|
when 1
|
||||||
break
|
break
|
||||||
@@ -1057,129 +1079,30 @@ module SpeciesPoolProperty
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
cmdwin.dispose
|
command_window.dispose
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.defaultValue
|
def defaultValue
|
||||||
return []
|
return []
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.format(value)
|
def format(value)
|
||||||
ret = ""
|
return value.map { |val| @game_data_module.get(val).real_name }.join(",")
|
||||||
for i in 0...value.length
|
|
||||||
ret << "," if i > 0
|
|
||||||
ret << GameData::Species.get(value[i]).real_name
|
|
||||||
end
|
|
||||||
return ret
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module ItemPoolProperty
|
class EggMovesProperty < GameDataPoolProperty
|
||||||
def self.set(_settingname, oldsetting)
|
def initialize
|
||||||
# Get all items in the pool
|
super(:Move, false, true)
|
||||||
realcmds = []
|
|
||||||
realcmds.push([nil, "-", -1]) # Item ID, index in this list, name
|
|
||||||
for i in 0...oldsetting.length
|
|
||||||
realcmds.push([oldsetting[i], GameData::Item.get(oldsetting[i]).real_name, i])
|
|
||||||
end
|
|
||||||
# Edit item pool
|
|
||||||
cmdwin = pbListWindow([], 200)
|
|
||||||
oldsel = -1
|
|
||||||
ret = oldsetting
|
|
||||||
cmd = [0, 0]
|
|
||||||
commands = []
|
|
||||||
refreshlist = true
|
|
||||||
loop do
|
|
||||||
if refreshlist
|
|
||||||
realcmds.sort! { |a, b| a[2] <=> b[2] }
|
|
||||||
commands = []
|
|
||||||
realcmds.each_with_index do |entry, i|
|
|
||||||
commands.push((entry[0].nil?) ? _INTL("[ADD ITEM]") : entry[1])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
refreshlist = false
|
|
||||||
oldsel = -1
|
|
||||||
cmd = pbCommands3(cmdwin, commands, -1, cmd[1], true)
|
|
||||||
case cmd[0]
|
|
||||||
when 1 # Swap item up
|
|
||||||
if cmd[1] > 0 && cmd[1] < realcmds.length - 1
|
|
||||||
realcmds[cmd[1] + 1][2], realcmds[cmd[1]][2] = realcmds[cmd[1]][2], realcmds[cmd[1] + 1][2]
|
|
||||||
refreshlist = true
|
|
||||||
end
|
|
||||||
when 2 # Swap item down
|
|
||||||
if cmd[1] > 1
|
|
||||||
realcmds[cmd[1] - 1][2], realcmds[cmd[1]][2] = realcmds[cmd[1]][2], realcmds[cmd[1] - 1][2]
|
|
||||||
refreshlist = true
|
|
||||||
end
|
|
||||||
when 0
|
|
||||||
if cmd[1] >= 0 # Chose an entry
|
|
||||||
entry = realcmds[cmd[1]]
|
|
||||||
if entry[0].nil? # Add new item
|
|
||||||
new_item = pbChooseItemList
|
|
||||||
if new_item
|
|
||||||
maxid = -1
|
|
||||||
realcmds.each { |e| maxid = [maxid, e[2]].max }
|
|
||||||
realcmds.push([new_item, GameData::Item.get(new_item).real_name, maxid + 1])
|
|
||||||
refreshlist = true
|
|
||||||
end
|
|
||||||
else # Edit existing item
|
|
||||||
case pbMessage(_INTL("\\ts[]Do what with this item?"),
|
|
||||||
[_INTL("Change item"), _INTL("Delete"), _INTL("Cancel")], 3)
|
|
||||||
when 0 # Change item
|
|
||||||
new_item = pbChooseItemList(entry[0])
|
|
||||||
if new_item && new_item != entry[0]
|
|
||||||
entry[0] = new_item
|
|
||||||
entry[1] = GameData::Item.get(new_item).real_name
|
|
||||||
oldsel = entry[2]
|
|
||||||
refreshlist = true
|
|
||||||
end
|
|
||||||
when 1 # Delete
|
|
||||||
realcmds.delete_at(cmd[1])
|
|
||||||
cmd[1] = [cmd[1], realcmds.length - 1].min
|
|
||||||
refreshlist = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else # Cancel/quit
|
|
||||||
case pbMessage(_INTL("Save changes?"),
|
|
||||||
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
|
|
||||||
when 0
|
|
||||||
realcmds.shift
|
|
||||||
for i in 0...realcmds.length
|
|
||||||
realcmds[i] = realcmds[i][0]
|
|
||||||
end
|
|
||||||
realcmds.compact!
|
|
||||||
ret = realcmds
|
|
||||||
break
|
|
||||||
when 1
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
cmdwin.dispose
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.defaultValue
|
|
||||||
return []
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.format(value)
|
|
||||||
ret = ""
|
|
||||||
for i in 0...value.length
|
|
||||||
ret << "," if i > 0
|
|
||||||
ret << GameData::Item.get(value[i]).real_name
|
|
||||||
end
|
|
||||||
return ret
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module MovePoolProperty
|
module LevelUpMovesProperty
|
||||||
def self.set(_settingname, oldsetting)
|
def self.set(_settingname, oldsetting)
|
||||||
# Get all moves in move pool
|
# Get all moves in move pool
|
||||||
realcmds = []
|
realcmds = []
|
||||||
@@ -1331,101 +1254,6 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
module EggMovesProperty
|
|
||||||
def self.set(_settingname, oldsetting)
|
|
||||||
# Get all egg moves
|
|
||||||
realcmds = []
|
|
||||||
realcmds.push([nil, _INTL("[ADD MOVE]"), -1])
|
|
||||||
for i in 0...oldsetting.length
|
|
||||||
realcmds.push([oldsetting[i], GameData::Move.get(oldsetting[i]).real_name, 0])
|
|
||||||
end
|
|
||||||
# Edit egg moves list
|
|
||||||
cmdwin = pbListWindow([], 200)
|
|
||||||
oldsel = nil
|
|
||||||
ret = oldsetting
|
|
||||||
cmd = 0
|
|
||||||
commands = []
|
|
||||||
refreshlist = true
|
|
||||||
loop do
|
|
||||||
if refreshlist
|
|
||||||
realcmds.sort! { |a, b| (a[2] == b[2]) ? a[1] <=> b[1] : a[2] <=> b[2] }
|
|
||||||
commands = []
|
|
||||||
realcmds.each_with_index do |entry, i|
|
|
||||||
commands.push(entry[1])
|
|
||||||
cmd = i if oldsel && entry[0] == oldsel
|
|
||||||
end
|
|
||||||
end
|
|
||||||
refreshlist = false
|
|
||||||
oldsel = nil
|
|
||||||
cmd = pbCommands2(cmdwin, commands, -1, cmd, true)
|
|
||||||
if cmd >= 0 # Chose an entry
|
|
||||||
entry = realcmds[cmd]
|
|
||||||
if entry[2] == -1 # Add new move
|
|
||||||
newmove = pbChooseMoveList
|
|
||||||
if newmove
|
|
||||||
if realcmds.any? { |e| e[0] == newmove }
|
|
||||||
oldsel = newmove # Already have move; just move cursor to it
|
|
||||||
else
|
|
||||||
realcmds.push([newmove, GameData::Move.get(newmove).name, 0])
|
|
||||||
end
|
|
||||||
refreshlist = true
|
|
||||||
end
|
|
||||||
else # Edit move
|
|
||||||
case pbMessage(_INTL("\\ts[]Do what with this move?"),
|
|
||||||
[_INTL("Change move"), _INTL("Delete"), _INTL("Cancel")], 3)
|
|
||||||
when 0 # Change move
|
|
||||||
newmove = pbChooseMoveList(entry[0])
|
|
||||||
if newmove
|
|
||||||
if realcmds.any? { |e| e[0] == newmove } # Already have move; delete this one
|
|
||||||
realcmds.delete_at(cmd)
|
|
||||||
cmd = [cmd, realcmds.length - 1].min
|
|
||||||
else # Change move
|
|
||||||
realcmds[cmd] = [newmove, GameData::Move.get(newmove).name, 0]
|
|
||||||
end
|
|
||||||
oldsel = newmove
|
|
||||||
refreshlist = true
|
|
||||||
end
|
|
||||||
when 1 # Delete
|
|
||||||
realcmds.delete_at(cmd)
|
|
||||||
cmd = [cmd, realcmds.length - 1].min
|
|
||||||
refreshlist = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else # Cancel/quit
|
|
||||||
case pbMessage(_INTL("Save changes?"),
|
|
||||||
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
|
|
||||||
when 0
|
|
||||||
for i in 0...realcmds.length
|
|
||||||
realcmds[i] = realcmds[i][0]
|
|
||||||
end
|
|
||||||
realcmds.compact!
|
|
||||||
ret = realcmds
|
|
||||||
break
|
|
||||||
when 1
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
cmdwin.dispose
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.defaultValue
|
|
||||||
return []
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.format(value)
|
|
||||||
ret = ""
|
|
||||||
for i in 0...value.length
|
|
||||||
ret << "," if i > 0
|
|
||||||
ret << GameData::Move.get(value[i]).real_name
|
|
||||||
end
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class EvolutionsProperty
|
class EvolutionsProperty
|
||||||
def initialize
|
def initialize
|
||||||
@methods = []
|
@methods = []
|
||||||
|
|||||||
@@ -824,9 +824,9 @@ module Compiler
|
|||||||
:egg_moves => contents["EggMoves"] || base_data.egg_moves.clone,
|
:egg_moves => contents["EggMoves"] || base_data.egg_moves.clone,
|
||||||
:abilities => contents["Abilities"] || base_data.abilities.clone,
|
:abilities => contents["Abilities"] || base_data.abilities.clone,
|
||||||
:hidden_abilities => contents["HiddenAbilities"] || contents["HiddenAbility"] || base_data.hidden_abilities.clone,
|
:hidden_abilities => contents["HiddenAbilities"] || contents["HiddenAbility"] || base_data.hidden_abilities.clone,
|
||||||
:wild_item_common => contents["WildItemCommon"] || base_data.wild_item_common,
|
:wild_item_common => contents["WildItemCommon"] || base_data.wild_item_common.clone,
|
||||||
:wild_item_uncommon => contents["WildItemUncommon"] || base_data.wild_item_uncommon,
|
:wild_item_uncommon => contents["WildItemUncommon"] || base_data.wild_item_uncommon.clone,
|
||||||
:wild_item_rare => contents["WildItemRare"] || base_data.wild_item_rare,
|
:wild_item_rare => contents["WildItemRare"] || base_data.wild_item_rare.clone,
|
||||||
:egg_groups => contents["EggGroups"] || contents["Compatibility"] || base_data.egg_groups.clone,
|
:egg_groups => contents["EggGroups"] || contents["Compatibility"] || base_data.egg_groups.clone,
|
||||||
:hatch_steps => contents["HatchSteps"] || contents["StepsToHatch"] || base_data.hatch_steps,
|
:hatch_steps => contents["HatchSteps"] || contents["StepsToHatch"] || base_data.hatch_steps,
|
||||||
:incense => base_data.incense,
|
:incense => base_data.incense,
|
||||||
@@ -847,7 +847,9 @@ module Compiler
|
|||||||
# If form is single-typed, ensure it remains so if base species is dual-typed
|
# If form is single-typed, ensure it remains so if base species is dual-typed
|
||||||
species_hash[:type2] = contents["Type1"] if contents["Type1"] && !contents["Type2"]
|
species_hash[:type2] = contents["Type1"] if contents["Type1"] && !contents["Type2"]
|
||||||
# If form has any wild items, ensure none are inherited from base species
|
# If form has any wild items, ensure none are inherited from base species
|
||||||
if contents["WildItemCommon"] || contents["WildItemUncommon"] || contents["WildItemRare"]
|
if (contents["WildItemCommon"] && !contents["WildItemCommon"].empty?) ||
|
||||||
|
(contents["WildItemUncommon"] && !contents["WildItemUncommon"].empty?) ||
|
||||||
|
(contents["WildItemRare"] && !contents["WildItemRare"].empty?)
|
||||||
species_hash[:wild_item_common] = contents["WildItemCommon"]
|
species_hash[:wild_item_common] = contents["WildItemCommon"]
|
||||||
species_hash[:wild_item_uncommon] = contents["WildItemUncommon"]
|
species_hash[:wild_item_uncommon] = contents["WildItemUncommon"]
|
||||||
species_hash[:wild_item_rare] = contents["WildItemRare"]
|
species_hash[:wild_item_rare] = contents["WildItemRare"]
|
||||||
|
|||||||
@@ -329,9 +329,9 @@ module Compiler
|
|||||||
f.write(sprintf("FormName = %s\r\n", species.real_form_name)) if species.real_form_name && !species.real_form_name.empty?
|
f.write(sprintf("FormName = %s\r\n", species.real_form_name)) if species.real_form_name && !species.real_form_name.empty?
|
||||||
f.write(sprintf("Generation = %d\r\n", species.generation)) if species.generation != 0
|
f.write(sprintf("Generation = %d\r\n", species.generation)) if species.generation != 0
|
||||||
f.write(sprintf("Flags = %s\r\n", species.flags.join(","))) if species.flags.length > 0
|
f.write(sprintf("Flags = %s\r\n", species.flags.join(","))) if species.flags.length > 0
|
||||||
f.write(sprintf("WildItemCommon = %s\r\n", species.wild_item_common)) if species.wild_item_common
|
f.write(sprintf("WildItemCommon = %s\r\n", species.wild_item_common.join(","))) if species.wild_item_common.length > 0
|
||||||
f.write(sprintf("WildItemUncommon = %s\r\n", species.wild_item_uncommon)) if species.wild_item_uncommon
|
f.write(sprintf("WildItemUncommon = %s\r\n", species.wild_item_uncommon.join(","))) if species.wild_item_uncommon.length > 0
|
||||||
f.write(sprintf("WildItemRare = %s\r\n", species.wild_item_rare)) if species.wild_item_rare
|
f.write(sprintf("WildItemRare = %s\r\n", species.wild_item_rare.join(","))) if species.wild_item_rare.length > 0
|
||||||
if species.evolutions.any? { |evo| !evo[3] }
|
if species.evolutions.any? { |evo| !evo[3] }
|
||||||
f.write("Evolutions = ")
|
f.write("Evolutions = ")
|
||||||
need_comma = false
|
need_comma = false
|
||||||
@@ -431,9 +431,9 @@ module Compiler
|
|||||||
if species.wild_item_common != base_species.wild_item_common ||
|
if species.wild_item_common != base_species.wild_item_common ||
|
||||||
species.wild_item_uncommon != base_species.wild_item_uncommon ||
|
species.wild_item_uncommon != base_species.wild_item_uncommon ||
|
||||||
species.wild_item_rare != base_species.wild_item_rare
|
species.wild_item_rare != base_species.wild_item_rare
|
||||||
f.write(sprintf("WildItemCommon = %s\r\n", species.wild_item_common)) if species.wild_item_common
|
f.write(sprintf("WildItemCommon = %s\r\n", species.wild_item_common.join(","))) if species.wild_item_common.length > 0
|
||||||
f.write(sprintf("WildItemUncommon = %s\r\n", species.wild_item_uncommon)) if species.wild_item_uncommon
|
f.write(sprintf("WildItemUncommon = %s\r\n", species.wild_item_uncommon.join(","))) if species.wild_item_uncommon.length > 0
|
||||||
f.write(sprintf("WildItemRare = %s\r\n", species.wild_item_rare)) if species.wild_item_rare
|
f.write(sprintf("WildItemRare = %s\r\n", species.wild_item_rare.join(","))) if species.wild_item_rare.length > 0
|
||||||
end
|
end
|
||||||
if species.evolutions != base_species.evolutions && species.evolutions.any? { |evo| !evo[3] }
|
if species.evolutions != base_species.evolutions && species.evolutions.any? { |evo| !evo[3] }
|
||||||
f.write("Evolutions = ")
|
f.write("Evolutions = ")
|
||||||
|
|||||||
Reference in New Issue
Block a user