Add new image sizes
* Weapons can now download the “raw”image size, which is the weapon art without a background * Characters now download the “detail” image size, which is a horizontal crop of the character’s art * Summons now download the “detail” image size, which is a horizontal crop of the summon’s art * Summons also download “ls” and “m” instead of “party_main” and “party_sub”, as they match the aspect ratio of weapon sizes better, which should make our lives a lot easier.
This commit is contained in:
parent
5955ef2650
commit
0d997d6ad5
3 changed files with 24 additions and 8 deletions
|
|
@ -77,8 +77,13 @@ module Granblue
|
|||
# @return [String] Complete URL for downloading the image
|
||||
def build_variant_url(variant_id, size)
|
||||
directory = directory_for_size(size)
|
||||
|
||||
if size == 'detail'
|
||||
"#{@base_url}/#{directory}/#{variant_id}.png"
|
||||
else
|
||||
"#{@base_url}/#{directory}/#{variant_id}.jpg"
|
||||
end
|
||||
end
|
||||
|
||||
# Gets object type for file paths and storage keys
|
||||
# @return [String] Returns "character"
|
||||
|
|
@ -102,6 +107,7 @@ module Granblue
|
|||
when 'main' then 'f'
|
||||
when 'grid' then 'm'
|
||||
when 'square' then 's'
|
||||
when 'detail' then 'detail'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -79,8 +79,12 @@ module Granblue
|
|||
# @return [String] Complete URL for downloading the image
|
||||
def build_variant_url(variant_id, size)
|
||||
directory = directory_for_size(size)
|
||||
if size == 'detail'
|
||||
"#{@base_url}/#{directory}/#{variant_id}.png"
|
||||
else
|
||||
"#{@base_url}/#{directory}/#{variant_id}.jpg"
|
||||
end
|
||||
end
|
||||
|
||||
# Gets object type for file paths and storage keys
|
||||
# @return [String] Returns "summon"
|
||||
|
|
@ -95,14 +99,16 @@ module Granblue
|
|||
end
|
||||
|
||||
# Gets directory name for a size variant
|
||||
#
|
||||
# @param size [String] Image size variant
|
||||
# @return [String] Directory name in game asset URL structure
|
||||
# @note Maps "main" -> "party_main", "grid" -> "party_sub", "square" -> "s"
|
||||
def directory_for_size(size)
|
||||
case size.to_s
|
||||
when 'main' then 'party_main'
|
||||
when 'grid' then 'party_sub'
|
||||
when 'main' then 'ls'
|
||||
when 'grid' then 'm'
|
||||
when 'square' then 's'
|
||||
when 'detail' then 'detail'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -42,9 +42,7 @@ module Granblue
|
|||
variants = [@id]
|
||||
|
||||
# Add transcendence variants if available
|
||||
if weapon.transcendence
|
||||
variants.push("#{@id}_02", "#{@id}_03")
|
||||
end
|
||||
variants.push("#{@id}_02", "#{@id}_03") if weapon.transcendence
|
||||
|
||||
log_info "Downloading weapon variants: #{variants.join(', ')}" if @verbose
|
||||
|
||||
|
|
@ -79,8 +77,12 @@ module Granblue
|
|||
# @return [String] Complete URL for downloading the image
|
||||
def build_variant_url(variant_id, size)
|
||||
directory = directory_for_size(size)
|
||||
if size == 'raw'
|
||||
"#{@base_url}/#{directory}/#{variant_id}.png"
|
||||
else
|
||||
"#{@base_url}/#{directory}/#{variant_id}.jpg"
|
||||
end
|
||||
end
|
||||
|
||||
# Gets object type for file paths and storage keys
|
||||
# @return [String] Returns "weapon"
|
||||
|
|
@ -95,6 +97,7 @@ module Granblue
|
|||
end
|
||||
|
||||
# Gets directory name for a size variant
|
||||
#
|
||||
# @param size [String] Image size variant
|
||||
# @return [String] Directory name in game asset URL structure
|
||||
# @note Maps "main" -> "ls", "grid" -> "m", "square" -> "s"
|
||||
|
|
@ -103,6 +106,7 @@ module Granblue
|
|||
when 'main' then 'ls'
|
||||
when 'grid' then 'm'
|
||||
when 'square' then 's'
|
||||
when 'raw' then 'b'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue