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-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
  #2  
Old 02-10-2015, 01:06 PM
utbbop
Sarnak
 
Join Date: May 2009
Location: Mentor
Posts: 58
Default

Quote:
Originally Posted by trevius View Post
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);
}
Going to work with this now, will let you know the results!
Thanks Trev.
Reply With Quote
  #3  
Old 02-10-2015, 01:17 PM
utbbop
Sarnak
 
Join Date: May 2009
Location: Mentor
Posts: 58
Default

Okay, got a question for ya Trev.

Code:
	# 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 ]
If the format is [ Turn-in, Reward ], how do I handle multiple potential turn-in's for the same reward?

Example:
I am a Warrior.
I have item 1234 which is a Wizard Leg Item.
I want to turn in item 1234 for the Warrior Leg Item which is item number 12345.

Alternatively, I may have created item 123 which is a Druid Leg Item.
I want to be able to then turn in item 123 and receive the Warrior Leg Item which again is item 12345.


Edit:
Might have stumbled onto something that seems to have worked initially...

Code:
my $RewardReceived = 0;
	
	# t1chestarmor
	# Class => [ Turn-In, Reward ],
	my %HandInHash = (
		"Warrior"		=> [ 1591, 2995, 1563 ],

if($HandInHash{$class})
	{
		# $HandInHash{$class}[0]; # Item Turned In 1
		# $HandInHash{$class}[1]; # Item Turned In 2
		# $HandInHash{$class}[2]; # Reward
	
		if (plugin::check_handin(\%itemcount, $HandInHash{$class}[0,1] => 1))
		{
			quest::summonitem($HandInHash{$class}[2]);
			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;
		}
	}
Any feedback on this?

Thanks for the help...
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 03:56 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