So I play a little space MMO that some of you may know (eve-online.com). And the game is rather vast when it comes to in game items. And a lot of these items have blueprints which allow you manufacture the items provided you have the necessary skills and materials. I was puttering around this past weekend trying to find a list of all the blueprints and what materials were required and simply could not find one that was current. But I did stumble upon a complete static dump of the game database for items, etc. And given some SQL-fu I could gather the information I wanted.
Sadly, my SQL-fu is not strong for scarily interrelated datasets, but that is why awesome people like mst came up with DBIx::Class and other modules of the same vain such as DBIx::Class::Schema::Loader. I got a hold of the database that CCP distributed and someone was kind enough to do a sqlite conversion. I threw Schema::Loader at it and got back a whole set Result classes ready for use.
Next step was to write a quick little script that would do the little calculations that I want and print out via STDOUT a CSV file suitable to be read in by OpenOffice. Earlier I read and commented on jnapiorkowski's blog about his very awesome MooseX::Role::BuildInstanceOfmodule. And so I took his module and used it in a class to spin up an attribute of the Schema class. Then I threw some MooseX::Getopt at the class to allow easy runtime option definition for things like what field separator to use.
Once that was all in place, the script ran and I now I have a rudimentary spreadsheet that allows me to find blueprints that take the materials that I readily have available. And what was my total time in developing this little 68 line script? 30 minutes.
Nerd hackery for the win!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment