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
  #12  
Old 02-10-2015, 12:08 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

This is a much cleaner way of doing it via hashes:

Note that I only updated the first hash with your item IDs and the second one was just a copy/paste of the first one because I was too lazy to copy your item IDs all over for it. So, you will need to update the second hash (HandInHash2). Also, note that I am not sure what class order you had for your arrays @t1chestarmor or @t1legarmor, so please make sure to review the Turn-In column of the hash and ensure it is the correct one for each class.

Code:
sub EVENT_ITEM {

	my $RewardReceived = 0;
	
	# t1chestarmor
	# Class => [ Turn-In, Reward ],
	my %HandInHash = (
		"Warrior"		=> [ 1591, 1563 ],
		"Rogue"			=> [ 2845, 2828 ],
		"Monk"			=> [ 2868, 2444 ],
		"Berserker"		=> [ 2835, 2684 ],
		"Shadowknight"	=> [ 2861, 1819 ],
		"Paladin"		=> [ 2886, 1810 ],
		"Ranger"		=> [ 2958, 2493 ],
		"Bard"			=> [ 3540, 1846 ],
		"Beastlord"		=> [ 3680, 2562 ],
		"Cleric"		=> [ 3235, 1803 ],
		"Druid"			=> [ 3295, 2434 ],
		"Shaman"		=> [ 3484, 2665 ],
		"Wizard"		=> [ 3226, 2422 ],
		"Magician"		=> [ 2995, 2278 ],
		"Enchanter"		=> [ 3854, 2561 ],
		"Necromancer"	=> [ 3137, 2381 ]
	);
	
	# t1legarmor (Note that this is just a copy of the above array - Make sure you update the IDs!)
	# Class => [ Turn-In, Reward ],
	my %HandInHash2 = (
		"Warrior"		=> [ 1591, 1563 ],
		"Rogue"			=> [ 2845, 2828 ],
		"Monk"			=> [ 2868, 2444 ],
		"Berserker"		=> [ 2835, 2684 ],
		"Shadowknight"	=> [ 2861, 1819 ],
		"Paladin"		=> [ 2886, 1810 ],
		"Ranger"		=> [ 2958, 2493 ],
		"Bard"			=> [ 3540, 1846 ],
		"Beastlord"		=> [ 3680, 2562 ],
		"Cleric"		=> [ 3235, 1803 ],
		"Druid"			=> [ 3295, 2434 ],
		"Shaman"		=> [ 3484, 2665 ],
		"Wizard"		=> [ 3226, 2422 ],
		"Magician"		=> [ 2995, 2278 ],
		"Enchanter"		=> [ 3854, 2561 ],
		"Necromancer"	=> [ 3137, 2381 ]
	);

	if($HandInHash{$class})
	{
		# $HandInHash{$class}[0]; # Item Turned In
		# $HandInHash{$class}[1]; # Reward
	
		if (plugin::check_handin(\%itemcount, $HandInHash{$class}[0] => 1))
		{
			quest::summonitem($HandInHash{$class}[1]);
			quest::emote("Works to make a piece of armor from the instructions you provided to him." );
			quest::say ("Here you go $name.");
			# Example for below: Percent Experience (5), Max Level to give full exp percentage (level 45)
			$client->AddLevelBasedExp(5, 45);
			quest::ding();
			$RewardReceived = 1;
		}
	}
	
	if ($HandInHash2{$class})
	{
		# $HandInHash2{$class}[0]; # Item Turned In
		# $HandInHash2{$class}[1]; # Reward
	
		if (plugin::check_handin(\%itemcount, $HandInHash2{$class}[0] => 1))
		{
			quest::summonitem($HandInHash2{$class}[1]);
			quest::emote("Works to make a piece of armor from the instructions you provided to him." );
			quest::say ("Here you go $name.");
			# Example for below: Percent Experience (5), Max Level to give full exp percentage (level 45)
			$client->AddLevelBasedExp(5, 45);
			quest::ding();
			$RewardReceived = 1;
		}
	}
	
	if ($RewardReceived == 0)
	{
		quest::say ("Sorry, $name, but I cannot accept that.");
	}
	
	plugin::return_items(\%itemcount);
}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 02-10-2015 at 12:15 PM..
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 02:41 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3