Merge pull request #47 from jedmund/transcendence
Adds support for transcendence
This commit is contained in:
commit
0797306569
5 changed files with 25 additions and 12 deletions
|
|
@ -5,11 +5,11 @@ module Api
|
||||||
class GridSummonBlueprint < ApiBlueprint
|
class GridSummonBlueprint < ApiBlueprint
|
||||||
view :uncap do
|
view :uncap do
|
||||||
association :party, blueprint: PartyBlueprint, view: :minimal
|
association :party, blueprint: PartyBlueprint, view: :minimal
|
||||||
fields :position, :uncap_level
|
fields :position, :uncap_level, :transcendence_step
|
||||||
end
|
end
|
||||||
|
|
||||||
view :nested do
|
view :nested do
|
||||||
fields :main, :friend, :position, :uncap_level
|
fields :main, :friend, :position, :uncap_level, :transcendence_step
|
||||||
association :summon, name: :object, blueprint: SummonBlueprint
|
association :summon, name: :object, blueprint: SummonBlueprint
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,13 +47,9 @@ module Api
|
||||||
|
|
||||||
@character.attributes = character_params.merge(mastery)
|
@character.attributes = character_params.merge(mastery)
|
||||||
|
|
||||||
if @character.save
|
return render json: GridCharacterBlueprint.render(@character, view: :full) if @character.save
|
||||||
ap 'Saved character'
|
|
||||||
return render json: GridCharacterBlueprint.render(@character, view: :full) if @character.save
|
render_validation_error_response(@character)
|
||||||
else
|
|
||||||
ap 'Could not save'
|
|
||||||
render_validation_error_response(@character)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def resolve
|
def resolve
|
||||||
|
|
@ -89,6 +85,7 @@ module Api
|
||||||
render_unauthorized_response if current_user && (character.party.user != current_user)
|
render_unauthorized_response if current_user && (character.party.user != current_user)
|
||||||
|
|
||||||
character.uncap_level = character_params[:uncap_level]
|
character.uncap_level = character_params[:uncap_level]
|
||||||
|
character.transcendence_step = character_params[:transcendence_step]
|
||||||
return unless character.save!
|
return unless character.save!
|
||||||
|
|
||||||
render json: GridCharacterBlueprint.render(character, view: :nested, root: :grid_character)
|
render json: GridCharacterBlueprint.render(character, view: :nested, root: :grid_character)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
module Api
|
module Api
|
||||||
module V1
|
module V1
|
||||||
class GridSummonsController < Api::V1::ApiController
|
class GridSummonsController < Api::V1::ApiController
|
||||||
before_action :set, only: %w[destroy]
|
before_action :set, only: %w[update destroy]
|
||||||
|
|
||||||
attr_reader :party, :incoming_summon
|
attr_reader :party, :incoming_summon
|
||||||
|
|
||||||
|
|
@ -24,6 +24,14 @@ module Api
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@summon.attributes = summon_params
|
||||||
|
|
||||||
|
return render json: GridSummonBlueprint.render(@summon, view: :nested, root: :grid_summon) if @summon.save
|
||||||
|
|
||||||
|
render_validation_error_response(@character)
|
||||||
|
end
|
||||||
|
|
||||||
def save_summon(summon)
|
def save_summon(summon)
|
||||||
if (grid_summon = GridSummon.where(
|
if (grid_summon = GridSummon.where(
|
||||||
party_id: party.id,
|
party_id: party.id,
|
||||||
|
|
@ -57,6 +65,8 @@ module Api
|
||||||
render_unauthorized_response if current_user && (summon.party.user != current_user)
|
render_unauthorized_response if current_user && (summon.party.user != current_user)
|
||||||
|
|
||||||
summon.uncap_level = summon_params[:uncap_level]
|
summon.uncap_level = summon_params[:uncap_level]
|
||||||
|
summon.transcendence_step = 0
|
||||||
|
|
||||||
return unless summon.save!
|
return unless summon.save!
|
||||||
|
|
||||||
render json: GridSummonBlueprint.render(summon, view: :nested, root: :grid_summon)
|
render json: GridSummonBlueprint.render(summon, view: :nested, root: :grid_summon)
|
||||||
|
|
@ -91,7 +101,8 @@ module Api
|
||||||
|
|
||||||
# Specify whitelisted properties that can be modified.
|
# Specify whitelisted properties that can be modified.
|
||||||
def summon_params
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ Rails.application.routes.draw do
|
||||||
resources :users, only: %i[create update show]
|
resources :users, only: %i[create update show]
|
||||||
resources :grid_weapons, only: %i[update destroy]
|
resources :grid_weapons, only: %i[update destroy]
|
||||||
resources :grid_characters, 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]
|
resources :favorites, only: [:create]
|
||||||
|
|
||||||
get 'users/info/:id', to: 'users#info'
|
get 'users/info/:id', to: 'users#info'
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,11 @@ namespace :granblue do
|
||||||
f.write("#{build_summon_url("#{s.granblue_id}_02",
|
f.write("#{build_summon_url("#{s.granblue_id}_02",
|
||||||
size)} \n")
|
size)} \n")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if s.xlb
|
||||||
|
f.write("#{build_summon_url("#{s.granblue_id}_03",
|
||||||
|
size)} \n")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue