mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Fixed and generalised PBS editors
This commit is contained in:
@@ -38,6 +38,27 @@ module GameData
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
def self.editor_properties
|
||||
field_use_array = [_INTL("Can't use in field")]
|
||||
self.schema["FieldUse"][2].each { |key, value| field_use_array[value] = key if !field_use_array[value] }
|
||||
battle_use_array = [_INTL("Can't use in battle")]
|
||||
self.schema["BattleUse"][2].each { |key, value| battle_use_array[value] = key if !battle_use_array[value] }
|
||||
return [
|
||||
["ID", ReadOnlyProperty, _INTL("ID of this item (used as a symbol like :XXX).")],
|
||||
["Name", ItemNameProperty, _INTL("Name of this item as displayed by the game.")],
|
||||
["NamePlural", ItemNameProperty, _INTL("Plural name of this item as displayed by the game.")],
|
||||
["Pocket", PocketProperty, _INTL("Pocket in the Bag where this item is stored.")],
|
||||
["Price", LimitProperty.new(Settings::MAX_MONEY), _INTL("Purchase price of this item.")],
|
||||
["SellPrice", LimitProperty2.new(Settings::MAX_MONEY), _INTL("Sell price of this item. If blank, is half the purchase price.")],
|
||||
["FieldUse", EnumProperty.new(field_use_array), _INTL("How this item can be used outside of battle.")],
|
||||
["BattleUse", EnumProperty.new(battle_use_array), _INTL("How this item can be used within a battle.")],
|
||||
["Flags", StringListProperty, _INTL("Words/phrases that can be used to group certain kinds of items.")],
|
||||
["Consumable", BooleanProperty, _INTL("Whether this item is consumed after use.")],
|
||||
["Move", MoveProperty, _INTL("Move taught by this HM, TM or TR.")],
|
||||
["Description", StringProperty, _INTL("Description of this item.")]
|
||||
]
|
||||
end
|
||||
|
||||
def self.icon_filename(item)
|
||||
return "Graphics/Items/back" if item.nil?
|
||||
item_data = self.try_get(item)
|
||||
@@ -198,6 +219,7 @@ module GameData
|
||||
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS unless method_defined?(:__orig__get_property_for_PBS)
|
||||
def get_property_for_PBS(key)
|
||||
key = "SectionName" if key == "ID"
|
||||
ret = __orig__get_property_for_PBS(key)
|
||||
case key
|
||||
when "SellPrice"
|
||||
|
||||
@@ -49,30 +49,6 @@ module GameData
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
# @param species [Symbol, self, String]
|
||||
# @param form [Integer]
|
||||
# @return [self, nil]
|
||||
def self.get_species_form(species, form)
|
||||
return nil if !species || !form
|
||||
validate species => [Symbol, self, String]
|
||||
validate form => Integer
|
||||
species = species.species if species.is_a?(self)
|
||||
species = species.to_sym if species.is_a?(String)
|
||||
trial = sprintf("%s_%d", species, form).to_sym
|
||||
species_form = (DATA[trial].nil?) ? species : trial
|
||||
return (DATA.has_key?(species_form)) ? DATA[species_form] : nil
|
||||
end
|
||||
|
||||
def self.each_species
|
||||
DATA.each_value { |species| yield species if species.form == 0 }
|
||||
end
|
||||
|
||||
def self.species_count
|
||||
ret = 0
|
||||
self.each_species { |species| ret += 1 }
|
||||
return ret
|
||||
end
|
||||
|
||||
def self.schema(compiling_forms = false)
|
||||
ret = {}
|
||||
if compiling_forms
|
||||
@@ -132,6 +108,68 @@ module GameData
|
||||
return ret
|
||||
end
|
||||
|
||||
def self.editor_properties
|
||||
return [
|
||||
["ID", ReadOnlyProperty, _INTL("The ID of the Pokémon.")],
|
||||
["Name", LimitStringProperty.new(Pokemon::MAX_NAME_SIZE), _INTL("Name of the Pokémon.")],
|
||||
["FormName", StringProperty, _INTL("Name of this form of the Pokémon.")],
|
||||
["Types", TypesProperty, _INTL("The Pokémon's type(s).")],
|
||||
["BaseStats", BaseStatsProperty, _INTL("Base stats of the Pokémon.")],
|
||||
["GenderRatio", GameDataProperty.new(:GenderRatio), _INTL("Proportion of males to females for this species.")],
|
||||
["GrowthRate", GameDataProperty.new(:GrowthRate), _INTL("Pokémon's growth rate.")],
|
||||
["BaseExp", LimitProperty.new(9999), _INTL("Base experience earned when this species is defeated.")],
|
||||
["EVs", EffortValuesProperty, _INTL("Effort Value points earned when this species is defeated.")],
|
||||
["CatchRate", LimitProperty.new(255), _INTL("Catch rate of this species (0-255).")],
|
||||
["Happiness", LimitProperty.new(255), _INTL("Base happiness of this species (0-255).")],
|
||||
["Abilities", AbilitiesProperty.new, _INTL("Abilities which the Pokémon can have (max. 2).")],
|
||||
["HiddenAbilities", AbilitiesProperty.new, _INTL("Secret abilities which the Pokémon can have.")],
|
||||
["Moves", LevelUpMovesProperty, _INTL("Moves which the Pokémon learns while levelling up.")],
|
||||
["TutorMoves", EggMovesProperty.new, _INTL("Moves which the Pokémon can be taught by TM/HM/Move Tutor.")],
|
||||
["EggMoves", EggMovesProperty.new, _INTL("Moves which the Pokémon can learn via breeding.")],
|
||||
["EggGroups", EggGroupsProperty.new, _INTL("Egg groups that the Pokémon belongs to for breeding purposes.")],
|
||||
["HatchSteps", LimitProperty.new(99_999), _INTL("Number of steps until an egg of this species hatches.")],
|
||||
["Incense", ItemProperty, _INTL("Item needed to be held by a parent to produce an egg of this species.")],
|
||||
["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).")],
|
||||
["Height", NonzeroLimitProperty.new(999), _INTL("Height of the Pokémon in 0.1 metres (e.g. 42 = 4.2m).")],
|
||||
["Weight", NonzeroLimitProperty.new(9999), _INTL("Weight of the Pokémon in 0.1 kilograms (e.g. 42 = 4.2kg).")],
|
||||
["Color", GameDataProperty.new(:BodyColor), _INTL("Pokémon's body color.")],
|
||||
["Shape", GameDataProperty.new(:BodyShape), _INTL("Body shape of this species.")],
|
||||
["Habitat", GameDataProperty.new(:Habitat), _INTL("The habitat of this species.")],
|
||||
["Category", StringProperty, _INTL("Kind of Pokémon species.")],
|
||||
["Pokedex", StringProperty, _INTL("Description of the Pokémon as displayed in the Pokédex.")],
|
||||
["Generation", LimitProperty.new(99_999), _INTL("The number of the generation the Pokémon debuted in.")],
|
||||
["Flags", StringListProperty, _INTL("Words/phrases that distinguish this species from others.")],
|
||||
["WildItemCommon", GameDataPoolProperty.new(:Item), _INTL("Item(s) commonly held by wild Pokémon of this species.")],
|
||||
["WildItemUncommon", GameDataPoolProperty.new(:Item), _INTL("Item(s) uncommonly held by wild Pokémon of this species.")],
|
||||
["WildItemRare", GameDataPoolProperty.new(:Item), _INTL("Item(s) rarely held by wild Pokémon of this species.")],
|
||||
["Evolutions", EvolutionsProperty.new, _INTL("Evolution paths of this species.")]
|
||||
]
|
||||
end
|
||||
|
||||
# @param species [Symbol, self, String]
|
||||
# @param form [Integer]
|
||||
# @return [self, nil]
|
||||
def self.get_species_form(species, form)
|
||||
return nil if !species || !form
|
||||
validate species => [Symbol, self, String]
|
||||
validate form => Integer
|
||||
species = species.species if species.is_a?(self)
|
||||
species = species.to_sym if species.is_a?(String)
|
||||
trial = sprintf("%s_%d", species, form).to_sym
|
||||
species_form = (DATA[trial].nil?) ? species : trial
|
||||
return (DATA.has_key?(species_form)) ? DATA[species_form] : nil
|
||||
end
|
||||
|
||||
def self.each_species
|
||||
DATA.each_value { |species| yield species if species.form == 0 }
|
||||
end
|
||||
|
||||
def self.species_count
|
||||
ret = 0
|
||||
self.each_species { |species| ret += 1 }
|
||||
return ret
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@species = hash[:species] || @id
|
||||
@@ -347,6 +385,7 @@ module GameData
|
||||
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS unless method_defined?(:__orig__get_property_for_PBS)
|
||||
def get_property_for_PBS(key, writing_form = false)
|
||||
key = "SectionName" if key == "ID"
|
||||
ret = nil
|
||||
if self.class.schema(writing_form).include?(key)
|
||||
ret = self.send(self.class.schema(writing_form)[key][0])
|
||||
|
||||
@@ -33,6 +33,22 @@ module GameData
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
def self.editor_properties
|
||||
gender_array = []
|
||||
self.schema["Gender"][2].each { |key, value| gender_array[value] = key if !gender_array[value] }
|
||||
return [
|
||||
["ID", ReadOnlyProperty, _INTL("ID of this Trainer Type (used as a symbol like :XXX).")],
|
||||
["Name", StringProperty, _INTL("Name of this Trainer Type as displayed by the game.")],
|
||||
["Gender", EnumProperty.new(gender_array), _INTL("Gender of this Trainer Type.")],
|
||||
["BaseMoney", LimitProperty.new(9999), _INTL("Player earns this much money times the highest level among the trainer's Pokémon.")],
|
||||
["SkillLevel", LimitProperty2.new(9999), _INTL("Skill level of this Trainer Type.")],
|
||||
["Flags", StringListProperty, _INTL("Words/phrases that can be used to make trainers of this type behave differently to others.")],
|
||||
["IntroBGM", BGMProperty, _INTL("BGM played before battles against trainers of this type.")],
|
||||
["BattleBGM", BGMProperty, _INTL("BGM played in battles against trainers of this type.")],
|
||||
["VictoryBGM", BGMProperty, _INTL("BGM played when player wins battles against trainers of this type.")]
|
||||
]
|
||||
end
|
||||
|
||||
def self.check_file(tr_type, path, optional_suffix = "", suffix = "")
|
||||
tr_type_data = self.try_get(tr_type)
|
||||
return nil if tr_type_data.nil?
|
||||
@@ -109,6 +125,7 @@ module GameData
|
||||
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS unless method_defined?(:__orig__get_property_for_PBS)
|
||||
def get_property_for_PBS(key)
|
||||
key = "SectionName" if key == "ID"
|
||||
ret = __orig__get_property_for_PBS(key)
|
||||
ret = nil if key == "SkillLevel" && ret == @base_money
|
||||
return ret
|
||||
|
||||
@@ -57,7 +57,7 @@ module GameData
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id = hash[:id] || 0
|
||||
@start_money = hash[:start_money] || 3000
|
||||
@start_item_storage = hash[:start_item_storage] || []
|
||||
@home = hash[:home]
|
||||
|
||||
@@ -27,6 +27,7 @@ module GameData
|
||||
|
||||
def self.editor_properties
|
||||
return [
|
||||
["ID", ReadOnlyProperty, _INTL("ID number of this player.")],
|
||||
["TrainerType", TrainerTypeProperty, _INTL("Trainer type of this player.")],
|
||||
["WalkCharset", CharacterProperty, _INTL("Charset used while the player is still or walking.")],
|
||||
["RunCharset", CharacterProperty, _INTL("Charset used while the player is running. Uses WalkCharset if undefined.")],
|
||||
@@ -84,5 +85,11 @@ module GameData
|
||||
def surf_fish_charset
|
||||
return @surf_fish_charset || fish_charset
|
||||
end
|
||||
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS unless method_defined?(:__orig__get_property_for_PBS)
|
||||
def get_property_for_PBS(key)
|
||||
key = "SectionName" if key == "ID"
|
||||
return __orig__get_property_for_PBS(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -60,6 +60,7 @@ module GameData
|
||||
|
||||
def self.editor_properties
|
||||
return [
|
||||
["ID", ReadOnlyProperty, _INTL("ID number of this map.")],
|
||||
["Name", StringProperty, _INTL("The name of the map, as seen by the player. Can be different to the map's name as seen in RMXP.")],
|
||||
["Outdoor", BooleanProperty, _INTL("If true, this map is an outdoor map and will be tinted according to time of day.")],
|
||||
["ShowArea", BooleanProperty, _INTL("If true, the game will display the map's name upon entry.")],
|
||||
@@ -120,5 +121,11 @@ module GameData
|
||||
def has_flag?(flag)
|
||||
return @flags.any? { |f| f.downcase == flag.downcase }
|
||||
end
|
||||
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS unless method_defined?(:__orig__get_property_for_PBS)
|
||||
def get_property_for_PBS(key)
|
||||
key = "SectionName" if key == "ID"
|
||||
return __orig__get_property_for_PBS(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user