mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Dynamic spriter credits lust
This commit is contained in:
38
Data/Scripts/050_AddOns/ExportScripts.rb
Normal file
38
Data/Scripts/050_AddOns/ExportScripts.rb
Normal 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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user