mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 06:04:59 +00:00
Converted Shadow Pokémon PBS file to a section-based format, improved Shadow Pokémon mechanics
This commit is contained in:
44
Data/Scripts/010_Data/002_PBS data/012_Ribbon.rb
Normal file
44
Data/Scripts/010_Data/002_PBS data/012_Ribbon.rb
Normal file
@@ -0,0 +1,44 @@
|
||||
module GameData
|
||||
class Ribbon
|
||||
attr_reader :id
|
||||
attr_reader :real_name
|
||||
attr_reader :icon_position # Where this ribbon's graphic is within ribbons.png
|
||||
attr_reader :real_description
|
||||
attr_reader :flags
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "ribbons.dat"
|
||||
|
||||
SCHEMA = {
|
||||
"Name" => [:name, "s"],
|
||||
"IconPosition" => [:icon_position, "u"],
|
||||
"Description" => [:description, "q"],
|
||||
"Flags" => [:flags, "*s"]
|
||||
}
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@icon_position = hash[:icon_position] || 0
|
||||
@real_description = hash[:description] || "???"
|
||||
@flags = hash[:flags] || []
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this ribbon
|
||||
def name
|
||||
return pbGetMessageFromHash(MessageTypes::RibbonNames, @real_name)
|
||||
end
|
||||
|
||||
# @return [String] the translated description of this ribbon
|
||||
def description
|
||||
return pbGetMessageFromHash(MessageTypes::RibbonDescriptions, @real_description)
|
||||
end
|
||||
|
||||
def has_flag?(flag)
|
||||
return @flags.any? { |f| f.downcase == flag.downcase }
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user