View Single Post
  #3  
Old 02-14-2015, 12:20 AM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,604
Default

Here's a re-written version of Ghanja's script that uses a hash instead to make it simpler, rather than several conditional based assignments:
Code:
sub EVENT_SAY {
    if ($text=~/Hail/i) {
        plugin::Whisper("Oh.. it's you.  Yeah, so I've been demoted from the Priest of all things Evil to an item butler. Do you want a " . quest::saylink("bag", 1) . " to put your junk in or do you want your " . quest::saylink("items, 1") . " now?");
    } elsif ($text=~/bag/i) {
        quest::summonitem(17969);
    } elsif ($text=~/items/i) {
        my %hash = ("Warrior" => [1, 2, 3, 4, 5, 6, 7, 8, 9],
        "Cleric" => [1, 2, 3, 4, 5, 6, 7, 8, 9],
        "Paladin" => [1, 2, 3, 4, 5, 6, 7, 8, 9],
        "Ranger" => [1, 2, 3, 4, 5, 6, 7, 8, 9],
        "Shadowknight" => [1, 2, 3, 4, 5, 6, 7, 8, 9],
        "Druid" => [1, 2, 3, 4, 5, 6, 7, 8, 9],
        "Monk" => [1, 2, 3, 4, 5, 6, 7, 8, 9],
        "Bard" => [1, 2, 3, 4, 5, 6, 7, 8, 9],
        "Rogue" => [1, 2, 3, 4, 5, 6, 7, 8, 9],
        "Shaman" => [1, 2, 3, 4, 5, 6, 7, 8, 9],
        "Necromancer" => [1, 2, 3, 4, 5, 6, 7, 8, 9],
        "Wizard" => [1, 2, 3, 4, 5, 6, 7, 8, 9],
        "Magician" => [1, 2, 3, 4, 5, 6, 7, 8, 9],
        "Enchanter" => [1, 2, 3, 4, 5, 6, 7, 8, 9],
        "Beastlord" => [1, 2, 3, 4, 5, 6, 7, 8, 9],
        "Berserker" => [1, 2, 3, 4, 5, 6, 7, 8, 9]);
        foreach my $item (@{$hash{$class}}) {
            if (!plugin::check_hasitem($client, $item)) {
                quest::summonitem($item);
            }
        }
    }
}
Reply With Quote