move to unstable rocketamf so that it builds hashes from registries, not arrays

This commit is contained in:
Emi Matchu 2011-01-13 17:22:07 -05:00
parent d28e297656
commit 1e8ec13bfe
5 changed files with 18 additions and 11 deletions

View file

@ -6,11 +6,13 @@ gem 'rails', '3.0.3'
gem 'compass', '~> 0.10.1'
gem 'haml', '~> 3.0.18'
gem 'rdiscount', '~> 1.6.5'
gem 'RocketAMF', '~> 0.2.1'
gem 'will_paginate', '~> 3.0.pre2'
gem 'warden', '~> 1.0.1'
gem 'rails_warden', '~> 0.5.2'
# unstable version of RocketAMF interprets info registry as a hash instead of an array
gem 'RocketAMF', :git => 'git://github.com/warhammerkid/rocket-amf.git'
gem 'msgpack', '~> 0.4.3'
gem 'openneo-auth-signatory', '~> 0.1.0'

View file

@ -32,10 +32,15 @@ GIT
specs:
mysqlplus (0.1.1)
GIT
remote: git://github.com/warhammerkid/rocket-amf.git
revision: aecb8ce8b54e822bb594a53371801b446ecb26af
specs:
RocketAMF (0.2.1)
GEM
remote: http://rubygems.org/
specs:
RocketAMF (0.2.1)
aaronh-chronic (0.3.9)
abstract (1.0.0)
actionmailer (3.0.3)
@ -153,7 +158,7 @@ PLATFORMS
ruby
DEPENDENCIES
RocketAMF (~> 0.2.1)
RocketAMF!
addressable
compass (~> 0.10.1)
em-http-request!

View file

@ -210,9 +210,9 @@ class Item < ActiveRecord::Base
# due to how the parser works
items = {}
item_ids = []
info_registry.each do |info|
info_registry.each do |item_id, info|
if info && info[:is_compatible]
item_ids << info[:obj_info_id].to_i
item_ids << item_id.to_i
end
end
existing_relationships_by_item_id_and_swf_asset_id = {}
@ -227,8 +227,8 @@ class Item < ActiveRecord::Base
relationships_by_swf_asset_id
end
swf_asset_ids = []
asset_registry.each_with_index do |asset_data, index|
swf_asset_ids << index if asset_data
asset_registry.each do |asset_id, asset_data|
swf_asset_ids << asset_id.to_i if asset_data
end
existing_swf_assets = SwfAsset.object_assets.find_all_by_id swf_asset_ids
existing_swf_assets_by_id = {}
@ -236,7 +236,7 @@ class Item < ActiveRecord::Base
existing_swf_assets_by_id[swf_asset.id] = swf_asset
end
relationships_by_item_id = {}
asset_registry.each do |asset_data|
asset_registry.each do |asset_id, asset_data|
if asset_data
item_id = asset_data[:obj_info_id].to_i
next unless item_ids.include?(item_id) # skip incompatible
@ -246,7 +246,7 @@ class Item < ActiveRecord::Base
item.id = item_id
items[item_id] = item
end
item.origin_registry_info = info_registry[item.id]
item.origin_registry_info = info_registry[item.id.to_s]
item.current_body_id = pet_type.body_id
swf_asset_id = asset_data[:asset_id].to_i
swf_asset = existing_swf_assets_by_id[swf_asset_id]

View file

@ -50,7 +50,7 @@ class PetState < ActiveRecord::Base
def self.from_pet_type_and_biology_info(pet_type, info)
swf_asset_ids = []
info.each do |asset_info|
info.each do |zone_id, asset_info|
if asset_info
swf_asset_ids << asset_info[:part_id].to_i
end
@ -77,7 +77,7 @@ class PetState < ActiveRecord::Base
end
pet_state.pet_type = pet_type # save the second case from having to look it up by ID
relationships = []
info.each do |asset_info|
info.each do |zone_id, asset_info|
if asset_info
swf_asset_id = asset_info[:part_id].to_i
swf_asset = existing_swf_assets_by_id[swf_asset_id]

Binary file not shown.