Merge branch 'staging' into raid-rework
This commit is contained in:
commit
9c82a669e4
3 changed files with 66 additions and 9 deletions
14
db/schema.rb
14
db/schema.rb
|
|
@ -381,6 +381,20 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_18_051638) do
|
||||||
t.index ["user_id"], name: "index_sparks_on_user_id", unique: true
|
t.index ["user_id"], name: "index_sparks_on_user_id", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "sparks", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||||
|
t.string "user_id", null: false
|
||||||
|
t.string "guild_ids", null: false, array: true
|
||||||
|
t.integer "crystals", default: 0
|
||||||
|
t.integer "tickets", default: 0
|
||||||
|
t.integer "ten_tickets", default: 0
|
||||||
|
t.string "target_type"
|
||||||
|
t.bigint "target_id"
|
||||||
|
t.datetime "updated_at", default: -> { "CURRENT_TIMESTAMP" }, null: false
|
||||||
|
t.string "target_memo"
|
||||||
|
t.index ["target_type", "target_id"], name: "index_sparks_on_target"
|
||||||
|
t.index ["user_id"], name: "index_sparks_on_user_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
create_table "summons", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
create_table "summons", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||||
t.string "name_en"
|
t.string "name_en"
|
||||||
t.string "name_jp"
|
t.string "name_jp"
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ namespace :granblue do
|
||||||
|
|
||||||
puts "Summon #{id}"
|
puts "Summon #{id}"
|
||||||
sizes.each do |size|
|
sizes.each do |size|
|
||||||
path = "#{Rails.root}/download/character-#{size}"
|
path = "#{Rails.root}/download/summon-#{size}"
|
||||||
download_images(url[size.to_sym], size, path)
|
download_images(url[size.to_sym], size, path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -125,7 +125,10 @@ namespace :granblue do
|
||||||
elsif object == 'weapon'
|
elsif object == 'weapon'
|
||||||
download_weapon_images(id)
|
download_weapon_images(id)
|
||||||
elsif object == 'summon'
|
elsif object == 'summon'
|
||||||
download_summon_images(id)
|
download_summon_images("#{id}")
|
||||||
|
download_summon_images("#{id}_02")
|
||||||
|
download_summon_images("#{id}_03")
|
||||||
|
download_summon_images("#{id}_04")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,73 @@
|
||||||
namespace :granblue do
|
namespace :granblue do
|
||||||
namespace :export do
|
namespace :export do
|
||||||
def build_job_icon_url(id)
|
def build_job_icon_url(id)
|
||||||
# Set up URL
|
|
||||||
base_url = 'https://prd-game-a-granbluefantasy.akamaized.net/assets_en/img/sp/ui/icon/job'
|
base_url = 'https://prd-game-a-granbluefantasy.akamaized.net/assets_en/img/sp/ui/icon/job'
|
||||||
extension = '.png'
|
extension = '.png'
|
||||||
|
|
||||||
"#{base_url}/#{id}#{extension}"
|
"#{base_url}/#{id}#{extension}"
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Exports a list of weapon URLs for a given size'
|
def build_job_portrait_url(id, proficiency, gender)
|
||||||
task :job do |_t, _args|
|
base_url = 'https://prd-game-a1-granbluefantasy.akamaized.net/assets_en/img/sp/assets/leader/quest'
|
||||||
# Include weapon model
|
extension = '.jpg'
|
||||||
|
|
||||||
|
prefix = ""
|
||||||
|
case proficiency
|
||||||
|
when 1
|
||||||
|
prefix = "sw"
|
||||||
|
when 2
|
||||||
|
prefix = "kn"
|
||||||
|
when 3
|
||||||
|
prefix = "ax"
|
||||||
|
when 4
|
||||||
|
prefix = "sp"
|
||||||
|
when 5
|
||||||
|
prefix = "bw"
|
||||||
|
when 6
|
||||||
|
prefix = "wa"
|
||||||
|
when 7
|
||||||
|
prefix = "me"
|
||||||
|
when 8
|
||||||
|
prefix = "mc"
|
||||||
|
when 9
|
||||||
|
prefix = "gu"
|
||||||
|
when 10
|
||||||
|
prefix = "kt"
|
||||||
|
end
|
||||||
|
|
||||||
|
"#{base_url}/#{id}_#{prefix}_#{gender}_01#{extension}"
|
||||||
|
end
|
||||||
|
|
||||||
|
# job-icon
|
||||||
|
def write_urls(size)
|
||||||
|
# Include model
|
||||||
Dir.glob("#{Rails.root}/app/models/job.rb").each { |file| require file }
|
Dir.glob("#{Rails.root}/app/models/job.rb").each { |file| require file }
|
||||||
|
|
||||||
# Set up filepath
|
# Set up filepath
|
||||||
dir = "#{Rails.root}/export/"
|
dir = "#{Rails.root}/export/"
|
||||||
filename = "#{dir}/job-icon.txt"
|
filename = "#{dir}job-#{size}.txt"
|
||||||
FileUtils.mkdir(dir) unless Dir.exist?(dir)
|
FileUtils.mkdir(dir) unless Dir.exist?(dir)
|
||||||
|
|
||||||
# Write to file
|
# Write to file
|
||||||
File.open(filename, 'w') do |f|
|
File.open(filename, 'w') do |f|
|
||||||
Job.all.each do |w|
|
Job.all.each do |w|
|
||||||
|
if size == 'icon'
|
||||||
f.write("#{build_job_icon_url(w.granblue_id.to_s)} \n")
|
f.write("#{build_job_icon_url(w.granblue_id.to_s)} \n")
|
||||||
|
elsif size == 'portrait'
|
||||||
|
f.write("#{build_job_portrait_url(w.granblue_id.to_s, w.proficiency1, 0)} \n")
|
||||||
|
f.write("#{build_job_portrait_url(w.granblue_id.to_s, w.proficiency1, 1)} \n")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# CLI output
|
# CLI output
|
||||||
count = `wc -l #{filename}`.split.first.to_i
|
count = `wc -l #{filename}`.split.first.to_i
|
||||||
puts "Wrote #{count} job URLs for icon size"
|
puts "Wrote #{count} job URLs for #{size} size"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Exports a list of job URLs for a given size'
|
||||||
|
task :job, [:size] => :environment do |_t, args|
|
||||||
|
write_urls(args[:size])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue