EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Custom (https://www.eqemulator.org/forums/forumdisplay.php?f=671)
-   -   Tradeskill Recipe Generator. (https://www.eqemulator.org/forums/showthread.php?t=39965)

Kingly_Krab 08-29-2015 06:00 PM

Tradeskill Recipe Generator.
 
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:
http://i.imgur.com/65AMgFS.png


All times are GMT -4. The time now is 10:07 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.