Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Completed

Quests::Completed This is where Completed quests are.

Reply
 
Thread Tools Display Modes
  #1  
Old 02-09-2018, 07:22 PM
Kingly_Krab's Avatar
Kingly_Krab
Demi-God
 
Join Date: May 2013
Location: United States
Posts: 1,515
Default Class-Specific Armor Upgrader

On my server I have a Tier progression that requires a mold, class shard, and the previous Tier item, the below scripts handle this and allow you to upgrade your items to the next tier. I've left my item IDs in for an example, if you have any questions, feel free to ask.

Popup Plugin and GetItemName (required for this script unless you change the popup windows to something else):
Code:
sub Popup {
    my $client = plugin::val('client');
    my $title = shift;
    my $text = shift;
    my $button_type = shift;
    if ($button_type == 2) {
        my $button_one_id = shift;
        my $button_two_id = shift;
        my $button_one = shift;
        my $button_two = shift;
        $client->Popup2($title, $text, $button_one_id, $button_two_id, 1, 600, $button_one, $button_two);
    } else {
        my $id = shift;
        quest::popup($title, $text, $id, $button_type);
    }
}

sub Popup2 {
    my $client = shift;
    my $title = shift;
    my $text = shift;
    my $button_type = shift;
    if ($button_type == 2) {
        my $button_one_id = shift;
        my $button_two_id = shift;
        my $button_one = shift;
        my $button_two = shift;
        $client->Popup2($title, $text, $button_one_id, $button_two_id, 1, 600, $button_one, $button_two);
    } else {
        my $id = shift;
        $client->Popup2($title, $text, 0, 999, 0, 600);
    }
}

sub GetItemName {
    my $dbh = plugin::LoadMysql();
    my $item_id = shift;
    $sth = $dbh->prepare("SELECT `name` FROM `items` WHERE `id` = '$item_id'");
    $sth->execute();
    if ($sth->rows() > 0) {
        my @data = $sth->fetchrow_array();
        return plugin::PWColor($data["name"], "Light Blue");
    } else {
        return plugin::PWColor("INVALID ITEM", "Light Blue");
    }
    $sth->finish();
    $dbh->disconnect();
}

