View Single Post
  #5  
Old 10-26-2009, 10:14 PM
Valdaun
Fire Beetle
 
Join Date: Oct 2009
Posts: 28
Default

I thought this was a cool idea for gearing up bots, so here's my much simplified version as requested originally (fully tested on my own server). You do receive all 20 items on your cursor, but this works fine at least on 0.8.0+ and SoF client.

Code:
# Gear summoner for quick and easy bot equipping
#
# This gear is the full set of "Class Slot (Test)" for each class
#
# Utilizes navigation links and whispers for easy NPC interaction
#  

sub EVENT_SAY
{
	# this array holds all the required names and item IDs used later
	my %class_arr = (
		Warrior => { "start" => 38000, "end" => 38020 },
		Monk => { "start" => 38021, "end" => 38042 },
		Rogue => { "start" => 38042, "end" => 38062 },
		Shadowknight => { "start" => 38063, "end" => 38083 },
		Paladin => { "start" => 38084, "end" => 38104 },
		Ranger => { "start" => 38105, "end" => 38125 },
		Beastlord => { "start" => 38126, "end" => 38146 }, 
		Bard => { "start" => 38147, "end" => 38167 },
		Cleric => { "start" => 38168, "end" => 38188 },
		Druid => { "start" => 38189, "end" => 38209 },
		Shaman => { "start" => 38210, "end" => 38230 },
		Wizard => { "start" => 38231, "end" => 38251 },
		Magician => { "start" => 38252, "end" => 38272 },
		Enchanter => { "start" => 38273, "end" => 38293 },
		Necromancer => { "start" => 38294, "end" => 38314 },
		Berserker => { "start" => 38315, "end" => 38332 } #Uses 2hander, less items
	);

	# misc. variables
	my $class_link = quest::saylink("class");
	my $whisper_color = 315;	#tan
	my $NPCName = $npc->GetCleanName();	

	if($text=~/Hail/i)
	{
    	quest::say("Greetings, $name.  Once I was a great Hero like you,
   	but now I am relegated to equipping all the new mercenaries that
	seem to be popping up all over.  Simply tell me the [$class_link] of
	mercenary that you wish to equip and I can scounge up some starter equipment.");
	}

	if($text=~/Class/i)
	{
		$client->Message($whisper_color, "$NPCName whispers to you, 'I can
		equip any of the following classes'");

		# print out say links for each of the classes in alpha order
		foreach $class_name (sort keys %class_arr)
		{
			my $link = quest::saylink($class_name);
			$client->Message($whisper_color, "$link");
		}
	}

	# for any typed text besides "Hail" or "class", check to see if it was a class
	# name that was said (clicked), and summon the appropriate items on a match
	if($text !~ /Hail/i || $text !~ /class/i)
	{
		foreach $class_name (sort keys %class_arr)
		{
			if ($text eq $class_name)
			{
				$start = $class_arr{$class_name}{"start"};
				$end = $class_arr{$class_name}{"end"};

				$client->Message($whisper_color, "$NPCName whispers to you, 'Thanks for shopping
					at Bot-Mart!'");

				# this will dump all 20 items onto the players cursor
				foreach ($start..$end)
				{
					quest::summonitem($_);
				}
			}
		}
	} #end class name checks

}#END of FILE
Reply With Quote