diff --git a/app/models/item.rb b/app/models/item.rb index ea399cb3..3f8dfaa6 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -316,6 +316,7 @@ class Item < ActiveRecord::Base end swf_asset.origin_object_data = asset_data swf_asset.origin_pet_type = pet_type + swf_asset.item = item # Build and update the relationship relationship = existing_relationships_by_item_id_and_swf_asset_id[item.id][swf_asset.id] rescue nil diff --git a/app/models/swf_asset.rb b/app/models/swf_asset.rb index 4faf040b..8ee3cf48 100644 --- a/app/models/swf_asset.rb +++ b/app/models/swf_asset.rb @@ -194,7 +194,11 @@ class SwfAsset < ActiveRecord::Base end def body_specific? - self.zone.type_id < 3 + # If we already have assigned this a non-zero body id, or if the asset is + # in a body-specific zone, or if the item is explicitly labeled as + # body-specific (like Encased In Ice, which is body-specific but whose + # assets occupy Background Item), then this asset is body-specific. + (body_id? && body_id > 0) || self.zone.type_id < 3 || (@item && @item.explicitly_body_specific?) end def zone diff --git a/db/migrate/20121006010446_add_explicitly_body_specific_to_objects.rb b/db/migrate/20121006010446_add_explicitly_body_specific_to_objects.rb new file mode 100644 index 00000000..d9517e1b --- /dev/null +++ b/db/migrate/20121006010446_add_explicitly_body_specific_to_objects.rb @@ -0,0 +1,9 @@ +class AddExplicitlyBodySpecificToObjects < ActiveRecord::Migration + def self.up + add_column :objects, :explicitly_body_specific, :boolean, :null => false, :default => false + end + + def self.down + remove_column :objects, :explicitly_body_specific + end +end diff --git a/db/schema.rb b/db/schema.rb index 38a662ba..97249527 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120725232903) do +ActiveRecord::Schema.define(:version => 20121006010446) do create_table "auth_servers", :force => true do |t| t.string "short_name", :limit => 10, :null => false @@ -90,21 +90,22 @@ ActiveRecord::Schema.define(:version => 20120725232903) do add_index "login_cookies", ["user_id"], :name => "login_cookies_user_id" create_table "objects", :force => true do |t| - t.text "zones_restrict", :null => false - t.text "thumbnail_url", :limit => 16777215, :null => false - t.string "name", :limit => 100, :null => false - t.text "description", :limit => 16777215, :null => false - t.string "category", :limit => 50 - t.string "type", :limit => 50 - t.string "rarity", :limit => 25 - t.integer "rarity_index", :limit => 2 - t.integer "price", :limit => 3, :null => false - t.integer "weight_lbs", :limit => 2 - t.text "species_support_ids", :limit => 16777215 - t.boolean "sold_in_mall", :null => false + t.text "zones_restrict", :null => false + t.text "thumbnail_url", :limit => 16777215, :null => false + t.string "name", :limit => 100, :null => false + t.text "description", :limit => 16777215, :null => false + t.string "category", :limit => 50 + t.string "type", :limit => 50 + t.string "rarity", :limit => 25 + t.integer "rarity_index", :limit => 2 + t.integer "price", :limit => 3, :null => false + t.integer "weight_lbs", :limit => 2 + t.text "species_support_ids", :limit => 16777215 + t.boolean "sold_in_mall", :null => false t.datetime "last_spidered" t.datetime "created_at" t.datetime "updated_at" + t.boolean "explicitly_body_specific", :default => false, :null => false end add_index "objects", ["last_spidered"], :name => "objects_last_spidered"