View Single Post
  #16  
Old 02-10-2015, 03:40 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

This may work .. now that I know what you are asking for.

Place all rewards into the correct spot...
Place all possibly turn in items into @item_list...

This will ONLY work if they are single slot items and they match.. (helms give helms.. ect ect...)


Turning in any helm from the list of items will give you your class helm.. ect..

Code:
sub EVENT_ITEM {
	my %rewards = (		   #head arm  bracer hands chest legs  feet
		"Warrior"		=> [4515, 4517, 4518, 4519, 4516, 4520, 4521],  #All the cobalt set.. (for testing)
		"Rogue"			=> [2828, 1001, 1002, 1003, 1004, 1005, 1006],
		"Monk"			=> [2444, 1001, 1002, 1003, 1004, 1005, 1006],
		"Berserker"		=> [2684, 1001, 1002, 1003, 1004, 1005, 1006],
		"Shadowknight"	=> [1819, 1001, 1002, 1003, 1004, 1005, 1006],
		"Paladin"		=> [1810, 1001, 1002, 1003, 1004, 1005, 1006],
		"Ranger"		=> [2493, 1001, 1002, 1003, 1004, 1005, 1006],
		"Bard"			=> [1846, 1001, 1002, 1003, 1004, 1005, 1006],
		"Beastlord"		=> [2562, 1001, 1002, 1003, 1004, 1005, 1006],
		"Cleric"		=> [1803, 1001, 1002, 1003, 1004, 1005, 1006],
		"Druid"			=> [2434, 1001, 1002, 1003, 1004, 1005, 1006],
		"Shaman"		=> [2665, 1001, 1002, 1003, 1004, 1005, 1006],
		"Wizard"		=> [2422, 1001, 1002, 1003, 1004, 1005, 1006],
		"Magician"		=> [2278, 1001, 1002, 1003, 1004, 1005, 1006],
		"Enchanter"		=> [2561, 1001, 1002, 1003, 1004, 1005, 1006],
		"Necromancer"	=> [2381, 1001, 1002, 1003, 1004, 1005, 1006]
	);
	my %reward_type = (
	 4			=> 0,  #Head  
	 128		=> 1,  #Arm
	 1536		=> 2,  #Bracer 
	 4096		=> 3,  #hands
	 131072		=> 4,  #chest
	 262144		=> 5,  #legs
	 524288		=> 6   #feet
	);

	my @item_list = (1001, 1004, 1008, 1009, 1010, 1011, 1012); #THIS would be ALL items that are turned IN
	my $item_turnin = 0;
	if (grep { $_ == $item1 } @item_list) { $item_turnin = $item1; }
	elsif (grep { $_ == $item2 } @item_list) { $item_turnin = $item2; }
	elsif (grep { $_ == $item3 } @item_list) { $item_turnin = $item3; }
	elsif (grep { $_ == $item4 } @item_list) { $item_turnin = $item4; }

	if($item_turnin > 0) {
		my $slots = $client->GetItemStat($item_turnin, "slots");
		if (plugin::check_handin(\%itemcount, $item_turnin => 1)) {
			quest::summonitem($rewards{$class}[$reward_type{$slots}]);
			quest::emote("Works to make a piece of armor from the instructions you provided to him." );
			quest::say ("Here you go $name.");
		}
	}
	
	plugin::return_items(\%itemcount);
}
Reply With Quote