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
  #6  
Old 10-03-2018, 08:35 PM
Almusious
Fire Beetle
 
Join Date: Sep 2012
Posts: 25
Default

I wrote this late at night, pretty sure it will work out, though my comments -may- be off a little, maybe someone can correct me on any wrong points. We're all here to learn.

Code:
%HoH = (
	'leather'	=>	{
					'head'	=>	147587,
					'chest'	=>	147588,
					'legs'	=>	147591,
				},
	'plate'		=>	{
					'head'	=>	147580,
					'chest'	=>	147581,
					'legs'	=>	147584,
				},
	'chain'		=>	{
					'head'	=>	147573,
					'chest'	=>	147547,
					'legs'	=>	147577,
				},
	'cloth'		=>	{
					'head'	=>	147566,
					'chest'	=>	147567,
					'legs'	=>	147570,
				},
);

sub EVENT_SAY 
{
	if ($text=~/hasharmorset/i)
	{
		# doing the following assuming the player is wearing a plate head (ID 147580)
		foreach $firstlevelkey (keys %HoH) 
		{ 	
		# iterate the parent keys of hash %HoH one by one and put the current key being read into $parentkey
		# we will assume 'plate' was read first
			$childhashref = $HoH{$firstlevelkey};	
			# make reference of first level hash based on current parent key (i.e. $parentkey)
			# $childhashref now equals $HoH{plate}
			foreach $secondlevelkey (keys %$childhashref) 
			{	
			# iterate the second level (child) keys of the dereferenced hash and put that key into $secondlevelkey
			# could also be written %{$childhashref} - lets assume it pulls out the key 'head' from $HoH{plate}
				if ($client->GetItemIDAt(2) == $HoH{$firstlevelkey}->{$secondlevelkey})
				{ 
				# $HoH{plate}->{head} is equal to its key value which is 147580 - a match, we know they have plate this iteration
				quest::say("You are wearing a ".$firstlevelkey." ".$secondlevelkey." found within my Hash of Hashes");
				}
			}
		}
	}
}
Reply With Quote
 

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 03:25 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