mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Implemented GameData::Metadata and GameData::MapMetadata
This commit is contained in:
@@ -429,7 +429,7 @@ def pbGetPlayerCharset(meta,charset,trainer=nil,force=false)
|
||||
end
|
||||
|
||||
def pbUpdateVehicle
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
|
||||
meta = GameData::Metadata.get_player($PokemonGlobal.playerID)
|
||||
if meta
|
||||
charset = 1 # Regular graphic
|
||||
if $PokemonGlobal.diving; charset = 5 # Diving graphic
|
||||
@@ -448,10 +448,10 @@ def pbCancelVehicles(destination=nil)
|
||||
pbUpdateVehicle
|
||||
end
|
||||
|
||||
def pbCanUseBike?(mapid)
|
||||
return true if pbGetMetadata(mapid,MapMetadata::BICYCLE_ALWAYS)
|
||||
val = pbGetMetadata(mapid,MapMetadata::BICYCLE)
|
||||
val = pbGetMetadata(mapid,MapMetadata::OUTDOOR) if val==nil
|
||||
def pbCanUseBike?(map_id)
|
||||
return true if GameData::MapMetadata.get(map_id).always_bicycle
|
||||
val = GameData::MapMetadata.get(map_id).can_bicycle
|
||||
val = GameData::MapMetadata.get(map_id).outdoor_map if val.nil?
|
||||
return (val) ? true : false
|
||||
end
|
||||
|
||||
@@ -459,8 +459,8 @@ def pbMountBike
|
||||
return if $PokemonGlobal.bicycle
|
||||
$PokemonGlobal.bicycle = true
|
||||
pbUpdateVehicle
|
||||
bikebgm = pbGetMetadata(0,Metadata::BICYCLE_BGM)
|
||||
pbCueBGM(bikebgm,0.5) if bikebgm
|
||||
bike_bgm = GameData::Metadata.get.bicycle_BGM
|
||||
pbCueBGM(bike_bgm, 0.5) if bike_bgm
|
||||
end
|
||||
|
||||
def pbDismountBike
|
||||
|
||||
@@ -38,7 +38,7 @@ class Game_Player < Game_Character
|
||||
@defaultCharacterName = "" if !@defaultCharacterName
|
||||
return @defaultCharacterName if @defaultCharacterName!=""
|
||||
if !@move_route_forcing && $PokemonGlobal.playerID>=0
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
|
||||
meta = GameData::Metadata.get_player($PokemonGlobal.playerID)
|
||||
if meta && !$PokemonGlobal.bicycle && !$PokemonGlobal.diving && !$PokemonGlobal.surfing
|
||||
charset = 1 # Display normal character sprite
|
||||
if pbCanRun? && (moving? || @wasmoving) && Input.dir4!=0 && meta[4] && meta[4]!=""
|
||||
|
||||
@@ -318,7 +318,7 @@ class Game_Map
|
||||
|
||||
def display_x=(value)
|
||||
@display_x = value
|
||||
if pbGetMetadata(self.map_id,MapMetadata::SNAP_EDGES)
|
||||
if GameData::MapMetadata.get(self.map_id).snap_edges
|
||||
max_x = (self.width - Graphics.width*1.0/TILE_WIDTH) * REAL_RES_X
|
||||
@display_x = [0, [@display_x, max_x].min].max
|
||||
end
|
||||
@@ -327,7 +327,7 @@ class Game_Map
|
||||
|
||||
def display_y=(value)
|
||||
@display_y = value
|
||||
if pbGetMetadata(self.map_id,MapMetadata::SNAP_EDGES)
|
||||
if GameData::MapMetadata.get(self.map_id).snap_edges
|
||||
max_y = (self.height - Graphics.height*1.0/TILE_HEIGHT) * REAL_RES_Y
|
||||
@display_y = [0, [@display_y, max_y].min].max
|
||||
end
|
||||
|
||||
@@ -869,7 +869,7 @@ class PokemonEntryScene
|
||||
addBackgroundPlane(@sprites,"background","Naming/bg_2",@viewport)
|
||||
case subject
|
||||
when 1 # Player
|
||||
meta=pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
|
||||
meta=GameData::Metadata.get_player($PokemonGlobal.playerID)
|
||||
if meta
|
||||
@sprites["shadow"]=IconSprite.new(0,0,@viewport)
|
||||
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
|
||||
@@ -1147,7 +1147,7 @@ class PokemonEntryScene2
|
||||
@sprites["bg"].setBitmap("Graphics/Pictures/Naming/bg")
|
||||
case subject
|
||||
when 1 # Player
|
||||
meta=pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
|
||||
meta=GameData::Metadata.get_player($PokemonGlobal.playerID)
|
||||
if meta
|
||||
@sprites["shadow"]=IconSprite.new(0,0,@viewport)
|
||||
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
|
||||
|
||||
@@ -49,23 +49,6 @@ def pbClearData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Methods to get metadata.
|
||||
#===============================================================================
|
||||
def pbLoadMetadata
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.metadata
|
||||
$PokemonTemp.metadata = load_data("Data/metadata.dat") || []
|
||||
end
|
||||
return $PokemonTemp.metadata
|
||||
end
|
||||
|
||||
def pbGetMetadata(map_id, metadata_type)
|
||||
meta = pbLoadMetadata
|
||||
return meta[map_id][metadata_type] if meta[map_id]
|
||||
return nil
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Method to get Town Map data.
|
||||
#===============================================================================
|
||||
|
||||
@@ -2,6 +2,7 @@ module GameData
|
||||
# A mixin module for data classes which provides common class methods (called
|
||||
# by GameData::Thing.method) that provide access to data held within.
|
||||
# Assumes the data class's data is stored in a class constant hash called DATA.
|
||||
# For data that is known by a symbol or an ID number.
|
||||
module ClassMethods
|
||||
# @param other [Symbol, self, String, Integer]
|
||||
# @return [Boolean] whether the given other is defined as a self
|
||||
@@ -39,9 +40,51 @@ module GameData
|
||||
|
||||
def each
|
||||
keys = self::DATA.keys.sort { |a, b| self::DATA[a].id_number <=> self::DATA[b].id_number }
|
||||
keys.each do |key|
|
||||
yield self::DATA[key] if key.is_a?(Symbol)
|
||||
keys.each { |key| yield self::DATA[key] if key.is_a?(Symbol) }
|
||||
end
|
||||
|
||||
def load
|
||||
const_set(:DATA, load_data("Data/#{self::DATA_FILENAME}"))
|
||||
end
|
||||
|
||||
def save
|
||||
save_data(self::DATA, "Data/#{self::DATA_FILENAME}")
|
||||
end
|
||||
end
|
||||
|
||||
# A mixin module for data classes which provides common class methods (called
|
||||
# by GameData::Thing.method) that provide access to data held within.
|
||||
# Assumes the data class's data is stored in a class constant hash called DATA.
|
||||
# For data that is only known by an ID number.
|
||||
module ClassMethodsIDNumbers
|
||||
# @param other [self, Integer]
|
||||
# @return [Boolean] whether the given other is defined as a self
|
||||
def exists?(other)
|
||||
return false if other.nil?
|
||||
validate other => [self, Integer]
|
||||
other = other.id if other.is_a?(self)
|
||||
return !self::DATA[other].nil?
|
||||
end
|
||||
|
||||
# @param other [self, Integer]
|
||||
# @return [self]
|
||||
def get(other)
|
||||
validate other => [self, Integer]
|
||||
return other if other.is_a?(self)
|
||||
raise "Unknown ID #{other}." unless self::DATA.has_key?(other)
|
||||
return self::DATA[other]
|
||||
end
|
||||
|
||||
def try_get(other)
|
||||
return nil if other.nil?
|
||||
validate other => [self, Integer]
|
||||
return other if other.is_a?(self)
|
||||
return (self::DATA.has_key?(other)) ? self::DATA[other] : nil
|
||||
end
|
||||
|
||||
def each
|
||||
keys = self::DATA.keys.sort
|
||||
keys.each { |key| yield self::DATA[key] }
|
||||
end
|
||||
|
||||
def load
|
||||
229
Data/Scripts/011_Data/001_Game data/005_Metadata.rb
Normal file
229
Data/Scripts/011_Data/001_Game data/005_Metadata.rb
Normal file
@@ -0,0 +1,229 @@
|
||||
module GameData
|
||||
class Metadata
|
||||
attr_reader :id
|
||||
attr_reader :home
|
||||
attr_reader :wild_battle_BGM
|
||||
attr_reader :trainer_battle_BGM
|
||||
attr_reader :wild_victory_ME
|
||||
attr_reader :trainer_victory_ME
|
||||
attr_reader :wild_capture_ME
|
||||
attr_reader :surf_BGM
|
||||
attr_reader :bicycle_BGM
|
||||
attr_reader :player_A
|
||||
attr_reader :player_B
|
||||
attr_reader :player_C
|
||||
attr_reader :player_D
|
||||
attr_reader :player_E
|
||||
attr_reader :player_F
|
||||
attr_reader :player_G
|
||||
attr_reader :player_H
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "metadata.dat"
|
||||
|
||||
SCHEMA = {
|
||||
"Home" => [1, "vuuu"],
|
||||
"WildBattleBGM" => [2, "s"],
|
||||
"TrainerBattleBGM" => [3, "s"],
|
||||
"WildVictoryME" => [4, "s"],
|
||||
"TrainerVictoryME" => [5, "s"],
|
||||
"WildCaptureME" => [6, "s"],
|
||||
"SurfBGM" => [7, "s"],
|
||||
"BicycleBGM" => [8, "s"],
|
||||
"PlayerA" => [9, "esssssss", :PBTrainers],
|
||||
"PlayerB" => [10, "esssssss", :PBTrainers],
|
||||
"PlayerC" => [11, "esssssss", :PBTrainers],
|
||||
"PlayerD" => [12, "esssssss", :PBTrainers],
|
||||
"PlayerE" => [13, "esssssss", :PBTrainers],
|
||||
"PlayerF" => [14, "esssssss", :PBTrainers],
|
||||
"PlayerG" => [15, "esssssss", :PBTrainers],
|
||||
"PlayerH" => [16, "esssssss", :PBTrainers]
|
||||
}
|
||||
|
||||
extend ClassMethodsIDNumbers
|
||||
include InstanceMethods
|
||||
|
||||
def self.editor_properties
|
||||
return [
|
||||
["Home", MapCoordsFacingProperty, _INTL("Map ID and X and Y coordinates of where the player goes if no Pokémon Center was entered after a loss.")],
|
||||
["WildBattleBGM", BGMProperty, _INTL("Default BGM for wild Pokémon battles.")],
|
||||
["TrainerBattleBGM", BGMProperty, _INTL("Default BGM for Trainer battles.")],
|
||||
["WildVictoryME", MEProperty, _INTL("Default ME played after winning a wild Pokémon battle.")],
|
||||
["TrainerVictoryME", MEProperty, _INTL("Default ME played after winning a Trainer battle.")],
|
||||
["WildCaptureME", MEProperty, _INTL("Default ME played after catching a Pokémon.")],
|
||||
["SurfBGM", BGMProperty, _INTL("BGM played while surfing.")],
|
||||
["BicycleBGM", BGMProperty, _INTL("BGM played while on a bicycle.")],
|
||||
["PlayerA", PlayerProperty, _INTL("Specifies player A.")],
|
||||
["PlayerB", PlayerProperty, _INTL("Specifies player B.")],
|
||||
["PlayerC", PlayerProperty, _INTL("Specifies player C.")],
|
||||
["PlayerD", PlayerProperty, _INTL("Specifies player D.")],
|
||||
["PlayerE", PlayerProperty, _INTL("Specifies player E.")],
|
||||
["PlayerF", PlayerProperty, _INTL("Specifies player F.")],
|
||||
["PlayerG", PlayerProperty, _INTL("Specifies player G.")],
|
||||
["PlayerH", PlayerProperty, _INTL("Specifies player H.")]
|
||||
]
|
||||
end
|
||||
|
||||
def self.get
|
||||
return DATA[0]
|
||||
end
|
||||
|
||||
def self.get_player(id)
|
||||
case id
|
||||
when 0 then return self.get.player_A
|
||||
when 1 then return self.get.player_B
|
||||
when 2 then return self.get.player_C
|
||||
when 3 then return self.get.player_D
|
||||
when 4 then return self.get.player_E
|
||||
when 5 then return self.get.player_F
|
||||
when 6 then return self.get.player_G
|
||||
when 7 then return self.get.player_H
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
validate hash => Hash, hash[:id] => Integer
|
||||
@id = hash[:id]
|
||||
@home = hash[:home]
|
||||
@wild_battle_BGM = hash[:wild_battle_BGM]
|
||||
@trainer_battle_BGM = hash[:trainer_battle_BGM]
|
||||
@wild_victory_ME = hash[:wild_victory_ME]
|
||||
@trainer_victory_ME = hash[:trainer_victory_ME]
|
||||
@wild_capture_ME = hash[:wild_capture_ME]
|
||||
@surf_BGM = hash[:surf_BGM]
|
||||
@bicycle_BGM = hash[:bicycle_BGM]
|
||||
@player_A = hash[:player_A]
|
||||
@player_B = hash[:player_B]
|
||||
@player_C = hash[:player_C]
|
||||
@player_D = hash[:player_D]
|
||||
@player_E = hash[:player_E]
|
||||
@player_F = hash[:player_F]
|
||||
@player_G = hash[:player_G]
|
||||
@player_H = hash[:player_H]
|
||||
end
|
||||
|
||||
def property_from_string(str)
|
||||
case str
|
||||
when "Home" then return @home
|
||||
when "WildBattleBGM" then return @wild_battle_BGM
|
||||
when "TrainerBattleBGM" then return @trainer_battle_BGM
|
||||
when "WildVictoryME" then return @wild_victory_ME
|
||||
when "TrainerVictoryME" then return @trainer_victory_ME
|
||||
when "WildCaptureME" then return @wild_capture_ME
|
||||
when "SurfBGM" then return @surf_BGM
|
||||
when "BicycleBGM" then return @bicycle_BGM
|
||||
when "PlayerA" then return @player_A
|
||||
when "PlayerB" then return @player_B
|
||||
when "PlayerC" then return @player_C
|
||||
when "PlayerD" then return @player_D
|
||||
when "PlayerE" then return @player_E
|
||||
when "PlayerF" then return @player_F
|
||||
when "PlayerG" then return @player_G
|
||||
when "PlayerH" then return @player_H
|
||||
end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
def pbLoadMetadata
|
||||
Deprecation.warn_method('pbLoadMetadata', 'v20', 'GameData::Metadata.get or GameData::MapMetadata.get(map_id)')
|
||||
return nil
|
||||
end
|
||||
|
||||
def pbGetMetadata(map_id, metadata_type)
|
||||
if map_id == 0 # Global metadata
|
||||
Deprecation.warn_method('pbGetMetadata', 'v20', 'GameData::Metadata.get.something')
|
||||
ret = GameData::Metadata.get
|
||||
case metadata_type
|
||||
when Metadata::HOME then return ret.home
|
||||
when Metadata::WILD_BATTLE_BGM then return ret.wild_battle_BGM
|
||||
when Metadata::TRAINER_BATTLE_BGM then return ret.trainer_battle_BGM
|
||||
when Metadata::WILD_VICTORY_ME then return ret.wild_victory_ME
|
||||
when Metadata::TRAINER_VICTORY_ME then return ret.trainer_victory_ME
|
||||
when Metadata::WILD_CAPTURE_ME then return ret.wild_capture_ME
|
||||
when Metadata::SURF_BGM then return ret.surf_BGM
|
||||
when Metadata::BICYCLE_BGM then return ret.bicycle_BGM
|
||||
when Metadata::PLAYER_A then return ret.player_A
|
||||
when Metadata::PLAYER_B then return ret.player_B
|
||||
when Metadata::PLAYER_C then return ret.player_C
|
||||
when Metadata::PLAYER_D then return ret.player_D
|
||||
when Metadata::PLAYER_E then return ret.player_E
|
||||
when Metadata::PLAYER_F then return ret.player_F
|
||||
when Metadata::PLAYER_G then return ret.player_G
|
||||
when Metadata::PLAYER_H then return ret.player_H
|
||||
end
|
||||
else # Map metadata
|
||||
Deprecation.warn_method('pbGetMetadata', 'v20', 'GameData::MapMetadata.get(map_id).something')
|
||||
ret = GameData::MapMetadata.get(map_id)
|
||||
case metadata_type
|
||||
when MapMetadata::OUTDOOR then return ret.outdoor_map
|
||||
when MapMetadata::SHOW_AREA then return ret.announce_location
|
||||
when MapMetadata::BICYCLE then return ret.can_bicycle
|
||||
when MapMetadata::BICYCLE_ALWAYS then return ret.always_bicycle
|
||||
when MapMetadata::HEALING_SPOT then return ret.teleport_destination
|
||||
when MapMetadata::WEATHER then return ret.weather
|
||||
when MapMetadata::MAP_POSITION then return ret.town_map_position
|
||||
when MapMetadata::DIVE_MAP then return ret.dive_map_id
|
||||
when MapMetadata::DARK_MAP then return ret.dark_map
|
||||
when MapMetadata::SAFARI_MAP then return ret.safari_map
|
||||
when MapMetadata::SNAP_EDGES then return ret.snap_edges
|
||||
when MapMetadata::DUNGEON then return ret.random_dungeon
|
||||
when MapMetadata::BATTLE_BACK then return ret.battle_background
|
||||
when MapMetadata::WILD_BATTLE_BGM then return ret.wild_battle_BGM
|
||||
when MapMetadata::TRAINER_BATTLE_BGM then return ret.trainer_battle_BGM
|
||||
when MapMetadata::WILD_VICTORY_ME then return ret.wild_victory_ME
|
||||
when MapMetadata::TRAINER_VICTORY_ME then return ret.trainer_victory_ME
|
||||
when MapMetadata::WILD_CAPTURE_ME then return ret.wild_capture_ME
|
||||
when MapMetadata::MAP_SIZE then return ret.town_map_size
|
||||
when MapMetadata::ENVIRONMENT then return ret.battle_environment
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
module Metadata
|
||||
HOME = 1
|
||||
WILD_BATTLE_BGM = 2
|
||||
TRAINER_BATTLE_BGM = 3
|
||||
WILD_VICTORY_ME = 4
|
||||
TRAINER_VICTORY_ME = 5
|
||||
WILD_CAPTURE_ME = 6
|
||||
SURF_BGM = 7
|
||||
BICYCLE_BGM = 8
|
||||
PLAYER_A = 9
|
||||
PLAYER_B = 10
|
||||
PLAYER_C = 11
|
||||
PLAYER_D = 12
|
||||
PLAYER_E = 13
|
||||
PLAYER_F = 14
|
||||
PLAYER_G = 15
|
||||
PLAYER_H = 16
|
||||
end
|
||||
|
||||
module MapMetadata
|
||||
OUTDOOR = 1
|
||||
SHOW_AREA = 2
|
||||
BICYCLE = 3
|
||||
BICYCLE_ALWAYS = 4
|
||||
HEALING_SPOT = 5
|
||||
WEATHER = 6
|
||||
MAP_POSITION = 7
|
||||
DIVE_MAP = 8
|
||||
DARK_MAP = 9
|
||||
SAFARI_MAP = 10
|
||||
SNAP_EDGES = 11
|
||||
DUNGEON = 12
|
||||
BATTLE_BACK = 13
|
||||
WILD_BATTLE_BGM = 14
|
||||
TRAINER_BATTLE_BGM = 15
|
||||
WILD_VICTORY_ME = 16
|
||||
TRAINER_VICTORY_ME = 17
|
||||
WILD_CAPTURE_ME = 18
|
||||
MAP_SIZE = 19
|
||||
ENVIRONMENT = 20
|
||||
end
|
||||
130
Data/Scripts/011_Data/001_Game data/006_Map metadata.rb
Normal file
130
Data/Scripts/011_Data/001_Game data/006_Map metadata.rb
Normal file
@@ -0,0 +1,130 @@
|
||||
module GameData
|
||||
class MapMetadata
|
||||
attr_reader :id
|
||||
attr_reader :outdoor_map
|
||||
attr_reader :announce_location
|
||||
attr_reader :can_bicycle
|
||||
attr_reader :always_bicycle
|
||||
attr_reader :teleport_destination
|
||||
attr_reader :weather
|
||||
attr_reader :town_map_position
|
||||
attr_reader :dive_map_id
|
||||
attr_reader :dark_map
|
||||
attr_reader :safari_map
|
||||
attr_reader :snap_edges
|
||||
attr_reader :random_dungeon
|
||||
attr_reader :battle_background
|
||||
attr_reader :wild_battle_BGM
|
||||
attr_reader :trainer_battle_BGM
|
||||
attr_reader :wild_victory_ME
|
||||
attr_reader :trainer_victory_ME
|
||||
attr_reader :wild_capture_ME
|
||||
attr_reader :town_map_size
|
||||
attr_reader :battle_environment
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "map_metadata.dat"
|
||||
|
||||
SCHEMA = {
|
||||
"Outdoor" => [1, "b"],
|
||||
"ShowArea" => [2, "b"],
|
||||
"Bicycle" => [3, "b"],
|
||||
"BicycleAlways" => [4, "b"],
|
||||
"HealingSpot" => [5, "vuu"],
|
||||
"Weather" => [6, "eu", :PBFieldWeather],
|
||||
"MapPosition" => [7, "uuu"],
|
||||
"DiveMap" => [8, "v"],
|
||||
"DarkMap" => [9, "b"],
|
||||
"SafariMap" => [10, "b"],
|
||||
"SnapEdges" => [11, "b"],
|
||||
"Dungeon" => [12, "b"],
|
||||
"BattleBack" => [13, "s"],
|
||||
"WildBattleBGM" => [14, "s"],
|
||||
"TrainerBattleBGM" => [15, "s"],
|
||||
"WildVictoryME" => [16, "s"],
|
||||
"TrainerVictoryME" => [17, "s"],
|
||||
"WildCaptureME" => [18, "s"],
|
||||
"MapSize" => [19, "us"],
|
||||
"Environment" => [20, "e", :PBEnvironment]
|
||||
}
|
||||
|
||||
extend ClassMethodsIDNumbers
|
||||
include InstanceMethods
|
||||
|
||||
def self.editor_properties
|
||||
return [
|
||||
["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.")],
|
||||
["Bicycle", BooleanProperty, _INTL("If true, the bicycle can be used on this map.")],
|
||||
["BicycleAlways", BooleanProperty, _INTL("If true, the bicycle will be mounted automatically on this map and cannot be dismounted.")],
|
||||
["HealingSpot", MapCoordsProperty, _INTL("Map ID of this Pokémon Center's town, and X and Y coordinates of its entrance within that town.")],
|
||||
["Weather", WeatherEffectProperty, _INTL("Weather conditions in effect for this map.")],
|
||||
["MapPosition", RegionMapCoordsProperty, _INTL("Identifies the point on the regional map for this map.")],
|
||||
["DiveMap", MapProperty, _INTL("Specifies the underwater layer of this map. Use only if this map has deep water.")],
|
||||
["DarkMap", BooleanProperty, _INTL("If true, this map is dark and a circle of light appears around the player. Flash can be used to expand the circle.")],
|
||||
["SafariMap", BooleanProperty, _INTL("If true, this map is part of the Safari Zone (both indoor and outdoor). Not to be used in the reception desk.")],
|
||||
["SnapEdges", BooleanProperty, _INTL("If true, when the player goes near this map's edge, the game doesn't center the player as usual.")],
|
||||
["Dungeon", BooleanProperty, _INTL("If true, this map has a randomly generated layout. See the wiki for more information.")],
|
||||
["BattleBack", StringProperty, _INTL("PNG files named 'XXX_bg', 'XXX_base0', 'XXX_base1', 'XXX_message' in Battlebacks folder, where XXX is this property's value.")],
|
||||
["WildBattleBGM", BGMProperty, _INTL("Default BGM for wild Pokémon battles on this map.")],
|
||||
["TrainerBattleBGM", BGMProperty, _INTL("Default BGM for trainer battles on this map.")],
|
||||
["WildVictoryME", MEProperty, _INTL("Default ME played after winning a wild Pokémon battle on this map.")],
|
||||
["TrainerVictoryME", MEProperty, _INTL("Default ME played after winning a Trainer battle on this map.")],
|
||||
["WildCaptureME", MEProperty, _INTL("Default ME played after catching a wild Pokémon on this map.")],
|
||||
["MapSize", MapSizeProperty, _INTL("The width of the map in Town Map squares, and a string indicating which squares are part of this map.")],
|
||||
["Environment", EnvironmentProperty, _INTL("The default battle environment for battles on this map.")]
|
||||
]
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
validate hash => Hash, hash[:id] => Integer
|
||||
@id = hash[:id]
|
||||
@outdoor_map = hash[:outdoor_map]
|
||||
@announce_location = hash[:announce_location]
|
||||
@can_bicycle = hash[:can_bicycle]
|
||||
@always_bicycle = hash[:always_bicycle]
|
||||
@teleport_destination = hash[:teleport_destination]
|
||||
@weather = hash[:weather]
|
||||
@town_map_position = hash[:town_map_position]
|
||||
@dive_map_id = hash[:dive_map_id]
|
||||
@dark_map = hash[:dark_map]
|
||||
@safari_map = hash[:safari_map]
|
||||
@snap_edges = hash[:snap_edges]
|
||||
@random_dungeon = hash[:random_dungeon]
|
||||
@battle_background = hash[:battle_background]
|
||||
@wild_battle_BGM = hash[:wild_battle_BGM]
|
||||
@trainer_battle_BGM = hash[:trainer_battle_BGM]
|
||||
@wild_victory_ME = hash[:wild_victory_ME]
|
||||
@trainer_victory_ME = hash[:trainer_victory_ME]
|
||||
@wild_capture_ME = hash[:wild_capture_ME]
|
||||
@town_map_size = hash[:town_map_size]
|
||||
@battle_environment = hash[:battle_environment]
|
||||
end
|
||||
|
||||
def property_from_string(str)
|
||||
case str
|
||||
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 "WildVictoryME" then return @wild_victory_ME
|
||||
when "TrainerVictoryME" then return @trainer_victory_ME
|
||||
when "WildCaptureME" then return @wild_capture_ME
|
||||
when "MapSize" then return @town_map_size
|
||||
when "Environment" then return @battle_environment
|
||||
end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -30,96 +30,6 @@ module PhoneMsgType
|
||||
BattleRequest = 3
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Global metadata
|
||||
#===============================================================================
|
||||
module Metadata
|
||||
HOME = 1
|
||||
WILD_BATTLE_BGM = 2
|
||||
TRAINER_BATTLE_BGM = 3
|
||||
WILD_VICTORY_ME = 4
|
||||
TRAINER_VICTORY_ME = 5
|
||||
WILD_CAPTURE_ME = 6
|
||||
SURF_BGM = 7
|
||||
BICYCLE_BGM = 8
|
||||
PLAYER_A = 9
|
||||
PLAYER_B = 10
|
||||
PLAYER_C = 11
|
||||
PLAYER_D = 12
|
||||
PLAYER_E = 13
|
||||
PLAYER_F = 14
|
||||
PLAYER_G = 15
|
||||
PLAYER_H = 16
|
||||
|
||||
SCHEMA = {
|
||||
"Home" => [HOME, "uuuu"],
|
||||
"WildBattleBGM" => [WILD_BATTLE_BGM, "s"],
|
||||
"TrainerBattleBGM" => [TRAINER_BATTLE_BGM, "s"],
|
||||
"WildVictoryME" => [WILD_VICTORY_ME, "s"],
|
||||
"TrainerVictoryME" => [TRAINER_VICTORY_ME, "s"],
|
||||
"WildCaptureME" => [WILD_CAPTURE_ME, "s"],
|
||||
"SurfBGM" => [SURF_BGM, "s"],
|
||||
"BicycleBGM" => [BICYCLE_BGM, "s"],
|
||||
"PlayerA" => [PLAYER_A, "esssssss", :PBTrainers],
|
||||
"PlayerB" => [PLAYER_B, "esssssss", :PBTrainers],
|
||||
"PlayerC" => [PLAYER_C, "esssssss", :PBTrainers],
|
||||
"PlayerD" => [PLAYER_D, "esssssss", :PBTrainers],
|
||||
"PlayerE" => [PLAYER_E, "esssssss", :PBTrainers],
|
||||
"PlayerF" => [PLAYER_F, "esssssss", :PBTrainers],
|
||||
"PlayerG" => [PLAYER_G, "esssssss", :PBTrainers],
|
||||
"PlayerH" => [PLAYER_H, "esssssss", :PBTrainers]
|
||||
}
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Map-specific metadata
|
||||
#===============================================================================
|
||||
module MapMetadata
|
||||
OUTDOOR = 1
|
||||
SHOW_AREA = 2
|
||||
BICYCLE = 3
|
||||
BICYCLE_ALWAYS = 4
|
||||
HEALING_SPOT = 5
|
||||
WEATHER = 6
|
||||
MAP_POSITION = 7
|
||||
DIVE_MAP = 8
|
||||
DARK_MAP = 9
|
||||
SAFARI_MAP = 10
|
||||
SNAP_EDGES = 11
|
||||
DUNGEON = 12
|
||||
BATTLE_BACK = 13
|
||||
WILD_BATTLE_BGM = 14
|
||||
TRAINER_BATTLE_BGM = 15
|
||||
WILD_VICTORY_ME = 16
|
||||
TRAINER_VICTORY_ME = 17
|
||||
WILD_CAPTURE_ME = 18
|
||||
MAP_SIZE = 19
|
||||
ENVIRONMENT = 20
|
||||
|
||||
SCHEMA = {
|
||||
"Outdoor" => [OUTDOOR, "b"],
|
||||
"ShowArea" => [SHOW_AREA, "b"],
|
||||
"Bicycle" => [BICYCLE, "b"],
|
||||
"BicycleAlways" => [BICYCLE_ALWAYS, "b"],
|
||||
"HealingSpot" => [HEALING_SPOT, "uuu"],
|
||||
"Weather" => [WEATHER, "eu", :PBFieldWeather],
|
||||
"MapPosition" => [MAP_POSITION, "uuu"],
|
||||
"DiveMap" => [DIVE_MAP, "u"],
|
||||
"DarkMap" => [DARK_MAP, "b"],
|
||||
"SafariMap" => [SAFARI_MAP, "b"],
|
||||
"SnapEdges" => [SNAP_EDGES, "b"],
|
||||
"Dungeon" => [DUNGEON, "b"],
|
||||
"BattleBack" => [BATTLE_BACK, "s"],
|
||||
"WildBattleBGM" => [WILD_BATTLE_BGM, "s"],
|
||||
"TrainerBattleBGM" => [TRAINER_BATTLE_BGM, "s"],
|
||||
"WildVictoryME" => [WILD_VICTORY_ME, "s"],
|
||||
"TrainerVictoryME" => [TRAINER_VICTORY_ME, "s"],
|
||||
"WildCaptureME" => [WILD_CAPTURE_ME, "s"],
|
||||
"MapSize" => [MAP_SIZE, "us"],
|
||||
"Environment" => [ENVIRONMENT, "e", :PBEnvironment]
|
||||
}
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Pokémon data
|
||||
#===============================================================================
|
||||
|
||||
@@ -412,11 +412,11 @@ Events.onMapChanging += proc { |_sender,e|
|
||||
newMapID = e[0]
|
||||
if newMapID>0
|
||||
mapinfos = ($RPGVX) ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata")
|
||||
oldWeather = pbGetMetadata($game_map.map_id,MapMetadata::WEATHER)
|
||||
oldWeather = GameData::MapMetadata.get($game_map.map_id).weather
|
||||
if $game_map.name!=mapinfos[newMapID].name
|
||||
$game_screen.weather(0,0,0) if oldWeather
|
||||
else
|
||||
newWeather = pbGetMetadata(newMapID,MapMetadata::WEATHER)
|
||||
newWeather = GameData::MapMetadata.get(newMapID).weather
|
||||
$game_screen.weather(0,0,0) if oldWeather && !newWeather
|
||||
end
|
||||
end
|
||||
@@ -424,19 +424,19 @@ Events.onMapChanging += proc { |_sender,e|
|
||||
|
||||
# Set up various data related to the new map
|
||||
Events.onMapChange += proc { |_sender,e|
|
||||
oldid = e[0] # previous map ID, 0 if no map ID
|
||||
healing = pbGetMetadata($game_map.map_id,MapMetadata::HEALING_SPOT)
|
||||
oldid = e[0] # previous map ID, is 0 if no map ID
|
||||
healing = GameData::MapMetadata.get($game_map.map_id).teleport_destination
|
||||
$PokemonGlobal.healingSpot = healing if healing
|
||||
$PokemonMap.clear if $PokemonMap
|
||||
$PokemonEncounters.setup($game_map.map_id) if $PokemonEncounters
|
||||
$PokemonGlobal.visitedMaps[$game_map.map_id] = true
|
||||
if oldid!=0 && oldid!=$game_map.map_id
|
||||
mapinfos = ($RPGVX) ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata")
|
||||
weather = pbGetMetadata($game_map.map_id,MapMetadata::WEATHER)
|
||||
weather = GameData::MapMetadata.get($game_map.map_id).weather
|
||||
if $game_map.name!=mapinfos[oldid].name
|
||||
$game_screen.weather(weather[0],8,20) if weather && rand(100)<weather[1]
|
||||
else
|
||||
oldweather = pbGetMetadata(oldid,MapMetadata::WEATHER)
|
||||
oldweather = GameData::MapMetadata.get(oldid).weather
|
||||
$game_screen.weather(weather[0],8,20) if weather && !oldweather && rand(100)<weather[1]
|
||||
end
|
||||
end
|
||||
@@ -457,7 +457,7 @@ Events.onMapSceneChange += proc { |_sender,e|
|
||||
$PokemonGlobal.mapTrail[0] = $game_map.map_id
|
||||
end
|
||||
# Display darkness circle on dark maps
|
||||
darkmap = pbGetMetadata($game_map.map_id,MapMetadata::DARK_MAP)
|
||||
darkmap = GameData::MapMetadata.get($game_map.map_id).dark_map
|
||||
if darkmap
|
||||
if $PokemonGlobal.flashUsed
|
||||
$PokemonTemp.darknessSprite = DarknessSprite.new
|
||||
@@ -477,7 +477,7 @@ Events.onMapSceneChange += proc { |_sender,e|
|
||||
end
|
||||
# Show location signpost
|
||||
if mapChanged
|
||||
if pbGetMetadata($game_map.map_id,MapMetadata::SHOW_AREA)
|
||||
if GameData::MapMetadata.get($game_map.map_id).announce_location
|
||||
nosignpost = false
|
||||
if $PokemonGlobal.mapTrail[1]
|
||||
for i in 0...NO_SIGNPOSTS.length/2
|
||||
@@ -493,7 +493,7 @@ Events.onMapSceneChange += proc { |_sender,e|
|
||||
end
|
||||
end
|
||||
# Force cycling/walking
|
||||
if pbGetMetadata($game_map.map_id,MapMetadata::BICYCLE_ALWAYS)
|
||||
if GameData::MapMetadata.get($game_map.map_id).always_bicycle
|
||||
pbMountBike
|
||||
elsif !pbCanUseBike?($game_map.map_id)
|
||||
pbDismountBike
|
||||
@@ -830,7 +830,7 @@ def pbCueBGM(bgm,seconds,volume=nil,pitch=nil)
|
||||
end
|
||||
|
||||
def pbAutoplayOnTransition
|
||||
surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
|
||||
surfbgm = GameData::Metadata.get.surf_BGM
|
||||
if $PokemonGlobal.surfing && surfbgm
|
||||
pbBGMPlay(surfbgm)
|
||||
else
|
||||
@@ -839,7 +839,7 @@ def pbAutoplayOnTransition
|
||||
end
|
||||
|
||||
def pbAutoplayOnSave
|
||||
surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
|
||||
surfbgm = GameData::Metadata.get.surf_BGM
|
||||
if $PokemonGlobal.surfing && surfbgm
|
||||
pbBGMPlay(surfbgm)
|
||||
else
|
||||
@@ -1126,7 +1126,7 @@ def pbFishingBegin
|
||||
$PokemonGlobal.fishing = true
|
||||
if !pbCommonEvent(FISHING_BEGIN_COMMON_EVENT)
|
||||
patternb = 2*$game_player.direction - 1
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
|
||||
meta = GameData::Metadata.get_player($PokemonGlobal.playerID)
|
||||
num = ($PokemonGlobal.surfing) ? 7 : 6
|
||||
if meta && meta[num] && meta[num]!=""
|
||||
charset = pbGetPlayerCharset(meta,num)
|
||||
@@ -1145,7 +1145,7 @@ end
|
||||
def pbFishingEnd
|
||||
if !pbCommonEvent(FISHING_END_COMMON_EVENT)
|
||||
patternb = 2*($game_player.direction - 2)
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
|
||||
meta = GameData::Metadata.get_player($PokemonGlobal.playerID)
|
||||
num = ($PokemonGlobal.surfing) ? 7 : 6
|
||||
if meta && meta[num] && meta[num]!=""
|
||||
charset = pbGetPlayerCharset(meta,num)
|
||||
|
||||
@@ -52,7 +52,7 @@ def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)
|
||||
location = 3
|
||||
elsif $PokemonEncounters.isCave?
|
||||
location = 2
|
||||
elsif !pbGetMetadata($game_map.map_id,MapMetadata::OUTDOOR)
|
||||
elsif !GameData::MapMetadata.get($game_map.map_id).outdoor_map
|
||||
location = 1
|
||||
end
|
||||
anim = ""
|
||||
@@ -654,7 +654,7 @@ def pbStartOver(gameover=false)
|
||||
$scene.transfer_player if $scene.is_a?(Scene_Map)
|
||||
$game_map.refresh
|
||||
else
|
||||
homedata = pbGetMetadata(0,Metadata::HOME)
|
||||
homedata = GameData::Metadata.get.home
|
||||
if homedata && !pbRxdataExists?(sprintf("Data/Map%03d",homedata[0]))
|
||||
if $DEBUG
|
||||
pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.",homedata[0]))
|
||||
|
||||
@@ -131,7 +131,7 @@ def pbPrepareBattle(battle)
|
||||
elsif $PokemonGlobal.surfing
|
||||
backdrop = "water" # This applies wherever you are, including in caves
|
||||
else
|
||||
back = pbGetMetadata($game_map.map_id,MapMetadata::BATTLE_BACK)
|
||||
back = GameData::MapMetadata.get($game_map.map_id).battle_background
|
||||
backdrop = back if back && back!=""
|
||||
end
|
||||
backdrop = "indoor1" if !backdrop
|
||||
@@ -152,7 +152,7 @@ def pbPrepareBattle(battle)
|
||||
end
|
||||
battle.backdropBase = base if base
|
||||
# Time of day
|
||||
if pbGetMetadata($game_map.map_id,MapMetadata::ENVIRONMENT)==PBEnvironment::Cave
|
||||
if GameData::MapMetadata.get($game_map.map_id).battle_environment == PBEnvironment::Cave
|
||||
battle.time = 2 # This makes Dusk Balls work properly in caves
|
||||
elsif TIME_SHADING
|
||||
timeNow = pbGetTimeNow
|
||||
@@ -166,7 +166,7 @@ end
|
||||
# Used to determine the environment in battle, and also the form of Burmy/
|
||||
# Wormadam.
|
||||
def pbGetEnvironment
|
||||
ret = pbGetMetadata($game_map.map_id,MapMetadata::ENVIRONMENT)
|
||||
ret = GameData::MapMetadata.get($game_map.map_id).battle_environment
|
||||
ret = PBEnvironment::None if !ret
|
||||
if $PokemonTemp.encounterType==EncounterTypes::OldRod ||
|
||||
$PokemonTemp.encounterType==EncounterTypes::GoodRod ||
|
||||
|
||||
@@ -183,7 +183,8 @@ EncounterModifier.register(proc { |encounter|
|
||||
# are in the same region
|
||||
if roamerMap!=$game_map.map_id
|
||||
currentRegion = pbGetCurrentRegion
|
||||
next if pbGetMetadata(roamerMap,MapMetadata::MAP_POSITION)[0]!=currentRegion
|
||||
map_position = GameData::MapMetadata.get(roamerMap).town_map_position
|
||||
next if !map_position || map_position[0] != currentRegion
|
||||
currentMapName = pbGetMessage(MessageTypes::MapNames,$game_map.map_id)
|
||||
next if pbGetMessage(MessageTypes::MapNames,roamerMap)!=currentMapName
|
||||
end
|
||||
|
||||
@@ -555,7 +555,7 @@ end
|
||||
Events.onMapCreate += proc { |_sender, e|
|
||||
mapID=e[0]
|
||||
map=e[1]
|
||||
if pbGetMetadata(mapID,MapMetadata::DUNGEON)
|
||||
if GameData::MapMetadata.get(mapID).random_dungeon
|
||||
# this map is a randomly generated dungeon
|
||||
dungeon=Dungeon.new(map.width,map.height)
|
||||
dungeon.generate
|
||||
|
||||
@@ -302,7 +302,7 @@ HiddenMoveHandlers::UseMove.add(:DIG,proc { |move,pokemon|
|
||||
# Dive
|
||||
#===============================================================================
|
||||
def pbDive
|
||||
divemap = pbGetMetadata($game_map.map_id,MapMetadata::DIVE_MAP)
|
||||
divemap = GameData::MapMetadata.get($game_map.map_id).dive_map_id
|
||||
return false if !divemap
|
||||
move = getID(PBMoves,:DIVE)
|
||||
movefinder = pbCheckMove(move)
|
||||
@@ -333,14 +333,13 @@ end
|
||||
|
||||
def pbSurfacing
|
||||
return if !$PokemonGlobal.diving
|
||||
divemap = nil
|
||||
meta = pbLoadMetadata
|
||||
for i in 0...meta.length
|
||||
if meta[i] && meta[i][MapMetadata::DIVE_MAP] && meta[i][MapMetadata::DIVE_MAP]==$game_map.map_id
|
||||
divemap = i; break
|
||||
surface_map_id = nil
|
||||
GameData::MapMetadata.each do |map_data|
|
||||
next if !map_data.dive_map_id || map_data.dive_map_id != $game_map.map_id
|
||||
surface_map_id = map_data.id
|
||||
break
|
||||
end
|
||||
end
|
||||
return if !divemap
|
||||
return if !surface_map_id
|
||||
move = getID(PBMoves,:DIVE)
|
||||
movefinder = pbCheckMove(move)
|
||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_DIVE,false) || (!$DEBUG && !movefinder)
|
||||
@@ -352,7 +351,7 @@ def pbSurfacing
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,PBMoves.getName(move)))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = divemap
|
||||
$game_temp.player_new_map_id = surface_map_id
|
||||
$game_temp.player_new_x = $game_player.x
|
||||
$game_temp.player_new_y = $game_player.y
|
||||
$game_temp.player_new_direction = $game_player.direction
|
||||
@@ -360,7 +359,7 @@ def pbSurfacing
|
||||
$PokemonGlobal.diving = false
|
||||
pbUpdateVehicle
|
||||
$scene.transfer_player(false)
|
||||
surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
|
||||
surfbgm = GameData::Metadata.get.surf_BGM
|
||||
(surfbgm) ? pbBGMPlay(surfbgm) : $game_map.autoplayAsCue
|
||||
$game_map.refresh
|
||||
}
|
||||
@@ -381,19 +380,19 @@ def pbTransferUnderwater(mapid,x,y,direction=$game_player.direction)
|
||||
}
|
||||
end
|
||||
|
||||
Events.onAction += proc { |_sender,_e|
|
||||
Events.onAction += proc { |_sender, _e|
|
||||
if $PokemonGlobal.diving
|
||||
if DIVING_SURFACE_ANYWHERE
|
||||
pbSurfacing
|
||||
else
|
||||
divemap = nil
|
||||
meta = pbLoadMetadata
|
||||
for i in 0...meta.length
|
||||
if meta[i] && meta[i][MapMetadata::DIVE_MAP] && meta[i][MapMetadata::DIVE_MAP]==$game_map.map_id
|
||||
divemap = i; break
|
||||
surface_map_id = nil
|
||||
GameData::MapMetadata.each do |map_data|
|
||||
next if !map_data.dive_map_id || map_data.dive_map_id != $game_map.map_id
|
||||
surface_map_id = map_data.id
|
||||
break
|
||||
end
|
||||
end
|
||||
if divemap && PBTerrain.isDeepWater?($MapFactory.getTerrainTag(divemap,$game_player.x,$game_player.y))
|
||||
if surface_map_id &&
|
||||
PBTerrain.isDeepWater?($MapFactory.getTerrainTag(surface_map_id, $game_player.x, $game_player.y))
|
||||
pbSurfacing
|
||||
end
|
||||
end
|
||||
@@ -406,19 +405,19 @@ HiddenMoveHandlers::CanUseMove.add(:DIVE,proc { |move,pkmn,showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(BADGE_FOR_DIVE,showmsg)
|
||||
if $PokemonGlobal.diving
|
||||
next true if DIVING_SURFACE_ANYWHERE
|
||||
divemap = nil
|
||||
meta = pbLoadMetadata
|
||||
for i in 0...meta.length
|
||||
if meta[i] && meta[i][MapMetadata::DIVE_MAP] && meta[i][MapMetadata::DIVE_MAP]==$game_map.map_id
|
||||
divemap = i; break
|
||||
surface_map_id = nil
|
||||
GameData::MapMetadata.each do |map_data|
|
||||
next if !map_data.dive_map_id || map_data.dive_map_id != $game_map.map_id
|
||||
surface_map_id = map_data.id
|
||||
break
|
||||
end
|
||||
end
|
||||
if !PBTerrain.isDeepWater?($MapFactory.getTerrainTag(divemap,$game_player.x,$game_player.y))
|
||||
if !surface_map_id ||
|
||||
!PBTerrain.isDeepWater?($MapFactory.getTerrainTag(surface_map_id, $game_player.x, $game_player.y))
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
else
|
||||
if !pbGetMetadata($game_map.map_id,MapMetadata::DIVE_MAP)
|
||||
if !GameData::MapMetadata.get($game_map.map_id).dive_map_id
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
@@ -433,22 +432,21 @@ HiddenMoveHandlers::CanUseMove.add(:DIVE,proc { |move,pkmn,showmsg|
|
||||
HiddenMoveHandlers::UseMove.add(:DIVE,proc { |move,pokemon|
|
||||
wasdiving = $PokemonGlobal.diving
|
||||
if $PokemonGlobal.diving
|
||||
divemap = nil
|
||||
meta = pbLoadMetadata
|
||||
for i in 0...meta.length
|
||||
if meta[i] && meta[i][MapMetadata::DIVE_MAP] && meta[i][MapMetadata::DIVE_MAP]==$game_map.map_id
|
||||
divemap = i; break
|
||||
end
|
||||
dive_map_id = nil
|
||||
GameData::MapMetadata.each do |map_data|
|
||||
next if !map_data.dive_map_id || map_data.dive_map_id != $game_map.map_id
|
||||
dive_map_id = map_data.id
|
||||
break
|
||||
end
|
||||
else
|
||||
divemap = pbGetMetadata($game_map.map_id,MapMetadata::DIVE_MAP)
|
||||
dive_map_id = GameData::MapMetadata.get($game_map.map_id).dive_map_id
|
||||
end
|
||||
next false if !divemap
|
||||
next false if !dive_map_id
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
end
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = divemap
|
||||
$game_temp.player_new_map_id = dive_map_id
|
||||
$game_temp.player_new_x = $game_player.x
|
||||
$game_temp.player_new_y = $game_player.y
|
||||
$game_temp.player_new_direction = $game_player.direction
|
||||
@@ -469,7 +467,7 @@ HiddenMoveHandlers::UseMove.add(:DIVE,proc { |move,pokemon|
|
||||
#===============================================================================
|
||||
HiddenMoveHandlers::CanUseMove.add(:FLASH,proc { |move,pkmn,showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(BADGE_FOR_FLASH,showmsg)
|
||||
if !pbGetMetadata($game_map.map_id,MapMetadata::DARK_MAP)
|
||||
if !GameData::MapMetadata.get($game_map.map_id).dark_map
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
@@ -509,7 +507,7 @@ HiddenMoveHandlers::CanUseMove.add(:FLY,proc { |move,pkmn,showmsg|
|
||||
pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
|
||||
next false
|
||||
end
|
||||
if !pbGetMetadata($game_map.map_id,MapMetadata::OUTDOOR)
|
||||
if !GameData::MapMetadata.get($game_map.map_id).outdoor_map
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
@@ -715,7 +713,7 @@ def pbSurf
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,PBMoves.getName(move)))
|
||||
pbCancelVehicles
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
|
||||
surfbgm = GameData::Metadata.get.surf_BGM
|
||||
pbCueBGM(surfbgm,0.5) if surfbgm
|
||||
pbStartSurfing
|
||||
return true
|
||||
@@ -768,7 +766,7 @@ end
|
||||
|
||||
Events.onAction += proc { |_sender,_e|
|
||||
next if $PokemonGlobal.surfing
|
||||
next if pbGetMetadata($game_map.map_id,MapMetadata::BICYCLE_ALWAYS)
|
||||
next if GameData::MapMetadata.get($game_map.map_id).always_bicycle
|
||||
next if !PBTerrain.isSurfable?(pbFacingTerrainTag)
|
||||
next if !$game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||
pbSurf
|
||||
@@ -784,7 +782,7 @@ HiddenMoveHandlers::CanUseMove.add(:SURF,proc { |move,pkmn,showmsg|
|
||||
pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
|
||||
next false
|
||||
end
|
||||
if pbGetMetadata($game_map.map_id,MapMetadata::BICYCLE_ALWAYS)
|
||||
if GameData::MapMetadata.get($game_map.map_id).always_bicycle
|
||||
pbMessage(_INTL("Let's enjoy cycling!")) if showmsg
|
||||
next false
|
||||
end
|
||||
@@ -802,7 +800,7 @@ HiddenMoveHandlers::UseMove.add(:SURF,proc { |move,pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
end
|
||||
surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
|
||||
surfbgm = GameData::Metadata.get.surf_BGM
|
||||
pbCueBGM(surfbgm,0.5) if surfbgm
|
||||
pbStartSurfing
|
||||
next true
|
||||
@@ -865,12 +863,12 @@ HiddenMoveHandlers::UseMove.add(:SWEETSCENT,proc { |move,pokemon|
|
||||
# Teleport
|
||||
#===============================================================================
|
||||
HiddenMoveHandlers::CanUseMove.add(:TELEPORT,proc { |move,pkmn,showmsg|
|
||||
if !pbGetMetadata($game_map.map_id,MapMetadata::OUTDOOR)
|
||||
if !GameData::MapMetadata.get($game_map.map_id).outdoor_map
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
healing = $PokemonGlobal.healingSpot
|
||||
healing = pbGetMetadata(0,Metadata::HOME) if !healing # Home
|
||||
healing = GameData::Metadata.get.home if !healing # Home
|
||||
if !healing
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
@@ -884,7 +882,7 @@ HiddenMoveHandlers::CanUseMove.add(:TELEPORT,proc { |move,pkmn,showmsg|
|
||||
|
||||
HiddenMoveHandlers::ConfirmUseMove.add(:TELEPORT,proc { |move,pkmn|
|
||||
healing = $PokemonGlobal.healingSpot
|
||||
healing = pbGetMetadata(0,Metadata::HOME) if !healing # Home
|
||||
healing = GameData::Metadata.get.home if !healing # Home
|
||||
next false if !healing
|
||||
mapname = pbGetMapNameFromId(healing[0])
|
||||
next pbConfirmMessage(_INTL("Want to return to the healing spot used last in {1}?",mapname))
|
||||
@@ -892,7 +890,7 @@ HiddenMoveHandlers::ConfirmUseMove.add(:TELEPORT,proc { |move,pkmn|
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:TELEPORT,proc { |move,pokemon|
|
||||
healing = $PokemonGlobal.healingSpot
|
||||
healing = pbGetMetadata(0,Metadata::HOME) if !healing # Home
|
||||
healing = GameData::Metadata.get.home if !healing # Home
|
||||
next false if !healing
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
|
||||
@@ -117,7 +117,7 @@ end
|
||||
|
||||
def pbDayNightTint(object)
|
||||
return if !$scene.is_a?(Scene_Map)
|
||||
if TIME_SHADING && pbGetMetadata($game_map.map_id,MapMetadata::OUTDOOR)
|
||||
if TIME_SHADING && GameData::MapMetadata.get($game_map.map_id).outdoor_map
|
||||
tone = PBDayNight.getTone
|
||||
object.tone.set(tone.red,tone.green,tone.blue,tone.gray)
|
||||
else
|
||||
|
||||
@@ -361,14 +361,14 @@ def pbBikeCheck
|
||||
return false
|
||||
end
|
||||
if $PokemonGlobal.bicycle
|
||||
if pbGetMetadata($game_map.map_id,MapMetadata::BICYCLE_ALWAYS)
|
||||
if GameData::MapMetadata.get($game_map.map_id).always_bicycle
|
||||
pbMessage(_INTL("You can't dismount your Bike here."))
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
val = pbGetMetadata($game_map.map_id,MapMetadata::BICYCLE)
|
||||
val = pbGetMetadata($game_map.map_id,MapMetadata::OUTDOOR) if val==nil
|
||||
val = GameData::MapMetadata.get($game_map.map_id).can_bicycle
|
||||
val = GameData::MapMetadata.get($game_map.map_id).outdoor_map if val.nil?
|
||||
if !val
|
||||
pbMessage(_INTL("Can't use that here."))
|
||||
return false
|
||||
|
||||
@@ -66,13 +66,14 @@ end
|
||||
def pbRandomPhoneTrainer
|
||||
$PokemonGlobal.phoneNumbers = [] if !$PokemonGlobal.phoneNumbers
|
||||
temparray = []
|
||||
currentRegion = pbGetMetadata($game_map.map_id,MapMetadata::MAP_POSITION)
|
||||
currentRegion = GameData::MapMetadata.get($game_map.map_id).town_map_position
|
||||
return nil if !currentRegion
|
||||
for num in $PokemonGlobal.phoneNumbers
|
||||
next if !num[0] || num.length!=8 # if not visible or not a trainer
|
||||
next if $game_map.map_id==num[6] # Can't call if on same map
|
||||
callerRegion = pbGetMetadata(num[6],MapMetadata::MAP_POSITION)
|
||||
callerRegion = GameData::MapMetadata.get(num[6]).town_map_position
|
||||
# Can't call if in different region
|
||||
next if callerRegion && currentRegion && callerRegion[0]!=currentRegion[0]
|
||||
next if !callerRegion || callerRegion[0] != currentRegion[0]
|
||||
temparray.push(num)
|
||||
end
|
||||
return nil if temparray.length==0
|
||||
@@ -193,9 +194,9 @@ def pbCallTrainer(trtype,trname)
|
||||
pbMessage(_INTL("The Trainer is close by.\nTalk to the Trainer in person!"))
|
||||
return
|
||||
end
|
||||
callerregion = pbGetMetadata(trainer[6],MapMetadata::MAP_POSITION)
|
||||
currentregion = pbGetMetadata($game_map.map_id,MapMetadata::MAP_POSITION)
|
||||
if callerregion && currentregion && callerregion[0]!=currentregion[0]
|
||||
callerregion = GameData::MapMetadata.get(trainer[6]).town_map_position
|
||||
currentregion = GameData::MapMetadata.get($game_map.map_id).town_map_position
|
||||
if !callerregion || !currentregion || callerregion[0] != currentregion[0]
|
||||
pbMessage(_INTL("The Trainer is out of range."))
|
||||
return # Can't call if in different region
|
||||
end
|
||||
|
||||
@@ -667,13 +667,13 @@ MultipleForms.register(:NECROZMA,{
|
||||
|
||||
# These species don't have visually different Alolan forms, but they need to
|
||||
# evolve into different forms depending on the location where they evolved.
|
||||
MultipleForms.register(:PIKACHU,{
|
||||
MultipleForms.register(:PIKACHU, {
|
||||
"getForm" => proc { |pkmn|
|
||||
next if pkmn.formSimple>=2
|
||||
mapPos = pbGetMetadata($game_map.map_id,MapMetadata::MAP_POSITION)
|
||||
next 1 if mapPos && mapPos[0]==1 # Tiall region
|
||||
next if pkmn.formSimple >= 2
|
||||
mapPos = GameData::MapMetadata.get($game_map.map_id).town_map_position
|
||||
next 1 if mapPos && mapPos[0] == 1 # Tiall region
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.copy(:PIKACHU,:EXEGGCUTE,:CUBONE)
|
||||
MultipleForms.copy(:PIKACHU, :EXEGGCUTE, :CUBONE)
|
||||
|
||||
@@ -392,7 +392,7 @@ PBEvolution.register(:LevelDiving, {
|
||||
|
||||
PBEvolution.register(:LevelDarkness, {
|
||||
"levelUpCheck" => proc { |pkmn, parameter|
|
||||
next pkmn.level >= parameter && pbGetMetadata($game_map.map_id, MapMetadata::DARK_MAP)
|
||||
next pkmn.level >= parameter && GameData::MapMetadata.get($game_map.map_id).dark_map
|
||||
}
|
||||
})
|
||||
|
||||
@@ -651,7 +651,7 @@ PBEvolution.register(:Location, {
|
||||
PBEvolution.register(:Region, {
|
||||
"minimumLevel" => 1, # Needs any level up
|
||||
"levelUpCheck" => proc { |pkmn, parameter|
|
||||
mapPos = pbGetMetadata($game_map.map_id, MapMetadata::MAP_POSITION)
|
||||
mapPos = GameData::MapMetadata.get($game_map.map_id).town_map_position
|
||||
next mapPos && mapPos[0] == parameter
|
||||
}
|
||||
})
|
||||
|
||||
@@ -27,7 +27,7 @@ class PokemonPokedexInfo_Scene
|
||||
@sprites["infosprite"].x = 104
|
||||
@sprites["infosprite"].y = 136
|
||||
@mapdata = pbLoadTownMapData
|
||||
mappos = ($game_map) ? pbGetMetadata($game_map.map_id,MapMetadata::MAP_POSITION) : nil
|
||||
mappos = ($game_map) ? GameData::MapMetadata.get($game_map.map_id).town_map_position : nil
|
||||
if @region<0 # Use player's current region
|
||||
@region = (mappos) ? mappos[0] : 0 # Region 0 default
|
||||
end
|
||||
@@ -311,7 +311,7 @@ class PokemonPokedexInfo_Scene
|
||||
for enc in encdata.keys
|
||||
enctypes = encdata[enc][1]
|
||||
if pbFindEncounter(enctypes,@species)
|
||||
mappos = pbGetMetadata(enc,MapMetadata::MAP_POSITION)
|
||||
mappos = GameData::MapMetadata.get(enc).town_map_position
|
||||
if mappos && mappos[0]==@region
|
||||
showpoint = true
|
||||
for loc in @mapdata[@region][2]
|
||||
@@ -319,7 +319,7 @@ class PokemonPokedexInfo_Scene
|
||||
loc[7] && !$game_switches[loc[7]]
|
||||
end
|
||||
if showpoint
|
||||
mapsize = pbGetMetadata(enc,MapMetadata::MAP_SIZE)
|
||||
mapsize = GameData::MapMetadata.get(enc).town_map_size
|
||||
if mapsize && mapsize[0] && mapsize[0]>0
|
||||
sqwidth = mapsize[0]
|
||||
sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil
|
||||
|
||||
@@ -77,7 +77,7 @@ class PokemonRegionMap_Scene
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
@mapdata = pbLoadTownMapData
|
||||
playerpos = (!$game_map) ? nil : pbGetMetadata($game_map.map_id,MapMetadata::MAP_POSITION)
|
||||
playerpos = (!$game_map) ? nil : GameData::MapMetadata.get($game_map.map_id).town_map_position
|
||||
if !playerpos
|
||||
mapindex = 0
|
||||
@map = @mapdata[0]
|
||||
@@ -93,7 +93,7 @@ class PokemonRegionMap_Scene
|
||||
@map = @mapdata[playerpos[0]]
|
||||
@mapX = playerpos[1]
|
||||
@mapY = playerpos[2]
|
||||
mapsize = (!$game_map) ? nil : pbGetMetadata($game_map.map_id,MapMetadata::MAP_SIZE)
|
||||
mapsize = (!$game_map) ? nil : GameData::MapMetadata.get($game_map.map_id).town_map_size
|
||||
if mapsize && mapsize[0] && mapsize[0]>0
|
||||
sqwidth = mapsize[0]
|
||||
sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil
|
||||
|
||||
@@ -159,7 +159,7 @@ class PokemonLoad_Scene
|
||||
|
||||
def pbSetParty(trainer)
|
||||
return if !trainer || !trainer.party
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+trainer.metaID)
|
||||
meta = GameData::Metadata.get_player(trainer.metaID)
|
||||
if meta
|
||||
filename = pbGetPlayerCharset(meta,1,trainer,true)
|
||||
@sprites["player"] = TrainerWalkingCharSprite.new(filename,@viewport)
|
||||
|
||||
@@ -62,7 +62,7 @@ def pbInSafari?
|
||||
# map can be outdoors, with its own grassy patches.
|
||||
reception = pbSafariState.pbReceptionMap
|
||||
return true if $game_map.map_id==reception
|
||||
return true if pbGetMetadata($game_map.map_id,MapMetadata::SAFARI_MAP)
|
||||
return true if GameData::MapMetadata.get($game_map.map_id).safari_map
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -80,6 +80,8 @@ def pbSetUpSystem
|
||||
GameData::Ability.load
|
||||
GameData::Item.load
|
||||
GameData::BerryPlant.load
|
||||
GameData::Metadata.load
|
||||
GameData::MapMetadata.load
|
||||
rescue
|
||||
consts = []
|
||||
end
|
||||
|
||||
@@ -532,13 +532,13 @@ def pbGetWildBattleBGM(_wildParty) # wildParty is an array of Pokémon objects
|
||||
end
|
||||
ret = nil
|
||||
if !ret
|
||||
# Check map-specific metadata
|
||||
music = pbGetMetadata($game_map.map_id,MapMetadata::WILD_BATTLE_BGM)
|
||||
# Check map metadata
|
||||
music = GameData::MapMetadata.get($game_map.map_id).wild_battle_BGM
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
if !ret
|
||||
# Check global metadata
|
||||
music = pbGetMetadata(0,Metadata::WILD_BATTLE_BGM)
|
||||
music = GameData::Metadata.get.wild_battle_BGM
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
ret = pbStringToAudioFile("Battle wild") if !ret
|
||||
@@ -551,13 +551,13 @@ def pbGetWildVictoryME
|
||||
end
|
||||
ret = nil
|
||||
if !ret
|
||||
# Check map-specific metadata
|
||||
music = pbGetMetadata($game_map.map_id,MapMetadata::WILD_VICTORY_ME)
|
||||
# Check map metadata
|
||||
music = GameData::MapMetadata.get($game_map.map_id).wild_victory_ME
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
if !ret
|
||||
# Check global metadata
|
||||
music = pbGetMetadata(0,Metadata::WILD_VICTORY_ME)
|
||||
music = GameData::Metadata.get.wild_victory_ME
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
ret = pbStringToAudioFile("Battle victory") if !ret
|
||||
@@ -571,13 +571,13 @@ def pbGetWildCaptureME
|
||||
end
|
||||
ret = nil
|
||||
if !ret
|
||||
# Check map-specific metadata
|
||||
music = pbGetMetadata($game_map.map_id,MapMetadata::WILD_CAPTURE_ME)
|
||||
# Check map metadata
|
||||
music = GameData::MapMetadata.get($game_map.map_id).wild_capture_ME
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
if !ret
|
||||
# Check global metadata
|
||||
music = pbGetMetadata(0,Metadata::WILD_CAPTURE_ME)
|
||||
music = GameData::Metadata.get.wild_capture_ME
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
ret = pbStringToAudioFile("Battle capture success") if !ret
|
||||
@@ -611,15 +611,15 @@ def pbGetTrainerBattleBGM(trainer) # can be a PokeBattle_Trainer or an array o
|
||||
end
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
if !ret
|
||||
# Check map-specific metadata
|
||||
music = pbGetMetadata($game_map.map_id,MapMetadata::TRAINER_BATTLE_BGM)
|
||||
# Check map metadata
|
||||
music = GameData::MapMetadata.get($game_map.map_id).trainer_battle_BGM
|
||||
if music && music!=""
|
||||
ret = pbStringToAudioFile(music)
|
||||
end
|
||||
end
|
||||
if !ret
|
||||
# Check global metadata
|
||||
music = pbGetMetadata(0,Metadata::TRAINER_BATTLE_BGM)
|
||||
music = GameData::Metadata.get.trainer_battle_BGM
|
||||
if music && music!=""
|
||||
ret = pbStringToAudioFile(music)
|
||||
end
|
||||
@@ -635,13 +635,13 @@ def pbGetTrainerBattleBGMFromType(trainertype)
|
||||
data = pbGetTrainerTypeData(trainertype)
|
||||
ret = pbStringToAudioFile(data[4]) if data && data[4]
|
||||
if !ret
|
||||
# Check map-specific metadata
|
||||
music = pbGetMetadata($game_map.map_id,MapMetadata::TRAINER_BATTLE_BGM)
|
||||
# Check map metadata
|
||||
music = GameData::MapMetadata.get($game_map.map_id).trainer_battle_BGM
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
if !ret
|
||||
# Check global metadata
|
||||
music = pbGetMetadata(0,Metadata::TRAINER_BATTLE_BGM)
|
||||
music = GameData::Metadata.get.trainer_battle_BGM
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
ret = pbStringToAudioFile("Battle trainer") if !ret
|
||||
@@ -663,15 +663,15 @@ def pbGetTrainerVictoryME(trainer) # can be a PokeBattle_Trainer or an array o
|
||||
ret = pbStringToAudioFile(music)
|
||||
end
|
||||
if !ret
|
||||
# Check map-specific metadata
|
||||
music = pbGetMetadata($game_map.map_id,MapMetadata::TRAINER_VICTORY_ME)
|
||||
# Check map metadata
|
||||
music = GameData::MapMetadata.get($game_map.map_id).trainer_victory_ME
|
||||
if music && music!=""
|
||||
ret = pbStringToAudioFile(music)
|
||||
end
|
||||
end
|
||||
if !ret
|
||||
# Check global metadata
|
||||
music = pbGetMetadata(0,Metadata::TRAINER_VICTORY_ME)
|
||||
music = GameData::Metadata.get.trainer_victory_ME
|
||||
if music && music!=""
|
||||
ret = pbStringToAudioFile(music)
|
||||
end
|
||||
|
||||
@@ -666,7 +666,7 @@ end
|
||||
#===============================================================================
|
||||
def pbChangePlayer(id)
|
||||
return false if id<0 || id>=8
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+id)
|
||||
meta = GameData::Metadata.get_player(id)
|
||||
return false if !meta
|
||||
$Trainer.trainertype = meta[0] if $Trainer
|
||||
$game_player.character_name = meta[1]
|
||||
@@ -678,7 +678,7 @@ end
|
||||
def pbGetPlayerGraphic
|
||||
id = $PokemonGlobal.playerID
|
||||
return "" if id<0 || id>=8
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+id)
|
||||
meta = GameData::Metadata.get_player(id)
|
||||
return "" if !meta
|
||||
return pbPlayerSpriteFile(meta[0])
|
||||
end
|
||||
@@ -686,7 +686,7 @@ end
|
||||
def pbGetPlayerTrainerType
|
||||
id = $PokemonGlobal.playerID
|
||||
return 0 if id<0 || id>=8
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+id)
|
||||
meta = GameData::Metadata.get_player(id)
|
||||
return 0 if !meta
|
||||
return meta[0]
|
||||
end
|
||||
@@ -868,7 +868,7 @@ end
|
||||
# no region was defined in the game's metadata. The ID numbers returned by
|
||||
# this function depend on the current map's position metadata.
|
||||
def pbGetCurrentRegion(defaultRegion=-1)
|
||||
mappos = ($game_map) ? pbGetMetadata($game_map.map_id,MapMetadata::MAP_POSITION) : nil
|
||||
mappos = ($game_map) ? GameData::MapMetadata.get($game_map.map_id).town_map_position : nil
|
||||
return (mappos) ? mappos[0] : defaultRegion
|
||||
end
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ def pbDebugMenuCommands(showall=true)
|
||||
commands.add("main","editorsmenu",_INTL("Information editors..."),
|
||||
_INTL("Edit information in the PBS files, terrain tags, battle animations, etc."))
|
||||
commands.add("editorsmenu","setmetadata",_INTL("Edit Metadata"),
|
||||
_INTL("Edit global and map-specific metadata."))
|
||||
_INTL("Edit global and map metadata."))
|
||||
commands.add("editorsmenu","mapconnections",_INTL("Edit Map Connections"),
|
||||
_INTL("Connect maps using a visual interface. Can also edit map encounters/metadata."))
|
||||
commands.add("editorsmenu","terraintags",_INTL("Edit Terrain Tags"),
|
||||
@@ -679,7 +679,7 @@ def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
|
||||
when "setplayer"
|
||||
limit = 0
|
||||
for i in 0...8
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+i)
|
||||
meta = GameData::Metadata.get_player(i)
|
||||
if !meta
|
||||
limit = i; break
|
||||
end
|
||||
|
||||
@@ -553,27 +553,85 @@ end
|
||||
#===============================================================================
|
||||
# Metadata editor
|
||||
#===============================================================================
|
||||
def pbMetadataScreen(defaultMapId=nil)
|
||||
metadata = nil
|
||||
mapinfos = pbLoadRxData("Data/MapInfos")
|
||||
metadata = pbLoadMetadata
|
||||
map = defaultMapId ? defaultMapId : 0
|
||||
def pbMetadataScreen(map_id = 0)
|
||||
loop do
|
||||
map = pbListScreen(_INTL("SET METADATA"),MapLister.new(map,true))
|
||||
break if map<0
|
||||
mapname = (map==0) ? _INTL("Global Metadata") : mapinfos[map].name
|
||||
map_id = pbListScreen(_INTL("SET METADATA"), MapLister.new(map_id, true))
|
||||
break if map_id < 0
|
||||
pbEditMetadata(map_id)
|
||||
end
|
||||
end
|
||||
|
||||
def pbEditMetadata(map_id = 0)
|
||||
mapinfos = pbLoadRxData("Data/MapInfos")
|
||||
data = []
|
||||
properties = (map==0) ? MapScreenScene::GLOBALMETADATA : MapScreenScene::LOCALMAPS
|
||||
for i in 0...properties.length
|
||||
data.push((metadata[map]) ? metadata[map][i+1] : nil)
|
||||
if map_id == 0 # Global metadata
|
||||
map_name = _INTL("Global Metadata")
|
||||
metadata = GameData::Metadata.get
|
||||
properties = GameData::Metadata.editor_properties
|
||||
else # Map metadata
|
||||
map_name = mapinfos[map_id].name
|
||||
metadata = GameData::MapMetadata.get(map_id)
|
||||
properties = GameData::MapMetadata.editor_properties
|
||||
end
|
||||
pbPropertyList(mapname,data,properties)
|
||||
for i in 0...properties.length
|
||||
metadata[map] = [] if !metadata[map]
|
||||
metadata[map][i+1] = data[i]
|
||||
properties.each do |property|
|
||||
data.push(metadata.property_from_string(property[0]))
|
||||
end
|
||||
if pbPropertyList(map_name, data, properties, true)
|
||||
if map_id == 0 # Global metadata
|
||||
# Construct metadata hash
|
||||
metadata_hash = {
|
||||
:id => map_id,
|
||||
:home => data[0],
|
||||
:wild_battle_BGM => data[1],
|
||||
:trainer_battle_BGM => data[2],
|
||||
:wild_victory_ME => data[3],
|
||||
:trainer_victory_ME => data[4],
|
||||
:wild_capture_ME => data[5],
|
||||
:surf_BGM => data[6],
|
||||
:bicycle_BGM => data[7],
|
||||
:player_A => data[8],
|
||||
:player_B => data[9],
|
||||
:player_C => data[10],
|
||||
:player_D => data[11],
|
||||
:player_E => data[12],
|
||||
:player_F => data[13],
|
||||
:player_G => data[14],
|
||||
:player_H => data[15]
|
||||
}
|
||||
# Add metadata's data to records
|
||||
GameData::Metadata::DATA[map_id] = GameData::Metadata.new(metadata_hash)
|
||||
GameData::Metadata.save
|
||||
else # Map metadata
|
||||
# Construct metadata hash
|
||||
metadata_hash = {
|
||||
:id => map_id,
|
||||
:outdoor_map => data[0],
|
||||
:announce_location => data[1],
|
||||
:can_bicycle => data[2],
|
||||
:always_bicycle => data[3],
|
||||
:teleport_destination => data[4],
|
||||
:weather => data[5],
|
||||
:town_map_position => data[6],
|
||||
:dive_map_id => data[7],
|
||||
:dark_map => data[8],
|
||||
:safari_map => data[9],
|
||||
:snap_edges => data[10],
|
||||
:random_dungeon => data[11],
|
||||
:battle_background => data[12],
|
||||
:wild_battle_BGM => data[13],
|
||||
:trainer_battle_BGM => data[14],
|
||||
:wild_victory_ME => data[15],
|
||||
:trainer_victory_ME => data[16],
|
||||
:wild_capture_ME => data[17],
|
||||
:town_map_size => data[18],
|
||||
:battle_environment => data[19]
|
||||
}
|
||||
# Add metadata's data to records
|
||||
GameData::MapMetadata::DATA[map_id] = GameData::MapMetadata.new(metadata_hash)
|
||||
GameData::MapMetadata.save
|
||||
end
|
||||
pbSaveMetadata
|
||||
end
|
||||
pbSerializeMetadata(metadata,mapinfos) if metadata
|
||||
end
|
||||
|
||||
|
||||
@@ -638,8 +696,7 @@ def pbItemEditor
|
||||
itm.type,
|
||||
itm.move || 0
|
||||
]
|
||||
save = pbPropertyList(itm.id.to_s, data, items, true)
|
||||
if save
|
||||
if pbPropertyList(itm.id.to_s, data, items, true)
|
||||
# Construct item hash
|
||||
item_hash = {
|
||||
:id_number => itm.id_number,
|
||||
|
||||
@@ -184,44 +184,47 @@ end
|
||||
#===============================================================================
|
||||
# Save metadata data to PBS file
|
||||
#===============================================================================
|
||||
def pbSerializeMetadata(metadata,mapinfos)
|
||||
save_data(metadata,"Data/metadata.dat")
|
||||
def pbSaveMetadata
|
||||
File.open("PBS/metadata.txt","wb") { |f|
|
||||
f.write(0xEF.chr)
|
||||
f.write(0xBB.chr)
|
||||
f.write(0xBF.chr)
|
||||
f.write("\# "+_INTL("See the documentation on the wiki to learn how to edit this file."))
|
||||
f.write("\r\n")
|
||||
for i in 0...metadata.length
|
||||
next if !metadata[i]
|
||||
# Write global metadata
|
||||
f.write("\#-------------------------------\r\n")
|
||||
f.write(sprintf("[%03d]\r\n",i))
|
||||
if i==0
|
||||
types = Metadata::SCHEMA
|
||||
else
|
||||
if mapinfos && mapinfos[i]
|
||||
f.write(sprintf("# %s\r\n",mapinfos[i].name))
|
||||
f.write("[000]\r\n")
|
||||
metadata = GameData::Metadata.get
|
||||
schema = GameData::Metadata::SCHEMA
|
||||
keys = schema.keys.sort {|a, b| schema[a][0] <=> schema[b][0] }
|
||||
for key in keys
|
||||
record = metadata.property_from_string(key)
|
||||
next if record.nil?
|
||||
f.write(sprintf("%s = ", key))
|
||||
pbWriteCsvRecord(record, f, schema[key])
|
||||
f.write("\r\n")
|
||||
end
|
||||
types = MapMetadata::SCHEMA
|
||||
# Write map metadata
|
||||
map_infos = pbLoadRxData("Data/MapInfos")
|
||||
schema = GameData::MapMetadata::SCHEMA
|
||||
keys = schema.keys.sort {|a, b| schema[a][0] <=> schema[b][0] }
|
||||
GameData::MapMetadata.each do |map_data|
|
||||
f.write("\#-------------------------------\r\n")
|
||||
f.write(sprintf("[%03d]\r\n", map_data.id))
|
||||
if map_infos && map_infos[map_data.id]
|
||||
f.write(sprintf("# %s\r\n", map_infos[map_data.id].name))
|
||||
end
|
||||
for key in types.keys
|
||||
schema = types[key]
|
||||
record = metadata[i][schema[0]]
|
||||
next if record==nil
|
||||
f.write(sprintf("%s = ",key))
|
||||
pbWriteCsvRecord(record,f,schema)
|
||||
for key in keys
|
||||
record = map_data.property_from_string(key)
|
||||
next if record.nil?
|
||||
f.write(sprintf("%s = ", key))
|
||||
pbWriteCsvRecord(record, f, schema[key])
|
||||
f.write("\r\n")
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
def pbSaveMetadata
|
||||
data = load_data("Data/metadata.dat") rescue nil
|
||||
return if !data
|
||||
pbSerializeMetadata(data,pbLoadRxData("Data/MapInfos"))
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
|
||||
@@ -240,83 +240,6 @@ end
|
||||
# Visual Editor (map connections)
|
||||
#===============================================================================
|
||||
class MapScreenScene
|
||||
GLOBALMETADATA=[
|
||||
["Home",MapCoordsFacingProperty,
|
||||
_INTL("Map ID and X and Y coordinates of where the player goes if no Pokémon Center was entered after a loss.")],
|
||||
["WildBattleBGM",BGMProperty,
|
||||
_INTL("Default BGM for wild Pokémon battles.")],
|
||||
["TrainerBattleBGM",BGMProperty,
|
||||
_INTL("Default BGM for Trainer battles.")],
|
||||
["WildVictoryME",MEProperty,
|
||||
_INTL("Default ME played after winning a wild Pokémon battle.")],
|
||||
["TrainerVictoryME",MEProperty,
|
||||
_INTL("Default ME played after winning a Trainer battle.")],
|
||||
["WildCaptureME",MEProperty,
|
||||
_INTL("Default ME played after catching a Pokémon.")],
|
||||
["SurfBGM",BGMProperty,
|
||||
_INTL("BGM played while surfing.")],
|
||||
["BicycleBGM",BGMProperty,
|
||||
_INTL("BGM played while on a bicycle.")],
|
||||
["PlayerA",PlayerProperty,
|
||||
_INTL("Specifies player A.")],
|
||||
["PlayerB",PlayerProperty,
|
||||
_INTL("Specifies player B.")],
|
||||
["PlayerC",PlayerProperty,
|
||||
_INTL("Specifies player C.")],
|
||||
["PlayerD",PlayerProperty,
|
||||
_INTL("Specifies player D.")],
|
||||
["PlayerE",PlayerProperty,
|
||||
_INTL("Specifies player E.")],
|
||||
["PlayerF",PlayerProperty,
|
||||
_INTL("Specifies player F.")],
|
||||
["PlayerG",PlayerProperty,
|
||||
_INTL("Specifies player G.")],
|
||||
["PlayerH",PlayerProperty,
|
||||
_INTL("Specifies player H.")]
|
||||
]
|
||||
LOCALMAPS = [
|
||||
["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.")],
|
||||
["Bicycle",BooleanProperty,
|
||||
_INTL("If true, the bicycle can be used on this map.")],
|
||||
["BicycleAlways",BooleanProperty,
|
||||
_INTL("If true, the bicycle will be mounted automatically on this map and cannot be dismounted.")],
|
||||
["HealingSpot",MapCoordsProperty,
|
||||
_INTL("Map ID of this Pokémon Center's town, and X and Y coordinates of its entrance within that town.")],
|
||||
["Weather",WeatherEffectProperty,
|
||||
_INTL("Weather conditions in effect for this map.")],
|
||||
["MapPosition",RegionMapCoordsProperty,
|
||||
_INTL("Identifies the point on the regional map for this map.")],
|
||||
["DiveMap",MapProperty,
|
||||
_INTL("Specifies the underwater layer of this map. Use only if this map has deep water.")],
|
||||
["DarkMap",BooleanProperty,
|
||||
_INTL("If true, this map is dark and a circle of light appears around the player. Flash can be used to expand the circle.")],
|
||||
["SafariMap",BooleanProperty,
|
||||
_INTL("If true, this map is part of the Safari Zone (both indoor and outdoor). Not to be used in the reception desk.")],
|
||||
["SnapEdges",BooleanProperty,
|
||||
_INTL("If true, when the player goes near this map's edge, the game doesn't center the player as usual.")],
|
||||
["Dungeon",BooleanProperty,
|
||||
_INTL("If true, this map has a randomly generated layout. See the wiki for more information.")],
|
||||
["BattleBack",StringProperty,
|
||||
_INTL("PNG files named 'XXX_bg', 'XXX_base0', 'XXX_base1', 'XXX_message' in Battlebacks folder, where XXX is this property's value.")],
|
||||
["WildBattleBGM",BGMProperty,
|
||||
_INTL("Default BGM for wild Pokémon battles on this map.")],
|
||||
["TrainerBattleBGM",BGMProperty,
|
||||
_INTL("Default BGM for trainer battles on this map.")],
|
||||
["WildVictoryME",MEProperty,
|
||||
_INTL("Default ME played after winning a wild Pokémon battle on this map.")],
|
||||
["TrainerVictoryME",MEProperty,
|
||||
_INTL("Default ME played after winning a Trainer battle on this map.")],
|
||||
["WildCaptureME",MEProperty,
|
||||
_INTL("Default ME played after catching a wild Pokémon on this map.")],
|
||||
["MapSize",MapSizeProperty,
|
||||
_INTL("The width of the map in Town Map squares, and a string indicating which squares are part of this map.")],
|
||||
["Environment",EnvironmentProperty,
|
||||
_INTL("The default battle environment for battles on this map.")]
|
||||
]
|
||||
|
||||
def getMapSprite(id)
|
||||
if !@mapsprites[id]
|
||||
@mapsprites[id]=Sprite.new(@viewport)
|
||||
@@ -405,7 +328,7 @@ class MapScreenScene
|
||||
ret.compact!
|
||||
end
|
||||
|
||||
# Returns the maps within _keys_ that are directly connected to this map, _map_.
|
||||
# Returns the maps within _keys_ that are directly connected to this map, _map_.
|
||||
def getDirectConnections(keys,map)
|
||||
thissprite=getMapSprite(map)
|
||||
thisdims=MapFactoryHelper.getMapDims(map)
|
||||
@@ -520,7 +443,6 @@ class MapScreenScene
|
||||
for c in conns
|
||||
@mapconns.push(c.clone)
|
||||
end
|
||||
@metadata=pbLoadMetadata
|
||||
if $game_map
|
||||
@currentmap=$game_map.map_id
|
||||
else
|
||||
@@ -532,26 +454,9 @@ class MapScreenScene
|
||||
|
||||
def setTopSprite(id)
|
||||
for i in @mapsprites.keys
|
||||
if i==id
|
||||
@mapsprites[i].z=1
|
||||
else
|
||||
@mapsprites[i].z=0
|
||||
@mapsprites[i].z = (i == id) ? 1 : 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def getMetadata(mapid,metadataType)
|
||||
return @metadata[mapid][metadataType] if @metadata[mapid]
|
||||
end
|
||||
|
||||
def setMetadata(mapid,metadataType,data)
|
||||
@metadata[mapid]=[] if !@metadata[mapid]
|
||||
@metadata[mapid][metadataType]=data
|
||||
end
|
||||
|
||||
def serializeMetadata
|
||||
pbSerializeMetadata(@metadata,@mapinfos)
|
||||
end
|
||||
|
||||
def helpWindow
|
||||
helptext=_INTL("A: Add map to canvas\r\n")
|
||||
@@ -578,19 +483,6 @@ class MapScreenScene
|
||||
title.dispose
|
||||
end
|
||||
|
||||
def propertyList(map,properties)
|
||||
infos=load_data("Data/MapInfos.rxdata")
|
||||
mapname=(map==0) ? _INTL("Global Metadata") : infos[map].name
|
||||
data=[]
|
||||
for i in 0...properties.length
|
||||
data.push(getMetadata(map,i+1))
|
||||
end
|
||||
pbPropertyList(mapname,data,properties)
|
||||
for i in 0...properties.length
|
||||
setMetadata(map,i+1,data[i])
|
||||
end
|
||||
end
|
||||
|
||||
def getMapRect(mapid)
|
||||
sprite=getMapSprite(mapid)
|
||||
if sprite
|
||||
@@ -605,16 +497,12 @@ class MapScreenScene
|
||||
end
|
||||
end
|
||||
|
||||
def onDoubleClick(mapid)
|
||||
if mapid>=0
|
||||
propertyList(mapid,LOCALMAPS)
|
||||
else
|
||||
propertyList(0,GLOBALMETADATA)
|
||||
end
|
||||
def onDoubleClick(map_id)
|
||||
pbEditMetadata(map_id)
|
||||
end
|
||||
|
||||
def onClick(mapid,x,y)
|
||||
if @lastclick>0 && Graphics.frame_count-@lastclick<15
|
||||
if @lastclick>0 && Graphics.frame_count - @lastclick < Graphics.frame_rate * 0.5
|
||||
onDoubleClick(mapid)
|
||||
@lastclick=-1
|
||||
else
|
||||
@@ -718,7 +606,7 @@ class MapScreenScene
|
||||
onMouseOver(hitmap,mousepos[0],mousepos[1])
|
||||
@lasthitmap=hitmap
|
||||
end
|
||||
if @oldmousex!=mousepos[0]||@oldmousey!=mousepos[1]
|
||||
if @oldmousex!=mousepos[0] || @oldmousey!=mousepos[1]
|
||||
onMouseMove(hitmap,mousepos[0],mousepos[1])
|
||||
@oldmousex=mousepos[0]
|
||||
@oldmousey=mousepos[1]
|
||||
@@ -727,26 +615,22 @@ class MapScreenScene
|
||||
end
|
||||
if Input.press?(Input::UP)
|
||||
for i in @mapsprites
|
||||
next if !i
|
||||
i[1].y+=4
|
||||
i[1].y += 4 if i
|
||||
end
|
||||
end
|
||||
if Input.press?(Input::DOWN)
|
||||
for i in @mapsprites
|
||||
next if !i
|
||||
i[1].y-=4
|
||||
i[1].y -= 4 if i
|
||||
end
|
||||
end
|
||||
if Input.press?(Input::LEFT)
|
||||
for i in @mapsprites
|
||||
next if !i
|
||||
i[1].x+=4
|
||||
i[1].x += 4 if i
|
||||
end
|
||||
end
|
||||
if Input.press?(Input::RIGHT)
|
||||
for i in @mapsprites
|
||||
next if !i
|
||||
i[1].x-=4
|
||||
i[1].x -= 4 if i
|
||||
end
|
||||
end
|
||||
if Input.triggerex?("A"[0])
|
||||
@@ -791,9 +675,8 @@ class MapScreenScene
|
||||
if Input.trigger?(Input::B)
|
||||
if pbConfirmMessage(_INTL("Save changes?"))
|
||||
serializeConnectionData
|
||||
serializeMetadata
|
||||
save_data(@encdata,"Data/encounters.dat")
|
||||
# TODO: Only need to reload connections, metadata, encounter data.
|
||||
# TODO: Only need to reload connections and encounter data.
|
||||
pbClearData
|
||||
pbSaveEncounterData
|
||||
end
|
||||
|
||||
@@ -7,45 +7,89 @@ module Compiler
|
||||
# Compile metadata
|
||||
#=============================================================================
|
||||
def compile_metadata
|
||||
sections = []
|
||||
currentmap = -1
|
||||
pbCompilerEachCommentedLine("PBS/metadata.txt") { |line,lineno|
|
||||
if line[/^\s*\[\s*(\d+)\s*\]\s*$/]
|
||||
sectionname = $~[1]
|
||||
if currentmap==0
|
||||
if sections[currentmap][Metadata::HOME]==nil
|
||||
raise _INTL("The entry Home is required in metadata.txt section [{1}].",sectionname)
|
||||
elsif sections[currentmap][Metadata::PLAYER_A]==nil
|
||||
raise _INTL("The entry PlayerA is required in metadata.txt section [{1}].",sectionname)
|
||||
GameData::Metadata::DATA.clear
|
||||
GameData::MapMetadata::DATA.clear
|
||||
# Read from PBS file
|
||||
File.open("PBS/metadata.txt", "rb") { |f|
|
||||
FileLineData.file = "PBS/metadata.txt" # For error reporting
|
||||
# Read a whole section's lines at once, then run through this code.
|
||||
# contents is a hash containing all the XXX=YYY lines in that section, where
|
||||
# the keys are the XXX and the values are the YYY (as unprocessed strings).
|
||||
pbEachFileSection(f) { |contents, map_id|
|
||||
schema = (map_id == 0) ? GameData::Metadata::SCHEMA : GameData::MapMetadata::SCHEMA
|
||||
# Go through schema hash of compilable data and compile this section
|
||||
for key in schema.keys
|
||||
FileLineData.setSection(map_id, key, contents[key]) # For error reporting
|
||||
# Skip empty properties, or raise an error if a required property is
|
||||
# empty
|
||||
if contents[key].nil?
|
||||
if map_id == 0 && ["Home", "PlayerA"].include?(key)
|
||||
raise _INTL("The entry {1} is required in PBS/metadata.txt section 0.", key)
|
||||
end
|
||||
next
|
||||
end
|
||||
currentmap = sectionname.to_i
|
||||
if sections[currentmap]
|
||||
raise _INTL("Section [{1}] is defined twice in metadata.txt.\r\n{2}",currentmap,FileLineData.linereport)
|
||||
end
|
||||
sections[currentmap] = []
|
||||
else
|
||||
if currentmap<0
|
||||
raise _INTL("Expected a section at the beginning of the file.\r\n{1}",FileLineData.linereport)
|
||||
end
|
||||
if !line[/^\s*(\w+)\s*=\s*(.*)$/]
|
||||
raise _INTL("Bad line syntax (expected syntax like XXX=YYY).\r\n{1}",FileLineData.linereport)
|
||||
end
|
||||
matchData = $~
|
||||
schema = nil
|
||||
FileLineData.setSection(currentmap,matchData[1],matchData[2])
|
||||
if currentmap==0
|
||||
schema = Metadata::SCHEMA[matchData[1]]
|
||||
else
|
||||
schema = MapMetadata::SCHEMA[matchData[1]]
|
||||
end
|
||||
if schema
|
||||
record = pbGetCsvRecord(matchData[2],lineno,schema)
|
||||
sections[currentmap][schema[0]] = record
|
||||
# Compile value for key
|
||||
value = pbGetCsvRecord(contents[key], key, schema[key])
|
||||
value = nil if value.is_a?(Array) && value.length == 0
|
||||
contents[key] = value
|
||||
end
|
||||
if map_id == 0 # Global metadata
|
||||
# Construct metadata hash
|
||||
metadata_hash = {
|
||||
:id => map_id,
|
||||
:home => contents["Home"],
|
||||
:wild_battle_BGM => contents["WildBattleBGM"],
|
||||
:trainer_battle_BGM => contents["TrainerBattleBGM"],
|
||||
:wild_victory_ME => contents["WildVictoryME"],
|
||||
:trainer_victory_ME => contents["TrainerVictoryME"],
|
||||
:wild_capture_ME => contents["WildCaptureME"],
|
||||
:surf_BGM => contents["SurfBGM"],
|
||||
:bicycle_BGM => contents["BicycleBGM"],
|
||||
:player_A => contents["PlayerA"],
|
||||
:player_B => contents["PlayerB"],
|
||||
:player_C => contents["PlayerC"],
|
||||
:player_D => contents["PlayerD"],
|
||||
:player_E => contents["PlayerE"],
|
||||
:player_F => contents["PlayerF"],
|
||||
:player_G => contents["PlayerG"],
|
||||
:player_H => contents["PlayerH"]
|
||||
}
|
||||
# Add metadata's data to records
|
||||
GameData::Metadata::DATA[map_id] = GameData::Metadata.new(metadata_hash)
|
||||
else # Map metadata
|
||||
# Construct metadata hash
|
||||
metadata_hash = {
|
||||
:id => map_id,
|
||||
:outdoor_map => contents["Outdoor"],
|
||||
:announce_location => contents["ShowArea"],
|
||||
:can_bicycle => contents["Bicycle"],
|
||||
:always_bicycle => contents["BicycleAlways"],
|
||||
:teleport_destination => contents["HealingSpot"],
|
||||
:weather => contents["Weather"],
|
||||
:town_map_position => contents["MapPosition"],
|
||||
:dive_map_id => contents["DiveMap"],
|
||||
:dark_map => contents["DarkMap"],
|
||||
:safari_map => contents["SafariMap"],
|
||||
:snap_edges => contents["SnapEdges"],
|
||||
:random_dungeon => contents["Dungeon"],
|
||||
:battle_background => contents["BattleBack"],
|
||||
:wild_battle_BGM => contents["WildBattleBGM"],
|
||||
:trainer_battle_BGM => contents["TrainerBattleBGM"],
|
||||
:wild_victory_ME => contents["WildVictoryME"],
|
||||
:trainer_victory_ME => contents["TrainerVictoryME"],
|
||||
:wild_capture_ME => contents["WildCaptureME"],
|
||||
:town_map_size => contents["MapSize"],
|
||||
:battle_environment => contents["Environment"]
|
||||
}
|
||||
# Add metadata's data to records
|
||||
GameData::MapMetadata::DATA[map_id] = GameData::MapMetadata.new(metadata_hash)
|
||||
end
|
||||
}
|
||||
save_data(sections,"Data/metadata.dat")
|
||||
}
|
||||
# Save all data
|
||||
GameData::Metadata.save
|
||||
GameData::MapMetadata.save
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -166,27 +210,6 @@ module Compiler
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
def compile_berry_plants
|
||||
sections = {}
|
||||
if File.exists?("PBS/berryplants.txt")
|
||||
pbCompilerEachCommentedLine("PBS/berryplants.txt") { |line,_lineno|
|
||||
if line[ /^\s*(\w+)\s*=\s*(.*)$/ ]
|
||||
key = $1
|
||||
value = $2
|
||||
value = value.split(",")
|
||||
for i in 0...value.length
|
||||
value[i].sub!(/^\s*/,"")
|
||||
value[i].sub!(/\s*$/,"")
|
||||
value[i] = value[i].to_i
|
||||
end
|
||||
item = parseItem(key)
|
||||
sections[item] = value
|
||||
end
|
||||
}
|
||||
end
|
||||
save_data(sections, "Data/berry_plants.dat")
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Compile phone messages
|
||||
#=============================================================================
|
||||
|
||||
152
PBS/metadata.txt
152
PBS/metadata.txt
@@ -1,42 +1,42 @@
|
||||
# See the documentation on the wiki to learn how to edit this file.
|
||||
#-------------------------------
|
||||
[000]
|
||||
PlayerA = POKEMONTRAINER_Red,trchar000,boy_bike,boy_surf,boy_run,boy_surf,boy_fish_offset,boy_fish_offset
|
||||
PlayerB = POKEMONTRAINER_Leaf,trchar001,girl_bike,girl_surf,girl_run,girl_surf,girl_fish_offset,girl_fish_offset
|
||||
TrainerVictoryME = Battle victory trainer.ogg
|
||||
WildVictoryME = Battle victory wild.ogg
|
||||
TrainerBattleBGM = Battle trainer.mid
|
||||
SurfBGM = Surfing.mid
|
||||
BicycleBGM = Bicycle.mid
|
||||
Home = 3,7,5,8
|
||||
WildBattleBGM = Battle wild.mid
|
||||
TrainerBattleBGM = Battle trainer.mid
|
||||
WildVictoryME = Battle victory wild.ogg
|
||||
TrainerVictoryME = Battle victory trainer.ogg
|
||||
SurfBGM = Surfing.mid
|
||||
BicycleBGM = Bicycle.mid
|
||||
PlayerA = POKEMONTRAINER_Red,trchar000,boy_bike,boy_surf,boy_run,boy_surf,boy_fish_offset,boy_fish_offset
|
||||
PlayerB = POKEMONTRAINER_Leaf,trchar001,girl_bike,girl_surf,girl_run,girl_surf,girl_fish_offset,girl_fish_offset
|
||||
#-------------------------------
|
||||
[001]
|
||||
# Intro
|
||||
#-------------------------------
|
||||
[002]
|
||||
# Lappet Town
|
||||
BattleBack = field
|
||||
MapPosition = 0,13,12
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
MapPosition = 0,13,12
|
||||
BattleBack = field
|
||||
#-------------------------------
|
||||
[003]
|
||||
# \PN's house
|
||||
MapPosition = 0,13,12
|
||||
HealingSpot = 2,8,8
|
||||
MapPosition = 0,13,12
|
||||
#-------------------------------
|
||||
[004]
|
||||
# Pokémon Lab
|
||||
MapPosition = 0,13,12
|
||||
ShowArea = false
|
||||
MapPosition = 0,13,12
|
||||
#-------------------------------
|
||||
[005]
|
||||
# Route 1
|
||||
BattleBack = field
|
||||
MapPosition = 0,13,11
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
MapPosition = 0,13,11
|
||||
BattleBack = field
|
||||
#-------------------------------
|
||||
[006]
|
||||
# Kurt's house
|
||||
@@ -44,10 +44,10 @@ MapPosition = 0,13,11
|
||||
#-------------------------------
|
||||
[007]
|
||||
# Cedolan City
|
||||
MapSize = 2,11
|
||||
MapPosition = 0,13,10
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
MapPosition = 0,13,10
|
||||
MapSize = 2,11
|
||||
#-------------------------------
|
||||
[008]
|
||||
# Daisy's house
|
||||
@@ -55,13 +55,13 @@ MapPosition = 0,13,12
|
||||
#-------------------------------
|
||||
[009]
|
||||
# Cedolan City Poké Center
|
||||
MapPosition = 0,14,10
|
||||
HealingSpot = 8,17,11
|
||||
MapPosition = 0,14,10
|
||||
#-------------------------------
|
||||
[010]
|
||||
# Cedolan Gym
|
||||
BattleBack = indoor3
|
||||
MapPosition = 0,13,10
|
||||
BattleBack = indoor3
|
||||
Environment = Rock
|
||||
#-------------------------------
|
||||
[011]
|
||||
@@ -106,23 +106,23 @@ MapPosition = 0,13,10
|
||||
#-------------------------------
|
||||
[021]
|
||||
# Route 2
|
||||
MapSize = 1,11
|
||||
BattleBack = field
|
||||
Weather = Rain,100
|
||||
MapPosition = 0,14,8
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
Weather = Rain,100
|
||||
MapPosition = 0,14,8
|
||||
BattleBack = field
|
||||
MapSize = 1,11
|
||||
#-------------------------------
|
||||
[023]
|
||||
# Lerucean Town
|
||||
MapPosition = 0,15,8
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
MapPosition = 0,15,8
|
||||
#-------------------------------
|
||||
[024]
|
||||
# Lerucean Town Poké Center
|
||||
MapPosition = 0,15,8
|
||||
HealingSpot = 23,11,15
|
||||
MapPosition = 0,15,8
|
||||
#-------------------------------
|
||||
[025]
|
||||
# Lerucean Town Mart
|
||||
@@ -138,10 +138,10 @@ MapPosition = 0,15,8
|
||||
#-------------------------------
|
||||
[028]
|
||||
# Natural Park
|
||||
BattleBack = field
|
||||
MapPosition = 0,16,8
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
MapPosition = 0,16,8
|
||||
BattleBack = field
|
||||
#-------------------------------
|
||||
[029]
|
||||
# Natural Park Entrance
|
||||
@@ -154,34 +154,34 @@ MapPosition = 0,16,8
|
||||
#-------------------------------
|
||||
[031]
|
||||
# Route 3
|
||||
MapSize = 2,1101
|
||||
BattleBack = field
|
||||
MapPosition = 0,14,6
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
MapPosition = 0,14,6
|
||||
BattleBack = field
|
||||
MapSize = 2,1101
|
||||
#-------------------------------
|
||||
[034]
|
||||
# Ice Cave
|
||||
BattleBack = cave1
|
||||
Bicycle = true
|
||||
MapPosition = 0,15,6
|
||||
BattleBack = cave1
|
||||
Environment = Cave
|
||||
#-------------------------------
|
||||
[035]
|
||||
# Ingido Plateau
|
||||
MapPosition = 0,13,6
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
MapPosition = 0,13,6
|
||||
#-------------------------------
|
||||
[036]
|
||||
# Pokémon League
|
||||
MapPosition = 0,13,6
|
||||
HealingSpot = 35,17,7
|
||||
MapPosition = 0,13,6
|
||||
#-------------------------------
|
||||
[037]
|
||||
# Pokémon League
|
||||
BattleBack = elite1
|
||||
MapPosition = 0,13,6
|
||||
BattleBack = elite1
|
||||
#-------------------------------
|
||||
[038]
|
||||
# Hall of Fame
|
||||
@@ -189,41 +189,41 @@ MapPosition = 0,13,6
|
||||
#-------------------------------
|
||||
[039]
|
||||
# Route 4
|
||||
MapSize = 2,11
|
||||
BattleBack = field
|
||||
MapPosition = 0,11,6
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
MapPosition = 0,11,6
|
||||
BattleBack = field
|
||||
MapSize = 2,11
|
||||
#-------------------------------
|
||||
[040]
|
||||
# Route 4
|
||||
MapPosition = 0,11,6
|
||||
Outdoor = true
|
||||
BicycleAlways = true
|
||||
ShowArea = true
|
||||
BicycleAlways = true
|
||||
MapPosition = 0,11,6
|
||||
#-------------------------------
|
||||
[041]
|
||||
# Route 5
|
||||
MapSize = 1,111
|
||||
MapPosition = 0,11,7
|
||||
Outdoor = true
|
||||
BicycleAlways = true
|
||||
ShowArea = true
|
||||
BicycleAlways = true
|
||||
MapPosition = 0,11,7
|
||||
MapSize = 1,111
|
||||
#-------------------------------
|
||||
[044]
|
||||
# Route 6
|
||||
MapSize = 2,11
|
||||
BattleBack = field
|
||||
MapPosition = 0,11,10
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
MapPosition = 0,11,10
|
||||
BattleBack = field
|
||||
MapSize = 2,11
|
||||
#-------------------------------
|
||||
[045]
|
||||
# Route 6
|
||||
MapPosition = 0,11,10
|
||||
Outdoor = true
|
||||
BicycleAlways = true
|
||||
ShowArea = true
|
||||
BicycleAlways = true
|
||||
MapPosition = 0,11,10
|
||||
#-------------------------------
|
||||
[046]
|
||||
# Cycling Road gate
|
||||
@@ -232,47 +232,47 @@ MapPosition = 0,12,6
|
||||
#-------------------------------
|
||||
[047]
|
||||
# Route 7
|
||||
MapSize = 2,11
|
||||
BattleBack = rocky
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
Weather = Rain,0
|
||||
MapPosition = 0,15,10
|
||||
Outdoor = true
|
||||
BattleBack = rocky
|
||||
MapSize = 2,11
|
||||
Environment = Rock
|
||||
ShowArea = true
|
||||
#-------------------------------
|
||||
[049]
|
||||
# Rock Cave
|
||||
BattleBack = cave1
|
||||
Bicycle = true
|
||||
MapPosition = 0,16,10
|
||||
BattleBack = cave1
|
||||
Environment = Cave
|
||||
#-------------------------------
|
||||
[050]
|
||||
# Rock Cave
|
||||
BattleBack = cave3
|
||||
Bicycle = true
|
||||
MapPosition = 0,16,10
|
||||
DarkMap = true
|
||||
BattleBack = cave3
|
||||
Environment = Cave
|
||||
#-------------------------------
|
||||
[051]
|
||||
# Dungeon
|
||||
BattleBack = cave2
|
||||
Bicycle = true
|
||||
Dungeon = true
|
||||
MapPosition = 0,16,10
|
||||
Dungeon = true
|
||||
BattleBack = cave2
|
||||
Environment = Cave
|
||||
#-------------------------------
|
||||
[052]
|
||||
# Battle Frontier
|
||||
MapPosition = 0,17,10
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
MapPosition = 0,17,10
|
||||
#-------------------------------
|
||||
[053]
|
||||
# Battle Frontier Poké Center
|
||||
MapPosition = 0,17,10
|
||||
HealingSpot = 52,17,14
|
||||
MapPosition = 0,17,10
|
||||
#-------------------------------
|
||||
[054]
|
||||
# Battle Frontier Mart
|
||||
@@ -280,13 +280,13 @@ MapPosition = 0,17,10
|
||||
#-------------------------------
|
||||
[055]
|
||||
# Battle Tower
|
||||
MapPosition = 0,17,10
|
||||
HealingSpot = 52,30,10
|
||||
MapPosition = 0,17,10
|
||||
#-------------------------------
|
||||
[056]
|
||||
# Battle Tower arena
|
||||
BattleBack = indoor1
|
||||
MapPosition = 0,17,10
|
||||
BattleBack = indoor1
|
||||
#-------------------------------
|
||||
[057]
|
||||
# Stadium Cup lobby
|
||||
@@ -298,8 +298,8 @@ MapPosition = 0,17,10
|
||||
#-------------------------------
|
||||
[059]
|
||||
# Battle Palace arena
|
||||
BattleBack = indoor1
|
||||
MapPosition = 0,17,10
|
||||
BattleBack = indoor1
|
||||
#-------------------------------
|
||||
[060]
|
||||
# Battle Arena
|
||||
@@ -307,8 +307,8 @@ MapPosition = 0,17,10
|
||||
#-------------------------------
|
||||
[061]
|
||||
# Battle Arena arena
|
||||
BattleBack = indoor1
|
||||
MapPosition = 0,17,10
|
||||
BattleBack = indoor1
|
||||
#-------------------------------
|
||||
[062]
|
||||
# Battle Factory
|
||||
@@ -320,8 +320,8 @@ MapPosition = 0,17,10
|
||||
#-------------------------------
|
||||
[064]
|
||||
# Battle Factory arena
|
||||
BattleBack = indoor1
|
||||
MapPosition = 0,17,10
|
||||
BattleBack = indoor1
|
||||
#-------------------------------
|
||||
[065]
|
||||
# Battle Factory corridor
|
||||
@@ -329,10 +329,10 @@ MapPosition = 0,17,10
|
||||
#-------------------------------
|
||||
[066]
|
||||
# Safari Zone
|
||||
BattleBack = field
|
||||
MapPosition = 0,12,12
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
MapPosition = 0,12,12
|
||||
BattleBack = field
|
||||
#-------------------------------
|
||||
[067]
|
||||
# Safari Zone gate
|
||||
@@ -340,25 +340,25 @@ MapPosition = 0,12,12
|
||||
#-------------------------------
|
||||
[068]
|
||||
# Safari Zone
|
||||
BattleBack = forest
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
MapPosition = 0,12,12
|
||||
SafariMap = true
|
||||
Outdoor = true
|
||||
BattleBack = forest
|
||||
Environment = Forest
|
||||
ShowArea = true
|
||||
#-------------------------------
|
||||
[069]
|
||||
# Route 8
|
||||
DiveMap = 70
|
||||
BattleBack = field
|
||||
MapPosition = 0,13,13
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
MapPosition = 0,13,13
|
||||
DiveMap = 70
|
||||
BattleBack = field
|
||||
#-------------------------------
|
||||
[070]
|
||||
# Underwater
|
||||
BattleBack = underwater
|
||||
MapPosition = 0,13,13
|
||||
BattleBack = underwater
|
||||
Environment = Underwater
|
||||
#-------------------------------
|
||||
[071]
|
||||
@@ -367,18 +367,18 @@ MapPosition = 0,13,13
|
||||
#-------------------------------
|
||||
[072]
|
||||
# Berth Island
|
||||
BattleBack = field
|
||||
Weather = Storm,50
|
||||
MapPosition = 0,18,17
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
Weather = Storm,50
|
||||
MapPosition = 0,18,17
|
||||
BattleBack = field
|
||||
#-------------------------------
|
||||
[073]
|
||||
# Faraday Island
|
||||
BattleBack = field
|
||||
MapPosition = 0,22,16
|
||||
Outdoor = true
|
||||
ShowArea = true
|
||||
MapPosition = 0,22,16
|
||||
BattleBack = field
|
||||
#-------------------------------
|
||||
[074]
|
||||
# Cycling Road gate
|
||||
@@ -387,6 +387,6 @@ MapPosition = 0,12,10
|
||||
#-------------------------------
|
||||
[075]
|
||||
# Tiall Region
|
||||
BattleBack = city
|
||||
MapPosition = 1,13,16
|
||||
Outdoor = true
|
||||
MapPosition = 1,13,16
|
||||
BattleBack = city
|
||||
|
||||
Reference in New Issue
Block a user