Dynamic spriter credits lust

This commit is contained in:
infinitefusion
2023-05-01 20:16:29 -04:00
parent e64df61a43
commit 11a6f7e6cc
32 changed files with 82 additions and 32 deletions

View File

@@ -0,0 +1,38 @@
def export_music_use_map()
music_hash = Hash.new
for map_id in 1..796
mapInfos = load_data(sprintf("Data/Map%03d.rxdata", map_id))
bgm_name = mapInfos.bgm.name
map_name = Kernel.getMapName(map_id)
formatted_value = map_name + " [" + map_id.to_s + "]"
if music_hash.has_key?(bgm_name)
music_hash[bgm_name] << formatted_value
else
music_hash[bgm_name] = Array.new(1, formatted_value)
end
end
export_hash_to_csv(music_hash,"music_export.csv")
end
def export_hash_to_csv(hash, file_path)
# Open the file for writing
file = File.open(file_path, "w")
# Write the CSV header
file.puts "Key,Value"
# Write each key-value pair as a new line in the CSV file
hash.each do |key, values|
if key == ""
key = "(No value)"
end
# Join the values into a single string with newline characters
values_str = values.join("\n,")
file.puts "#{key},#{values_str}"
end
# Close the file
file.close
end

View File

@@ -11,6 +11,22 @@ def map_sprites_by_artist
return creditsMap
end
def get_top_artists(nb_names=100)
filename = Settings::CREDITS_FILE_PATH
name_counts = Hash.new(0)
File.readlines(filename).each do |line|
name = line.strip.split(',')[1]
name_counts[name] += 1
end
name_counts.sort_by { |name, count| -count }.to_h
.first(nb_names)
.to_h
end
def analyzeSpritesList(spritesList, mostPopularCallbackVariable=1)
pokemon_map = Hash.new
for spritename in spritesList
@@ -93,4 +109,26 @@ def getSpriteCredits(spriteName)
end
end
return nil
end
end
def formatList(list,separator)
formatted = ""
i =0
for element in list
formatted << element
formatted << separator if i < list.length
i+=1
end
end
def format_names_for_game_credits()
spriters_map = get_top_artists(50)
formatted = ""
for spriter in spriters_map.keys
line = spriter + "<s>" + spriters_map[spriter].to_s + " sprites\n"
formatted << line
end
return formatted
end