Implemented GameData::BerryPlant

This commit is contained in:
Maruno17
2020-11-13 21:34:11 +00:00
parent d7e9f6db67
commit d8476d1fa4
5 changed files with 89 additions and 57 deletions

View File

@@ -139,6 +139,33 @@ module Compiler
#=============================================================================
# Compile berry plants
#=============================================================================
def compile_berry_plants
GameData::BerryPlant::DATA.clear
pbCompilerEachCommentedLine("PBS/berryplants.txt") { |line, line_no|
if line[/^\s*(\w+)\s*=\s*(.*)$/] # Of the format XXX = YYY
key = $1
value = $2
item_symbol = parseItem(key).to_sym
item_number = GameData::Item.get(item_symbol).id_number
line = pbGetCsvRecord(value, line_no, [0, "vuuv"])
# Construct berry plant hash
berry_plant_hash = {
:id => item_symbol,
:id_number => item_number,
:hours_per_stage => line[0],
:drying_per_hour => line[1],
:minimum_yield => line[2],
:maximum_yield => line[3]
}
# Add berry plant's data to records
GameData::BerryPlant::DATA[item_number] = GameData::BerryPlant::DATA[item_symbol] = GameData::BerryPlant.new(berry_plant_hash)
end
}
# Save all data
GameData::BerryPlant.save
Graphics.update
end
def compile_berry_plants
sections = {}
if File.exists?("PBS/berryplants.txt")