Loading...   

This file is live on EZ Server as of 4/12/16, located in .../quests/hohonora/default.pl (with drop chances replaced with XXX)

#######################################################
### FILE:    default.pl
### NPC:     ALL
### Quest:   default
### Zone:    hohonora
### Modified: 4/10/16
######################################################

sub EVENT_SPAWN
{
	my $nid = $npc->GetNPCTypeID();
	my $nn = $npc->GetCleanName();
	my @plat_bags = ( 21821 ); 
	my @spells = ( 125419, 125423, 125425, 125430, 125431, 125525, 135345, 135352, 100088 ); 
	my @t3_weps = ( 151015, 151016, 151017, 151018, 151019, 151020, 151021, 151022, 151023, 151024, 151025, 151026, 135333 );
	my @t3_special = ( 151027, 151028 );
	my @charmsV1 = ( 99027, 99028, 99029, 99030 );
	my @charmsV2 = ( 112941, 112942, 112943, 112944 );
	my @book = ( 99281 );
	my @tokens = ( 112921, 112921, 112921, 112921, 112922, 112922, 112922, 112923, 112923, 112923, 112924, 112924, 112924, 112925, 112925, 112925, 112926, 112926, 112927, 112927, 112938 );
	my @augs = ( 112101, 112102, 112103, 112104, 112105, 112106, 112107, 112108 );
	
	if($nid == 211205) # Shadow
	{
		my $shadowstep = int (rand(20)) + 25; # Changes for each shadow step
		quest::setnexthpevent("$shadowstep");
		$npc->SetEntityVariable("shadowstepHP", $shadowstep); # store HP to step
		$npc->SetEntityVariable("shadowsteps", 0); # store number of steps
		plugin::EZAddLoot(1, XXX, @book); # 3.5 book
		plugin::EZAddLoot(5, XXX, @plat_bags);
		plugin::EZAddLoot(1, XXX, @charmsV1);
		plugin::EZAddLoot(1, XXX, @charmsV2);
		plugin::EZAddLoot(2, XXX, @tokens);
		plugin::EZAddLoot(1, XXX, @t3_weps); 
		plugin::EZAddLoot(1, XXX, @t3_special);
		plugin::EZAddLoot(1, XXX, @spells);
	}
	elsif($nid > 1000 && $nn =~/Avatar of/i)
	{
		my %pages = (
			2700735 => [ 99271 ], # Avatar_of_the_Heavens
			2700737 => [ 99272 ], # Avatar_of_the_Earth
			2700738 => [ 99273 ], # Avatar_of_Storms
			2700739 => [ 99274 ], # Avatar_of_the_Abyss
			2700741 => [ 99275 ], # Avatar_of_Valor
			2700742 => [ 99276 ], # Avatar_of_the_Skies
			2700743 => [ 99277 ], # Avatar_of_the_Underworld
			2700740 => [ 99278 ], # Avatar_of_Hate
			2700736 => [ 99279, 99280 ] # Avatar_of_Hell
		);
		if(exists($pages{$nid}[0]))
		{
			my @page = ();
			if($nid == 2700736) { @page = ( 99279, 99280 ); } #
			else { @page = ( $pages{$nid}[0] ); } # Set page
			plugin::EZAddLoot(1, XXX, @page);
		}
		plugin::EZAddLoot(1, XXX, @spells); # 1:120 chance for spell drops		
		plugin::EZAddLoot(1, XXX, @t3_weps); # 1:100 chance for one of the items to drop
		plugin::EZAddLoot(1, XXX, @t3_special); # 1:1000 chance for a special weapon
		plugin::EZAddLoot(1, XXX, @plat_bags);
		plugin::EZAddLoot(1, XXX, @tokens);
		plugin::EZAddLoot(1, XXX, @charmsV2);
		plugin::EZAddLoot(1, XXX, @augs);
	}
} 

