View Single Post
  #2  
Old 11-27-2018, 03:22 PM
Almusious
Fire Beetle
 
Join Date: Sep 2012
Posts: 25
Default

Not sure if you could use this and I haven't tested it beyond compiling:

Code:
sub EVENT_KILLED_MERIT 
{
	%tierhash = 
	(
		72	=>	[
			{
				npcminlevel 	=>	70,
				npcs 			=>	[72003,207001,221008,200055,76007],
				pointsfornpcs 	=>	250,
				tier 			=>	7,
			},
			{
				npcminlevel 	=>	70,
				npcs 			=>	[72004,72000,72002,72090],
				pointsfornpcs	=>	50,
				tier 			=>	7,				
			},
			{
				npcminlevel 	=>	70,
				npcs 			=>	["nonspecific"],
				pointsfornpcs	=>	1,
				tier 			=>	7,				
			},
		],
		72	=>	[
			{
				npcminlevel 	=> 70,
				npcs 			=> [72003,207001,221008,200055,76007],
				pointsfornpcs 	=> 250,
				tier 			=>	7,				
			},
			{
				npcminlevel 	=> 70,
				npcs 			=> [34238,54078,16976],
				pointsfornpcs	=> 80,
				tier 			=>	7,				
			},
		],
	);			
 
	my $pointsearned = 0;
	
	if ($client->InZone() && ($npc || !$npc->GetOwnerID() || !$npc->GetSwarmOwner()))
	{
		if (exists $tierhash{$zoneid})
		{
			
			foreach my $individualhasharray (keys ( @{$tierhash{$zoneid}} ))
			{
				if ($mlevel >= $tierhash{$zoneid}[$individualhasharray]->{npcminlevel})
				{
					
					if ($npc->GetNPCTypeID() ~~ @{$tierhash{$zoneid}[$individualhasharray]->{npcs}})
					{
						$pointsearned = $tierhash{$zoneid}[$individualhasharray]->{pointsfornpcs};
					}
					elsif ("nonspecific" ~~ @{$tierhash{$zoneid}[$individualhasharray]->{npcs}})
					{
						$pointsearned = $tierhash{$zoneid}[$individualhasharray]->{pointsfornpcs};
					}	
					if ($pointsearned)
					{					
						
						if (defined $client->GetGlobal("tier". $tierhash{$zoneid}[$individualhasharray]->{tier} ."_credit")) 
						{
							$client->SetGlobal(	"tier". $tierhash{$zoneid}[$individualhasharray]->{tier} ."_credit", 
												($client->GetGlobal("tier". $tierhash{$zoneid}[$individualhasharray]->{tier} ."_credit") + $pointsearned),
												5, "F");
							$client->Message(5, "You have gained " . 
											$pointsearned .
											" more Tier " . 
											$tierhash{$zoneid}[$individualhasharray]->{tier} .
											" Tokens!  This raises your total to " .
											$client->GetGlobal("tier". $tierhash{$zoneid}[$individualhasharray]->{tier} ."_credit") . "!");
						} else {
							$client->SetGlobal(	"tier". $tierhash{$zoneid}[$individualhasharray]->{tier} ."_credit", 
												$pointsearned,
												5, "F");
							$client->Message(5, "Congratulations, you have gained " . 
											$pointsearned .
											" initial Tier " . 
											$tierhash{$zoneid}[$individualhasharray]->{tier} .
											" Tokens!");
						}						
					}
				}
			}
		}
	}
}
Just one thing, and I only looked over it briefly like, is the "INITIALIZE_TALENTS" sub somewhere in the code?

Awesome work and thank you for sharing.
Reply With Quote