View Single Post
  #19  
Old 10-19-2016, 03:29 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

I'm going a little beyond my comfort level without having at least Perl installed on this PC, but this may do the trick:

Code:
sub EVENT_LOOT {
	if (quest::ChooseRandom(1..10) < 10) { 
		my %h = (
			1 => [[69,72,81],[69,72,81],[69,72,81],[69,72,81],[91,94,96],[100,142,214]],
			4 => [[45,75,81],[45,75,81],[45,75,81],[45,75,81],[45,75,81],[100,142,214]]
		);
		if ($itemid ~~ keys %h) {
			@augments;
			$unaugmenteditemslot;
			@slots_to_check = (0..30,251..340);
			foreach my $a_s (0..4) {
				$augments[$a_s] = ($h{$itemid}[$a_s][quest::ChooseRandom(0..((scalar @{$h{$itemid}}[$a_s]) - 1 ))]);
			}
			foreach my $slot_check ($slots_to_check) {
				$dupe_check = 0;
				$slot_item_id = $client->GetItemIDAt($slot_check);
				if ($itemid == $slot_item_id) {
					for ($augment_check = 0; $augment_check < 5; $augment_check++) {
						$augment_item_id = $client->GetAugmentIDAt($slot_item_id, $augment_check);
						$unaugmenteditemslot = $slot_check if ($augment_item_id = 0);
						++$dupe_check if ($augment_item_id == $augments[$augment_check]);
					}
				}
			}
			$client->RemoveItem($itemid, 1, $unaugmentedslot);
			if ($dupe_check = 5) {
				$client->Message(7, "That item has poofed into the abyss as you already have one just like it!");
			} else {
				$client->SummonItem($itemid,0,1,$augments[0],$augments[1],$augments[2],$augments[3],$augments[4],$unaugmentedslot);
			}
		}
	}
}
It will need to be checked for logic (heading out of town so no time). It appears sound.

I -think- it will function as closely as what you were after. I used the augment item ID's of what you originally provided for reference of what is going on in the hash of arrays. The key values (ie. 1 and 4) are the item ID's of the main item you're dealing with.

Gotta run, good luck.
Reply With Quote