return 1;
Plugin:
Code:
sub ProgressionItems {
    my $class = shift;
    my %items = (
    "Warrior" =>
        [[103328..103334],
        [104540..104546],
        [104764..104770],
        [104652..104658],
        [104876..104882],
        [129480..129486],
        [104988..104994],
        [105100..105106],
        [105212..105218],
        [105324..105330]],
    "Cleric" =>
        [[103335..103341],
        [104547..104553],
        [104771..104777],
        [104659..104665],
        [104883..104889],
        [129487..129493],
        [104995..105001],
        [105107..105113],
        [105219..105225],
        [105331..105337]],
    "Paladin" =>
        [[103342..103348],
        [104554..104560],
        [104778..104784],
        [104666..104672],
        [104890..104896],
        [129494..129500],
        [105002..105008],
        [105114..105120],
        [105226..105232],
        [105338..105344]],
    "Ranger" =>
        [[103349..103355],
        [104561..104567],
        [104785..104791],
        [104673..104679],
        [104897..104903],
        [129501..129507],
        [105009..105015],
        [105121..105127],
        [105233..105239],
        [105345..105351]],
    "Shadowknight" =>
        [[103356..103362],
        [104568..104574],
        [104792..104798],
        [104680..104686],
        [104904..104910],
        [129508..129514],
        [105016..105022],
        [105128..105134],
        [105240..105246],
        [105352..105358]],
    "Druid" =>
        [[103363..103369],
        [104575..104581],
        [104799..104805],
        [104687..104693],
        [104911..104917],
        [129515..129521],
        [105023..105029],
        [105135..105141],
        [105247..105253],
        [105359..105365]],
    "Monk" =>
        [[103370..103376],
        [104582..104588],
        [104806..104812],
        [104694..104700],
        [104918..104924],
        [129522..129528],
        [105030..105036],
        [105142..105148],
        [105254..105260],
        [105366..105372]],
    "Bard" =>
        [[103377..103383],
        [104589..104595],
        [104813..104819],
        [104701..104707],
        [104925..104931],
        [129529..129535],
        [105037..105043],
        [105149..105155],
        [105261..105267],
        [105373..105379]],
    "Rogue" =>
        [[103384..103390],
        [104596..104602],
        [104820..104826],
        [104708..104714],
        [104932..104938],
        [129536..129542],
        [105044..105050],
        [105156..105162],
        [105268..105274],
        [105380..105386]],
    "Shaman" =>
        [[103391..103397],
        [104603..104609],
        [104827..104833],
        [104715..104721],
        [104939..104945],
        [129543..129549],
        [105051..105057],
        [105163..105169],
        [105275..105281],
        [105387..105393]],
    "Necromancer" =>
        [[103398..103404],
        [104610..104616],
        [104834..104840],
        [104722..104728],
        [104946..104952],
        [129550..129556],
        [105058..105064],
        [105170..105176],
        [105282..105288],
        [105394..105400]],
    "Wizard" =>
        [[103405..103411],
        [104617..104623],
        [104841..104847],
        [104729..104735],
        [104953..104959],
        [129557..129563],
        [105065..105071],
        [105177..105183],
        [105289..105295],
        [105401..105407]],
    "Magician" =>
        [[103412..103418],
        [104624..104630],
        [104848..104854],
        [104736..104742],
        [104960..104966],
        [129564..129570],
        [105072..105078],
        [105184..105190],
        [105296..105302],
        [105408..105414]],
    "Enchanter" =>
        [[103419..103425],
        [104631..104637],
        [104855..104861],
        [104743..104749],
        [104967..104973],
        [129571..129577],
        [105079..105085],
        [105191..105197],
        [105303..105309],
        [105415..105421]],
    "Beastlord" =>
        [[103426..103432],
        [104638..104644],
        [104862..104868],
        [104750..104756],
        [104974..104980],
        [129578..129584],
        [105086..105092],
        [105198..105204],
        [105310..105316],
        [105422..105428]],
    "Berserker" =>
        [[103433..103439],
        [104645..104651],
        [104869..104875],
        [104757..104763],
        [104981..104987],
        [129585..129591],
        [105093..105099],
        [105205..105211],
        [105317..105323],
        [105429..105435]]);
    return @{$items{$class}};
}

sub ProgressionEmblems {
    my $class = shift;
    my %emblems = ("Warrior" => 167000,
    "Cleric" => 167001,
    "Paladin" => 167002,
    "Ranger" => 167003,
    "Shadowknight" => 167004,
    "Druid" => 167005,
    "Monk" => 167006,
    "Bard" => 167007,
    "Rogue" => 167008,
    "Shaman" => 167009,
    "Necromancer" => 167010,
    "Wizard" => 167011,
    "Magician" => 167012,
    "Enchanter" => 167013,
    "Beastlord" => 167014,
    "Berserker" => 167015);
    return $emblems{$class};
}

sub ProgressionMolds {
    my $tier = shift;
    my $index = shift;
    my %molds = (0 => [166000..166006],
    1 => [166007..166013],
    2 => [166014..166020],
    3 => [166021..166027],
    4 => [166028..166034],
    5 => [166035..166041],
    6 => [166042..166048],
    7 => [166049..166055],
    8 => [166056..166062],
    9 => [166063..166069]);
    return $molds{$tier}[$index];
}

sub GetProgressionTier {
    my $class = plugin::val('class');
    my $itemcount = plugin::var('itemcount');
    my @items = plugin::ProgressionItems($class);
    my $type = shift;
    for ($tier = 0; $tier < 10; $tier++) {
        for ($index = 0; $index < 7; $index++) {            
            my $mold = plugin::ProgressionMolds($tier, $index);
            if (defined $itemcount->{$items[$tier][$index]}) {
                return ($tier + 1, $index);
            }
            
            if (defined $itemcount->{$mold}) {
                return ($tier, $index);            
            }
        }
    }
    return (0, 0);    
}

