Added Flags property to ribbons

This commit is contained in:
Maruno17
2021-09-02 21:09:18 +01:00
parent cef3d08917
commit 885c1193e3
2 changed files with 9 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ module GameData
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"
@@ -11,7 +12,8 @@ module GameData
SCHEMA = {
"Name" => [:name, "s"],
"IconPosition" => [:icon_position, "u"],
"Description" => [:description, "q"]
"Description" => [:description, "q"],
"Flags" => [:flags, "*s"]
}
extend ClassMethodsSymbols
@@ -22,6 +24,7 @@ module GameData
@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
@@ -33,5 +36,9 @@ module GameData
def description
return pbGetMessageFromHash(MessageTypes::RibbonDescriptions, @real_description)
end
def has_flag?(flag)
return @flags.any? { |f| f.downcase == flag.downcase }
end
end
end

View File

@@ -508,6 +508,7 @@ module Compiler
f.write("Name = #{ribbon.real_name}\r\n")
f.write("IconPosition = #{ribbon.icon_position}\r\n")
f.write("Description = #{ribbon.real_description}\r\n")
f.write(sprintf("Flags = %s\r\n", ribbon.flags.join(","))) if ribbon.flags.length > 0
end
}
Graphics.update