Skip to content

Instantly share code, notes, and snippets.

@tekkub
Created August 30, 2008 18:47
Show Gist options
  • Select an option

  • Save tekkub/8136 to your computer and use it in GitHub Desktop.

Select an option

Save tekkub/8136 to your computer and use it in GitHub Desktop.
# data = {:method_vendors=>[{:price=>[8000, 0, 0], :type=>7, :locs=>[440], :react=>[1, 1],
# :desc=>"Alchemy Supplies", :name=>"Alchemist Pestlezugg", :minlevel=>45, :id=>5594}],
# :learned=>200, :produces=>[3577], :skillup=>[200, 240, 260, 280], :method_drops=>[],
# :rarity=>2, :method=>"sold-by,", :reagents=>[[3575, 1]], :id=>9304}
# Assuming the containing structure is an array...
new_data = bigger_struct.map do |data|
source, trainerflag = "Unknown", "nil"
source, trainerflag = 'L["Trainer"]', 1 unless data[:method_vendors].nil?
%Q|self:addTradeSkillSpell(#{data[:id]}, #{data[:skillup].first}, #{source}, #{trainerflag})|
end
p new_data.join("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment