From cfee8b0b31486acf5ad76427a066135b666d2354 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 22 Jan 2023 19:58:45 -0800 Subject: [PATCH 1/7] Support for frontend transcendence Set transcendence step when updating uncap level --- app/controllers/api/v1/grid_characters_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/api/v1/grid_characters_controller.rb b/app/controllers/api/v1/grid_characters_controller.rb index 23d9381..4f0ec8b 100644 --- a/app/controllers/api/v1/grid_characters_controller.rb +++ b/app/controllers/api/v1/grid_characters_controller.rb @@ -90,6 +90,7 @@ module Api render_unauthorized_response if current_user && (character.party.user != current_user) character.uncap_level = character_params[:uncap_level] + character.transcendence_step = character_params[:transcendence_step] return unless character.save! render json: GridCharacterBlueprint.render(character, view: :nested, root: :grid_character) From bb79f68a2cc63b34ff2b2e1a33f625f275922163 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 22 Jan 2023 20:37:15 -0800 Subject: [PATCH 2/7] Remove extraneous code --- app/controllers/api/v1/grid_characters_controller.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/controllers/api/v1/grid_characters_controller.rb b/app/controllers/api/v1/grid_characters_controller.rb index 4f0ec8b..8e1e3e0 100644 --- a/app/controllers/api/v1/grid_characters_controller.rb +++ b/app/controllers/api/v1/grid_characters_controller.rb @@ -48,13 +48,9 @@ module Api @character.attributes = character_params.merge(mastery) - if @character.save - ap 'Saved character' - return render json: GridCharacterBlueprint.render(@character, view: :full) if @character.save - else - ap 'Could not save' - render_validation_error_response(@character) - end + return render json: GridCharacterBlueprint.render(@character, view: :full) if @character.save + + render_validation_error_response(@character) end def resolve From 8c1fae02d4840fca64022e135fb5f235de5efdf6 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 22 Jan 2023 20:37:52 -0800 Subject: [PATCH 3/7] Add update method to GridSummonsController --- app/controllers/api/v1/grid_summons_controller.rb | 10 +++++++++- config/routes.rb | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/grid_summons_controller.rb b/app/controllers/api/v1/grid_summons_controller.rb index 2a40033..a34a035 100644 --- a/app/controllers/api/v1/grid_summons_controller.rb +++ b/app/controllers/api/v1/grid_summons_controller.rb @@ -3,7 +3,7 @@ module Api module V1 class GridSummonsController < Api::V1::ApiController - before_action :set, only: %w[destroy] + before_action :set, only: %w[update destroy] attr_reader :party, :incoming_summon @@ -24,6 +24,14 @@ module Api end end + def update + @summon.attributes = summon_params + + return render json: GridSummonBlueprint.render(@summon, view: :full) if @summon.save + + render_validation_error_response(@character) + end + def save_summon(summon) if (grid_summon = GridSummon.where( party_id: party.id, diff --git a/config/routes.rb b/config/routes.rb index e9a6b9f..70bdf6d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,7 +10,7 @@ Rails.application.routes.draw do resources :users, only: %i[create update show] resources :grid_weapons, only: %i[update destroy] resources :grid_characters, only: %i[update destroy] - resources :grid_summons, only: %i[destroy] + resources :grid_summons, only: %i[update destroy] resources :favorites, only: [:create] get 'users/info/:id', to: 'users#info' From 422651668ef10b9fbac36bffe4612cc3f9361041 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 22 Jan 2023 20:41:24 -0800 Subject: [PATCH 4/7] Permit transcendence_step --- app/controllers/api/v1/grid_summons_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/grid_summons_controller.rb b/app/controllers/api/v1/grid_summons_controller.rb index a34a035..6dfd6d4 100644 --- a/app/controllers/api/v1/grid_summons_controller.rb +++ b/app/controllers/api/v1/grid_summons_controller.rb @@ -99,7 +99,8 @@ module Api # Specify whitelisted properties that can be modified. def summon_params - params.require(:summon).permit(:id, :party_id, :summon_id, :position, :main, :friend, :uncap_level) + params.require(:summon).permit(:id, :party_id, :summon_id, :position, :main, :friend, :uncap_level, + :transcendence_step) end end end From 717c08ea8fa9f26cf8a314767a9a362b13603450 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 22 Jan 2023 21:01:58 -0800 Subject: [PATCH 5/7] Update summon task to download XLB images --- lib/tasks/export_summon.rake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/tasks/export_summon.rake b/lib/tasks/export_summon.rake index 5942ab1..7c81afd 100644 --- a/lib/tasks/export_summon.rake +++ b/lib/tasks/export_summon.rake @@ -36,6 +36,11 @@ namespace :granblue do f.write("#{build_summon_url("#{s.granblue_id}_02", size)} \n") end + + if s.xlb + f.write("#{build_summon_url("#{s.granblue_id}_03", + size)} \n") + end end end From b248fb62ea5ab4d1cec8f799482e84e90031ec85 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 22 Jan 2023 21:02:06 -0800 Subject: [PATCH 6/7] Add transcendence_step to output --- app/blueprints/api/v1/grid_summon_blueprint.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/blueprints/api/v1/grid_summon_blueprint.rb b/app/blueprints/api/v1/grid_summon_blueprint.rb index 1a27594..116b7ab 100644 --- a/app/blueprints/api/v1/grid_summon_blueprint.rb +++ b/app/blueprints/api/v1/grid_summon_blueprint.rb @@ -5,11 +5,11 @@ module Api class GridSummonBlueprint < ApiBlueprint view :uncap do association :party, blueprint: PartyBlueprint, view: :minimal - fields :position, :uncap_level + fields :position, :uncap_level, :transcendence_step end view :nested do - fields :main, :friend, :position, :uncap_level + fields :main, :friend, :position, :uncap_level, :transcendence_step association :summon, name: :object, blueprint: SummonBlueprint end From 5460a1d1678a076277024384cbdcb17c6df2c02c Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 22 Jan 2023 21:02:19 -0800 Subject: [PATCH 7/7] Reset transcendence step on uncap --- app/controllers/api/v1/grid_summons_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/grid_summons_controller.rb b/app/controllers/api/v1/grid_summons_controller.rb index 6dfd6d4..788f3d5 100644 --- a/app/controllers/api/v1/grid_summons_controller.rb +++ b/app/controllers/api/v1/grid_summons_controller.rb @@ -27,7 +27,7 @@ module Api def update @summon.attributes = summon_params - return render json: GridSummonBlueprint.render(@summon, view: :full) if @summon.save + return render json: GridSummonBlueprint.render(@summon, view: :nested, root: :grid_summon) if @summon.save render_validation_error_response(@character) end @@ -65,6 +65,8 @@ module Api render_unauthorized_response if current_user && (summon.party.user != current_user) summon.uncap_level = summon_params[:uncap_level] + summon.transcendence_step = 0 + return unless summon.save! render json: GridSummonBlueprint.render(summon, view: :nested, root: :grid_summon)