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

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

Reply
 
Thread Tools Display Modes
  #1  
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
  #2  
Old 02-14-2013, 01:32 PM
Figback65
Discordant
 
Join Date: Aug 2009
Location: 2131231231
Posts: 255
Default

Awsome c0ncrete!!! I am going to test that out right now! Here is the script me and Ghanja was working on as well. I got the npcs to respond to hail's with the proper class response but calling the correct spell list was not working... lol. Here is that script of a mess.

Code:
use strict;
no strict 'vars';
use warnings;


sub EVENT_SAY {
my $Necro = {
            @spelllist	=>	["Bind Affinity","Dead Men Floating"],
            @spellcost	=>	[10,10],
			@spellid	=>	[35,1391],
        },
my $Ench = {
            @spelllist	=>	["Bind Affinity","Breeze","Clarity","Clarity II","Alacrity","Augment","Aanya's Quickening","Rune I"],
            @spellcost	=>	[10,25,50,200,10,30,100,5],
			@spellid	=>	[35,697,174,1693,170,1729,1708,481],
        },
my $Magi = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Wiz = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Rog = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Ranger = {
            @spelllist	=>	["Bind Affinity",],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Druid = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Shaman = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Cleric = {
            @spelllist	=>	["Bind Affinity","Daring"],
            @spellcost	=>	[10,5],
			@spellid	=>	[35,89],
        },
my $SK = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Paladin = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Ber = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Bst = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $War = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Bard = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
	
my $cleanclass = $npc->GetClass();
 
 
if ($text=~/hail/i) {
my $buffs = quest::saylink("buffs", 1);
my $NPCName = $npc->GetCleanName();
my $count = 1;
my $n = 0;

	if($cleanclass eq 11) {
	$client->Message(315, "Souls and $buffs.'");
	while ($Necro[$n]) {
		if ((lc($Spelllist[$n]) =~ lc($text) && lc($Spelllist[$n]) ne lc($text)) || ($text =~ /^buffs$/i)) {
		my $Spelllist = quest::saylink($Spelllist[$n]);
		$client->Message(315, "These are your choices, $buffs");
		}
 			if (lc($Spelllist[$n]) eq lc($text) && $text !~ /^buffs$/i) {
			quest::setglobal("buffs", $text, 0, "M5");
			$client->Message(315, "That's going to cost $SpellCost[$n]pp for the $qglobals{buffs} buff.");
			}
			$n++;
			$count++;
			}
	}

	elsif ($cleanclass eq 14) {
	quest::say("I have the $buffs for your mind.");
	while ($Ench[$n]) {
	if ((lc($Ench[$n]) =~ lc($text) && lc($Ench[$n]) ne lc($text)) || ($text =~ /^buffs$/i)) {
		my $Ench = quest::saylink($Ench[$n]);
		$client->Message(315, "These are your choices, $Ench");
		}
			if (lc($Ench[$n]) eq lc($text) && $text !~ /^buffs$/i) {
			quest::setglobal("buffs", $text, 0, "M5");
			$client->Message(315, "That's going to cost $SpellCost[$n]pp for the $qglobals{buffs} buff.");
			}
			$n++;
			$count++;
			}
	
	
	}

	elsif ($cleanclass eq 13) {
	quest::say("I will summon you no $buffs.");
	}

	elsif ($cleanclass eq 12) {
	quest::say("Wizard $buffs? Hah! Where do you need to go?");
	}

	elsif ($cleanclass eq 9) {
	quest::say("shhhhhhhhhhhhhhhh!");
	}

	elsif ($cleanclass eq 4) {
	quest::say("What can I do for you naturewalker? Do you require some $buffs?");
	}

	elsif ($cleanclass eq 6) {
	quest::say("I $buffs you to protect my animals!");
	}

	elsif ($cleanclass eq 10) {
	quest::say("All the best $buffs bring the best money.");
	}

	elsif ($cleanclass eq 2) {
	quest::say("Heals? $buffs?");
	while ($Cleric[$n]) {
		if ((lc($Cleric[$n]) =~ lc($text) && lc($Cleric[$n]) ne lc($text)) || ($text =~ /^buffs$/i)) {
		my $Cleric = quest::saylink($Cleric[$n]);
		$client->Message(315, "These are your choices, $SpellList");
		}
			if (lc($Cleric[$n]) eq lc($text) && $text !~ /^buffs$/i) {
			quest::setglobal("buffs", $text, 0, "M5");
			$client->Message(315, "That's going to cost $SpellCost[$n]pp for the $qglobals{buffs} buff.");
			}
			$n++;
			$count++;
			}
	}

	elsif ($cleanclass eq 5) {
	quest::say("No $buffs here, only death!");
	}

	elsif ($cleanclass eq 3) {
	quest::say("Do you need protection my child or some $buffs?");
	}

	elsif ($cleanclass eq 16) {
	quest::say(".......");
	}

	elsif ($cleanclass eq 15) {
	quest::say("Paragon, Feral, $buffs");
	}

	elsif ($cleanclass eq 1) {
	quest::say("Kidding, right?");
	}

	elsif ($cleanclass eq 8) {
	quest::say("La Ti Da Ti");
	}


}



}
__________________
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:56 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