Merge pull request #19 from jedmund/awakening
Add support for Awakening and other Weapon Mod fixes
This commit is contained in:
commit
0246f01523
10 changed files with 49 additions and 6 deletions
|
|
@ -10,6 +10,14 @@ module Api
|
|||
|
||||
view :nested do
|
||||
fields :position, :uncap_level, :perpetuity
|
||||
|
||||
field :awakening do |c|
|
||||
{
|
||||
type: c.awakening_type,
|
||||
level: c.awakening_level
|
||||
}
|
||||
end
|
||||
|
||||
association :character, name: :object, blueprint: CharacterBlueprint
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ module Api
|
|||
association :weapon_keys,
|
||||
blueprint: WeaponKeyBlueprint,
|
||||
if: lambda { |_field_name, w, _options|
|
||||
[2, 3, 17, 22].include?(w.weapon.series)
|
||||
[2, 3, 17, 24].include?(w.weapon.series)
|
||||
}
|
||||
|
||||
field :ax, if: ->(_field_name, w, _options) { w.weapon.ax.positive? } do |w|
|
||||
|
|
@ -32,6 +32,13 @@ module Api
|
|||
end
|
||||
end
|
||||
|
||||
field :awakening, if: ->(_field_name, w, _options) { w.weapon.awakening } do |w|
|
||||
{
|
||||
type: w.awakening_type,
|
||||
level: w.awakening_level
|
||||
}
|
||||
end
|
||||
|
||||
view :full do
|
||||
include_view :nested
|
||||
association :party, blueprint: PartyBlueprint, view: :minimal
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module Api
|
|||
|
||||
fields :granblue_id, :element, :proficiency,
|
||||
:max_level, :max_skill_level, :limit, :rarity,
|
||||
:series, :ax
|
||||
:series, :ax, :awakening
|
||||
|
||||
field :uncap do |w|
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ module Api
|
|||
}
|
||||
end
|
||||
|
||||
fields :series, :slot, :group, :order
|
||||
fields :slug, :series, :slot, :group, :order
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ module Api
|
|||
class WeaponKeysController < Api::V1::ApiController
|
||||
def all
|
||||
conditions = {}.tap do |hash|
|
||||
hash[:series] = request.params['series']
|
||||
hash[:slot] = request.params['slot']
|
||||
hash[:series] = request.params['series'] unless request.params['series'].blank?
|
||||
hash[:slot] = request.params['slot'] unless request.params['slot'].blank?
|
||||
hash[:group] = request.params['group'] unless request.params['group'].blank?
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
class AddAwakeningToGridWeapons < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :grid_weapons, :awakening_type, :integer, null: true
|
||||
add_column :grid_weapons, :awakening_level, :integer, null: false, default: 1
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
class AddAwakeningToGridCharacters < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :grid_characters, :awakening_type, :integer, null: false, default: 0
|
||||
add_column :grid_characters, :awakening_level, :integer, null: false, default: 1
|
||||
end
|
||||
end
|
||||
5
db/migrate/20221221084556_add_awakening_to_weapons.rb
Normal file
5
db/migrate/20221221084556_add_awakening_to_weapons.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class AddAwakeningToWeapons < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :weapons, :awakening, :boolean, null: false, default: true
|
||||
end
|
||||
end
|
||||
5
db/migrate/20221224065845_add_slug_to_weapon_keys.rb
Normal file
5
db/migrate/20221224065845_add_slug_to_weapon_keys.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class AddSlugToWeaponKeys < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :weapon_keys, :slug, :string
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2022_12_03_112452) do
|
||||
ActiveRecord::Schema.define(version: 2022_12_24_065845) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "btree_gin"
|
||||
|
|
@ -65,6 +65,8 @@ ActiveRecord::Schema.define(version: 2022_12_03_112452) do
|
|||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.boolean "perpetuity", default: false, null: false
|
||||
t.integer "awakening_type", default: 0, null: false
|
||||
t.integer "awakening_level", default: 1, null: false
|
||||
t.index ["character_id"], name: "index_grid_characters_on_character_id"
|
||||
t.index ["party_id"], name: "index_grid_characters_on_party_id"
|
||||
end
|
||||
|
|
@ -98,6 +100,8 @@ ActiveRecord::Schema.define(version: 2022_12_03_112452) do
|
|||
t.integer "ax_modifier2"
|
||||
t.float "ax_strength2"
|
||||
t.integer "element"
|
||||
t.integer "awakening_type"
|
||||
t.integer "awakening_level", default: 1, null: false
|
||||
t.index ["party_id"], name: "index_grid_weapons_on_party_id"
|
||||
t.index ["weapon_id"], name: "index_grid_weapons_on_weapon_id"
|
||||
end
|
||||
|
|
@ -244,6 +248,7 @@ ActiveRecord::Schema.define(version: 2022_12_03_112452) do
|
|||
t.integer "slot"
|
||||
t.integer "group"
|
||||
t.integer "order"
|
||||
t.string "slug"
|
||||
end
|
||||
|
||||
create_table "weapons", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
|
|
@ -269,6 +274,7 @@ ActiveRecord::Schema.define(version: 2022_12_03_112452) do
|
|||
t.boolean "extra", default: false, null: false
|
||||
t.integer "limit"
|
||||
t.integer "ax", default: 0, null: false
|
||||
t.boolean "awakening", default: true, null: false
|
||||
t.index ["name_en"], name: "index_weapons_on_name_en", opclass: :gin_trgm_ops, using: :gin
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue