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
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,594
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, Color Plugin, etc:
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, plugin::PopupColor($text, "orange"), $button_one_id, $button_two_id, 1, 600, $button_one, $button_two);
    } else {
        my $popup_id = shift;
        quest::popup($title, $text, $popup_id, $button_type);
    }
}

sub PopupColor {
    my $text = shift;
    my $color = shift;
    my $color_text = quest::gethexcolorcode($color);
    return "<c \"$color_text\">$text</c>";
}

sub GetItemName {
    my $item_id = shift;
    return plugin::PopupColor(
        quest::getitemname($item_id),
        "royal_blue"
    );
}

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 $item_id = $items[$tier][$index];
            my $mold_item_id = plugin::ProgressionMolds($tier, $index);
            if (defined $itemcount->{$item_id}) {
                return ($tier + 1, $index);
            }
            
            if (defined $itemcount->{$mold_item_id}) {
                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_item_id = plugin::ProgressionEmblems($class);
    my @data = plugin::GetProgressionTier();
    my ($tier, $index) = ($data[0], $data[1]);
    my $item_id = $items[$tier][$index];
    my $previous_item_id = $items[$tier - 1][$index];
    my $mold_item_id = plugin::ProgressionMolds($tier, $index);
    my $mold_check = (defined $itemcount->{$mold_item_id} ? 1 : 0);
    my $emblem_check = (defined $itemcount->{$emblem_item_id} ? 1 : 0);
    my $previous_check = (defined $itemcount->{$previous_item_id} ? 1 : 0);
    if ($tier == 0) {
        if ($mold_check && $emblem_check) {
            my $item_name = plugin::GetItemName($item_id);
            delete $itemcount->{$_} for ($emblem_item_id, $mold_item_id);
            quest::summonitem($item_id);
            plugin::Popup("Forgemaster Ezekiel says,", "You have upgraded your item to a $item_name.", 0, 999);
            return 1;
        } else {
            my $mold_item_name = plugin::GetItemName($mold_item_id);
            my $emblem_item_name = plugin::GetItemName($emblem_item_id);
            my $error_status = "You need to give me the following:<br>";
            if (!$mold_check) { $error_status .= "1 $mold_item_name"; }
            if (!$emblem_check) { $error_status  .= "1 $emblem_item_name" ; }
            plugin::Popup("Forgemaster Ezekiel says,", $error_status, 0, 999);
            return 0;
        }
    } else {
        if ($mold_check && $emblem_check && $previous_check) {
            my $item_name = plugin::GetItemName($item_id);
            delete $itemcount->{$_} for ($emblem_item_id, $mold_item_id, $previous_check);
            quest::summonitem($item_id);
            plugin::Popup("Forgemaster Ezekiel says,", "Here is your $item_name.", 0, 999);
            return 1;
        } else {
            my $mold_item_name = plugin::GetItemName($mold_item_id);
            my $emblem_item_name = plugin::GetItemName($emblem_item_id);
            my $previous_item_name = plugin::GetItemName($previous_item_id);
            my $error_status = "You need to give me the following:<br>";
            if (!$mold_check) { $error_status .= "1 $mold_item_name<br>"; }
            if (!$emblem_check) { $error_status .= "1 $emblem_item_name<br>"; }
            if (!$previous_check) { $error_status .= "1 $previous_item_name"; }
            plugin::Popup("Forgemaster Ezekiel says,", $error_status, 0, 999);
            return 0;
        }
    }
}

return 1;

NPC:
Code:
sub EVENT_SAY {
    if ($ulevel == 70) {
        my $yes = plugin::PopupColor("Yes", "green");
        my $no = plugin::PopupColor("No", "red_1");
        my $message = "<table>
            <tr>
                <td></td>
                <td>Tier Mold</td>
                <td>Class Shard</td>
                <td>Previous Tier Item</td>
            <tr>";
        foreach my $tier (1..10) {
            my $requires_previous = $tier != 1 ? $yes : $no ;
            $message .= "<tr>
                <td>Tier $tier</td>
                <td>$yes</td>
                <td>$yes</td>
                <td>$requires_previous</td>
            </tr>";
        }
        $message .= "</table>";
        plugin::Popup("Forgemaster Ezekiel says,", $message, 0, 999);        
    } else {
        plugin::Popup("Forgemaster Ezekiel says,", "I only speak to the most elite of soldiers.", 0, 999);
    }
}

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

Last edited by Kingly_Krab; 03-09-2022 at 06:51 PM..
Reply With Quote
Reply


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 04:31 AM.


 

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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3