mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Added PBS schema character ^ for repeated lines, more refactoring of PBS compilers/writers
This commit is contained in:
@@ -812,7 +812,7 @@ module GameData
|
||||
return data
|
||||
end
|
||||
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS unless method_defined?(:__orig__get_property_for_PBS)
|
||||
def get_property_for_PBS(key)
|
||||
ret = __orig__get_property_for_PBS(key)
|
||||
ret = nil if ["Power", "Priority", "EffectChance"].include?(key) && ret == 0
|
||||
|
||||
@@ -193,7 +193,7 @@ module GameData
|
||||
return combos[species]&.include?(@id)
|
||||
end
|
||||
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS unless method_defined?(:__orig__get_property_for_PBS)
|
||||
def get_property_for_PBS(key)
|
||||
ret = __orig__get_property_for_PBS(key)
|
||||
case key
|
||||
|
||||
@@ -342,7 +342,7 @@ module GameData
|
||||
return 1
|
||||
end
|
||||
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS
|
||||
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)
|
||||
ret = nil
|
||||
if self.class.schema(writing_form).include?(key)
|
||||
|
||||
@@ -85,7 +85,7 @@ module GameData
|
||||
# return @front_sprite_altitude > 0
|
||||
end
|
||||
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS unless method_defined?(:__orig__get_property_for_PBS)
|
||||
def get_property_for_PBS(key)
|
||||
ret = __orig__get_property_for_PBS(key)
|
||||
case key
|
||||
|
||||
@@ -104,7 +104,7 @@ module GameData
|
||||
return @flags.any? { |f| f.downcase == flag.downcase }
|
||||
end
|
||||
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS unless method_defined?(:__orig__get_property_for_PBS)
|
||||
def get_property_for_PBS(key)
|
||||
ret = __orig__get_property_for_PBS(key)
|
||||
ret = nil if key == "SkillLevel" && ret == @base_money
|
||||
|
||||
@@ -74,22 +74,5 @@ module GameData
|
||||
ret = pbGetMessage(MessageTypes::StorageCreator, 0)
|
||||
return nil_or_empty?(ret) ? _INTL("Bill") : ret
|
||||
end
|
||||
|
||||
def property_from_string(str)
|
||||
case str
|
||||
when "StartMoney" then return @start_money
|
||||
when "StartItemStorage" then return @start_item_storage
|
||||
when "Home" then return @home
|
||||
when "StorageCreator" then return @real_storage_creator
|
||||
when "WildBattleBGM" then return @wild_battle_BGM
|
||||
when "TrainerBattleBGM" then return @trainer_battle_BGM
|
||||
when "WildVictoryBGM" then return @wild_victory_BGM
|
||||
when "TrainerVictoryBGM" then return @trainer_victory_BGM
|
||||
when "WildCaptureME" then return @wild_capture_ME
|
||||
when "SurfBGM" then return @surf_BGM
|
||||
when "BicycleBGM" then return @bicycle_BGM
|
||||
end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -82,20 +82,5 @@ module GameData
|
||||
def surf_fish_charset
|
||||
return @surf_fish_charset || fish_charset
|
||||
end
|
||||
|
||||
def property_from_string(str)
|
||||
case str
|
||||
when "TrainerType" then return @trainer_type
|
||||
when "WalkCharset" then return @walk_charset
|
||||
when "RunCharset" then return @run_charset
|
||||
when "CycleCharset" then return @cycle_charset
|
||||
when "SurfCharset" then return @surf_charset
|
||||
when "DiveCharset" then return @dive_charset
|
||||
when "FishCharset" then return @fish_charset
|
||||
when "SurfFishCharset" then return @surf_fish_charset
|
||||
when "Home" then return @home
|
||||
end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -109,34 +109,6 @@ module GameData
|
||||
@flags = hash[:flags] || []
|
||||
end
|
||||
|
||||
def property_from_string(str)
|
||||
case str
|
||||
when "Name" then return @real_name
|
||||
when "Outdoor" then return @outdoor_map
|
||||
when "ShowArea" then return @announce_location
|
||||
when "Bicycle" then return @can_bicycle
|
||||
when "BicycleAlways" then return @always_bicycle
|
||||
when "HealingSpot" then return @teleport_destination
|
||||
when "Weather" then return @weather
|
||||
when "MapPosition" then return @town_map_position
|
||||
when "DiveMap" then return @dive_map_id
|
||||
when "DarkMap" then return @dark_map
|
||||
when "SafariMap" then return @safari_map
|
||||
when "SnapEdges" then return @snap_edges
|
||||
when "Dungeon" then return @random_dungeon
|
||||
when "BattleBack" then return @battle_background
|
||||
when "WildBattleBGM" then return @wild_battle_BGM
|
||||
when "TrainerBattleBGM" then return @trainer_battle_BGM
|
||||
when "WildVictoryBGM" then return @wild_victory_BGM
|
||||
when "TrainerVictoryBGM" then return @trainer_victory_BGM
|
||||
when "WildCaptureME" then return @wild_capture_ME
|
||||
when "MapSize" then return @town_map_size
|
||||
when "Environment" then return @battle_environment
|
||||
when "Flags" then return @flags
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this map
|
||||
def name
|
||||
return pbGetMapNameFromId(@id)
|
||||
|
||||
@@ -15,8 +15,9 @@ module GameData
|
||||
DATA_FILENAME = "dungeon_tilesets.dat"
|
||||
|
||||
SCHEMA = {
|
||||
"Autotile" => [:autotile, "um"],
|
||||
"Tile" => [:tile, "um"],
|
||||
"SectionName" => [:id, "u"],
|
||||
"Autotile" => [:autotile, "^um"],
|
||||
"Tile" => [:tile, "^um"],
|
||||
"SnapToLargeGrid" => [:snap_to_large_grid, "b"],
|
||||
"LargeVoidTiles" => [:large_void_tiles, "b"],
|
||||
"LargeWallTiles" => [:large_wall_tiles, "b"],
|
||||
@@ -192,18 +193,27 @@ module GameData
|
||||
return ret
|
||||
end
|
||||
|
||||
def property_from_string(str)
|
||||
case str
|
||||
when "SnapToLargeGrid" then return @snap_to_large_grid
|
||||
when "LargeVoidTiles" then return @large_void_tiles
|
||||
when "LargeWallTiles" then return @large_wall_tiles
|
||||
when "LargeFloorTiles" then return @large_floor_tiles
|
||||
when "DoubleWalls" then return @double_walls
|
||||
when "FloorPatchUnderWalls" then return @floor_patch_under_walls
|
||||
when "ThinNorthWallOffset" then return @thin_north_wall_offset
|
||||
when "Flags" then return @flags
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS unless method_defined?(:__orig__get_property_for_PBS)
|
||||
def get_property_for_PBS(key)
|
||||
ret = __orig__get_property_for_PBS(key)
|
||||
case key
|
||||
when "ThinNorthWallOffset"
|
||||
ret = nil if ret == 0
|
||||
when "Tile", "Autotile"
|
||||
ret = []
|
||||
@tile_type_ids.each do |tile_type, tile_ids|
|
||||
tile_ids.each do |tile|
|
||||
case key
|
||||
when "Tile"
|
||||
ret.push([tile[0] - 384, tile_type]) if !tile[1] && tile[0] >= 384
|
||||
when "Autotile"
|
||||
ret.push([tile[0] / 48, tile_type]) if !tile[1] && tile[0] < 384
|
||||
end
|
||||
end
|
||||
end
|
||||
ret = nil if ret.length == 0
|
||||
end
|
||||
return nil
|
||||
return ret
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -115,7 +115,7 @@ module GameData
|
||||
return width, height
|
||||
end
|
||||
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS unless method_defined?(:__orig__get_property_for_PBS)
|
||||
def get_property_for_PBS(key)
|
||||
case key
|
||||
when "SectionName" then return [@area, (@version > 0) ? @version : nil]
|
||||
|
||||
@@ -11,29 +11,36 @@ module GameData
|
||||
DATA_FILENAME = "phone.dat"
|
||||
|
||||
SCHEMA = {
|
||||
"Intro" => [:intro, "q"],
|
||||
"IntroMorning" => [:intro_morning, "q"],
|
||||
"IntroAfternoon" => [:intro_afternoon, "q"],
|
||||
"IntroEvening" => [:intro_evening, "q"],
|
||||
"Body" => [:body, "q"],
|
||||
"Body1" => [:body1, "q"],
|
||||
"Body2" => [:body2, "q"],
|
||||
"BattleRequest" => [:battle_request, "q"],
|
||||
"BattleRemind" => [:battle_remind, "q"],
|
||||
"End" => [:end, "q"]
|
||||
"SectionName" => [:id, "q"],
|
||||
"Intro" => [:intro, "^q"],
|
||||
"IntroMorning" => [:intro_morning, "^q"],
|
||||
"IntroAfternoon" => [:intro_afternoon, "^q"],
|
||||
"IntroEvening" => [:intro_evening, "^q"],
|
||||
"Body1" => [:body1, "^q"],
|
||||
"Body2" => [:body2, "^q"],
|
||||
"Body" => [:body, "^q"],
|
||||
"BattleRequest" => [:battle_request, "^q"],
|
||||
"BattleRemind" => [:battle_remind, "^q"],
|
||||
"End" => [:end, "^q"]
|
||||
}
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
# @param tr_type [Symbol, String]
|
||||
# @param tr_name [String]
|
||||
# @param tr_name [String, nil] only nil for the default message set
|
||||
# @param tr_version [Integer, nil]
|
||||
# @return [Boolean] whether the given other is defined as a self
|
||||
def self.exists?(tr_type, tr_name, tr_version = 0)
|
||||
def self.exists?(tr_type, tr_name = nil, tr_version = 0)
|
||||
if tr_type.is_a?(Array)
|
||||
tr_name = tr_type[1]
|
||||
tr_version = tr_type[2]
|
||||
tr_type = tr_type[0]
|
||||
end
|
||||
validate tr_type => [Symbol, String]
|
||||
validate tr_name => [String]
|
||||
validate tr_name => [String, NilClass]
|
||||
key = [tr_type.to_sym, tr_name, tr_version]
|
||||
key = key[0] if key[1] == nil
|
||||
return !self::DATA[key].nil?
|
||||
end
|
||||
|
||||
@@ -63,7 +70,7 @@ module GameData
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@trainer_type = hash[:trainer_type]
|
||||
@real_name = hash[:name]
|
||||
@real_name = hash[:real_name]
|
||||
@version = hash[:version] || 0
|
||||
@intro = hash[:intro]
|
||||
@intro_morning = hash[:intro_morning]
|
||||
@@ -77,20 +84,14 @@ module GameData
|
||||
@end = hash[:end]
|
||||
end
|
||||
|
||||
def property_from_string(str)
|
||||
case str
|
||||
when "Intro" then return @intro
|
||||
when "IntroMorning" then return @intro_morning
|
||||
when "IntroAfternoon" then return @intro_afternoon
|
||||
when "IntroEvening" then return @intro_evening
|
||||
when "Body" then return @body
|
||||
when "Body1" then return @body1
|
||||
when "Body2" then return @body2
|
||||
when "BattleRequest" then return @battle_request
|
||||
when "BattleRemind" then return @battle_remind
|
||||
when "End" then return @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)
|
||||
if key == "SectionName"
|
||||
return "Default" if @id == "default"
|
||||
ret = [@trainer_type, @real_name, (@version > 0) ? @version : nil]
|
||||
return ret.compact.join(",")
|
||||
end
|
||||
return nil
|
||||
return __orig__get_property_for_PBS(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user