These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

Science & Industry

 
  • Topic is locked indefinitely.
 

Fetching blueprint materials from SQL database dump

Author
Hermesyus
Federal Navy Academy
Gallente Federation
#1 - 2012-10-24 15:57:24 UTC
I was wondering what is the appropriate query for fetching all the materials needed to build an item. For example, if I want to build a 10MN Microwarpdrive II, I can fetch the minerals needed for it by doing the following select query:

select * from invtypes where typeID=12052;

..but that only returns the minerals needed, not everything else I need for building the item (10MN Microwarpdrive I, Antimatter Reactor Unit, Ion Thruster, R.A.M. - Armor/Hull Tech and Plasma Thruster). Could you please provide me with a query that will fetch everything I need for building an item or at least, please point me to the correct database tables.

Thanks,
Hermesyus
Twoso
Doomheim
#2 - 2012-10-24 16:01:35 UTC
Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#3 - 2012-10-24 16:37:11 UTC  |  Edited by: Steve Ronuken
https://github.com/fuzzysteve/eve-blueprint-calc

Specifically:
select typeid,name,greatest(0,sum(quantity)) quantity from (select invTypes.typeid typeid,invTypes.typeName name,quantity from invTypes,invTypeMaterials where invTypeMaterials.materialTypeID=invTypes.typeID and invTypeMaterials.TypeID=? union select invTypes.typeid typeid,invTypes.typeName name,invTypeMaterials.quantity*r.quantity*-1 quantity from invTypes,invTypeMaterials,ramTypeRequirements r,invBlueprintTypes bt where invTypeMaterials.materialTypeID=invTypes.typeID and invTypeMaterials.TypeID =r.requiredTypeID and r.typeID = bt.blueprintTypeID AND r.activityID = 1 and bt.productTypeID=? and r.recycle=1) t group by typeid,name

and

SELECT t.typeName tn, r.quantity qn, r.damagePerJob dmg,t.typeID typeid FROM ramTypeRequirements r,invTypes t,invBlueprintTypes bt,invGroups g where r.requiredTypeID = t.typeID and r.typeID = bt.blueprintTypeID AND r.activityID = 1 and bt.productTypeID=? and g.categoryID != 16 and t.groupID = g.groupID

Where the three bind variables are the product that you're trying to create.

Feel free to drop me a eve mail, or drop into #eve-dev on irc.coldfront.net



psst:
http://www.fuzzwork.co.uk/blueprints/
Check out the bare tables and xml options. Blink

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#4 - 2012-10-24 22:29:10 UTC