The following script generates a tradeskill_recipe entry and tradeskill_recipe entries (by this I mean it creates a .SQL file for insertion):
Code:
sub T {
my $recipe_id = shift;
my $recipe_name = shift;
my $tradeskill = shift;
my $tradeskill_level = shift;
my $tradeskill_trivial = shift;
my $failable = shift;
my $data = shift;
my @info = split(/ /, $data);
open my $file, ">Recipe $recipe_id.sql";
my $query = "INSERT INTO `tradeskill_recipe` VALUES ('$recipe_id', '$recipe_name', '$tradeskill', '$tradeskill_level', '$tradeskill_trivial', '$failable', '0', '', '0', '0', '1');\n";
foreach my $entry (@info) {
my @record = split(/\-/, $entry);
chomp $record[$_] for (0..$#record);
print "Adding item $record[0].\n";
$query .= "INSERT INTO `tradeskill_recipe_entries` (`recipe_id`, `item_id`, `successcount`, `failcount`, `componentcount`, `salvagecount`, `iscontainer`) VALUES ('$recipe_id', '$record[0]', '$record[1]', '$record[2]', '$record[3]', '$record[4]', '$record[5]');\n";
}
say $file $query;
close $file;
}
print "What is the recipe ID?\n";
my $recipe_id = int(<STDIN>);
print "What is the recipe name?\n";
my $recipe_name = <STDIN>;
chomp $recipe_name;
print "What is the tradeskill?\n";
my $tradeskill = int(<STDIN>);
print "What is the tradeskill level needed?\n";
my $tradeskill_level = int(<STDIN>);
print "What is the trivial level?\n";
my $tradeskill_trivial = int(<STDIN>);
print "Is it failable?\n";
my $failable = int(<STDIN>);
print "List the item id, component count, success count, failure count, salvage count, and if they are a container.\n";
my $data = <STDIN>;
T($recipe_id, $recipe_name, $tradeskill, $tradeskill_level, $tradeskill_trivial, $failable, $data);
Example of use: