EQEmulator Forums

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

Kingly_Krab 08-29-2015 05:57 PM

Loot Generator Script.
 
This script creates a loottable entry, loottable_entries entry, lootdrop entry, and lootdrop_entries entry/entries (by this I mean it writes a .SQL file for insertion):
Code:

sub L {
    my $loottable_info = shift;
    my $lootdrop_info = shift;
    my $item_info = shift;
    my @lti = split(/-/, $loottable_info);
    chomp $lti[$#lti];
    my @ldi = split(/-/, $lootdrop_info);
    chomp $ldi[1];
    my @ii = split(/ /, $item_info);
    chomp $ii[$#ii];
    open my $file, ">Loottable $lti[0].sql";
    my $query = "INSERT INTO `loottable` VALUES ('$lti[0]', '$lti[1]', '$lti[2]', '$lti[3]', '0', '1');\n";
    $query .= "INSERT INTO `loottable_entries` VALUES ('$lti[0]', '$ldi[0]', '1', '1', '0', '100');\n";
    $query .= "INSERT INTO `lootdrop` VALUES ('$ldi[0]', '$ldi[1]');\n";
    foreach my $item (@ii) {
        my @data = split(/-/, $item);
        print "Adding item $data[0].\n";
        $query .= "INSERT INTO `lootdrop_entries` VALUES ('$ldi[0]', '$data[0]', '$data[1]', '$data[2]', '$data[3]', '0', '$data[4]', '127', '$data[5]');\n";
    }
    say $file $query;
    close $file;
}
print "What is the loottable info (id-name-mincash-maxcash)?\n";
my $loottable_info = <STDIN>;
print "What is the lootdrop info (id-name)?\n";
my $lootdrop_info = <STDIN>;
print "List the items' id, charges, whether they're equipped or not, chance, minimum level, and multiplier.\n";
my $item_info = <STDIN>;
L($loottable_info, $lootdrop_info, $item_info);

Here is an example of use:
http://i.imgur.com/8NaaUzo.png


All times are GMT -4. The time now is 08:57 AM.

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