mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Turned Town Map PBS data into a GameData class
This commit is contained in:
@@ -246,6 +246,7 @@ module GameData
|
||||
# A bulk loader method for all data stored in .dat files in the Data folder.
|
||||
#=============================================================================
|
||||
def self.load_all
|
||||
TownMap.load
|
||||
Type.load
|
||||
Ability.load
|
||||
Move.load
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Data caches.
|
||||
#===============================================================================
|
||||
class Game_Temp
|
||||
attr_accessor :town_map_data
|
||||
attr_accessor :regional_dexes_data
|
||||
attr_accessor :battle_animations_data
|
||||
attr_accessor :move_to_battle_animation_data
|
||||
@@ -11,7 +10,6 @@ end
|
||||
|
||||
def pbClearData
|
||||
if $game_temp
|
||||
$game_temp.town_map_data = nil
|
||||
$game_temp.regional_dexes_data = nil
|
||||
$game_temp.battle_animations_data = nil
|
||||
$game_temp.move_to_battle_animation_data = nil
|
||||
@@ -24,17 +22,6 @@ def pbClearData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Method to get Town Map data.
|
||||
#===============================================================================
|
||||
def pbLoadTownMapData
|
||||
$game_temp = Game_Temp.new if !$game_temp
|
||||
if !$game_temp.town_map_data
|
||||
$game_temp.town_map_data = load_data("Data/town_map.dat")
|
||||
end
|
||||
return $game_temp.town_map_data
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Method to get Regional Dexes data.
|
||||
#===============================================================================
|
||||
|
||||
40
Data/Scripts/010_Data/002_PBS data/002_TownMap.rb
Normal file
40
Data/Scripts/010_Data/002_PBS data/002_TownMap.rb
Normal file
@@ -0,0 +1,40 @@
|
||||
module GameData
|
||||
class TownMap
|
||||
attr_reader :id
|
||||
attr_reader :real_name
|
||||
attr_reader :filename
|
||||
attr_reader :point
|
||||
attr_reader :flags
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "town_map.dat"
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "u"],
|
||||
"Name" => [:real_name, "s"],
|
||||
"Filename" => [:filename, "s"],
|
||||
"Point" => [:point, "^uussUUUU"],
|
||||
"Flags" => [:flags, "*s"]
|
||||
}
|
||||
|
||||
extend ClassMethodsIDNumbers
|
||||
include InstanceMethods
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:real_name] || "???"
|
||||
@filename = hash[:filename]
|
||||
@point = hash[:point] || []
|
||||
@flags = hash[:flags] || []
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this region
|
||||
def name
|
||||
return pbGetMessage(MessageTypes::RegionNames, @id)
|
||||
end
|
||||
|
||||
def has_flag?(flag)
|
||||
return @flags.any? { |f| f.downcase == flag.downcase }
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user