sub UpgradeProgressionItem {
    my $class = plugin::val('class');
    my $itemcount = plugin::var('itemcount');
    my @items = plugin::ProgressionItems($class);
    my $emblem = plugin::ProgressionEmblems($class);
    my @data = plugin::GetProgressionTier();
    my ($tier, $index) = ($data[0], $data[1]);
    my $mold = plugin::ProgressionMolds($tier, $index);
    my $mold_check = (defined $itemcount->{$mold} ? 1 : 0);
    my $emblem_check = (defined $itemcount->{$emblem} ? 1 : 0);
    my $previous_check = (defined $itemcount->{$items[$tier - 1][$index]} ? 1 : 0);
    if ($tier == 0) {
        if ($mold_check && $emblem_check) {
            delete $itemcount->{$mold};
            delete $itemcount->{$emblem};
            quest::summonitem($items[$tier][$index]);
            plugin::Popup("Forgemaster Ezekiel says,",
            plugin::PWColor("You have upgraded your item to a '" .
            plugin::GetItemName($items[$tier][$index]) . "'.", "Orange"), 0, 999);
            return 1;
        } else {
            my $error_status = "You need to give me the following:<br>";
            if (!$mold_check) { $error_status .= "One " . plugin::GetItemName($mold); }
            if (!$emblem_check) { $error_status  .= "One " . plugin::GetItemName($emblem); }
            plugin::Popup("Forgemaster Ezekiel says,",
            plugin::PWColor($error_status, "Orange"), 0, 999);
            return 0;
        }
    } else {
        if ($mold_check && $emblem_check && $previous_check) {
            delete $itemcount->{$mold};
            delete $itemcount->{$emblem};
            delete $itemcount->{$previous_check};
            quest::summonitem($items[$tier][$index]);
            plugin::Popup("Forgemaster Ezekiel says,",
            plugin::PWColor("Here is your '" .
            plugin::GetItemName($items[$tier][$index]) . "'.", "Orange"), 0, 999);
            return 1;
        } else {
            my $error_status = "You need to give me the following:<br>";
            if (!$mold_check) { $error_status .= "One " . plugin::GetItemName($mold) . "<br>"; }
            if (!$emblem_check) { $error_status .= "One " . plugin::GetItemName($emblem) . "<br>"; }
            if (!$previous_check) { $error_status .= "One " . plugin::GetItemName($items[$tier - 1][$index]); }
            plugin::Popup("Forgemaster Ezekiel says,",
            plugin::PWColor($error_status, "Orange"), 0, 999);
            return 0;
        }
    }
}
NPC:
Code:
sub EVENT_SAY {
    if ($ulevel == 70) {
        plugin::Popup("Forgemaster Ezekiel says,", plugin::PWColor("
        Listed below is what each Tier requires:<br><br>
        <table>
            <tr>
                <td></td>
                <td>Tier Mold</td>
                <td>Class Shard</td>
                <td>Previous Tier Item</td>
            <tr>
            <tr>
                <td>Tier One</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("No", "Red") . "</td>
            </tr>
            <tr>
                <td>Tier Two</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
            </tr>
            <tr>
                <td>Tier Three</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
            </tr>
            <tr>
                <td>Tier Four</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
            </tr>
            <tr>
                <td>Tier Five</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
            </tr>
            <tr>
                <td>Tier Six</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
            </tr>
            <tr>
                <td>Tier Six</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
            </tr>
            <tr>
                <td>Tier Seven</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
            </tr>
            <tr>
                <td>Tier Eight</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
            </tr>
            <tr>
                <td>Tier Nine</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
            </tr>
            <tr>
                <td>Tier Ten</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
                <td>" . plugin::PWColor("Yes", "Green") . "</td>
            </tr>
        </table>", "Orange"));        
    } else {
        plugin::Popup("Forgemaster Ezekiel says,", plugin::PWColor("I only speak to the most elite of soldiers.", "Orange"), 0, 999);
    }
}

sub EVENT_ITEM {
    if (!plugin::UpgradeProgressionItem()) {
        plugin::return_items(\%itemcount);
    }
}

Last edited by Kingly_Krab; 02-09-2018 at 07:28 PM..
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:25 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3