Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 02-14-2013, 12:35 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

Code:
use 5.012;
use warnings;

package NPC;

sub new {
    my ( $class, %param ) = ( shift, @_ );
    $param{_class} = 14;
    return bless \%param, $class;
}

sub GetClass {
    shift->{_class};
}

package main;

my $npc = NPC->new();

# array of playable class long names
use constant CLASS_L => qw(
  Unknown Warrior Cleric Paladin Ranger Shadowknight Druid Monk Bard Rogue
  Shaman Necromancer Wizard Magician Enchanter Beastlord Berserker
);

# hashref containing buffs offered depening on the class of the npc
my $buff = {
    Enchanter => [
        [ "Bind Affinity",      35,   10 ],
        [ "Breeze",             697,  25 ],
        [ "Clarity",            174,  50 ],
        [ "Clarity II",         1693, 200 ],
        [ "Alacrity",           170,  10 ],
        [ "Augment",            1729, 30 ],
        [ "Aanya's Quickening", 1708, 100 ],
        [ "Rune I",             481,  5 ],
    ],
    Necromancer => [ [ "Dead Men Floating", 1391, 10 ], ],
};

# this is what the client said (used to search available buffs)
my $text = "la";

# this is how we find out long name of the class the npc is
my $mclass = (CLASS_L)[ $npc->GetClass() ];

# this searches the array of available buffs and returns only those that match
foreach my $spell ( grep { ${$_}[0] =~ /$text/i } @{ $buff->{$mclass} } ) {
    my ( $spellName, $spellID, $spellCost ) = @{$spell};
    say "I can cast $spellName [$spellID] on you for $spellCost platinum.";
}
results:

Code:
I can cast Clarity [174] on you for 50 platinum.
I can cast Clarity II [1693] on you for 200 platinum.
I can cast Alacrity [170] on you for 10 platinum.
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
 


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