Files
infinitefusion-e18/Data/Scripts/050_Outfits/001_OutfitsMain/OutfitsGlobal.rb
T
2026-07-10 15:42:06 -04:00

113 lines
3.2 KiB
Ruby

class PokemonGlobalMetadata
attr_accessor :hats_data
attr_accessor :hairstyles_data
attr_accessor :clothes_data
end
def update_global_hats_list()
file_path = Settings::HATS_DATA_PATH
json_data = File.read(file_path)
hat_data = HTTPLite::JSON.parse(json_data)
$PokemonGlobal.hats_data = {}
# Iterate through the JSON data and create Hat objects
hat_data.each do |data|
tags = data['tags'] ? data['tags'].split(',').map(&:strip) : []
storeLocations = data['storelocation'] ? data['storelocation'].split(',').map(&:strip) : []
tags += storeLocations
regionTags = data['regiontags'] ? data['regiontags'].split(',').map(&:strip) : []
tags += regionTags
pokemonTags = data['pokemontags'] ? data['pokemontags'].split(',').map(&:strip) : []
pokemonTags.each do |tag|
tags << "pokemon-#{tag.downcase}"
end
contest_conditions = data['contestcondition'] ? data['contestcondition'].split(',').map(&:strip) : []
hat = Hat.new(
data['id'],
_OUTFIT_INTL(data['name']),
_OUTFIT_INTL(data['description']),
data['price'],
tags,
storeLocations,
contest_conditions
)
$PokemonGlobal.hats_data[hat.id] = hat
end
end
def update_global_hairstyles_list()
file_path = Settings::HAIRSTYLE_DATA_PATH
json_data = File.read(file_path)
hair_data = HTTPLite::JSON.parse(json_data)
$PokemonGlobal.hairstyles_data = {}
# Iterate through the JSON data and create Hat objects
hair_data.each do |data|
tags = data['tags'] ? data['tags'].split(',').map(&:strip) : []
storeLocations = data['storelocation'] ? data['storelocation'].split(',').map(&:strip) : []
tags += storeLocations
regionTags = data['regiontags'] ? data['regiontags'].split(',').map(&:strip) : []
tags += regionTags
hair = Hairstyle.new(
data['id'],
_OUTFIT_INTL(data['name']),
_OUTFIT_INTL(data['description']),
data['price'],
tags,
storeLocations
)
$PokemonGlobal.hairstyles_data[hair.id] = hair
end
end
def update_global_clothes_list()
file_path = Settings::CLOTHES_DATA_PATH
json_data = File.read(file_path)
outfits_data = HTTPLite::JSON.parse(json_data)
$PokemonGlobal.clothes_data = {}
# Iterate through the JSON data and create Hat objects
outfits_data.each do |data|
tags = data['tags'] ? data['tags'].split(',').map(&:strip) : []
storeLocations = data['storelocation'] ? data['storelocation'].split(',').map(&:strip) : []
tags += storeLocations
regionTags = data['regiontags'] ? data['regiontags'].split(',').map(&:strip) : []
tags += regionTags
pokemonTags = data['pokemontags'] ? data['pokemontags'].split(',').map(&:strip) : []
pokemonTags.each do |tag|
tags << "pokemon-#{tag.downcase}"
end
contest_conditions = data['contestcondition'] ? data['contestcondition'].split(',').map(&:strip) : []
outfit = Clothes.new(
data['id'],
_OUTFIT_INTL(data['name']),
_OUTFIT_INTL(data['description']),
data['price'],
tags,
storeLocations,
contest_conditions
)
$PokemonGlobal.clothes_data[outfit.id] = outfit
end
end
def update_global_outfit_lists()
update_global_hats_list
update_global_hairstyles_list
update_global_clothes_list
end