sub EVENT_SAY
{
	my $nid = $npc->GetNPCTypeID();
	my $nn = $npc->GetCleanName();
	
	if($nn =~ /Greetings/i)
	{
		if ($text =~/hail/i)
		{
		   $client->Message(315, "$nn says to you, 'Hail, $name. Welcome to Plane of the Gods. Avatars do not take kindly to intruders, so visit with caution.
			  If you happen come across some curious tokens, then you might want to look to the seat of the gods. They are potent artifacts from the gods themselves.
			  If you are brave, or foolish, enough I can send you to the seat of the gods...".quest::saylink("Plane of Sky", 1).".'");
		} 
		elsif ($text =~/Plane of Sky/i) 
		{
		   $client->Message(315, "$nn says to you, 'To the seat of the gods you go!'");
		   quest::movepc(71,-854,-1035,1090); # Plane of Gods B (airplane) zone -854	-1035	1089 @ 71
		}
	}
}

sub EVENT_HP
{
	my $shadowstep = 0;
	if($npc->EntityVariableExists("shadowstepHP")) { $shadowstep = $npc->GetEntityVariable("shadowstepHP"); }
	if($shadowstep && $hpevent == $shadowstep)
	{
		my $steps = $npc->GetEntityVariable("shadowsteps");
		if($steps < 10) 
		{
			if($steps == 0) { ShadowStep(); } # sub to handle stepping and extra loot every 2nd jump
			else
			{
				my $chance = int(rand 100);
				quest::gmsay("default.pl - EVENT_HP - Chance is [$chance], steps is ".($steps * 10), 18);	
				if($chance > ($steps * 10)) { ShadowStep(); } # increasing chance to stop stepping
			}
		}
	}
}

sub EVENT_TIMER
{
	if($timer eq "drop_aggro")
	{
		quest::stoptimer($timer);
		$npc->BuffFadeAll();
		$npc->WipeHateList();
		#$npc->SpellFinished(12005, $npc, 0);
		#$npc->SpellFinished(5243, $npc, 0);
	}
}

sub ShadowStep
{
	my %steps = (
		 0 => [-1529.1, 2.4, 3.8, 200.0],
		 1 => [-1510.5, 378.6, 3.8, 133.9],
		 2 => [-1517.2, -381.8, 3.8, 254.9],
		 3 => [-1021.2, -403.3, 3.8, 196.5],
		 4 => [-1054.7, -1107.0, 3.8, 237.3],
		 5 => [-1364.0, -1171.0, 3.8, 37.1],
		 6 => [-1358.5, -1592.0, 3.8, 7.4],
		 7 => [-1645.4, -2035.9, 3.8, 0.9],
		 8 => [-1071.0, -2047.8, 3.8, 3.6],
		 9 => [-2024.3, -1125.0, 3.8, 83.1],
		 10 => [-2562.7, -1131.9, 7.8, 63.5],
		 11 => [-3191.3, -1142.1, -115.2, 63.6],
		 12 => [-3168.5, -1735.3, -115.2, 255.5],
		 13 => [-2471.9, -1729.7, -115.2, 190.8],
		 14 => [-1025.3, 397.8,  3.8, 192.1],
		 15 => [-1445.0, 875.3, 3.8, 209.1],
		 16 => [-1937.5, 879.2, 3.8, 204.8],
		 17 => [-2329.4, 2084.6, 7.8, 0.0],
		 18 => [-2313.4, 2723.9, -115.2, 79.1],
		 19 => [-1732.2, 2715.7, -115.2, 126.4],
		 20 => [-1725.3, 2020.3, -115.2, 121.4],
		 21 => [-262.4, 0.4, 3.9, 194.3],
		 22 => [-259.9, -1078.5, 3.8, 19.9],
		 23 => [-259.6, -1879.2, 7.8, 10.3],
		 24 => [-265.5, 738.7, 3.8, 251.6],
		 25 => [-258.3, 1993.4, 3.8, 111.4],
		 26 => [-672.1, 1968.6, 3.8, 78.1],
		 27 => [-1462.8, 1676.7, 3.8, 73.5],
		 28 => [-1455.2, 2258.5, 3.8, 72.5],
		 29 => [676.0, 1970.5, 7.8, 190.4],
		 30 => [1305.0, 1965.6, -115.2, 195.5],
		 31 => [1296.9, 1371.0, -115.2, 247.5],
		 32 => [608.9, 1374.9, -115.2, 77.4]
	 );
	my @plat_bags = ( 21821 ); 
	my @spells = ( 125419, 125423, 125425, 125430, 125431, 125525, 135345, 135352, 100088 ); 
	my @t3_weps = ( 151015, 151016, 151017, 151018, 151019, 151020, 151021, 151022, 151023, 151024, 151025, 151026, 135333 );
	my @t3_special = ( 151027, 151028 );
	my @charmsV1 = ( 99027, 99028, 99029, 99030 );
	my @charmsV2 = ( 112941, 112942, 112943, 112944 );
	my @book = ( 99281 );
	my @tokens = ( 112921, 112921, 112921, 112921, 112922, 112922, 112922, 112923, 112923, 112923, 112924, 112924, 112924, 112925, 112925, 112925, 112926, 112926, 112927, 112927, 112938 );
	my @augs = ( 112101, 112102, 112103, 112104, 112105, 112106, 112107, 112108 );
	 
	 # increment step counter
	 my $steps = $npc->GetEntityVariable("shadowsteps");
	quest::gmsay("default.pl - ShadowStep() - Steps was [$steps], increasing by 1", 18);
	 $steps++;
	 $npc->SetEntityVariable("shadowsteps", $steps);
	 my $shadowstep = int (rand(20)) + 25; # Changes for each shadow step
	 quest::setnexthpevent("$shadowstep");
	$npc->SetEntityVariable("shadowstepHP", $shadowstep); # store HP to step
	 
	 # add new loot every two seconds
	 if($steps ~~ [2, 4, 6, 8, 10])
	 {
		plugin::EZAddLoot(1, XXX, @plat_bags);
		plugin::EZAddLoot(1, XXX, @charmsV1);
		plugin::EZAddLoot(1, XXX, @charmsV2);
		plugin::EZAddLoot(2, XXX, @tokens);
		plugin::EZAddLoot(1, XXX, @t3_weps); 
		plugin::EZAddLoot(1, XXX, @t3_special);
		plugin::EZAddLoot(1, XXX, @spells);
		plugin::EZAddLoot(1, XXX, @augs);
	 }
	 
	 # handle actual stepping
	 quest::settimerMS("drop_aggro", 750);
	 my $loc = int(rand 33); 
	 quest::emote("steps into the shadows."); 	
	 $npc->GMMove($steps{$loc}[0], $steps{$loc}[1], $steps{$loc}[2], $steps{$loc}[3]);
	 $npc->BuffFadeAll();
	 my $hp = $npc->GetMaxHP();
	 $npc->SetHP($hp);
	 $npc->WipeHateList();
	 #$npc->SpellFinished(12005, $npc, 0);
	 #$npc->SpellFinished(5243, $npc, 0);
}